Generating a multi fasta consensus bcftools v1.7
2
0
Entering edit mode
6.1 years ago
skbrimer ▴ 740

Hello hive mind,

I work with segmented virus and normally I uses freebayes to make the vcf file, bgzip and tabix to compress and index and then the standard cat ref.fa | bcftools consensus vcf.file > cns.fa to make a consensus. This has worked for years, but now after upgrading to 1.7 from 1.3 this no longer seems to work.

My ref.fa file has 10 individual segments in it and the expected output would be a cns.fa file with 10 individual segments, with variant calls however I am only receiving the last segment now.

I have also tried using bcftools consensus -f ref.fa -o cns.fa vcf and this gives the same answer as before, just one segment.

I can write a script to loop through all the regions if I need to, but I wanted to see if someone here had a solution that just uses the tools as is.

Thanks,
Sean

samtools bcftools • 3.0k views
ADD COMMENT
0
Entering edit mode

May be worth reporting on the bcftools GitHub issues site.

ADD REPLY
0
Entering edit mode

And submitted. I will post their response as well.

ADD REPLY
2
Entering edit mode
6.1 years ago
skbrimer ▴ 740

appearenty the fasta file I was using had extra lines in it, although I thought I was taking care of that, but the bcftools team pointed it out and it did fix the issue that also said I could do this: cat ref.fasta | grep -v ^$ | bcftools consensus vcf.file and that would eliminate any potental lines in the future.

here is the link to the issue on github for anyone in the future https://github.com/samtools/bcftools/issues/752#issuecomment-372339708

ADD COMMENT
1
Entering edit mode
6.1 years ago
skbrimer ▴ 740

So far, I haven't gotten an answer from the bcftools team on github but I did get two workarounds to work, the first one was to just call each segment as a region and append the cns file, which works however it is not quick. The second solution was to use vcftools with the vcf-consensus command like this cat ref.fa | vcf-consensus vcf.filtered.gz > cns.fa which I compared to the previous slow way and got the same answer so its a viable solution just need to remember the command and update some scripts. If I get an answer from the bcftools team I will post it here as well just to make a more complete answer, however the vcftools solution is completely viable.

ADD COMMENT

Login before adding your answer.

Traffic: 1984 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6