Question: Piping Bwa And Samtools
3
gravatar for 2184687-1231-83-
10.6 years ago by
2184687-1231-83-5.0k wrote:

Hi,

Can someone tell me how to pipe bwa and samtools to get to a pileup2fq from a "bwa sampe"? I am trying this but it uses a humongous amount of memory and doesn't produce any results past sampe:

~/src/bwa/latest/bwa-0.5.7/bwa sampe collapsed.fasta.gz collapsed.aln_sa1.sai collapsed.aln_sa2.sai *_?_1_pf.fastq *_2_pf.fastq |\
~/src/samtools/latest/samtools/samtools view -bt collapsed.fasta.gz - |\
 ~/src/samtools/latest/samtools/samtools sort -m 9000000 - - |\
 ~/src/samtools/latest/samtools/samtools pileup -cf collapsed.fasta.gz - |\
 perl ~/src/samtools/latest/samtools/misc/samtools.pl pileup2fq -D1 |\
 gzip > collapsed.final.fastq.gz
samtools bwa • 5.2k views
ADD COMMENTlink modified 10.6 years ago by Pablo Marin-Garcia1.8k • written 10.6 years ago by 2184687-1231-83-5.0k

I would be a little cautious about using wildcards with BWA. I tried that once and it took the first file and ignored the rest.

ADD REPLYlink written 10.6 years ago by Jeremy Leipzig19k

nice pipeline. It's a good summary of the bwa/pileup workflow.

ADD REPLYlink written 10.6 years ago by Pierre Lindenbaum134k
2
gravatar for Istvan Albert
10.6 years ago by
Istvan Albert ♦♦ 86k
University Park, USA
Istvan Albert ♦♦ 86k wrote:

When you pipe the programs all of them consume memory at the same time. Probably your best solution is to direct the output into temporary files.

ADD COMMENTlink written 10.6 years ago by Istvan Albert ♦♦ 86k
2
gravatar for Pablo Marin-Garcia
9.7 years ago by
Spain
Pablo Marin-Garcia1.8k wrote:

Not answering your qustion but.. Is it really a good idea to pipe to samtools sort from bwa?

Sorting is very memory expensive and as a general rule if the previous step is taking long time to finish and produce big quantity of data you end having the program doing the sort waiting for long time sitting idle and consuming a lot of memory, and if you are working in parallel in a multi-core machine, usually memory is the bottleneck. Would it be this the case of bwa | samtools sort? or they behave differently?

ADD COMMENTlink written 9.7 years ago by Pablo Marin-Garcia1.8k
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: 1673 users visited in the last hour
_