コード例 #1
0
def test_ssl01_scan_f():

    # 4 haplotypes,
    h = np.array([[0, 0, 1, 1], [0, 0, 1, 1], [0, 0, 1, 1]])
    expect0 = [1, 2, 3]
    expect1 = [1, 2, 3]
    actual0, actual1 = ssl01_scan(h, sum_ssl)
    assert_array_equal(expect0, actual0)
    assert_array_equal(expect1, actual1)
コード例 #2
0
def test_ssl01_scan_c():

    # 2 haplotypes, identical
    h = np.array([[0, 0], [0, 0], [1, 1], [1, 1]])
    expect0 = [1, 2, 0, 0]
    expect1 = [0, 0, 3, 4]
    actual0, actual1 = ssl01_scan(h, sum_ssl)
    assert_array_equal(expect0, actual0)
    assert_array_equal(expect1, actual1)
コード例 #3
0
def test_ssl01_scan_e():

    # 3 haplotypes, 3 pairs, identical
    h = np.array([[0, 0, 0], [0, 0, 0], [0, 0, 0]])
    expect0 = [3, 6, 9]
    expect1 = [0, 0, 0]
    actual0, actual1 = ssl01_scan(h, sum_ssl)
    assert_array_equal(expect0, actual0)
    assert_array_equal(expect1, actual1)
コード例 #4
0
def test_ssl01_scan_d():

    # 2 haplotypes, different
    h = np.array([[0, 1], [0, 1], [1, 0], [1, 0]])
    expect0 = [0, 0, 0, 0]
    expect1 = [0, 0, 0, 0]
    actual0, actual1 = ssl01_scan(h, sum_ssl)
    assert_array_equal(expect0, actual0)
    assert_array_equal(expect1, actual1)
コード例 #5
0
def test_ssl01_scan_int8_b():

    # 2 haplotypes, identical
    h = np.array([[1, 1], [1, 1], [1, 1]], dtype='i1')
    expect0 = [0, 0, 0]
    expect1 = [1, 2, 3]
    actual0, actual1 = ssl01_scan_int8(h, sum_ssl)
    assert_array_equal(expect0, actual0)
    assert_array_equal(expect1, actual1)
コード例 #6
0
def test_ehh_decay():
    h = [[0, 0, 1, 1], [0, 0, 1, 1], [0, 0, 0, 1], [0, 0, 0, 0], [0, 1, 0, 0]]
    e = [2 / 6, 2 / 6, 1 / 6, 1 / 6, 0]
    a = ehh_decay(h)
    assert_array_equal(e, a)

    # with multiallelics
    h = [[0, 0, 2, 2], [0, 0, 1, 1], [0, 0, 0, 3], [0, 0, 0, 0], [0, 4, 0, 0]]
    e = [2 / 6, 2 / 6, 1 / 6, 1 / 6, 0]
    a = ehh_decay(h)
    assert_array_equal(e, a)
コード例 #7
0
def test_ssl01_scan_int8_f():

    # 4 haplotypes,
    h = np.array([[0, 0, 1, 1],
                  [0, 0, 1, 1],
                  [0, 0, 1, 1]], dtype='i1')
    expect0 = [1, 2, 3]
    expect1 = [1, 2, 3]
    actual0, actual1 = ssl01_scan_int8(h, sum_ssl)
    assert_array_equal(expect0, actual0)
    assert_array_equal(expect1, actual1)
コード例 #8
0
def test_ssl01_scan_int8_e():

    # 3 haplotypes, 3 pairs, identical
    h = np.array([[0, 0, 0],
                  [0, 0, 0],
                  [0, 0, 0]], dtype='i1')
    expect0 = [3, 6, 9]
    expect1 = [0, 0, 0]
    actual0, actual1 = ssl01_scan_int8(h, sum_ssl)
    assert_array_equal(expect0, actual0)
    assert_array_equal(expect1, actual1)
コード例 #9
0
def test_ssl01_scan_int8_b():

    # 2 haplotypes, identical
    h = np.array([[1, 1],
                  [1, 1],
                  [1, 1]], dtype='i1')
    expect0 = [0, 0, 0]
    expect1 = [1, 2, 3]
    actual0, actual1 = ssl01_scan_int8(h, sum_ssl)
    assert_array_equal(expect0, actual0)
    assert_array_equal(expect1, actual1)
コード例 #10
0
def test_ssl01_scan_int8_d():

    # 2 haplotypes, different
    h = np.array([[0, 1],
                  [0, 1],
                  [1, 0],
                  [1, 0]], dtype='i1')
    expect0 = [0, 0, 0, 0]
    expect1 = [0, 0, 0, 0]
    actual0, actual1 = ssl01_scan_int8(h, sum_ssl)
    assert_array_equal(expect0, actual0)
    assert_array_equal(expect1, actual1)
コード例 #11
0
def test_voight_painting():
    h = [[0, 0, 1, 1],
         [0, 0, 1, 1],
         [0, 0, 0, 1],
         [0, 0, 0, 0],
         [0, 1, 0, 0]]
    e = [[1, 1, 2, 2],
         [1, 1, 2, 2],
         [1, 1, 0, 0],
         [1, 1, 0, 0],
         [0, 0, 0, 0]]
    a, _ = voight_painting(h)
    assert_array_equal(e, a)
コード例 #12
0
def test_ehh_decay():
    h = [[0, 0, 1, 1], [0, 0, 1, 1], [0, 0, 0, 1], [0, 0, 0, 0], [0, 1, 0, 0]]
    e = [2 / 6, 2 / 6, 1 / 6, 1 / 6, 0]
    a = ehh_decay(h)
    assert_array_equal(e, a)