Filtering Vcf Files
1
0
Entering edit mode
10.8 years ago
rickyflintoff ▴ 100

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?

• 1.8k views
ADD COMMENT
2
Entering edit mode
10.8 years ago

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
ADD COMMENT

Login before adding your answer.

Traffic: 2108 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6