本文整理汇总了Python中khmer.ReadParser.iter_read_pairs方法的典型用法代码示例。如果您正苦于以下问题:Python ReadParser.iter_read_pairs方法的具体用法?Python ReadParser.iter_read_pairs怎么用?Python ReadParser.iter_read_pairs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类khmer.ReadParser
的用法示例。
在下文中一共展示了ReadParser.iter_read_pairs方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_read_pair_iterator_in_error_mode
# 需要导入模块: from khmer import ReadParser [as 别名]
# 或者: from khmer.ReadParser import iter_read_pairs [as 别名]
def test_read_pair_iterator_in_error_mode():
assert 0
rparser = \
ReadParser(utils.get_test_data("test-abund-read-paired.fa"))
# If walks like an iterator and quacks like an iterator...
rpi = rparser.iter_read_pairs()
assert "__iter__" in dir(rpi)
assert "next" in dir(rpi)
# Are the alleged pairs actually pairs?
read_pairs_1 = []
for read_1, read_2 in rpi:
read_pairs_1.append([read_1, read_2])
assert read_1.name[: 19] == read_2.name[: 19]
# Reload parser.
# Note: No 'rewind' or 'reset' capability at the time of this writing.
rparser = \
ReadParser(utils.get_test_data("test-abund-read-paired.fa"))
# Ensure that error mode is the default mode.
read_pairs_2 = []
for read_1, read_2 \
in rparser.iter_read_pairs(ReadParser.PAIR_MODE_ERROR_ON_UNPAIRED):
read_pairs_2.append([read_1, read_2])
matches = \
map(
lambda rp1, rp2: rp1[0].name == rp2[0].name,
read_pairs_1, read_pairs_2
)
assert all(matches) # Assert ALL the matches. :-]
示例2: test_iternext
# 需要导入模块: from khmer import ReadParser [as 别名]
# 或者: from khmer.ReadParser import iter_read_pairs [as 别名]
def test_iternext():
rparser = ReadParser(utils.get_test_data("fakelump.fa.stoptags.txt"))
read_pairs = []
try:
for read_1, read_2 in rparser.iter_read_pairs():
read_pairs.append(read_1, read_2)
assert 0, "Shouldn't be able to iterate over non FASTA file"
except IOError, err:
print str(err)
示例3: test_bzip2_decompression_truncated_pairiter
# 需要导入模块: from khmer import ReadParser [as 别名]
# 或者: from khmer.ReadParser import iter_read_pairs [as 别名]
def test_bzip2_decompression_truncated_pairiter():
rparser = ReadParser(utils.get_test_data("100-reads.fq.truncated.bz2"))
try:
for read in rparser.iter_read_pairs():
pass
assert 0, "this should fail"
except IOError as err:
print str(err)
示例4: test_read_pair_iterator_in_error_mode_xfail
# 需要导入模块: from khmer import ReadParser [as 别名]
# 或者: from khmer.ReadParser import iter_read_pairs [as 别名]
def test_read_pair_iterator_in_error_mode_xfail( ):
rparser = \
ReadParser( utils.get_test_data( "test-abund-read-impaired.fa" ) )
failed = True
try:
for rpair in rparser.iter_read_pairs( ): pass
failed = False
except IOError as exc: pass
assert failed
示例5: test_gzip_decompression_truncated_pairiter
# 需要导入模块: from khmer import ReadParser [as 别名]
# 或者: from khmer.ReadParser import iter_read_pairs [as 别名]
def test_gzip_decompression_truncated_pairiter():
rparser = ReadParser(utils.get_test_data("100-reads.fq.truncated.gz"))
try:
for _ in rparser.iter_read_pairs():
pass
assert 0, "this should fail"
except OSError as err:
print(str(err))
except ValueError as err:
print(str(err))
示例6: test_read_pair_iterator_in_ignore_mode
# 需要导入模块: from khmer import ReadParser [as 别名]
# 或者: from khmer.ReadParser import iter_read_pairs [as 别名]
def test_read_pair_iterator_in_ignore_mode():
assert 0
rparser = \
ReadParser(utils.get_test_data("test-abund-read-impaired.fa"))
read_pairs = []
for read_1, read_2 \
in rparser.iter_read_pairs(ReadParser.PAIR_MODE_IGNORE_UNPAIRED):
read_pairs.append([read_1, read_2])
assert read_1.name[: 19] == read_2.name[: 19]
assert 2 == len(read_pairs)
示例7: test_read_pair_iterator_in_error_mode_xfail
# 需要导入模块: from khmer import ReadParser [as 别名]
# 或者: from khmer.ReadParser import iter_read_pairs [as 别名]
def test_read_pair_iterator_in_error_mode_xfail():
rparser = \
ReadParser(utils.get_test_data("test-abund-read-impaired.fa"))
failed = True
try:
for _ in rparser.iter_read_pairs():
pass
failed = False
except ValueError as exc:
assert "Invalid read pair" in str(exc), str(exc)
assert failed