• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python alignment.StockholmAlignment类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中skbio.alignment.StockholmAlignment的典型用法代码示例。如果您正苦于以下问题:Python StockholmAlignment类的具体用法?Python StockholmAlignment怎么用?Python StockholmAlignment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了StockholmAlignment类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_to_file

    def test_to_file(self):
        st = StockholmAlignment(self.seqs, gc=self.GC, gf=self.GF, gs=self.GS,
                                gr=self.GR)

        with tempfile.NamedTemporaryFile('r+') as temp_file:
            st.to_file(temp_file)
            temp_file.flush()
            temp_file.seek(0)
            obs = temp_file.read()
            exp = ('# STOCKHOLM 1.0\n'
                   '#=GF AC RF00360\n'
                   '#=GF BM cmbuild  -F CM SEED\n'
                   '#=GF BM cmsearch  -Z 274931 -E 1000000\n'
                   '#=GF SQ 9\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'
                   '#=GS seq1 AC 111\n'
                   '#=GS seq2 AC 222\n'
                   'seq1          ACC-G-GGTA\n'
                   '#=GR seq1 SS  1110101111\n'
                   'seq2          TCC-G-GGCA\n'
                   '#=GR seq2 SS  0110101110\n'
                   '#=GC SS_cons  (((....)))\n//')
        self.assertEqual(obs, exp)
开发者ID:bctaylor,项目名称:scikit-bio,代码行数:32,代码来源:test_alignment.py


示例2: test_from_file_GS

 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)
开发者ID:bctaylor,项目名称:scikit-bio,代码行数:7,代码来源:test_alignment.py


示例3: test_from_file_GC

 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)
开发者ID:bctaylor,项目名称:scikit-bio,代码行数:7,代码来源:test_alignment.py


示例4: test_from_file_alignment

 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)
开发者ID:cauyrd,项目名称:scikit-bio,代码行数:8,代码来源:test_alignment.py


示例5: test_from_file_GR

 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)
开发者ID:bctaylor,项目名称:scikit-bio,代码行数:9,代码来源:test_alignment.py


示例6: test_from_file_GF

 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)
开发者ID:bctaylor,项目名称:scikit-bio,代码行数:13,代码来源:test_alignment.py


示例7: test_from_file_multi

 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
开发者ID:bctaylor,项目名称:scikit-bio,代码行数:19,代码来源:test_alignment.py


示例8: setUp

 def setUp(self):
     """Setup for stockholm tests."""
     self.seqs = [DNASequence("ACC-G-GGTA", id="seq1"), DNASequence("TCC-G-GGCA", id="seq2")]
     self.GF = OrderedDict(
         [
             ("AC", "RF00360"),
             ("BM", ["cmbuild  -F CM SEED", "cmsearch  -Z 274931 -E 1000000"]),
             ("SQ", "9"),
             ("RT", ["TITLE1", "TITLE2"]),
             ("RN", ["[1]", "[2]"]),
             ("RA", ["Auth1;", "Auth2;"]),
             ("RL", ["J Mol Biol", "Cell"]),
             ("RM", ["11469857", "12007400"]),
             ("RN", ["[1]", "[2]"]),
         ]
     )
     self.GS = {"AC": OrderedDict([("seq1", "111"), ("seq2", "222")])}
     self.GR = {"SS": OrderedDict([("seq1", "1110101111"), ("seq2", "0110101110")])}
     self.GC = {"SS_cons": "(((....)))"}
     self.st = StockholmAlignment(self.seqs, gc=self.GC, gf=self.GF, gs=self.GS, gr=self.GR)
开发者ID:cauyrd,项目名称:scikit-bio,代码行数:20,代码来源:test_alignment.py


示例9: setUp

 def setUp(self):
     self.seqs = [DNA("ACC-G-GGTA", metadata={'id': "seq1"}),
                  DNA("TCC-G-GGCA", metadata={'id': "seq2"})]
     self.GF = OrderedDict([
         ("AC", "RF00360"),
         ("BM", ["cmbuild  -F CM SEED",
                 "cmsearch  -Z 274931 -E 1000000"]),
         ("SQ", "9"),
         ("RT", ["TITLE1",  "TITLE2"]),
         ("RN", ["[1]", "[2]"]),
         ("RA", ["Auth1;", "Auth2;"]),
         ("RL", ["J Mol Biol", "Cell"]),
         ("RM", ["11469857", "12007400"]),
         ('RN', ['[1]', '[2]'])
     ])
     self.GS = {"AC": OrderedDict([("seq1", "111"), ("seq2", "222")])}
     self.GR = {"SS": OrderedDict([("seq1", "1110101111"),
                                   ("seq2", "0110101110")])}
     self.GC = {"SS_cons": "(((....)))"}
     self.st = StockholmAlignment(self.seqs, gc=self.GC, gf=self.GF,
                                  gs=self.GS, gr=self.GR)
开发者ID:sh4wn,项目名称:scikit-bio,代码行数:21,代码来源:test_alignment.py


示例10: StockholmAlignmentTests

class StockholmAlignmentTests(TestCase):
    def setUp(self):
        self.seqs = [DNA("ACC-G-GGTA", id="seq1"),
                     DNA("TCC-G-GGCA", id="seq2")]
        self.GF = OrderedDict([
            ("AC", "RF00360"),
            ("BM", ["cmbuild  -F CM SEED",
                    "cmsearch  -Z 274931 -E 1000000"]),
            ("SQ", "9"),
            ("RT", ["TITLE1",  "TITLE2"]),
            ("RN", ["[1]", "[2]"]),
            ("RA", ["Auth1;", "Auth2;"]),
            ("RL", ["J Mol Biol", "Cell"]),
            ("RM", ["11469857", "12007400"]),
            ('RN', ['[1]', '[2]'])
        ])
        self.GS = {"AC": OrderedDict([("seq1", "111"), ("seq2", "222")])}
        self.GR = {"SS": OrderedDict([("seq1", "1110101111"),
                                      ("seq2", "0110101110")])}
        self.GC = {"SS_cons": "(((....)))"}
        self.st = StockholmAlignment(self.seqs, gc=self.GC, gf=self.GF,
                                     gs=self.GS, gr=self.GR)

    def test_retrieve_metadata(self):
        self.assertEqual(self.st.gc, self.GC)
        self.assertEqual(self.st.gf, self.GF)
        self.assertEqual(self.st.gs, self.GS)
        self.assertEqual(self.st.gr, self.GR)

    def test_from_file_alignment(self):
        # test that a basic stockholm file with interleaved alignment can be
        # parsed
        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)

    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)

    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)

    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)

    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)

    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
#.........这里部分代码省略.........
开发者ID:bctaylor,项目名称:scikit-bio,代码行数:101,代码来源:test_alignment.py


示例11: StockholmAlignmentTests

class StockholmAlignmentTests(TestCase):

    """Tests for stockholmAlignment object"""

    def setUp(self):
        """Setup for stockholm tests."""
        self.seqs = [DNASequence("ACC-G-GGTA", id="seq1"), DNASequence("TCC-G-GGCA", id="seq2")]
        self.GF = OrderedDict(
            [
                ("AC", "RF00360"),
                ("BM", ["cmbuild  -F CM SEED", "cmsearch  -Z 274931 -E 1000000"]),
                ("SQ", "9"),
                ("RT", ["TITLE1", "TITLE2"]),
                ("RN", ["[1]", "[2]"]),
                ("RA", ["Auth1;", "Auth2;"]),
                ("RL", ["J Mol Biol", "Cell"]),
                ("RM", ["11469857", "12007400"]),
                ("RN", ["[1]", "[2]"]),
            ]
        )
        self.GS = {"AC": OrderedDict([("seq1", "111"), ("seq2", "222")])}
        self.GR = {"SS": OrderedDict([("seq1", "1110101111"), ("seq2", "0110101110")])}
        self.GC = {"SS_cons": "(((....)))"}
        self.st = StockholmAlignment(self.seqs, gc=self.GC, gf=self.GF, gs=self.GS, gr=self.GR)

    def test_retrieve_metadata(self):
        self.assertEqual(self.st.gc, self.GC)
        self.assertEqual(self.st.gf, self.GF)
        self.assertEqual(self.st.gs, self.GS)
        self.assertEqual(self.st.gr, self.GR)

    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)

    def test_from_file_GF(self):
        """Make sure GF lines are parsed correctly"""
        # 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)

    def test_from_file_GC(self):
        """Make sure GC lines are parsed correctly"""
        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)

    def test_from_file_GS(self):
        """Make sure GS lines are parsed correctly"""
        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)

    def test_from_file_GR(self):
        """Make sure GR lines are parsed correctly"""
        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)

    def test_from_file_multi(self):
        """Make sure yield works correctly with multi-alignment sto files"""
        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//"
        )
#.........这里部分代码省略.........
开发者ID:cauyrd,项目名称:scikit-bio,代码行数:101,代码来源:test_alignment.py



注:本文中的skbio.alignment.StockholmAlignment类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python util.which函数代码示例发布时间:2022-05-27
下一篇:
Python alignment.make_identity_substitution_matrix函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap