The bacteria P. pythonicus replicates every one hour, in a 100 ml tube. Being a very unfriendly bacteria, they reach stationary phase when there are 1,000,000 or more bacteria in the tube.
a) Write a program that will calculate the number of bacteria after one hour, two hours, etc, until stationarity is reached. The program will receive the starter size (number of bacteria to begin with), and start calculating from there. At each time point, the following message should be printed:
< time > hours: < no. of bacteria > bacteria
starter = 100 # Replace with a value of your choice.
bacteria = starter
time = 0
while __________________:
# your code here. remove the pass statement
pass
b) It turns out that the growth rate of P. pythonicus is affected by temperature. It's replication time r, is a function of the temperature T, so that:
$r = \frac{19 T (T - 70)}{2450} + 10$.
However, when the temperature is below 5, or over 50, the bacteria don't grow at all.
Write a program that will receive the starter size and the growth temperature, and will calculate the time to reach stationarity, printing the number of bacteria at each time point (like in part a). If bacteria can't grow, print an appropriate message (and don't do any calculation).
starter = 100 # Replace with a value of your choice.
temp = 30 # Replace with a value of your choice.
# check temperature and calculate replication time
# calculate and growth
a) Here’s a short section of genomic DNA:
ATCGATCGATCGATCGACTGACTAGTCATAGCTATGCATGTAGCTACTCGATCGATCGATCGATCGATCGATCGATCGATCGATCATGCTATCATCGATCGATATCGATGCATCGACTACTAT
It comprises two exons and an intron. The first exon runs from the start of the sequence to the sixty-third character, and the second exon runs from the ninety-first character to the end of the sequence.
Write a program that will print just the coding regions of the DNA sequence.
seq = 'ATCGATCGATCGATCGACTGACTAGTCATAGCTATGCATGTAGCTACTCGATCGATCGATCGATCGATCGATCGATCGATCGATCATGCTATCATCGATCGATATCGATGCATCGACTACTAT'
## your code goes here
b) Using the sequence from a, write a program that will calculate what percentage of the DNA sequence is coding.
## your code goes here
c) Using the sequence from a, write a program that will print out the original genomic DNA sequence with coding bases in uppercase and non-coding bases in lowercase.
## your code goes here
The list sequences
contains a number of DNA sequences as strings. Each sequence starts with the same 14 base pair fragment – a sequencing adapter that should have been removed.
Write a program that will trim this adapter and print the cleaned sequences to the screen. The program will then print the length of each cleaned sequence to the screen.
sequences = ['ATTCGATTATAAGCTCGATCGATCGATCGATCGATCGATCGATCGATCGATCGATC', \
'ATTCGATTATAAGCACTGATCGATCGATCGATCGATCGATGCTATCGTCGT', \
'ATTCGATTATAAGCATCGATCACGATCTATCGTACGTATGCATATCGATATCGATCGTAGTC', \
'ATTCGATTATAAGCACTATCGATGATCTAGCTACGATCGTAGCTGTA', \
'ATTCGATTATAAGCACTAGCTAGTCTCGATGCATGATCAGCTTAGCTGATGATGCTATGCA']
## your code goes here
The string genomic_dna
contains a section of genomic DNA.
The list exons
contains start/stop positions of exons as string indices.
Each exon is a separate list (within the list of exons) with two elements: the start and stop positions.
Write a program that will extract the exon segments from genomic_dna
using the positions in exons
, concatenate them, and print them to the screen.
genomic_dna = 'TCGATCGTACCGTCGACGATGCTACGATCGTCGATCGTAGTCGATCATCGATCGATCGACTGATCGATCGATCGATCGATCGATATCGATCGATATCATCGATGCATCGATCATCGATCGATCGATCGATCGATCGATCATATGTCAGTCGATGCATCGTAGCATCGTATAGTAGCTACGTAGCTACGATCGATCGATCGATCGTAGCTAGCTAGCTAGATCGATCATCATCGTAGCTAGCTCGACTAGCTACGTACGATCGATGCATCGATCGTAGCTAGTACGATCGCGTAGCTAGCATGCTACGTAGATCGATCGATGCATGCTAGCTAGCTAGCTACGATCGATCGATCGATCGATCGATCGATCGATCGATCGATCGTAGCTAGCTACGATCGATGCTACGTAGATCGATCGCTAGTAGATCGATCGCTAGCTAGCTGACTAGTACGCTGCTAGTAGTCAGCTAGATCGATGCTAGTCA'
exons = [[5, 58], [72, 133], [190, 276], [340, 398]] # [[start, stop], [start, stop], ...]
## your code goes here
Questions modified from Python for Biologists, a great book by Martin Jones.