This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Vcf-Consensus To Generate Consensus File

I have a VCF file and a reference fasta file, and am trying to create a consensus sequence using vcf-consensus.

First I create a tabix file, and then I run

cat NC_002516.2.fa | vcf-consensus 1_e5_d30.vcf.gz > out.fa

and I get an error

The fasta sequence does not match the REF at NC_002516.2:837550. G() in .fa, GT in .vcf at /group/RDI/gatk/vcftools/vcftools_0.1.9/perl/vcf-consensus line 18 main::error('The fasta sequence does not match the REF at NC_002516.2:8375...') called at /group/RDI/gatk/vcftools/vcftools_0.1.9/perl/vcf-consensus line 129 main::apply_variant('HASH(0x13a8b2a0)', 'ARRAY(0x13e1ac70)') called at /group/RDI/gatk/vcftools/vcftools_0.1.9/perl/vcf-consensus line 87 main::do_consensus('HASH(0x13a8b2a0)') called at /group/RDI/gatk/vcftools/vcftools_0.1.9/perl/vcf-consensus line 9

Has anyone else encountered this? Looking at the VCF file for location 837550,

NC_002516.2 521975 . AC A 3149.48 PASS AC=2;AF=1.00;AN=2;DP=79;FS=0.000;HRun=1;HaplotypeScore=315.8867;MQ=59.23;MQ0=0;QD=39.87;SB=-1477.05 GT:AD:DP:GQ:PL 1/1:1,78:79:99:3192,238,0 NC_002516.2 574043 . A AGGG 5241.60 PASS AC=2;AF=1.00;AN=2;DP=78;FS=0.000;HRun=1;HaplotypeScore=335.5748;MQ=42.53;MQ0=0;QD=67.20;SB=-2258.53 GT:AD:DP:GQ:PL 1/1:14,63:78:99:5242,235,0 NC_002516.2 675693 . G A 1670.23 PASS AC=2;AF=1.00;AN=2;DP=69;Dels=0.00;FS=0.000;HRun=0;HaplotypeScore=16.7733;MQ=57.48;MQ0=0;QD=24.21;SB=-839.28 GT:AD:DP:GQ:PL 1/1:0,69:69:99:1703,207,0 AC=2;AF=1.00;AN=2;DP=82;Dels=0.00;FS=0.000;HRun=1;HaplotypeScore=10.8533;MQ=59.44;MQ0=0;QD=24.28;SB=-814.59 GT:AD:DP:GQ:PL 1/1:0,82:82:99:2024,246,0 NC_002516.2 837550 . GT G 2892.26 PASS AC=2;AF=1.00;AN=2;DP=72;FS=0.000;HRun=1;HaplotypeScore=278.7822;MQ=59.96;MQ0=0;QD=40.17;SB=-1333.27 GT:AD:DP:GQ:PL 1/1:0

837550 is an indel. The thing is, there have been indels before, so that does not look to be the problem. Thanks

vcf consensus next-gen

are your sure the assembly version your vcf file is based on and the assembly version of your fasta file are the same

2 answers

Yes I am...I looked in the code, and it seems that it was a QC check that it was failing it. So I commented it. But not sure if that is a good thing.

I got the same error of The fasta sequence does not match the REF, and fixed this problem with dos2unix command

dos2unix NC_002516.2.fa
cat NC_002516.2.fa | vcf-consensus 1_e5_d30.vcf.gz > out.fa

Log in to answer this question.