Pulling out “alts” from a multisample vcf by sample ID – bcftools syntax question
Dear Biostars,
I have a multisample vcf. I would like a to turn this into a per sample “alts” file as below.
The desired outcome would be :
chr10:12342:A:T SAMPLEID1:0/1 SAMPLEID2:1/1 ...
chr10:432234:G:C SAMPLEID4:0/1 SAMPLEID7:1/1 ...
I have tried :
bcftools query -f "%CHROM:%POS:%REF:%ALTn[%SAMPLE:%GTt]' i- 'GT="alt"' input.vcf
which gives me:
chr10:12342:A:T SAMPLEID1:0/1 SAMPLEID2:1/1 chr10:432234:G:C
SAMPLEID4:0/1 SAMPLEID7:1/1 ...
or
bcftools query -f "%CHROM:%POS:%REF:%ALTt[%SAMPLE:%GTn'] i- 'GT="alt"' input.vcf
chr10:12342:A:T SAMPLEID1:0/1
SAMPLEID2:1/1
chr10:432234:G:C SAMPLEID4:0/1
SAMPLEID7:1/1
or
bcftools query -f "%CHROM:%POS:%REF:%ALTt[%SAMPLE:%GTt'] i- 'GT="alt"' input.vcf
chr10:12342:A:T SAMPLEID1:0/1 SAMPLEID2:1/1 chr10:432234:G:C SAMPLEID4:0/1 SAMPLEID7:1/1
I can’t quite get my head around the correct syntax and sure there is an easy fix! Your help would be much appreciated.
All the best
• 28 views
Read more here: Source link