Filtering Vcf Files
I am trying to subset a VCF file by a tag in INFO column. The tag is a triplet and I want to threshold by one of the values in the triplet. For example, for a given record, my triplet would be ABC=1,2,3 and I would like to decide whether it should be in my set or not by ABC[1] > 23. How can I accomplish this?
• 2,093 views
•
link
1 answer
you could use the following awk script:
/^#/ { print; next;}
/^[^#]/ {
n=split($8,a,/;/);
p=1;
for(i=1;i<=n;++i)
{
m=split(a[i],b,/=/);
if(m<2 || b[1]!="ABC") continue;
split(b[2],c,/,/);
if(int(c[2])>23) {p=0;}
break;
}
if(p) print;
}
usage:
awk -f filter.awk < input.vcf > output.vcf
• 80 views
•
link
Log in to answer this question.