How to get per sample read depth from VCF with no DP field
1
0
Entering edit mode
18 months ago

I have a VCF file that has no DP info only AD (allelic depth). Does anyone know of a way that I can get per sample mean read depth using only the AD filter? I want a custom script that sums the two AD values for each site. example for two individuals: GT:AD 0|1:6,5 0|0:12,0

VCF • 915 views
ADD COMMENT
0
Entering edit mode

I want a custom script that sums the two AD values for each site. example for two individual

why do you want this DP ? what's the next step ?

ADD REPLY
0
Entering edit mode

Without the DP, I can not upload this file to a specific software

ADD REPLY
0
Entering edit mode

AD = Allele Depth, is not enough to calculate depth

If you don't have DP, you need RD = Reference Depth

ADD REPLY
0
Entering edit mode
18 months ago

Using vcffilterjdk: http://lindenb.github.io/jvarkit/VcfFilterJdk.html

awk '/^#CHROM/ {printf("##FORMAT=<ID=DP,Number=1,Type=Integer,Description=\"depth\">\n");} {print}' input.vcf |\
java -jar dist/vcffilterjdk.jar -e 'return new VariantContextBuilder(variant).genotypes(variant.getGenotypes().stream().map(G->new GenotypeBuilder(G).DP(G.hasAD()?Arrays.stream(G.getAD()).sum():0).make()).collect(Collectors.toList())).make();'
ADD COMMENT

Login before adding your answer.

Traffic: 3153 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