Beispiel #1
0
def rosalind_RNA():
    s = 'AGCAGTGCGGTCTCGGGCCGGCTTGGCTGTCTCGACCGATGTGCGCTCATGCGCGTCGAATGATGATGATACACGTGTTTGACAATTTGTATTCATTAGTTCTGAGC' \
        'GAACATTCGTGACGGCGCGGAGTAGCCGGATTAATACTACGTAGTCCCAGTGGTTCGTCGCGGGAGTCCATCAGCGGCAGATACCCGTAGGAAAGCGCTCGTTACGG' \
        'TTTGGGCATCCCCCAGACATCTCCGCACCCTGGCCAAGTGGGAACGCCCGTGACTCGCCTTCGCTCGTGGAAGAGCGATAGTTTTTGGTTACAGGTTATTGATTCCG' \
        'CATGCACCACGTCCGCTCCACAGAAAGCTTCTACTGCTCGTGCGTTAGACTGCCTCTGGGATGTGACAGATTCGACGGTGACGTAAATGGGACCGCTATAACAAATA' \
        'AGGATTAGATGAGATCCGATCTCGTGCGGACTGATCCGACCTCGCCATCACGGCAAGGAGCTAGCCGTGGTCTCTAGTCCTCCACGATCAGTGTTCAATGTGTTGCG' \
        'GAACGTACTGCGGCCCAAGTCGGTGCGCTTATCGGATTATCGCGCTACCCAAGCTGGTAGTTAGGACCAGGATGGTCATATTCGGTCATACAAGATGATGATACCGC' \
        'AGGCCCAAACCATTCCGATAGAAGCGTAGTCGCGGTGGAGTGCCGTGTACATTCAAGGATCACACGCTGCACATTATATCGCTGAAGCCCACGAAAAAAAATAGCGC' \
        'CCCGGACGTAGCGAGCCGTATGCCATTCCTTTCCGTGTGCTAGCCCCCATGAGTTTAGGTCACTGCCCCCAATCGCGCTTTCAGGCTAGTATCAGTTAAGCCACTAA' \
        'ACGTGGACACCTACTCTGTCACCATCATTGCTTGGAGAGTTAGATGGGGCCAGGAGCAATTAAATATTGCCGCTAGCCACCATTAACACGAGCCTTACTATTTACT'
    print(seq_to_str(transcribe_to_rna(str_to_dna(s))))
Beispiel #2
0
def rosalind_REVC():
    s = 'GCACGCGTCGACGTGATGCGTTTCTGCACCTAAATAACCTCTTCTGAACCATTTGGGTCATGGGGCGTACACCTGTGGCCTAGATAGCATAAGAAGCATCCGGCAAA' \
        'ACAAAATAACCCTTCTTCTGAGGATACCGGAAAAGCAGCCAACAGTTTATGAAGGTAGCCCGATTCTAGAATTGAATCCTCTCTTGACATGAAATAGAGCCGTGTGC' \
        'GCGGCTCAAAACCCACTTGGAGACAGAGGCGCGACTTGTAGTTTTATGTCAAATCTGACTGTATCAAGGTCGTCTTGACCGTAGGTATAGAAAGCGAGAAGGTAATT' \
        'CCGCGGATGCGCTTTGGTGTACCGTAAATTCACCCCCTTGCAATGAACACAGATATTTGCATAGTGCAACCTCGTTGTCCGAGTCGTAAGCCATTGACTAGCTTCAC' \
        'TTGAAACGGGCCCCCCTGCACTTCCCATATGAACAATCTGGTCATGTTTTTCCACCGTTTGGGATTCCTGATATTATACGCGAATCCGCTCGGTGTGGCTGATGCGA' \
        'ACGTAGTAGAAACACATGGCACGCTTGAAACAGCCCATATTGGTTCGTGGCATTCATGTTCGCCTAGATATCACTATTTGGAACAATCACCCGCTTCTCTTCGGCAG' \
        'GACTACTTAATGTAAAAAGCGGTCGAAATGCGCCTCACATGACTGCAGCACGGGCAGCTCGCCTGGACCGGCGGGGCTAACGTTGTGCGTGTTACATCAACAACAGC' \
        'TGCAGAGAAAACAGACCATGATTAAGCCGGCCCCGGGCTTATATGTGATGTGTGCGATCGTTTAGCACCTGAGTCTAAATTTTACATCCTAAACATTAGCTCAGCGC' \
        'ATTTGGCCAATCTGTAGATGGGTTACACTTGTTCCGCCAGACCGGCGCATCCAGGGTTACTACGCCTCTC'
    dna_forward = str_to_dna(s)
    dna_reverse = reverse_complement_dna(dna_forward)
    print(seq_to_str(dna_reverse))
Beispiel #3
0
def rosalind_DNA():
    def rosalind_count_dna(histogram):
        return ' '.join(str(histogram[n]) for n in NUCLEOTIDES_DNA)

    s = 'GGCAGGAACCCTGTCGGCTTCTCCCCCCTATACGGAAAAAAGTGTGGCAGTGGAAGAAAGACCCACTGCGTTCGGAAAAACTAGCGCTCGAACGCTCGGCAGGGTAA' \
        'CGCCTCGGACTGACAGTCTCTAGTATGTCATCCCACAAACCTGACAACGACCCTCCGGGAGAGTCCGAGTCATGAAGGGCGGGCGGCTTTAACAACATCCACTTGCA' \
        'CTGAACGCTTTAGACATGGCTTGATGCGCCAGGCCATTGCAATCTTTCTTTGCACACACATTCAGGTGGTTCTCAGTAACTGTAAACGATGAACGAGGCACGCGGTT' \
        'CATGATGGTTGCGTGGCAGTATAAAAAACTTAAACGTTCGAAAGGGAGATTTGGTTCGCGTCGCCACGTGCGCGGTATGCGGCTAAACGGCAGACGAACATACTCTT' \
        'AGATGCTTTTAGAATCCGGACTAGTATTGCCTGGTATACTGGTGATAGGAGCAGTGCAGTTAGTGTTACCAAAATCACTCACTTCTAAGCCGAGTGTCGGTAAACAG' \
        'CACACATGATATCCATGGGCATATTAGCAAGGTCGGACGGGTACCAAGAAAAGTAAGGTGCGTGCCATCAAATTACTGTTTATCGGGTCAGAGATTCTAATGCATGT' \
        'TGCGAGGCATGTACTCAACTGTCTTGAGTGGCCAGGATTTGAGGTTGACGAGGGCCTGAAAAATTGTGAGCTTGGTGGGAAGAGAGAGAAGGAGGAGTTCTATTCTG' \
        'CATCATGCGGCATCCTCCAGGAGTTCCCGCAATATTTAGTAGGGCGGTCCGGTAGCCCGCTAAGAGACGCCTGAGTGACAGAAATCATGGACGCCCGGCGCGTCACT' \
        'ATTAACTAATTAGCTGCATAAGATCGAGCGGACCGTGACGATAAGATCGAAGATGTGAGCTTTCTAAAACAGTGGGGCGGACTTCACGTTTCGAGCGCTGGGCCA'
    print(rosalind_count_dna(count_nucleotides(str_to_dna(s))))
def test_count_nucleotides():
    dna = str_to_dna('ACCCAACT')
    dna_histogram = count_nucleotides(dna)
    assert dna_histogram == {
        'A': 3,
        'C': 4,
        'G': 0,
        'T': 1,
        'U': 0,
    }
    rna = str_to_rna('ACCCAACU')
    rna_histogram = count_nucleotides(rna)
    assert rna_histogram == {
        'A': 3,
        'C': 4,
        'G': 0,
        'T': 0,
        'U': 1,
    }
Beispiel #5
0
def test_rosalind_03():
    s = 'AAAACCCGGT'
    dna_forward = str_to_dna(s)
    dna_reverse = reverse_complement_dna(dna_forward)
    assert seq_to_str(dna_reverse) == 'ACCGGGTTTT'
Beispiel #6
0
def test_rosalind_02():
    s = 'GATGGAACTTGACTACGTAAATT'
    dna = str_to_dna(s)
    rna = transcribe_to_rna(dna)
    assert seq_to_str(rna) == 'GAUGGAACUUGACUACGUAAAUU'
Beispiel #7
0
def test_rosalind_01():
    dna = str_to_dna('AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC')
    histogram = count_nucleotides(dna)
    formated = ' '.join(str(histogram[n]) for n in NUCLEOTIDES_DNA)
    assert formated == '20 12 17 21'
def test_transcribe_to_rna():
    dna = str_to_dna('GATGGAACTTGACTACGTAAATT')
    rna = str_to_rna('GAUGGAACUUGACUACGUAAAUU')
    assert transcribe_to_rna(dna) == rna
def test_reverse_complement_dna():
    dna_0 = str_to_dna('gattaca')
    dna_1 = str_to_dna('tgtaatc')
    assert reverse_complement_dna(dna_0) == dna_1
def test_str_to_dna():
    s = 'gaTtACa'
    assert str_to_dna(s) == [G, A, T, T, A, C, A]
def test_complement_dna():
    dna_0 = str_to_dna('gattaca')
    dna_1 = str_to_dna('ctaatgt')
    assert complement_dna(dna_0) == dna_1