当前位置: 首页>>代码示例>>Python>>正文


Python StockholmAlignment._parse_gs_gr_info方法代码示例

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


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

示例1: StockholmAlignmentTests

# 需要导入模块: from skbio.alignment import StockholmAlignment [as 别名]
# 或者: from skbio.alignment.StockholmAlignment import _parse_gs_gr_info [as 别名]

#.........这里部分代码省略.........

    def test_parse_gf_info_nongf(self):
        sto = ["#=GF AC BLAAAAAAAHHH", "#=GC HUH THIS SHOULD NOT BE HERE"]
        with self.assertRaises(StockholmParseError):
            self.st._parse_gf_info(sto)

    def test_parse_gf_info_malformed(self):
        # too short of a line
        sto = ["#=GF AC", "#=GF"]
        with self.assertRaises(StockholmParseError):
            self.st._parse_gf_info(sto)

    def test_parse_gc_info_nongf(self):
        sto = ["#=GC AC BLAAAAAAAHHH", "#=GF HUH THIS SHOULD NOT BE HERE"]
        with self.assertRaises(StockholmParseError):
            self.st._parse_gf_info(sto)

    def test_parse_gc_info_strict_len(self):
        sto = ["#=GC SS_cons (((..)))"]
        with self.assertRaises(StockholmParseError):
            self.st._parse_gc_info(sto, seqlen=20, strict=True)

    def test_parse_gc_info_strict_duplicate(self):
        sto = ["#=GC SS_cons (((..)))", "#=GC SS_cons (((..)))"]
        with self.assertRaises(StockholmParseError):
            self.st._parse_gc_info(sto, seqlen=8, strict=True)

    def test_parse_gc_info_malformed(self):
        # too short of a line
        sto = ["#=GC AC BLAAAAAAAHHH", "#=GC"]
        with self.assertRaises(StockholmParseError):
            self.st._parse_gc_info(sto)

    def test_parse_gs_gr_info_mixed(self):
        sto = ["#=GS seq1 AC BLAAA", "#=GR seq2 HUH THIS SHOULD NOT BE HERE"]
        with self.assertRaises(StockholmParseError):
            self.st._parse_gs_gr_info(sto)

    def test_parse_gs_gr_info_malformed(self):
        # too short of a line
        sto = ["#=GS AC BLAAAAAAAHHH", "#=GS"]
        with self.assertRaises(StockholmParseError):
            self.st._parse_gs_gr_info(sto)

    def test_parse_gs_gr_info_strict(self):
        sto = ["#=GR seq1 SS  10101111", "#=GR seq2 SS  01101"]
        with self.assertRaises(StockholmParseError):
            self.st._parse_gs_gr_info(sto, seqlen=20, strict=True)

    def test_str(self):
        st = StockholmAlignment(self.seqs, gc=self.GC, gf=self.GF, gs=self.GS,
                                gr=self.GR)
        obs = str(st)
        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'
开发者ID:bctaylor,项目名称:scikit-bio,代码行数:70,代码来源:test_alignment.py

示例2: StockholmAlignmentTests

# 需要导入模块: from skbio.alignment import StockholmAlignment [as 别名]
# 或者: from skbio.alignment.StockholmAlignment import _parse_gs_gr_info [as 别名]

#.........这里部分代码省略.........
        with self.assertRaises(StockholmParseError):
            self.st._parse_gf_info(sto)

    def test_parse_gf_info_malformed(self):
        """Makes sure error raised if too short a line passed"""
        sto = ["#=GF AC", "#=GF"]
        with self.assertRaises(StockholmParseError):
            self.st._parse_gf_info(sto)

    def test_parse_gc_info_nongf(self):
        """Makes sure error raised if non-GC line passed"""
        sto = ["#=GC AC BLAAAAAAAHHH", "#=GF HUH THIS SHOULD NOT BE HERE"]
        with self.assertRaises(StockholmParseError):
            self.st._parse_gf_info(sto)

    def test_parse_gc_info_strict_len(self):
        """Make sure error raised if GC lines bad length and strict parsing"""
        sto = ["#=GC SS_cons (((..)))"]
        with self.assertRaises(StockholmParseError):
            self.st._parse_gc_info(sto, seqlen=20, strict=True)

    def test_parse_gc_info_strict_duplicate(self):
        """Make sure error raised if GC lines repeated"""
        sto = ["#=GC SS_cons (((..)))", "#=GC SS_cons (((..)))"]
        with self.assertRaises(StockholmParseError):
            self.st._parse_gc_info(sto, seqlen=8, strict=True)

    def test_parse_gc_info_malformed(self):
        """Makes sure error raised if too short a line passed"""
        sto = ["#=GC AC BLAAAAAAAHHH", "#=GC"]
        with self.assertRaises(StockholmParseError):
            self.st._parse_gc_info(sto)

    def test_parse_gs_gr_info_mixed(self):
        """Makes sure error raised if mixed GS and GR lines passed"""
        sto = ["#=GS seq1 AC BLAAA", "#=GR seq2 HUH THIS SHOULD NOT BE HERE"]
        with self.assertRaises(StockholmParseError):
            self.st._parse_gs_gr_info(sto)

    def test_parse_gs_gr_info_malformed(self):
        """Makes sure error raised if too short a line passed"""
        sto = ["#=GS AC BLAAAAAAAHHH", "#=GS"]
        with self.assertRaises(StockholmParseError):
            self.st._parse_gs_gr_info(sto)

    def test_parse_gs_gr_info_strict(self):
        """Make sure error raised if GR lines bad length and strict parsing"""
        sto = ["#=GR seq1 SS  10101111", "#=GR seq2 SS  01101"]
        with self.assertRaises(StockholmParseError):
            self.st._parse_gs_gr_info(sto, seqlen=20, strict=True)

    def test_str(self):
        """ Make sure stockholm with all information contained is formatted
        correctly """
        st = StockholmAlignment(self.seqs, gc=self.GC, gf=self.GF, gs=self.GS, gr=self.GR)
        obs = str(st)
        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"
开发者ID:cauyrd,项目名称:scikit-bio,代码行数:70,代码来源:test_alignment.py


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