This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Could not parse a VCF file when using bcftools annotate

I am not sure If I am doing something wrong ( I don't think so based on the documentation)

I have a VCF file and I want to remove the SB flag and annotated the variants with the 4th column of my bed file. The command is this

 apptainer exec --bind /mnt:/mnt docker://mgibio/bcftools-cwl:1.12 bcftools annotate \
          -a "$ampliconscoordenatesbed" \
          -c CHROM,FROM,TO,4 \
          -h "$RunID"_"$Sample_Name".vcf \
          -x FORMAT/SB "$RunID"_"$Sample_Name".vcf > "$RunID"_"$Sample_Name"_FINAL.vcf           

With this command I get this error

 Could not parse 240430_M01875_1088_000000000-LH8PT_W2407562-002.vcf: #CHROM     POS     ID      REF     ALT     QUAL    FILTER  INFO    FORMAT  240430_M01875_1088_000000000-LH8PT_W2407562-002.bam

The VCF file come directly from Pisces and I don't see any error.

My bed file looks good too

 chr1   43349260    43349367    MPL_003_F_
 chr1   43349260    43349367    MPL_003_R_
 chr1   45331526    45331640    MUTYH_002_F_
 chr1   45331526    45331640    MUTYH_002_R_

What am I doing wrong??

bcftools

what happens when you change the sample name from 240430_M01875_1088_000000000-LH8PT_W2407562-002.bam to sample1?

1 answer

Thank you for your question. It was me and the bad documentation of the programs. I make it run with this lines

apptainer exec --bind /mnt:/mnt docker://mgibio/bcftools-cwl:1.12 bcftools annotate \
         -x FORMAT/SB "$RunID"_"$Sample_Name".vcf > "$RunID"_"$Sample_Name"_withoutSB.vcf
rm "$RunID"_"$Sample_Name".vcf

apptainer exec --bind /mnt:/mnt docker://mgibio/bcftools-cwl:1.12 bcftools annotate \
        -a "$ampliconscoordenatesbed" \
        -c CHROM,FROM,TO,AMPLICON \
        -h <(echo '##INFO=<ID=AMPLICON,Number=1,Type=String,Description="Amplicon name">') \
        "$RunID"_"$Sample_Name"_withoutSB.vcf > "$RunID"_"$Sample_Name"_withoutSB_AmpliconNameAdded.vcf

I found part of the solution here Addin gene information to VCF file

bad documentation of the programs

Nope, the documentation is quite clear. -c clearly states that you need header lines if you are using a non VCF annotation file. You need not split the removal and addition into two commands, all you need to do is add the header line in your original code.

Log in to answer this question.