This is a test version of Biostars. For the public version, visit https://www.biostars.org.
bcftools FORMAT/FOO annotation to specific sample in multiple sample VCF

Hi,

I wonder what do we have to modify in this command "bcftools annotate -a annots.tsv.gz -h annots.hdr -c CHROM,FROM,TO,FMT/FOO,BAR in.vcf" if we want to annotate FMT/FOO to SAMPLE2 (let's say the in.vcf has two samples) but not to SAMPLE1.

I did like this "bcftools annotate -s SAMPLE2 -a annots.tsv.gz -h annots.hdr -c CHROM,FROM,TO,FMT/FOO,BAR in.vcf" but it again annotated FMT/FOO to SAMPLE1 instead of SAMPLE2.

KR, Rajendra

next-gen

Hi @Pierre Lindenbaum,

I think these steps [A-E] will help to illustrate more. (SAMPLE2 that has to be annotated with "FooValue1" and "FooValue2", see in bold)

A].

zcat annots.tsv.gz
1   752567  752567  FooValue1   12345
1   752722  752722  FooValue2   67890

B].

zcat annots.hdr
##FORMAT=<ID=FOO,Number=1,Type=String,Description="Some description">
##INFO=<ID=BAR,Number=1,Type=Integer,Description="Some description">

C].

cat in.vcf
#fileformat=VCFv4.1
##contig=<ID=1,length=249250621,assembly=b37>
#CHROM  POS ID  REF ALT QUAL    FILTER  INFO    FORMAT  SAMPLE1 SAMPLE2
1   752567  .   A   C   .   .   BAR=12345   FOO .   .
1   752722  .   G   A   .   .   BAR=67890   FOO .   .

D]. command:

bcftools annotate -s SAMPLE2 -a annots.tsv.gz -h annots.hdr -c CHROM,FROM,TO,FMT/FOO,BAR in.vcf>in_annoted.vcf

E].

cat in_annoted.vcf
##fileformat=VCFv4.1
##contig=<ID=1,length=249250621,assembly=b37>
##FORMAT=<ID=FOO,Number=1,Type=String,Description="Some description">
##INFO=<ID=BAR,Number=1,Type=Integer,Description="Some description">
##bcftools_annotateVersion=1.8+htslib-1.8
##bcftools_annotateCommand=annotate -s SAMPLE2 -a annots.tsv.gz -h annots.hdr -c CHROM,FROM,TO,FMT/FOO,BAR in.vcf; Date=Thu Jun 14 20:17:43 2018
#CHROM  POS ID  REF ALT QUAL    FILTER  INFO    FORMAT  SAMPLE1 SAMPLE2
1   752567  .   A   C   .   .   BAR=12345   FOO .   FooValue1
1   752722  .   G   A   .   .   BAR=67890   FOO .   FooValue2

Thanx,

Hello ShahiRB ,

Please use the formatting bar (especially the code option) to present your post better. I've done it for you this time.
code_formatting

Thank you!

is "E" here (in_annoted.vcf) the expected output, or the output currently given by the program?

Its expected output and if you run the latest bcftools you will get the output in that format.

1 answer

Developer/s told me (https://github.com/samtools/bcftools/issues/998) that the bug mentioned above is fixed in the latest version.

Log in to answer this question.