Question: Generating a multi fasta consensus bcftools v1.7
0
gravatar for skbrimer
24 months ago by
skbrimer610
United States
skbrimer610 wrote:

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

ADD COMMENTlink modified 23 months ago • written 24 months ago by skbrimer610

May be worth reporting on the bcftools GitHub issues site.

ADD REPLYlink written 24 months ago by genomax78k

And submitted. I will post their response as well.

ADD REPLYlink written 24 months ago by skbrimer610
1
gravatar for skbrimer
24 months ago by
skbrimer610
United States
skbrimer610 wrote:

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 COMMENTlink written 24 months ago by skbrimer610
1
gravatar for skbrimer
23 months ago by
skbrimer610
United States
skbrimer610 wrote:

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 COMMENTlink written 23 months ago by skbrimer610
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1507 users visited in the last hour