Question: Bwa Sampe Segmentation Fault
2
gravatar for a11msp
7.4 years ago by
a11msp110
European Union
a11msp110 wrote:

Hi everyone,

I'm running bwa in the sampe mode and, after successfully processing >10M reads it fails with a segmentation fault (as follows) on what appears like a set of poorly-alignable reads. Any suggestions on what can be done to overcome this problem would be much appreciated. Many thanks!

#chunk processed ok
[bwa_read_seq] 2.8% bases are trimmed.
[bwa_sai2sam_pe_core] convert to sequence coordinate... 
[infer_isize] (25, 50, 75) percentile: (492, 529, 561)
[infer_isize] low and high boundaries: 354 and 699 for estimating avg and std
[infer_isize] inferred external isize from 55618 pairs: 523.901 +/- 55.549
[infer_isize] skewness: -0.798; kurtosis: 0.914; ap_prior: 2.38e-04
[infer_isize] inferred maximum insert size: 897 (6.71 sigma)
[bwa_sai2sam_pe_core] time elapses: 9.46 sec
[bwa_sai2sam_pe_core] changing coordinates of 9766 alignments.
[bwa_sai2sam_pe_core] align unmapped mate...
[bwa_paired_sw] 76039 out of 91346 Q17 singletons are mated.
[bwa_paired_sw] 5151 out of 16392 Q17 discordant pairs are fixed.
[bwa_sai2sam_pe_core] time elapses: 52.09 sec
[bwa_sai2sam_pe_core] refine gapped alignments... 4.60 sec
[bwa_sai2sam_pe_core] print alignments... 1.93 sec
[bwa_sai2sam_pe_core] 11010048 sequences have been processed.

# failed chunk
[bwa_read_seq] 3.1% bases are trimmed.
[bwa_sai2sam_pe_core] convert to sequence coordinate... 
[infer_isize] fail to infer insert size: too few good pairs
[bwa_sai2sam_pe_core] time elapses: 11.07 sec
[bwa_sai2sam_pe_core] changing coordinates of 0 alignments.
[bwa_sai2sam_pe_core] align unmapped mate...
[bwa_paired_sw] 0 out of 0 Q17 singletons are mated.
[bwa_paired_sw] 68090 out of 140740 Q17 discordant pairs are fixed.
[bwa_sai2sam_pe_core] time elapses: 63.65 sec
[bwa_sai2sam_pe_core] refine gapped alignments... 
/spool/1339511835.1833481: line 8:  9921 Segmentation fault      (core dumped) 
../../bwa-0.6.1/bwa sampe -a 2000 ../myGenome.fa myReads.PE500.4.1.sai myReads.PE500.4.2.sai myReads.PE500.4.1.fq myReads.PE500.4.2.fq > myReads.PE500.4.bwape.sam
paired-end bwa • 8.4k views
ADD COMMENTlink modified 4.6 years ago by deepue110 • written 7.4 years ago by a11msp110
2

I had some seg fault problems with sampe awhile ago and after trying 101 different things, I eventually gave up and used bowtie2. So I'm curious to see what happens here.

That said, I would suggest mentioning what version of bwa you're using (or have tried) and hopefully post part of your failing data file somewhere if you want others to take a look.

ADD REPLYlink written 7.4 years ago by Madelaine Gogol5.1k
1

Haha. We both posted the same time with the same answer.

ADD REPLYlink written 7.4 years ago by Zev.Kronenberg11k
2

I posted this question to the bwa mailing list and received the following patch from Mark Kelly that may fix this bug:

diff -crN bwa-0.6.1-orig/bwase.c bwa-0.6.1-fix/bwase.c
*** bwa-0.6.1-orig/bwase.c      Mon Nov 28 08:55:02 2011
--- bwa-0.6.1-fix/bwase.c       Tue Jun 12 13:05:17 2012
***************
*** 245 - 251 ****
                       }
               }
       } else { // no gaps
!               for (z = u = 0; z < (bwtint_t)len; ++z) {
                       c = pacseq[(x+z)>>2] >> ((~(x+z)&3)<<1) & 3;
                       if (c > 3 || seq[y+z] > 3 || c != seq[y+z]) {
                               ksprintf(str, "%d", u);
*** 245 - 251 ***
                       }
               }
       } else { // no gaps
!               for (z = u = 0; z < (bwtint_t)len && x+z < l_pac; ++z) {
                       c = pacseq[(x+z)>>2] >> ((~(x+z)&3)<<1) & 3;
                       if (c > 3 || seq[y+z] > 3 || c != seq[y+z]) {
                               ksprintf(str, "%d", u);

Am re-running with the patched version now and if it works, will post it as an update to the question and close it.

ADD REPLYlink modified 7.4 years ago • written 7.4 years ago by a11msp110
1

Update: With this patch, the run lasted a little longer but eventually died in a very similar setting. Perhaps the patch is in the right place, but is not fully adequate...

ADD REPLYlink written 7.4 years ago by a11msp110
2

I had this exact problem and tried all the usual suspects. Sadly I couldn't figure it out and ended up using bowtie 2.

ADD REPLYlink written 7.4 years ago by Zev.Kronenberg11k

Same here:

bwa sampe -s -A -r "@RG\tID:id\tLB:foo\tSM:id\tPL:ILLUMINA" hg19 1.sai 2.sai 1.fq 2.fq ... [bwasai2sampe_core] convert to sequence coordinate... Segmentation fault (core dumped)

This happens within 2 seconds of starting the program. For me, this result is reproducible:

  • Across bwa-0.5.9, bwa-0.6.1 and bwa-0.6.2
  • Across 50 different pairs of .sai files
  • With a variety of optional parameters: with or without -s and -A,
    different @RG string lengths, outputting to .sam file or piping to samtools.
ADD REPLYlink modified 7.2 years ago • written 7.2 years ago by urbio0

I had this exact same seg fault 2 seconds after running.  The sai file was produced on a cluster using bwa 0.7, and I was running sampe on another server with bwa 0.6.  When I installed and ran `bwa sampe` using bwa 0.7, it worked perfectly.   Might be worth trying the new version.    -- Hope that helps people with this same issue.  

 

 

ADD REPLYlink written 4.1 years ago by rebekah.rogers0
1
gravatar for evelyne.c88
6.9 years ago by
evelyne.c8810
evelyne.c8810 wrote:

This exact error can also occur when wrong reference files are used (so when the chromosome id's in the reference index do not match those in the .sai)

ADD COMMENTlink written 6.9 years ago by evelyne.c8810

I was having the same problem and after I rebuilt the BWA indexes everything worked fine

ADD REPLYlink written 6.5 years ago by perry.ridge0
0
gravatar for Istvan Albert
7.4 years ago by
Istvan Albert ♦♦ 81k
University Park, USA
Istvan Albert ♦♦ 81k wrote:

Multiple users reported problems with bwa in similar circumstances. See comments to the question.

The main purpose of this answer is to label this question answered so that more people look at it and the excellent comments to the question

ADD COMMENTlink written 7.4 years ago by Istvan Albert ♦♦ 81k
0
gravatar for nick.shrine
7.3 years ago by
nick.shrine0 wrote:

We were getting a segmentation fault with sampe in version 0.5.9 because n_occ and rest were overflowing in bwase.c and becoming negative, so I changed from line 46:

if (n_multi) {
    int k, rest, n_occ, z = 0;
    for (k = n_occ = 0; k < n_aln; ++k) {
        const bwt_aln1_t *q = aln + k;
        n_occ += q->l - q->k + 1;
    }

to:

if (n_multi) {
    unsigned int k, rest, n_occ, z = 0;
    for (k = n_occ = 0; k < n_aln; ++k) {
        const bwt_aln1_t *q = aln + k;
        n_occ += q->l - q->k + 1;
    }

as q->l and q-> are defined as uint_32 if you look in the appropriate header. It worked after the above change. I don't know if this is related to your problem.

ADD COMMENTlink modified 7.3 years ago • written 7.3 years ago by nick.shrine0
0
gravatar for mghandi
6.4 years ago by
mghandi0
mghandi0 wrote:

I had similar problem with bwa version 0.7.4. but then I switched to bwa ver 0.6.2 and it worked fine.

ADD COMMENTlink written 6.4 years ago by mghandi0
0
gravatar for deepue
4.6 years ago by
deepue110
Finland
deepue110 wrote:

I had a sample run paired-end sequenced in two lanes, sample data of first lane has run successfully but the second lane data is having "Segmentation fault" error. If this is due to version issue or memory, the first one should have failed. What might be the issue ? Could someone please help me.

Thanks

ADD COMMENTlink modified 4.6 years ago • written 4.6 years ago by deepue110
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: 1503 users visited in the last hour