-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathautomate_snpeff.py
38 lines (24 loc) · 1.11 KB
/
automate_snpeff.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
# Get a filename as an input
# Run snpeff
import sys
import os
import subprocess
from ToolConfig import snpeff_jar, snpeff_config_file
import logging
def run_snpeff(target_folder, target_vcf):
outfile_name = target_vcf[:-4]
snpeff_input = target_folder + target_vcf
snpeff_output = target_folder + outfile_name + ".snpeff.vcf"
annotate_cmd = """java -Xmx2g -jar %s hg19 -t -hgvs -c %s -v %s > %s""" % (snpeff_jar, snpeff_config_file, snpeff_input, snpeff_output)
logging.debug( annotate_cmd )
result = subprocess.call(annotate_cmd, shell=True, stdout = open("log_out.txt", "wa"), stderr = open("log_err.txt", "wa"))
if result > 0:
logging.critical( annotate_cmd )
logging.critical( "Annovar failed. Is this a working command?" )
sys.exit()
return snpeff_output
##############################################################################################
if __name__ == '__main__':
target_folder = os.getcwd() + "/"
target_vcf = sys.argv[1]
run_snpeff(target_folder, target_vcf)