Homework 10

Enter your name and EID here

This homework is due on Apr. 27, 2020 at 12:00pm. Please submit as a PDF file on Canvas. Before submission, please re-run all cells by clicking "Kernel" and selecting "Restart & Run All."

Problem 1 (5 pts): Often in bioinformatics, we need to format unique gene and/or protein identifiers. For instance, FASTA files downloaded from the UniProt database will have sequence identifiers that look like >sp|Q8WZ42|TITIN_HUMAN. For cross-referencing purposes (i.e., the way this ID is stored in other databases), we just need the Q8WZ42 part. Write code that extracts this group between the | characters. Use this code to extract the UniProt IDs from both strings given below.

Hint: Remember, the | symbol is normally used to say "this or this" or this|this. To match | in a string, as opposed to using it as a Boolean operator, you will need to escape the character with a backslash like so: \|.

In [1]:
# You will need re to solve this problem
import re

titin_human = ">sp|Q8WZ42|TITIN_HUMAN"
lysozyme_frog = ">tr|A0A060A0J8|A0A060A0J8_XENLA"
In [ ]:
# your code here

Problem 2 (5 pts): We will work with the Microcystis aeruginosa genome. This cyanobacteria is partially responsible (along with Anabaena) for the toxic "blue-green algal" blooms affecting bodies of water in Central Texas in the latter half of 2019. First, we download it and save it locally (note, this code may take a minute or two to run):

In [2]:
from Bio import Entrez

Entrez.email = "your.email@utexas.edu" # put your email here

# download Microcystic aeruginosa genome & save it locally:
with open("Maeruginosa.gb", "w") as outfile:
    handle = Entrez.efetch(db="nucleotide", id="NC_010296", rettype="gbwithparts", retmode="text")
    data = handle.read()

Write code that loops over all features in the M. aeruginosa genome, and counts the number of tRNAs and rRNAs that are contained within it. Use regular expressions to find the answer.

In [ ]:
# your code here