Write a series of print statements that returns the following (include a blank line between each answer):
atgcatgcatgcatgcatgcatgcatgcatgcatgcatgcatgcatgcatgcatgcatgc
. Do this using
the * operator to make 15 copies of atgc
.Use functions from the string
module or from base Python to print the
following strings.
species
in all capital lettersgcagtctgaggattccaccttctacctgggagagaggacatactatatcgcagcagtggaggtggaatgg
with all of the occurences of a
replaced with A
Thank
)gccgatgtacatggaatatacttttcaggaaacacatatctgtggagagg
.gccgatgtacatggaatatacttttcaggaaacacatatctgtggagagg
Use string methods to print the following strings. Remember that methods work by
adding the function to the end of the object name using a .
, like
mystring = 'Hello World'
print mystring.lower()
species
in all capital lettersgcagtctgaggattccaccttctacctgggagagaggacatactatatcgcagcagtggaggtggaatgg
with all of the occurences of a
replaced with A
Thank
)gccgatgtacatggaatatacttttcaggaaacacatatctgtggagagg
.For the DNA sequence below determine the following properties and print them to the screen (you can cut and paste the following into your code, it’s a lot longer than you can see on the screen, but just select the whole thing and when you paste it into Python you’ll see what it looks like):
dna = ttcacctatgaatggactgtccccaaagaagtaggacccactaatgcagatcctgtgtgtctagctaagatgtattattctgctgtggatcccactaaagatatattcactgggcttattgggccaatgaaaatatgcaagaaaggaagtttacatgcaaatgggagacagaaagatgtagacaaggaattctatttgtttcctacagtatttgatgagaatgagagtttactcctggaagataatattagaatgtttacaactgcacctgatcaggtggataaggaagatgaagactttcaggaatctaataaaatgcactccatgaatggattcatgtatgggaatcagccgggtctcactatgtgcaaaggagattcggtcgtgtggtacttattcagcgccggaaatgaggccgatgtacatggaatatacttttcaggaaacacatatctgtggagaggagaacggagagacacagcaaacctcttccctcaaacaagtcttacgctccacatgtggcctgacacagaggggacttttaatgttgaatgccttacaactgatcattacacaggcggcatgaagcaaaaatatactgtgaaccaatgcaggcggcagtctgaggattccaccttctacctgggagagaggacatactatatcgcagcagtggaggtggaatgggattattccccacaaagggagtgggattaggagctgcatcatttacaagagcagaatgtttcaaatgcatttttagataagggagagttttacataggctcaaagtacaagaaagttgtgtatcggcagtatactgatagcacattccgtgttccagtggagagaaaagctgaagaagaacatctgggaattctaggtccacaacttcatgcagatgttggagacaaagtcaaaattatctttaaaaacatggccacaaggccctactcaatacatgcccatggggtacaaacagagagttctacagttactccaacattaccaggtaaactctcacttacgtatggaaaatcccagaaagatctggagctggaacagaggattctgcttgtattccatgggcttattattcaactgtggatcaagttaaggacctctacagtggattaattggccccctgattgtttgtcgaagaccttacttgaaagtattcaatcccagaaggaagctggaatttgcccttctgtttctagtttttgatgagaatgaatcttggtacttagatgacaacatcaaaacatactctgatcaccccgagaaagtaaacaaagatgatgaggaattcatagaaagcaataaaatgcatgctattaatggaagaatgtttggaaacct
A colleague has produced a file with one DNA sequence on each line. Download
the file and load it into Python using
numpy.loadtxt()
. You will need to use the optional argument dtype=str
to
tell loadtxt()
that the data is composed of strings.
Calculate the GC content of each sequence. The GC content is the percentage of bases that are either G or C (as a percentage of total base pairs). Print the result for each sequence as “The GC content of the sequence is XX.XX%” where XX.XX is the actual GC content. Do this using a “formatted strings”.
You have a data file with a single “taxonomy” column in it. This column contains
the family, genus, and species for a single taxonomic group. You need to figure
out how to split that information into separate values for family, genus, and
species. To solve the basic problem take a single example string,
Ornithorhynchidae Ornithorhynchus anatinus
, split it into three separate
strings using a Python command, and then print the family, genus, and species,
each on a separate line.