本文整理汇总了Python中sourmash._minhash.MinHash.copy_and_clear方法的典型用法代码示例。如果您正苦于以下问题:Python MinHash.copy_and_clear方法的具体用法?Python MinHash.copy_and_clear怎么用?Python MinHash.copy_and_clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sourmash._minhash.MinHash
的用法示例。
在下文中一共展示了MinHash.copy_and_clear方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_div_zero_contained
# 需要导入模块: from sourmash._minhash import MinHash [as 别名]
# 或者: from sourmash._minhash.MinHash import copy_and_clear [as 别名]
def test_div_zero_contained(track_abundance):
# verify that empty MHs do not yield divide by zero errors for contained_by
mh = MinHash(1, 4, track_abundance=track_abundance)
mh2 = mh.copy_and_clear()
mh.add_sequence('ATGC')
assert mh.contained_by(mh2) == 0
assert mh2.contained_by(mh) == 0
示例2: test_mh_copy_and_clear_with_max_hash
# 需要导入模块: from sourmash._minhash import MinHash [as 别名]
# 或者: from sourmash._minhash.MinHash import copy_and_clear [as 别名]
def test_mh_copy_and_clear_with_max_hash(track_abundance):
# test basic creation of new, empty MinHash w/max_hash param set
a = MinHash(0, 10, track_abundance=track_abundance, max_hash=20)
for i in range(0, 40, 2):
a.add_hash(i)
b = a.copy_and_clear()
assert a.ksize == b.ksize
assert b.num == a.num
assert b.max_hash == 20
assert not b.is_protein
assert b.track_abundance == track_abundance
assert b.seed == a.seed
assert len(b.get_mins()) == 0
assert a.scaled == b.scaled
assert b.scaled != 0