Exemplo n.º 1
0
 def test_align_no_blank_columns(self):
     """correctly handle a file with no white space at line starts"""
     parser = MinimalNexusAlignParser("data/nexus_aa.nxs")
     seqs = {n: s for n, s in parser}
     self.assertEqual(len(seqs), 10)  # 10 taxa
     lengths = set(len(seqs[n]) for n in seqs)
     self.assertEqual(lengths, {234})  # all same length and equal 234
Exemplo n.º 2
0
 def test_align_with_spaced_seqs(self):
     """correctly handle an alignment block with spaces in seqs"""
     parser = MinimalNexusAlignParser("data/nexus_dna.nex")
     seqs = {n: s for n, s in parser}
     self.assertEqual(len(seqs), 10)  # 10 taxa
     lengths = set(len(seqs[n]) for n in seqs)
     self.assertEqual(lengths, {705})  # all same length and equal 705
Exemplo n.º 3
0
 def test_align_from_mixed(self):
     """correctly handle a file with tree and alignment block"""
     parser = MinimalNexusAlignParser("data/nexus_mixed.nex")
     got = {n: s for n, s in parser}
     expect = {
         "fish": "ACATAGAGGGTACCTCTAAG",
         "frog": "ACATAGAGGGTACCTCTAAG",
         "snake": "ACATAGAGGGTACCTCTAAG",
         "mouse": "ACATAGAGGGTACCTCTAAG",
     }
     self.assertEqual(got, expect)
Exemplo n.º 4
0
 def test_align_with_comments(self):
     """correctly handle an alignment block containing comments"""
     parser = MinimalNexusAlignParser("data/nexus_comments.nex")
     got = {n: s for n, s in parser}
     expect = {
         "Ephedra": "TTAAGCCATGCATGTCTAAGTATGAACTAATTCCAAACGGTGA",
         "Gnetum": "TTAAGCCATGCATGTCTATGTACGAACTAATC-AGAACGGTGA",
         "Welwitschia": "TTAAGCCATGCACGTGTAAGTATGAACTAGTC-GAAACGGTGA",
         "Ginkgo": "TTAAGCCATGCATGTGTAAGTATGAACTCTTTACAGACTGTGA",
         "Pinus": "TTAAGCCATGCATGTCTAAGTATGAACTAATTGCAGACTGTGA",
     }
     self.assertEqual(got, expect)