예제 #1
0
def test_all_huddinge_pairs_shuffle(kmers):
    import pyhuddinge as ph

    D1 = ph.all_pairs_huddinge_distance(kmers)
    D2 = ph.all_pairs_huddinge_distance(kmers[::-1])

    Dsq1 = ph.squareform(D1, kmers)
    Dsq2 = ph.squareform(D2, kmers[::-1])
    reordered2 = Dsq2[Dsq1.columns].loc[Dsq1.index]

    #print(Dsq1)
    #print(reordered2)
    assert (Dsq1 == reordered2).all().all()
예제 #2
0
def test_all_huddinge_pairs1():
    import pyhuddinge as ph

    kmers = ["AAGGGAA", "AAAGCAA", "AAACCAA", "AAACAAA"]
    import itertools as it

    kmers = ["".join(x) for x in it.product("ACGT", repeat=6)]

    D = ph.all_pairs_huddinge_distance(kmers)

    assert len(D) == len(kmers) * (len(kmers) - 1) / 2
    assert min(D) > 0
예제 #3
0
def test_all_huddinge_pairs_concordance(kmers, reverse_complements):
    import pyhuddinge as ph
    print(repr(kmers), file=open("dump.py", "w"))

    D = ph.all_pairs_huddinge_distance(kmers, reverse_complements)

    assert len(D) == len(kmers) * (len(kmers) - 1) / 2

    Dsq = ph.squareform(D, kmers)

    for i in Dsq.index:
        for j in Dsq.columns:
            if i < j:
                assert Dsq.loc[i, j] == ph.huddinge_distance(
                    i, j, reverse_complements)
예제 #4
0
def test_all_huddinge_pairs_puregap():
    import pyhuddinge as ph
    kmers = ['nnnnnnnnnnnn', 'nnn']
    with pytest.raises(ValueError):
        D1 = ph.all_pairs_huddinge_distance(kmers)
예제 #5
0
def test_all_huddinge_pairs_empty():
    import pyhuddinge as ph
    kmers = []
    with pytest.raises(ValueError):
        D1 = ph.all_pairs_huddinge_distance(kmers)
예제 #6
0
def test_all_huddinge_pairs_nonbase(kmers):
    import pyhuddinge as ph

    with pytest.raises(ValueError):
        D1 = ph.all_pairs_huddinge_distance(kmers)