-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtest_pyhive_runBCFTools_VC.py
56 lines (45 loc) · 2.12 KB
/
test_pyhive_runBCFTools_VC.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import os
import subprocess
import glob
import pytest
# test_pyhive_runBCFTools_VC.py
def test_runBCFTools_VC(bcftools_folder, hive_dir, datadir, clean_tmp):
"""
Test function to run BCFTools mpileup|call on a BAM file
"""
bam_file = "{0}/exampleBAM.bam".format(datadir)
reference = "{0}/exampleFASTA.fasta".format(datadir)
work_dir = "{0}/outdir/".format(datadir)
annots = "\"['DP','SP','AD']\""
command = "perl {0}/scripts/standaloneJob.pl PyHive.VariantCalling.BCFTools_caller -language python3 \
-outprefix {1} -work_dir {2} -chunk {3} -bam {4} -reference {5} \
-bcftools_folder {6} -annots {7} -verbose True".format(hive_dir, 'out', work_dir,
"\"['chr1','10000','30000']\"", bam_file,
reference, bcftools_folder, annots)
try:
subprocess.check_output(command, shell=True)
assert True
except subprocess.CalledProcessError as exc:
assert False
raise Exception(exc.output)
def test_runBCFTools_VC_woptions(bcftools_folder, hive_dir, datadir, clean_tmp):
"""
Test function to run BCFTools mpileup|call on a BAM file
using some options and arguments
"""
bam_file = "{0}/exampleBAM.bam".format(datadir)
reference = "{0}/exampleFASTA.fasta".format(datadir)
work_dir = "{0}/outdir/".format(datadir)
annots = "\"['DP','SP','AD']\""
command = "perl {0}/scripts/standaloneJob.pl PyHive.VariantCalling.BCFTools_caller -language python3 \
-outprefix {1} -work_dir {2} -chunk {3} -bam {4} -reference {5} \
-bcftools_folder {6} -annots {7} -E 1 -p 1 -m_pileup 3 -m_call 1 -v 1 " \
"-F 0.05 -C 25 -verbose True".format(hive_dir, 'out', work_dir,
"\"['chr1','10000','30000']\"", bam_file,
reference, bcftools_folder, annots)
try:
subprocess.check_output(command, shell=True)
assert True
except subprocess.CalledProcessError as exc:
assert False
raise Exception(exc.output)