-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvcf-resolve.py
57 lines (49 loc) · 2.53 KB
/
vcf-resolve.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
57
import sys
if __name__ == "__main__":
import argparse
import mendelian as mf
import resolve as rslv
parser = argparse.ArgumentParser(description="VCFresolve")
#parser.add_argument("echo")
parser.add_argument("-g","--genome", dest="genome_file",
help="The reference genome file in fasta format.")
parser.add_argument("-v","--vcf", dest="vcf_file",
help="The VCF file to resolve the sequences.")
parser.add_argument("-a","--mei", dest="annot_file",
help="The Repeat Annotation files.")
parser.add_argument("-o","--output", dest="output_file",
help="The output VCF file.")
parser.add_argument("--precise", action='store_true',
help="To resolve the sequences of only the precise calls. The default is to resolve all the calls.")
parser.add_argument("--resolve", action='store_true',
help="Used to find the sequences of the SVs.")
parser.add_argument("--mendelian", action='store_true',
help="This option allows you to use mendelian filter for trios. With this option, only the VCF file (-v, --vcf) and output file (-o, --output) is needed as input.")
parser.add_argument("-f","--vcf-folder", dest="vcf_folder",
help="The input VCF folder.")
parser.add_argument("--verbose", action='store_true',
help="Works in verbose mode.")
args = parser.parse_args()
#print("The arguments given are: ")
#print("Genome is",args.genome_file)
#print("VCF File is", args.vcf_file)
#print("MEI Annotation file is", args.annot_file)
#print("Output File is", args.output_file)7
vcf_new = ''
if args.vcf_folder is None:
if args.output_file is None:
output = args.vcf_file+"_v2"
vcf_new = open(output,"w")
else:
output = args.output_file
vcf_new = open(output,"w")
if args.resolve:
if args.annot_file is None or args.genome_file is None:
sys.exit('Please run with correct genome and annotation file')
else:
mei_annot_file = args.annot_file
genome = args.genome_file
rslv.resolve(genome, args.vcf_file, vcf_new, mei_annot_file, args.precise, args.vcf_folder, args.verbose)
elif args.mendelian:
print("Running mendelian filter (Make sure that your VCF has the required columns for the trio and son must be at the last column)")
mf.flt(args.vcf_file, vcf_new)