本文整理汇总了Python中sourmash._minhash.MinHash.add_many方法的典型用法代码示例。如果您正苦于以下问题:Python MinHash.add_many方法的具体用法?Python MinHash.add_many怎么用?Python MinHash.add_many使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sourmash._minhash.MinHash
的用法示例。
在下文中一共展示了MinHash.add_many方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_add_many
# 需要导入模块: from sourmash._minhash import MinHash [as 别名]
# 或者: from sourmash._minhash.MinHash import add_many [as 别名]
def test_add_many(track_abundance):
a = MinHash(0, 10, track_abundance=track_abundance, max_hash=5000)
b = MinHash(0, 10, track_abundance=track_abundance, max_hash=5000)
a.add_many(list(range(0, 100, 2)))
a.add_many(list(range(0, 100, 2)))
assert len(a) == 50
assert all(c % 2 == 0 for c in a.get_mins())
for h in range(0, 100, 2):
b.add_hash(h)
b.add_hash(h)
assert len(b) == 50
assert a == b
示例2: test_remove_many
# 需要导入模块: from sourmash._minhash import MinHash [as 别名]
# 或者: from sourmash._minhash.MinHash import add_many [as 别名]
def test_remove_many(track_abundance):
a = MinHash(0, 10, track_abundance=track_abundance, max_hash=5000)
a.add_many(list(range(0, 100, 2)))
orig_sig = signature.SourmashSignature(a)
orig_md5 = orig_sig.md5sum()
a.remove_many(list(range(0, 100, 3)))
new_sig = signature.SourmashSignature(a)
new_md5 = new_sig.md5sum()
assert orig_md5 == "f1cc295157374f5c07cfca5f867188a1"
assert new_md5 == "dd93fa319ef57f4a019c59ee1a8c73e2"
assert orig_md5 != new_md5
assert len(a) == 33
assert all(c % 6 != 0 for c in a.get_mins())