Question: Fill a VCF record field that is partially annotated
0
gravatar for joangibert14
8 days ago by
joangibert140 wrote:

I have a VCF like:

chr1    65310489    .   T   C   3483.8  PASS AF=0.476857;AO=441;DP=931;FAO=443;FDP=929;FDVR=5 [...] AF_gnomAD=0.353 [...]

chr1    65310518    .  A    T 96.8  PASS AF=0.00107066;AO=1;DP=934;FAO=1;FDP=934;FDVR=10 [...]

...

Where I added an extra field with the AF using the gnomAD database and vcfanno (https://github.com/brentp/vcfanno). This package adds the AF of the coincident coordinates to the vcf but it does not include any field into the ones that do not appear in gnomAD (I know some of this variant will be false positives in the postprocessing).

I would like to add a field in the records that are not annotated something like "AF_gnomAD=0" (or a very low number).

Any suggestions? Thanks!

snp gnomad vcfanno vcf • 77 views
ADD COMMENTlink modified 8 days ago by Pierre Lindenbaum108k • written 8 days ago by joangibert140
1
gravatar for Pierre Lindenbaum
8 days ago by
France/Nantes/Institut du Thorax - INSERM UMR1087
Pierre Lindenbaum108k wrote:

assuming there is only one ALT allele:

awk -F '\t' '/^#/ {print; next} ($8 ~ /AF_gnomAD=/) {print;next;} {OFS="\t"; $8=sprintf("%s;AF_gnomAD=0",$8);print;}' input.vcf
ADD COMMENTlink written 8 days ago by Pierre Lindenbaum108k

It works great! Thanks! Also, if there is more than one ALT allele and they are separated with commas (,) there is no problem with this command :)

ADD REPLYlink modified 8 days ago • written 8 days ago by joangibert140

Also, if there is more than one ALT allele and they are separated with commas (,) there is no problem with this command

yes but an AF tag should have the same number of values than the number of ALT alleles (one frequency for each allele)

ADD REPLYlink written 8 days ago by Pierre Lindenbaum108k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1317 users visited in the last hour