コード例 #1
0
def test_term_run(variants):
	term = Term('FILTER[PASS]', None)
	assert term.run(variants[0], passed = True) == False
	assert term.run(variants[5], passed = True) == ['PASS']

	term = Term('FILTER2', None)
	assert term.run(variants[5], passed = True) == False

	term = Term('GTTYPEs{0}', ['A', 'B', 'C', 'D'])
	assert term.run(variants[0], passed = False) == ['HOM_REF']

	term = Term('AAF[.126,]', None)
	# .125
	assert term.run(variants[0], passed = False) == False
	assert term.run(variants[2], passed = False) == [.25]
	term = Term('AAF[,.24]', None)
	# .25
	assert term.run(variants[0], passed = False) == [.125]
	assert term.run(variants[2], passed = False) == False

	term = Term('FILTER[PASS]', None)
	assert term.run(variants[0], passed = False) == False
	assert term.run(variants[5], passed = False) == ['PASS']
コード例 #2
0
ファイル: test_formula.py プロジェクト: pwwang/vcfstats
def test_term_run(variants):
    term = Term("FILTER", "PASS")
    assert term.run(variants[0], passed=True) == False
    assert term.run(variants[5], passed=True) == ["PASS"]

    term = Term("FILTER2")
    assert term.run(variants[5], passed=True) == False

    term = Term("GTTYPEs", None, ["0"])
    term.set_samples(variants[-1])
    assert term.run(variants[0], passed=False) == ["HOM_REF"]

    term = Term("AAF", [0.126, None])
    # .125
    assert term.run(variants[0], passed=False) == False
    assert term.run(variants[2], passed=False) == [0.25]
    term = Term("AAF", [None, 0.24])
    # .25
    assert term.run(variants[0], passed=False) == [0.125]
    assert term.run(variants[2], passed=False) == False

    term = Term("FILTER", "PASS")
    assert term.run(variants[0], passed=False) == False
    assert term.run(variants[5], passed=False) == ["PASS"]