Created
April 20, 2014 04:36
-
-
Save adamewing/11105144 to your computer and use it in GitHub Desktop.
Make INDELs parse as INDELs via PyVCF by removing SVTYPE field
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import vcf | |
import sys | |
''' | |
PyVCF will parse INDELs as SVs if they have SVTYPE in the INFO field. | |
This provides a quick-fix. | |
contact: adam.ewing@mater.uq.edu.au | |
''' | |
def convert(vcf_fn): | |
invcf = vcf.Reader(filename=vcf_fn) | |
outvcf = vcf.Writer(sys.stdout, invcf) | |
for rec in invcf: | |
del(rec.INFO['SVTYPE']) | |
outvcf.write_record(rec) | |
if __name__ == '__main__': | |
if len(sys.argv) == 2: | |
convert(sys.argv[1]) | |
else: | |
print "usage:",sys.argv[0],"<VCF>" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment