コード例 #1
0
def test_tajima():
    with Capturing() as out:
        tajima.main([
            "tajima", "--no-header", "100000", "1000", "test_data/test.vcf.gz"
        ])
    assert out[0] == 'I\t6000\t106000\t2\t1\t-0.740993868265'
    assert out[-1] == 'X\t17567000\t17667000\t2\t1\t-0.740993868265'
コード例 #2
0
def test_sanger():
    if not os.path.exists(os.path.expanduser("~/.genome/WBcel235/WBcel235.fa.gz")):
        genome.main(["genome","ncbi","--ref=WBcel235"])
    with Capturing() as out:
        primer.main(["primer", "sanger", "--ref=WBcel235","--region=I:542216-543215", "test_data/test.vcf.gz"])
    
    t = eval(str(out))[1].split("\t")[8:10]
    assert t == ['GAGAAGGACGGGACCCTTTG', 'aGGCCAGAACCTCGTGAAAC']
コード例 #3
0
def test_template():
    if not os.path.exists(os.path.expanduser("~/.genome/WBcel235/WBcel235.fa.gz")):
        genome.main(["genome","ncbi","--ref=WBcel235"])
    with Capturing() as out:
        primer.main(["primer", "template", "--size=500", "--ref=WBcel235","--region=I:1-100000", "test_data/test.vcf.gz"])
    
    t = eval(str(out))[1].split("\t")[6][0:20]
    assert t == "ATTTCCCTCTCCGGGAAATG"
コード例 #4
0
def test_snip():
    if not os.path.exists(os.path.expanduser("~/.genome/WBcel235/WBcel235.fa.gz")):
        genome.main(["genome","ncbi","--ref=WBcel235"])
    with Capturing() as out:
        primer.main(["primer", "snip", "--size=500", "--ref=WBcel235","--region=I:542216-543215", "test_data/test.vcf.gz"])
    
    t = eval(str(out))[1].split("\t")[7:9]
    assert t == ['496:496,184', '429,496:429,67,184']
コード例 #5
0
ファイル: test_tajima.py プロジェクト: quanrd/VCF-kit
def test_compare_vcftools():
    """
        Compare the Tajima's D Calculation with vcftools output.
    """
    comm = ["vcftools", "--TajimaD", "100000", "--gzvcf", "test_data/test.vcf.gz"]
    out, err = Popen(comm, stdout=PIPE, stderr=PIPE).communicate()
    vcftools_tajima = open("out.Tajima.D", 'r').read().splitlines()
    vcftools_tajima = [x.split("\t")[0:4] for x in vcftools_tajima]
    with Capturing() as out:
        tajima.main(["tajima","--no-header","100000", "100000", "test_data/test.vcf.gz"])
    vcftools_tajima = dict([(x[0] + ":" + x[1], autoconvert(x[3])) for x in vcftools_tajima if x[3] != "nan"])
    out = [x.split("\t") for x in out]
    vcfkit_tajima = dict([(x[0] + ":" + x[1], autoconvert(x[5])) for x in out])
    for k in list(vcfkit_tajima.keys()):
        assert nearly_equal(vcftools_tajima[k], vcfkit_tajima[k], sig_fig = 3) is True
コード例 #6
0
def test_call_DL238():
    if not os.path.exists(
            os.path.expanduser("~/.genome/WBcel235/WBcel235.fa.gz")):
        genome.main(["genome", "ncbi", "--ref=WBcel235"])
    with Capturing() as out:
        call.main([
            "call", "test_data/DL238.ab1", "--ref=WBcel235", "--vcf-sites",
            "test_data/DL238.vcf.gz"
        ])
    out = eval(str(out))
    assert len(out) == 5
    out = out[1].split("\t")
    assert out[0] == "X"
    assert int(out[1]) == 14557228
    assert out[2] == out[3]
    assert out[5] == out[6]
    assert out[9] == "TN"
コード例 #7
0
ファイル: test_calc.py プロジェクト: quanrd/VCF-kit
def test_sample_hom_gt():
    with Capturing() as out:
        calc.main(["calc", "sample_hom_gt", "test_data/test.vcf.gz"])
    assert out[0] == 'sample\tfreq_of_gt\tn_gt_at_freq'
    assert out[10] == 'AB1\t10\t8'
コード例 #8
0
ファイル: test_tajima.py プロジェクト: quanrd/VCF-kit
def test_tajima():
    with Capturing() as out:
        tajima.main(["tajima","--no-header","100000", "1000", "test_data/test.vcf.gz"])
    assert round(float(out[0].split("\t")[5]), 3) == -0.741
コード例 #9
0
ファイル: test_calc.py プロジェクト: quanrd/VCF-kit
def test_spectrum_genotypes_frequency():
    with Capturing() as out:
        calc.main(["calc", "genotypes", "test_data/test.vcf.gz"])
    assert out[-1] == '1\t0\t0\t12\t2'
コード例 #10
0
ファイル: test_calc.py プロジェクト: quanrd/VCF-kit
def test_spectrum_alleles_count():
    with Capturing() as out:
        calc.main(["calc", "spectrum", "test_data/test.vcf.gz"])
    assert round(float(out[-2].split("\t")[1]), 5) == 0.03571
コード例 #11
0
def test_phylo_upgma():
    with Capturing() as out:
        comm = ["phylo", "tree", "upgma", "test_data/test.vcf.gz"]
        phylo.main(comm)
    h = hashlib.sha224(str(out)).hexdigest()
    assert h == "e3ef017c77bca5fd3feef7ed6215a37a5f0bb41101c125b3e493049e"
コード例 #12
0
ファイル: test_calc.py プロジェクト: quanrd/VCF-kit
def test_spectrum_genotypes_count():
    with Capturing() as out:
        calc.main(["calc", "genotypes", "test_data/test.vcf.gz"])
    assert out[0] == 'n\tref\thet\talt\tmis'
    assert out[-1] == '1\t0\t0\t12\t2'
コード例 #13
0
ファイル: test_phylo.py プロジェクト: snashraf/VCF-kit
def test_phylo_nj():
    with Capturing() as out:
        phylo.main(["phylo", "tree", "nj", "data/test.vcf.gz"])
    h = hashlib.sha224(str(out)).hexdigest()
    assert h == "6c21e0508729c604d403a29cb40dca810455009fec793a9a99da9927"
コード例 #14
0
def test_phylo_fasta():
    with Capturing() as out:
        phylo.main(["phylo", "fasta", "test_data/test.vcf.gz"])
    h = hashlib.sha224(str(out)).hexdigest()
    assert h == "81eda4b80e96eed31749e0a28d1acbd345fcd216023d17735978e999"
コード例 #15
0
ファイル: test_cli.py プロジェクト: Squarles2007/podracer
def test_vars():
    with Capturing() as out:
        result = command.main(['--flag'])
    assert True
コード例 #16
0
def test_phylo_nj():
    with Capturing() as out:
        phylo.main(["phylo", "tree", "nj", "test_data/test.vcf.gz"])
    h = hashlib.sha224(str(out)).hexdigest()
    assert h == "96cdd2d7221bcbea8d86e099fdc1af02594d9dcad4daf8a5f85d0557"
コード例 #17
0
def test_phylo_fasta():
    with Capturing() as out:
        phylo.main(["phylo", "fasta", "test_data/test.vcf.gz"])
    last_line = out[-1]
    assert 2958 == len(last_line)
    assert last_line.startswith("AANNCTC")
コード例 #18
0
def test_phylo_upgma():
    with Capturing() as out:
        phylo.main(["phylo", "tree", "upgma", "test_data/test.vcf.gz"])
    line = out[25]
    assert line.startswith("RC301:0.085")
コード例 #19
0
def test_phylo_nj():
    with Capturing() as out:
        phylo.main(["phylo", "tree", "nj", "test_data/test.vcf.gz"])
    line = out[24]
    assert line.startswith("DL200:0.1324")
コード例 #20
0
ファイル: test_phylo.py プロジェクト: snashraf/VCF-kit
def test_phylo_fasta():
    with Capturing() as out:
        phylo.main(["phylo", "fasta", "data/test.vcf.gz"])
    h = hashlib.sha224(str(out)).hexdigest()
    assert h == "610ba5d2b533d730b6e9fb3005453d3d94710c9021fa5ca46fb5d7d8"
コード例 #21
0
ファイル: test_phylo.py プロジェクト: snashraf/VCF-kit
def test_phylo_upgma():
    with Capturing() as out:
        comm = ["phylo", "tree", "upgma", "data/test.vcf.gz"]
        phylo.main(comm)
    h = hashlib.sha224(str(out)).hexdigest()
    assert h == "cd58f6912c40715ef5b2b1d8a381743454eb42cc6d0ba8a6c847ea83"
コード例 #22
0
ファイル: test_cli.py プロジェクト: Squarles2007/podracer
def test_square():
    with Capturing() as out:
        result = command.main(['--square', '20'])
    assert int(out[0]) == 400
コード例 #23
0
ファイル: test_calc.py プロジェクト: snashraf/VCF-kit
def test_spectrum_alleles_count():
    with Capturing() as out:
        calc.main(["calc", "spectrum", "data/test.vcf.gz"])
    assert out[-2] == '23\t0.0357142857143'