Question: Error using bwasw (bwa 0.7.15-r1140): bwtsw2_pair.c line 122: failed to allocate memory
gravatar for azaharamft
17 months ago by
azaharamft0 wrote:


I am having trouble while performing an alignment with bwasw in only a few fastqs coming from Miseq paired end targeted DNA-seq data. Reads are 300 bp long.

The command used is:

 bwa bwasw -t4 $REF $fastq_R1 $fastq_R2

And this is the error I get:

 Failed to allocate -9223372036854775618 bytes at bwtsw2_pair.c line 122

The output bam is empty. This is happening only in a subset of the whole batch of samples, and when I go to bwtsw2_pair.c line 122, the code is

seq = malloc(l_mseq + (end - beg));

I have checked fastq read number in both R1 and R2 and they are equal and insert size is smaller than 300.

I do not understand why it is working in most of the samples but not in a few which do not seem to be different from the rest.

bwa dna-seq alignment • 640 views
ADD COMMENTlink modified 1 day ago by finswimmer8.0k • written 17 months ago by azaharamft0

Is it possible that you run out of memory? Did you monitor that?

ADD REPLYlink written 17 months ago by WouterDeCoster35k

Thank you for your suggestion, but I have checked that using htop and it does not run out of memory (1G of 54G in use). The error happened both using processes and without them.

ADD REPLYlink written 17 months ago by azaharamft0

I believe that there is no benefit to using bwasw use mem instead.

ADD REPLYlink written 17 months ago by Istvan Albert ♦♦ 78k

Thanks four your appreciation, but the best approach I have made for this analysis requires bwasw because of split alignment. Alignment using mem does not fit the expected. Anyway, I will take your advice and test it with more mappers.

ADD REPLYlink written 17 months ago by azaharamft0

mem should do split alignments just as well (and superior alignments in general) - and I would say that any difference might be caused by different scoring being applied (in case you are taking the defaults). For example mem uses gapopen/gapextension of 6,6 vs the 5,2 of bwaws and so on.

Then there are quite a few other differences I think when it comes to clipping ends.

As per the author's advice mem is the recommended aligner.

ADD REPLYlink modified 17 months ago • written 17 months ago by Istvan Albert ♦♦ 78k

Hello! Thanks for your suggestions. I have tried with mem instead of sw and everything worked fine without errors, though I still do not know what was the error about with sw. Anyway, mem also gave the expected results (for some reason in my initial tests it did not give the desired results and I discarded it).

ADD REPLYlink written 17 months ago by azaharamft0
Please log in to add an answer.


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