예제 #1
0
    def test_minimal_parser(self):
        """MinimalFastaParser should read single record as (label, seq) tuple"""
        seqs = list(MinimalPhylipParser(self.big_interleaved))
        self.assertEqual(len(seqs), 10)
        label, seq = seqs[-1]
        self.assertEqual(label, 'Frog')
        self.assertEqual(seq, \
'ATGGCACACCCATCACAATTAGGTTTTCAAGACGCAGCCTCTCCAATTATAGAAGAATTACTTCACTTCCACGACCATACCCTCATAGCCGTTTTTCTTATTAGTACGCTAGTTCTTTACATTATTACTATTATAATAACTACTAAACTAACTAATACAAACCTAATGGACGCACAAGAGATCGAAATAGTGTGAACTATTATACCAGCTATTAGCCTCATCATAATTGCCCTTCCATCCCTTCGTATCCTATATTTAATAGATGAAGTTAATGATCCACACTTAACAATTAAAGCAATCGGCCACCAATGATACTGAAGCTACGAATATACTAACTATGAGGATCTCTCATTTGACTCTTATATAATTCCAACTAATGACCTTACCCCTGGACAATTCCGGCTGCTAGAAGTTGATAATCGAATAGTAGTCCCAATAGAATCTCCAACCCGACTTTTAGTTACAGCCGAAGACGTCCTCCACTCGTGAGCTGTACCCTCCTTGGGTGTCAAAACAGATGCAATCCCAGGACGACTTCATCAAACATCATTTATTGCTACTCGTCCGGGAGTATTTTACGGACAATGTTCAGAAATTTGCGGAGCAAACCACAGCTTTATACCAATTGTAGTTGAAGCAGTACCGCTAACCGACTTTGAAAACTGATCTTCATCAATACTA---GAAGCATCACTA------AGA')
        self.assertEqual(seqs[0][0], 'Cow')

        seqs = list(MinimalPhylipParser(self.space_interleaved))
        self.assertEqual(len(seqs), 5)
        self.assertEqual(seqs[0][0], 'cox2_leita')
        self.assertEqual(seqs[-1][0], 'cox2_tborr')
        self.assertEqual(len(seqs[0][1]), 176)
        self.assertEqual(len(seqs[-1][1]), 176)

        seqs = list(MinimalPhylipParser(self.interleaved_little))
        self.assertEqual(len(seqs), 6)
        self.assertEqual(seqs[1][0], 'Hesperorni')
        self.assertEqual(seqs[-1][0], 'B.subtilis')
        self.assertEqual(seqs[-1][1], 'GGCAGCCAATCACGGCAGCCAATCACGGCAGCCAATCAC')

        seqs = list(MinimalPhylipParser(self.noninterleaved_little))
        self.assertEqual(len(seqs), 6)
        self.assertEqual(seqs[0][0], 'Archaeopt')
        self.assertEqual(seqs[-1][0], 'B.subtilis')
        self.assertEqual(seqs[-1][-1], 'GGCAGCCAATCACGGCAGCC')

        seqs = list(MinimalPhylipParser(self.noninterleaved_big))
        self.assertEqual(len(seqs), 3)
        self.assertEqual(seqs[0][0], 'Rhesus')
        self.assertEqual(seqs[-1][0], 'Pig')
        self.assertEqual(seqs[-1][1], 'tgtggcacagatactcatgccagctcgttacagcatgagaacagcagtttattactcactaaagacagaatgaatgtagaaaaggctgaattttgtaataaaagcaagcagcctgtcttagcaaagagccaacagagcagatgggctgaaagtaagggcacatgtaatgataggcagactcctaacacagagaaaaaggtagttctgaatactgatctcctgtatgggagaaacgaactgaataagcagaaacctgcgtgctctgacagtcctagagattcccaagatgttccttgg')
예제 #2
0
 def test_empty(self):
     """MinimalFastaParser should return empty list from 'file' w/o labels"""
     self.assertEqual(list(MinimalPhylipParser(self.empty)), [])