samtools / bcftools

This is the official development repository for BCFtools. See installation instructions and other documentation here http://samtools.github.io/bcftools/howtos/install.html
http://samtools.github.io/bcftools/
Other
652 stars 240 forks source link

Bcftools consensus #1230

Open psur9757 opened 4 years ago

psur9757 commented 4 years ago
  1. BWA mem to align my genome (ref.fa) to Illumina DNA seq reads
  2. Freebayes to get variants
  3. VCFtools to filter variants only in the CDS region > cds.vcf

Now I want to use cds.vcf to generate a consensus. I only want the cds sequences. When I try cat cds.fa | bcftools consensus cds.vcf.gz > consensus.fa, it doesn't work. I get an error that the names don't match. Which makes sense.

But if I use cat ref.fa | bcftools consensus cds.vcf.gz > consensus.fa, I don't know the CDS position after variants are taken into account.

How do I get the consensus sequence for CDS only?

pd3 commented 4 years ago

When the input fasta sequence contains sequence names in the form ">chr:from-to" as opposed to the usual ">chr", the program should do the right thing and create consensus for that region. If bcftools consensus is run without parameters, the usage page does mention this feature.