This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Segmentation fault (core dumped) during bwa mem mapping

Hi,

I ran bwa mem with trimmed fastq files (ERR2593198) but I saw following error:

bwa mem CHO-PICR.fasta ../2.ngsShort/trimmed_ERR2593198_1.fastq ../2.ngsShort/trimmed_ERR2593198_2.fastq

>[M::bwa_idx_load_from_disk] read 0 ALT contigs
@PG ID:bwa  PN:bwa  VN:0.7.17-r1188 CL:../downloads/bwa-0.7.17/bwa mem CHO-PICR.fasta ../2.ngsShort/trimmed_ERR2593198_1.fastq ../2.ngsShort/trimmed_ERR2593198_2.fastq
[M::process] read 92156 sequences (10000179 bp)...
Segmentation fault (core dumped)

To figure out what's happening, I ran gdb and the report was like this:

bwa mem CHO-PICR.fasta ../2.ngsShort/trimmed_ERR2593198_1.fastq ../2.ngsShort/trimmed_ERR2593198_2.fastq

[Thread debugging using libthread_db enabled]

 Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

[M::bwa_idx_load_from_disk] read 0 ALT contigs

[New Thread 0x7ffff7c2a700 (LWP 18232)]

[New Thread 0x7ffff7429700 (LWP 18233)]

[M::process] read 92156 sequences (10000179 bp)...

[New Thread 0x7ffff6052700 (LWP 18234)]

Thread 4 "bwa" received signal SIGSEGV, Segmentation fault.

[Switching to Thread 0x7ffff6052700 (LWP 18234)]

bwt_2occ4 (bwt=bwt@entry=0x5555555ad6e0, k=18446744073709551615, l=18446744073709551615, 
    cntk=cntk@entry=0x7ffff6051a70, cntl=cntl@entry=0x7ffff6051a90) at bwt.c:203
203         memcpy(cntk, p, 4 * sizeof(bwtint_t));
------------------------------------------------
    (gdb) bt

#0  bwt_2occ4 (bwt=bwt@entry=0x5555555ad6e0, k=18446744073709551615, l=18446744073709551615, 
    cntk=cntk@entry=0x7ffff6051a70, cntl=cntl@entry=0x7ffff6051a90) at bwt.c:203

#1  0x000055555557a56b in bwt_extend (bwt=bwt@entry=0x5555555ad6e0, 
    ik=ik@entry=0x7ffff6051b50, ok=ok@entry=0x7ffff6051ba0, is_back=is_back@entry=0)
    at bwt.c:266

#2  0x000055555557a843 in bwt_smem1a (bwt=bwt@entry=0x5555555ad6e0, len=len@entry=96, 
    q=q@entry=0x7ffff0013900 "\001\003\001", x=x@entry=0, min_intv=min_intv@entry=1, 
    max_intv=max_intv@entry=0, mem=0x7ffff1e1afd8, tmpvec=0x7ffff1e1aff0) at bwt.c:310

#3  0x000055555557adf6 in bwt_smem1 (bwt=bwt@entry=0x5555555ad6e0, len=len@entry=96, 
    q=q@entry=0x7ffff0013900 "\001\003\001", x=x@entry=0, min_intv=min_intv@entry=1, 
    mem=mem@entry=0x7ffff1e1afd8, tmpvec=0x7ffff1e1aff0) at bwt.c:355

#4  0x00005555555819fd in mem_collect_intv (a=0x7ffff1e1afc0, 
    seq=0x7ffff0013900 "\001\003\001", len=96, bwt=0x5555555ad6e0, opt=0x5555555ad3b0)
    at bwamem.c:123

#5  mem_chain (opt=opt@entry=0x5555555ad3b0, bwt=0x5555555ad6e0, bns=bns@entry=0x5555555adb50, 
    len=len@entry=96, seq=seq@entry=0x7ffff0013900 "\001\003\001", buf=0x7ffff1e1afc0)
    at bwamem.c:264

#6  0x000055555558fac4 in mem_align1_core (opt=0x5555555ad3b0, bwt=<optimized out>, 
    bns=0x5555555adb50, pac=0x5555555add90 "", l_seq=96, seq=0x7ffff0013900 "\001\003\001", 
    buf=0x7ffff1e1afc0) at bwamem.c:1060

#7  0x000055555558fe56 in worker1 (data=0x7ffff7c29cb0, i=<optimized out>, tid=<optimized out>)
    at bwamem.c:1181

#8  0x00005555555766ca in ktf_worker (data=0x7ffff7c29bf0) at kthread.c:42

#9  0x00007ffff7e33609 in start_thread (arg=<optimized out>) at pthread_create.c:477

#10 0x00007ffff7d4f293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Can anyone please help me how to fix this error?

Thank you.

mapping

1 answer

The two standard points to check first:

a) google the error message, gives https://github.com/lh3/bwa/issues/181 which suggests a corrupted index. Try to make a short subset of the fastq files (like head -n 40 for each) and run bwa mem manually. This tells you whether the index is ok.

b) check if you have enough memory

Thank you, ATpont!.

I downloaded the genome file and the new genome file worked well!. As you said, the problem was the index file.

Best regards,

Log in to answer this question.