This is a test version of Biostars. For the public version, visit https://www.biostars.org.
vcf-consensus Error: Fasta sequence does not match REF

I'm using this series of commands to get consensus sequences:

samtools mpileup -vf seqs.fa aligned.bam > vcf.gz
tabix -p vcf -f vcf.gz
cat seqs.fa | vcf-consensus vcf.gz > consensus.fa

(I was trying to do this using bcftools/vcfutils.pl but was having a different problem I've finally given up on)

I'm getting this error:

The fasta sequence does not match the REF at XLOC_000009.TCONS_00000016:733. G(GTTATA) in .fa, C in .vcf, frz=0

but if I check the fasta sequence using samtools faidx, it gives the C that's expected:

$ samtools faidx seqs.fa XLOC_000009.TCONS_00000016:733
>XLOC_000009.TCONS_00000016:733
C

These warnings from before the error might be relevant?

The version "4.2" not supported, assuming VCFv4.1
Note: Conflicting variants at (or near) XLOC_000009.TCONS_00000016:725, cannot apply both.

Does anyone know why I'm getting this error and how to fix it?

Edit:

The line in the vcf at this location is:

XLOC_000009.TCONS_00000016      733     .       C       <*>     0       .       DP=14;I16=0,8,0,0,222,6594,0,0,336,14112,0,0,0,0,0,0;QS=1,0;MQ0F=0      PL      0,24,128

I noticed it's the last line/position for that sequence.

rna-seq vcf samtools software error

1 answer

Can you please print the vcf line at the position ? Conflicting variants would mean it is a heterozygous genotype and it does not know which allele to put in the fasta.

I've added the vcf line to my post.

Hi microfuge, I am getting the same error and I mapping reads from several genotypes to one heterozygous reference and was hoping to get the consensus files for each genotype. Does this error mean it is not possible to get the consensus for each genotype individually?

Log in to answer this question.