本文整理汇总了Python中khmer.LabelHash.n_labels方法的典型用法代码示例。如果您正苦于以下问题:Python LabelHash.n_labels方法的具体用法?Python LabelHash.n_labels怎么用?Python LabelHash.n_labels使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类khmer.LabelHash
的用法示例。
在下文中一共展示了LabelHash.n_labels方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_n_labels
# 需要导入模块: from khmer import LabelHash [as 别名]
# 或者: from khmer.LabelHash import n_labels [as 别名]
def test_n_labels():
lh = LabelHash(20, 1e7, 4)
filename = utils.get_test_data('test-labels.fa')
lh.consume_fasta_and_tag_with_labels(filename)
print lh.n_labels()
assert lh.n_labels() == 4
示例2: test_consume_fasta_and_tag_with_labels
# 需要导入模块: from khmer import LabelHash [as 别名]
# 或者: from khmer.LabelHash import n_labels [as 别名]
def test_consume_fasta_and_tag_with_labels():
lb = LabelHash(20, 1e7, 4)
read_1 = 'ACGTAACCGGTTAAACCCGGGTTTAAAACCCCGGGGTTTT'
filename = utils.get_test_data('test-transcript.fa')
total_reads, n_consumed = lb.consume_fasta_and_tag_with_labels(filename)
print "doing get"
assert lb.get(read_1[:20])
assert total_reads == 3
print "doing n_labels"
print lb.n_labels()
print "doing label dict"
print lb.get_label_dict()
print "get tagset"
for tag in lb.get_tagset():
print "forward hash"
print tag, khmer.forward_hash(tag, 20)
for record in screed.open(filename):
print "Sweeping tags"
print lb.sweep_tag_neighborhood(record.sequence, 40)
print "Sweeping labels..."
print lb.sweep_label_neighborhood(record.sequence, 40)
assert lb.n_labels() == 3
示例3: test_consume_partitioned_fasta_and_tag_with_labels
# 需要导入模块: from khmer import LabelHash [as 别名]
# 或者: from khmer.LabelHash import n_labels [as 别名]
def test_consume_partitioned_fasta_and_tag_with_labels():
lb = LabelHash(20, 1e7, 4)
filename = utils.get_test_data('real-partition-small.fa')
total_reads, n_consumed = lb.consume_partitioned_fasta_and_tag_with_labels(
filename)
labels = set()
for record in screed.open(filename):
seq = record.sequence
labels.update(lb.sweep_label_neighborhood(seq, 0, False, False))
# print lb.n_labels()
# print labels
assert len(labels) == 1
assert labels.pop() == 2
assert lb.n_labels() == 1