本文整理汇总了Python中skbio.alignment.StockholmAlignment._parse_gc_info方法的典型用法代码示例。如果您正苦于以下问题:Python StockholmAlignment._parse_gc_info方法的具体用法?Python StockholmAlignment._parse_gc_info怎么用?Python StockholmAlignment._parse_gc_info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类skbio.alignment.StockholmAlignment
的用法示例。
在下文中一共展示了StockholmAlignment._parse_gc_info方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: StockholmAlignmentTests
# 需要导入模块: from skbio.alignment import StockholmAlignment [as 别名]
# 或者: from skbio.alignment.StockholmAlignment import _parse_gc_info [as 别名]
#.........这里部分代码省略.........
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
def test_parse_gf_multiline_nh(self):
sto = ["#=GF TN MULTILINE TREE",
"#=GF NH THIS IS FIRST", "#=GF NH THIS IS SECOND",
"#=GF AC 1283394"]
exp = {'TN': 'MULTILINE TREE',
'NH': 'THIS IS FIRST THIS IS SECOND',
'AC': '1283394'}
self.assertEqual(self.st._parse_gf_info(sto), exp)
def test_parse_gf_multiline_cc(self):
sto = ["#=GF CC THIS IS FIRST", "#=GF CC THIS IS SECOND"]
exp = {'CC': 'THIS IS FIRST THIS IS SECOND'}
self.assertEqual(self.st._parse_gf_info(sto), exp)
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):
示例2: StockholmAlignmentTests
# 需要导入模块: from skbio.alignment import StockholmAlignment [as 别名]
# 或者: from skbio.alignment.StockholmAlignment import _parse_gc_info [as 别名]
#.........这里部分代码省略.........
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
def test_parse_gf_multiline_nh(self):
"""Makes sure a multiline NH code is parsed correctly"""
sto = ["#=GF TN MULTILINE TREE", "#=GF NH THIS IS FIRST", "#=GF NH THIS IS SECOND", "#=GF AC 1283394"]
exp = {"TN": "MULTILINE TREE", "NH": "THIS IS FIRST THIS IS SECOND", "AC": "1283394"}
self.assertEqual(self.st._parse_gf_info(sto), exp)
def test_parse_gf_multiline_cc(self):
"""Makes sure a multiline CC code is parsed correctly"""
sto = ["#=GF CC THIS IS FIRST", "#=GF CC THIS IS SECOND"]
exp = {"CC": "THIS IS FIRST THIS IS SECOND"}
self.assertEqual(self.st._parse_gf_info(sto), exp)
def test_parse_gf_info_nongf(self):
"""Makes sure error raised if non-GF line passed"""
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):
"""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"]