Esempio n. 1
0
 def test_dna_count_nucleotides_format(self):
     expected = '20 12 17 21'
     dna = DNA(
         'AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC'
     )
     result = dna_count_nucleotides.format_string(dna)
     assert expected == result
Esempio n. 2
0
 def test_count_nucleotides_success(self):
     expected = {'A': 2, 'C': 1, 'G': 0, 'T': 3}
     dna = DNA('ACTTAT')
     result = dna.nucleotide_counts()
     assert expected == result
Esempio n. 3
0
 def test_count_nucleotides_empty(self):
     expected = {'A': 0, 'C': 0, 'G': 0, 'T': 0}
     dna = DNA('')
     result = dna.nucleotide_counts()
     assert expected == result
Esempio n. 4
0
 def test_create_dna_success(self):
     dna = DNA('ACGT')
     assert dna.string == 'ACGT'
Esempio n. 5
0
def main():
    with open(get_rosalind_data_path('hamm')) as file:
        dna = DNA(file.readline())
        dna2 = DNA(file.readline())
        print(dna.get_hamming_distance(dna2))
Esempio n. 6
0
 def test_polynucleotides_different_type(self):
     dna = DNA("ACG")
     rna = RNA("ACG")
     assert dna != rna
Esempio n. 7
0
 def test_hamming_distance_diff(self):
     expected = 7
     dna = DNA("GAGCCTACTAACGGGAT")
     dna2 = DNA("CATCGTAATGACGGCCT")
     result = dna.get_hamming_distance(dna2)
     assert expected == result
Esempio n. 8
0
 def test_dna_gc_content_success(self):
     expected = 66.666
     dna = DNA("CCGGTA")
     result = dna.gc_content()
     assert abs(expected - result) < 0.001
Esempio n. 9
0
 def test_dna_to_rna_success(self):
     expected = RNA('ACGU')
     dna = DNA('ACGT')
     result = dna.to_rna()
     assert expected == result
Esempio n. 10
0
 def test_count_nucleotides_success(self):
     expected = {'A': 2, 'C': 1, 'G': 0, 'T': 3}
     dna = DNA('ACTTAT')
     result = dna.nucleotide_counts()
     assert expected == result
Esempio n. 11
0
 def test_count_nucleotides_empty(self):
     expected = {'A': 0, 'C': 0, 'G': 0, 'T': 0}
     dna = DNA('')
     result = dna.nucleotide_counts()
     assert expected == result
Esempio n. 12
0
 def test_recv_dna_strand_complement_format(self):
     expected = 'ACCGGGTTTT'
     dna = DNA('AAAACCCGGT')
     result = recv_dna_strand_complement.format_string(dna)
     assert expected == result
Esempio n. 13
0
 def test_rna_dna_transcription_format(self):
     expected = 'GAUGGAACUUGACUACGUAAAUU'
     dna = DNA('GATGGAACTTGACTACGTAAATT')
     result = rna_dna_transcription.format_string(dna)
     assert expected == result
Esempio n. 14
0
def main():
    with open(get_rosalind_data_path('hamm')) as file:
        dna = DNA(file.readline())
        dna2 = DNA(file.readline())
        print(dna.get_hamming_distance(dna2))
Esempio n. 15
0
 def test_dna_to_rna_success(self):
     expected = RNA('ACGU')
     dna = DNA('ACGT')
     result = dna.to_rna()
     assert expected == result
Esempio n. 16
0
 def test_dna_reverse_complement_success(self):
     expected = 'CGTA'
     dna = DNA('TACG')
     result = dna.reverse_complement()
     assert result == expected
Esempio n. 17
0
 def test_dna_reverse_complement_success(self):
     expected = 'CGTA'
     dna = DNA('TACG')
     result = dna.reverse_complement()
     assert result == expected
Esempio n. 18
0
 def test_dna_gc_content_success(self):
     expected = 66.666
     dna = DNA("CCGGTA")
     result = dna.gc_content()
     assert abs(expected-result) < 0.001
Esempio n. 19
0
 def test_hamming_distance_no_diff(self):
     expected = 0
     dna = DNA("CCC")
     dna2 = DNA("CCC")
     result = dna.get_hamming_distance(dna2)
     assert expected == result
Esempio n. 20
0
 def test_hamming_distance_no_diff(self):
     expected = 0
     dna = DNA("CCC")
     dna2 = DNA("CCC")
     result = dna.get_hamming_distance(dna2)
     assert expected == result
Esempio n. 21
0
 def test_create_dna_wrong_values(self):
     with pytest.raises(ValueError) as ve_info:
         DNA('AUGCT')
Esempio n. 22
0
 def test_hamming_distance_diff(self):
     expected = 7
     dna = DNA("GAGCCTACTAACGGGAT")
     dna2 = DNA("CATCGTAATGACGGCCT")
     result = dna.get_hamming_distance(dna2)
     assert expected == result
Esempio n. 23
0
def main():
    with open(get_rosalind_data_path('rna')) as file:
        dna = DNA(file.read())
        print(format_string(dna))
Esempio n. 24
0
def main():
    with open(get_rosalind_data_path('subs')) as file:
        DNAs = DNA(file.readline())
        DNAt = DNA(file.readline())
        index_list = map(lambda x: x, DNAs.find_substring_locations(DNAt))
        print(format_string(index_list))