comparison filter_vcf.py @ 0:834a312c0114 draft

Uploaded
author ulfschaefer
date Thu, 10 Dec 2015 09:22:39 -0500
parents
children cd59be4a7fe3
comparison
equal deleted inserted replaced
-1:000000000000 0:834a312c0114
1 #!/usr/bin/env python
2 '''Simple VCF parser using custom filters.
3
4 Created on 6 Oct 2015
5
6 @author: alex
7 '''
8 import argparse
9
10 from phe.variant import VariantSet
11
12
13 def get_args():
14
15 args = argparse.ArgumentParser()
16
17 args.add_argument("--vcf", "-v", required=True, help="VCF file to (re)filter.")
18 args.add_argument("--filters", "-f", required=True, help="Filter(s) to apply as key:threshold pairs, separated by comma.")
19 args.add_argument("--output", "-o", required=True, help="Location for filtered VCF to be written.")
20
21 return args.parse_args()
22
23
24 def main():
25 args = get_args()
26
27 var_set = VariantSet(args.vcf, filters=args.filters)
28
29 var_set.filter_variants()
30
31 var_set.serialise(args.output)
32
33 if __name__ == '__main__':
34 exit(main())