---
tags: ResBaz2021
---
# Intermediate Python with Testing and Types
## Tuesday, May 18th, 2021 10\:00-12\:00
[Back to Resbaz HackMD Directory](https://hackmd.io/@ResBaz21/directory)
In this tutorial, the author of [Mastering Python for Bioinformatics](https://learning.oreilly.com/library/view/mastering-python-for/9781098100872/) will help you write a Python program that will calculate the tetranucleotide frequency from a string of DNA.
As simple as this program sounds, it presents many opportunities to demonstrate how to write a documented and tested program.
Additionally, we'll explore the latest features of Python such as type hints and basic techniques of linting and formatting code to create programs that are easier to read and maintain.
The UA library has a subscription to O'Reilly's Safari Learning Platform. Visit https://new.library.arizona.edu/ and search for "Mastering Python for Bioinformatics."
## Getting Started
### Windows Users
Install Windows Subsystem for Linux (WSL). Any Linux distribution is fine, but I tend to use Ubuntu.
### Apple Users
The installed Terminal application is sufficient for executing programs, though I prefer to use iTerm2 (https://iterm2.com/).
### Linux Users
Any Linux distribution and terminal emulator is fine.
### Text Editor vs IDE
You may choose to work inside a terminal for running and editing code if you are comfortable using a text editor like Emacs or Vim; otherwise, I suggest you install an integrated development environment (IDE).
VS Code is a very good choice as it includes a terminal for executing the programs you'll write.
### Source Code
All the source code is available at https://github.com/kyclark/biofx_python.
If you are using an IDE, it may have the ability to clone a Git repo.
I will only show how to do this using a terminal.
Note that you may need to install Git first.
I recommend you put all your code into some directory in your home directory like _~/work_ or _~/code_ (where `~` expands in your shell into your `$HOME` directory).
In the following commands, the `$` indicates the shell prompt and should not be included in your commands:
```
$ mkdir ~/work
$ cd ~/work
$ git clone https://github.com/kyclark/biofx_python.git
```
You should now have the directory _~/work/biofx_python_ containing all the code, data, and tests for the book.
### Python
If your installed version of Python is at least 3.8.6, you should be fine.
I would still recommend you install the latest version of Python 3.9.5 from source (https://www.python.org/downloads/source/).
Install all the module dependencies for the repository:
```
$ cd ~/work/biofx_python
$ python -m pip install -r requirements.txt
```
---
## Introductions
Ken Youens-Clark
Sr. Scientific Programmer, University of Arizona, kyclark@arizona.edu
Data Engineer, The Critical Path Institute, kyclark@c-path.org
@kycl4rk
Join me in the "Biosystems Analytics" class BE434 this fall for more!
Kelsey Gonzalez, University of Arizona, @KelseyGonzalez
## Questions and Answers
In this section, you can post your questions and feel free to answer if you have it. Questions will be answered during or after the workshop.
1. Ask your question.
- Here is an answer
---
:::info
**Session Feedback :mega:**
Use the link below to provide your feedback on the session:
[**Session Feedback Form**](https://forms.gle/TrnJpr9qRBEKdnVVA)
:::