當前位置: 首頁>>代碼示例>>Python>>正文


Python MinHash.copy_and_clear方法代碼示例

本文整理匯總了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
開發者ID:dib-lab,項目名稱:sourmash,代碼行數:10,代碼來源:test__minhash.py

示例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
開發者ID:dib-lab,項目名稱:sourmash,代碼行數:18,代碼來源:test__minhash.py


注:本文中的sourmash._minhash.MinHash.copy_and_clear方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。