Extract AD thatt ' support the ALTERNATIVE ALLELE ' from VCF file
0
0
Entering edit mode
2.6 years ago
Maryem ▴ 10

Hi there, i'm trying to extract fields from VCF file using BCFTOOLS : The command :

bcftools query -f '%CHROM\t %POS\t %REF\t %ALT\t [%DP]\t [%AD]\t [%AF]\t [%MQ]\t [%GQ]\t %QUAL\t [%FS]\n' file.vcf > extract.tsv

I want to have output like this :

CHROM=1 POS=12783 REF=G ALT=A DP=19 AD=15
AF=0.5 MQ=26.6 GQ=87 QUAL=334.77 FS=0

Instead of this :

CHROM=1 POS=12783 REF=G ALT=A DP=19 AD=4,15
AF=0.5 MQ=26.6 GQ=87 QUAL=334.77 FS=0

I don't want to have the AD for reads that support the reference Can anyone help!

Or is there any command That can remove the Numbers before ',' in AD field. Thank youuu


EDIT : I just found the solution :

 bcftools query -f 'CHROM=%CHROM\t POS=%POS\t REF=%REF\t ALT=%ALT\t DP=[%DP]\t AD=[%AD**{1}**]\t AF=[%AF]\t MQ=[%MQ]\t GQ=[%GQ]\t QUAL=%QUAL\t FS=[%FS]\n' file.vcf > extract.tsv

[%AD{1}] : {1} will extract the second value and {0} The first.

AD vcf Bcftools • 504 views
ADD COMMENT

Login before adding your answer.

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