Ejemplo n.º 1
0
 def test_from_file_GS(self):
     sto = StringIO("# STOCKHOLM 1.0\n#=GS seq2 AC 222\n#=GS seq1 AC 111\n"
                    "seq1          ACC-G-GGTA\n"
                    "seq2          TCC-G-GGCA\n//")
     obs_sto = next(StockholmAlignment.from_file(sto, DNA))
     exp_sto = StockholmAlignment(self.seqs, {}, self.GS, {}, {})
     self.assertEqual(obs_sto, exp_sto)
Ejemplo n.º 2
0
 def test_from_file_GS(self):
     sto = StringIO("# STOCKHOLM 1.0\n#=GS seq2 AC 222\n#=GS seq1 AC 111\n"
                    "seq1          ACC-G-GGTA\n"
                    "seq2          TCC-G-GGCA\n//")
     obs_sto = next(StockholmAlignment.from_file(sto, DNA))
     exp_sto = StockholmAlignment(self.seqs, {}, self.GS, {}, {})
     self.assertEqual(obs_sto, exp_sto)
Ejemplo n.º 3
0
 def test_from_file_GC(self):
     sto = StringIO("# STOCKHOLM 1.0\n"
                    "seq1         ACC-G-GGTA\nseq2         TCC-G-GGCA\n"
                    "#=GC SS_cons (((....)))\n//")
     obs_sto = next(StockholmAlignment.from_file(sto, DNA))
     exp_sto = StockholmAlignment(self.seqs, {}, {}, {}, self.GC)
     self.assertEqual(obs_sto, exp_sto)
Ejemplo n.º 4
0
 def test_from_file_GC(self):
     sto = StringIO("# STOCKHOLM 1.0\n"
                    "seq1         ACC-G-GGTA\nseq2         TCC-G-GGCA\n"
                    "#=GC SS_cons (((....)))\n//")
     obs_sto = next(StockholmAlignment.from_file(sto, DNA))
     exp_sto = StockholmAlignment(self.seqs, {}, {}, {}, self.GC)
     self.assertEqual(obs_sto, exp_sto)
Ejemplo n.º 5
0
 def test_from_file_alignment(self):
     """make sure can parse basic sto file with interleaved alignment"""
     sto = StringIO(
         "# STOCKHOLM 1.0\n" "seq1      ACC-G\n" "seq2      TCC-G\n\n" "seq1      -GGTA\n" "seq2      -GGCA\n//"
     )
     obs_sto = next(StockholmAlignment.from_file(sto, DNA))
     exp_sto = StockholmAlignment(self.seqs)
     self.assertEqual(obs_sto, exp_sto)
Ejemplo n.º 6
0
 def test_from_file_GR(self):
     sto = StringIO("# STOCKHOLM 1.0\nseq1          ACC-G\n"
                    "#=GR seq1 SS  11101\nseq2          TCC-G\n"
                    "#=GR seq2 SS  01101\n\nseq1          -GGTA\n"
                    "#=GR seq1 SS  01111\nseq2          -GGCA\n"
                    "#=GR seq2 SS  01110\n//")
     obs_sto = next(StockholmAlignment.from_file(sto, DNA))
     exp_sto = StockholmAlignment(self.seqs, {}, {}, self.GR, {})
     self.assertEqual(obs_sto, exp_sto)
Ejemplo n.º 7
0
 def test_from_file_GR(self):
     sto = StringIO("# STOCKHOLM 1.0\nseq1          ACC-G\n"
                    "#=GR seq1 SS  11101\nseq2          TCC-G\n"
                    "#=GR seq2 SS  01101\n\nseq1          -GGTA\n"
                    "#=GR seq1 SS  01111\nseq2          -GGCA\n"
                    "#=GR seq2 SS  01110\n//")
     obs_sto = next(StockholmAlignment.from_file(sto, DNA))
     exp_sto = StockholmAlignment(self.seqs, {}, {}, self.GR, {})
     self.assertEqual(obs_sto, exp_sto)
Ejemplo n.º 8
0
 def test_from_file_alignment(self):
     """make sure can parse basic sto file with interleaved alignment"""
     sto = StringIO("# STOCKHOLM 1.0\n"
                    "seq1      ACC-G\n"
                    "seq2      TCC-G\n\n"
                    "seq1      -GGTA\n"
                    "seq2      -GGCA\n//")
     obs_sto = next(StockholmAlignment.from_file(sto, DNA))
     exp_sto = StockholmAlignment(self.seqs)
     self.assertEqual(obs_sto, exp_sto)
Ejemplo n.º 9
0
 def test_from_file_GF(self):
     # remove rn line to make sure auto-added
     self.GF.pop("RN")
     sto = StringIO("# STOCKHOLM 1.0\n#=GF RN [1]\n#=GF RM 11469857\n"
                    "#=GF RT TITLE1\n#=GF RA Auth1;\n#=GF RL J Mol Biol\n"
                    "#=GF RN [2]\n#=GF RM 12007400\n#=GF RT TITLE2\n"
                    "#=GF RA Auth2;\n#=GF RL Cell\n#=GF AC RF00360\n"
                    "#=GF BM cmbuild  -F CM SEED\n"
                    "#=GF BM cmsearch  -Z 274931 -E 1000000\n#=GF SQ 9\n"
                    "seq1         ACC-G-GGTA\nseq2         TCC-G-GGCA\n//")
     obs_sto = next(StockholmAlignment.from_file(sto, DNA))
     exp_sto = StockholmAlignment(self.seqs, self.GF, {}, {}, {})
     self.assertEqual(obs_sto, exp_sto)
Ejemplo n.º 10
0
 def test_from_file_GF(self):
     # remove rn line to make sure auto-added
     self.GF.pop("RN")
     sto = StringIO("# STOCKHOLM 1.0\n#=GF RN [1]\n#=GF RM 11469857\n"
                    "#=GF RT TITLE1\n#=GF RA Auth1;\n#=GF RL J Mol Biol\n"
                    "#=GF RN [2]\n#=GF RM 12007400\n#=GF RT TITLE2\n"
                    "#=GF RA Auth2;\n#=GF RL Cell\n#=GF AC RF00360\n"
                    "#=GF BM cmbuild  -F CM SEED\n"
                    "#=GF BM cmsearch  -Z 274931 -E 1000000\n#=GF SQ 9\n"
                    "seq1         ACC-G-GGTA\nseq2         TCC-G-GGCA\n//")
     obs_sto = next(StockholmAlignment.from_file(sto, DNA))
     exp_sto = StockholmAlignment(self.seqs, self.GF, {}, {}, {})
     self.assertEqual(obs_sto, exp_sto)
Ejemplo n.º 11
0
 def test_from_file_multi(self):
     sto = StringIO("# STOCKHOLM 1.0\n#=GS seq2 AC 222\n#=GS seq1 AC 111\n"
                    "seq1          ACC-G-GGTA\n"
                    "seq2          TCC-G-GGCA\n//\n"
                    "# STOCKHOLM 1.0\nseq1          ACC-G-GGTA\n"
                    "#=GR seq1 SS  1110101111\nseq2          TCC-G-GGCA\n"
                    "#=GR seq2 SS  0110101110\n//")
     obs_sto = StockholmAlignment.from_file(sto, DNA)
     count = 0
     for obs in obs_sto:
         if count == 0:
             exp_sto = StockholmAlignment(self.seqs, {}, self.GS, {}, {})
             self.assertEqual(obs, exp_sto)
         elif count == 1:
             exp_sto = StockholmAlignment(self.seqs, {}, {}, self.GR, {})
             self.assertEqual(obs, exp_sto)
         else:
             raise AssertionError("More than 2 sto alignments parsed!")
         count += 1
Ejemplo n.º 12
0
 def test_from_file_multi(self):
     sto = StringIO("# STOCKHOLM 1.0\n#=GS seq2 AC 222\n#=GS seq1 AC 111\n"
                    "seq1          ACC-G-GGTA\n"
                    "seq2          TCC-G-GGCA\n//\n"
                    "# STOCKHOLM 1.0\nseq1          ACC-G-GGTA\n"
                    "#=GR seq1 SS  1110101111\nseq2          TCC-G-GGCA\n"
                    "#=GR seq2 SS  0110101110\n//")
     obs_sto = StockholmAlignment.from_file(sto, DNA)
     count = 0
     for obs in obs_sto:
         if count == 0:
             exp_sto = StockholmAlignment(self.seqs, {}, self.GS, {}, {})
             self.assertEqual(obs, exp_sto)
         elif count == 1:
             exp_sto = StockholmAlignment(self.seqs, {}, {}, self.GR, {})
             self.assertEqual(obs, exp_sto)
         else:
             raise AssertionError("More than 2 sto alignments parsed!")
         count += 1