Piping Bwa And Samtools
2
3
Entering edit mode
13.7 years ago

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
bwa samtools • 6.6k views
ADD COMMENT
0
Entering edit mode

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 REPLY
0
Entering edit mode

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

ADD REPLY
2
Entering edit mode
13.7 years ago

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 COMMENT
2
Entering edit mode
12.9 years ago

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 COMMENT

Login before adding your answer.

Traffic: 2133 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