On Mar 18, 2015, at 15:42 , Thomas Sibley <trsib...@uw.edu> wrote: > Hi, > > I've scoured the docs and questions on the web, but I can't seem to find a > way to use samtools + bcftools to generate one consensus sequence per sample > (as defined in the RG-SM tag). All samples share the same reference. Though > there is mention of mpileup grouping by sample, it doesn't seem to end up > being used by `bcftools call -c` since that produces only a single sequence > for me. Would bcftools consensus from version 1.2 fare better? Do I need to > write my own tool to do this? > > My end goal is a FastQ with one consensus sequence per sample.
I've found one solution, but it's sub-optimal and more overhead than I'd like: samtools mpileup -gf ref bam > pileup samtools view -H bam | grep @RG | grep -oP '(?<=SM:)\S+' > samples parallel 'bcftools call -c -s "{}" < pileup | vcfutils.pl vcf2fq > {}.fq' :::: tags cat *.fq > all-samples.fq I wish bcftools could multiplex on samples for me! Does anyone have a better solution, or is this the best? ------------------------------------------------------------------------------ Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Samtools-help mailing list Samtools-help@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/samtools-help