Remove Single Info Field From Vcf
What's the quickest way to remove a single INFO field from a VCF file? Don't care what framework - vcftools, pyvcf, whatever. Just want a one liner to do this.
In this case, I just want to remove the ensembl CSQ field so I can annotate again
• 8,568 views
•
link
3 answers
The below python function takes a vcf line (non-header) and will return a line without CSQ field. Good luck~
def removeCSQ(line):
values = line.split()
INFO = values[7]
NEWINFO = []
for info in INFO.split(";"):
if not "CSQ=" in info:
NEWINFO.append(info)
values[7] = ";".join(NEWINFO)
return "\t".join(values)
• 305 views
•
link
Use vt package
vt rminfo in.vcf -t CSQ -o out.vcf
• 0 views
•
link
Log in to answer this question.