Question: bwa-mem: [bam_sort_core] merging from 0 files and 3 in-memory blocks
0
gravatar for CaffeSospeso
5 months ago by
CaffeSospeso0 wrote:

Hello,

I'm running bwa mem on paired-end single digested RAD-seq data. I'm using the following command:

bwa mem -t $threads -M $genome $input1 $input2 | samtools view -b -@ $threads | samtools sort -@ $threads -m 7G > ${output}.bam

with threads=3 and input 1 and 2, corresponding to the single-end and paired-end reads, respectively.

In the .log files I get at the end this message:

main] Real time: 178.000 sec; CPU: 359.533 sec
[bam_sort_core] merging from 0 files and 3 in-memory blocks...

It is to be considered an error? What does it mean exactly? could be that I have some problem with memory and I have to increase it?

bwa • 433 views
ADD COMMENTlink modified 5 months ago by WouterDeCoster37k • written 5 months ago by CaffeSospeso0
1

input 1 and 2, corresponding to the single-end and paired-end reads

If input1 are the single-end reads, and input2 are the paired-end reads in an interleaved file, BWA will incorrectly interpret the pairing and produce wrong results. If you want to mix single- and paired-end reads in the same run, you have to append the single-end reads at the end of the forward (or R1) file from the paired-end reads.

ADD REPLYlink modified 5 months ago • written 5 months ago by h.mon23k

Do you mean that I should do something like that ?

cat $input1 > sampleA.fq.gz
cat $input2 >> sampleA.fq.gz

bwa mem -t $threads -M $genome sampleA.fq.gz
ADD REPLYlink written 5 months ago by CaffeSospeso0

No. However, my initial suggestion is wrong, I think I may have mixed bbmap (or some other program) and bwa methods for handling a mix of paired- and single-end reads.

For bwa, you have to interleave the forward and reverse paired-end reads, append the single end to this file, and use the -p flag. Suppose the paired-end reads are in the files R1.fastq and R2.fastq, and the single-end reads are in the file single.fastq, you need to:

reformat.sh in1=R1.fastq in2=R2.fastq out=interleaved.fastq
cat interleaved.fastq single.fastq > concat.fastq
bwa mem -t $threads -p -M $genome concat.fastq > mapping.sam
ADD REPLYlink written 5 months ago by h.mon23k
4
gravatar for WouterDeCoster
5 months ago by
Belgium
WouterDeCoster37k wrote:

It's not an error, a normal message from samtools sort. For sorting it stores reads either in memory or in temporary files, and that's what you are informed about.

Note that you (with a reasonably recent samtools) can also pipe directly to samtools sort, specifying the output with -o

bwa mem -t $threads -M $genome $input1 $input2 | samtools sort -@ $threads -m 7G -o ${output}.bam
ADD COMMENTlink modified 5 months ago • written 5 months ago by WouterDeCoster37k
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: 831 users visited in the last hour