Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assertion in bntseq fails #120

Open
ahwagner opened this issue Apr 19, 2017 · 12 comments
Open

Assertion in bntseq fails #120

ahwagner opened this issue Apr 19, 2017 · 12 comments

Comments

@ahwagner
Copy link

BWA crashes when running on my PE RNA-seq data.

It looks like the failure is caused by a failed assertion here.

The logged error is as follows:

[M::bwa_idx_load_from_disk] read 0 ALT contigs
[M::process] read 858446 sequences (80000186 bp)...
[E::bns_fetch_seq] begin=109745949, mid=109746080, end=95461170, len=14284779, seq=0x7ff5c225e010, rid=21138, far_beg=95459107, far_end=95461170
bwa: bntseq.c:444: bns_fetch_seq: Assertion `seq && *end - *beg == len' failed.
@blacksxn
Copy link

I have the same question when using the latest version of BWA (0.7.15). while when i change the version to 0.7.8, the question disappeared. i really confused about the result.

@nanakiksc
Copy link

nanakiksc commented Jul 21, 2017

This seems to happen if you use a named pipe when creating the index, as in:
$ bwa index <(zcat ref.fa.gz)
Try redoing the index, this time from an already decompressed file, until the issue is fixed.
Hope this helps.

PS: It happens both in the latest version from GitHub (0.7.15-r1144-dirty) and in the version from the Canonical repo (0.7.12-r1039).

@ALFLAG
Copy link

ALFLAG commented Jun 25, 2019

Hello every one,
I have the same error message after trying to use bwa mem on a sequence of more than 4.8 billions nucleotides.
Indexation was done with the following parameter -b 600000000 and -a bwtsw, on a decompressed fasta file.
My bwa version is 0.7.17-r1188 and was installed with conda.

Any suggestions ?
Thanks !

@yanlinlin82
Copy link

@ALFLAG could you please help to try this pull request #243

@ALFLAG
Copy link

ALFLAG commented Jun 25, 2019

I'd love to. But I can't find the bntseq.c file. Is it because the tool has been installed with conda ?

@yanlinlin82
Copy link

You may try like this, build from the source, and try this test version:

git clone https://github.com/yanlinlin82/bwa.git -b patch-1 bwa-patch-1
make -C bwa-patch-1/
./bwa-patch-1/bwa

@ALFLAG
Copy link

ALFLAG commented Jun 28, 2019

@yanlinlin82
I test the patch you've made, no error message, the indexation succeed.
Thanks a lot.

@yanlinlin82
Copy link

Thank you for testing and feeding back.

@AliSajid
Copy link

AliSajid commented Nov 6, 2019

Reopening this as I am facing the exact same issue:

Here's the output from my command:
bwa mem -R '@RG\tID:bwa\tSM:A\tPL:ILLUMINA\tPU:HiSEQ2000' -o output_pe.sam ../GRCH38/Homo_sapiens.GRCh38.dna.primary_assembly.fa SRR3438555_1.fastq SRR3438555_2.fastq [M::bwa_idx_load_from_disk] read 0 ALT contigs [M::process] read 200000 sequences (10000000 bp)... [M::process] read 200000 sequences (10000000 bp)... [E::bns_fetch_seq] begin=3324490029, mid=3324490030, end=3099750718, len=224739311, seq=0x2ba8a4000010, rid=193, far_beg=3099749748, far_end=3099750718 bwa: bntseq.c:450: bns_fetch_seq: Assertion seq && *end - *beg == len' failed.
Aborted`

I tried to do understand the error. It complained about an equality. Here's the output from bc:

3099750718 - 3324490029 -224739311

The length is the same except it has a negative sign.

Edit:

I tried to run the patch. Here's the output from the patch:

/users/PJS0313/asimami/scratch/bwa-patch-1/bwa mem -R '@RG\tID:bwa\tSM:A\tPL:ILLUMINA\tPU:HiSEQ2000' -o output_pe.sam ../GRCH38/Homo_sapiens.GRCh38.dna.primary_assembly.fa SRR3438555_2.fastq SRR3438555_1.fastq [M::bwa_idx_load_from_disk] read 0 ALT contigs [M::process] read 200000 sequences (10000000 bp)... [M::process] read 200000 sequences (10000000 bp)... bwa: bwamem.c:750: mem_chain2aln: Assertion re >= 0' failed.
Aborted`

@ZZH19999
Copy link

BWA在运行我的PE RNA-seq数据时崩溃。

看起来失败是由此处的失败断言引起的。

记录的错误如下所示:

[M::bwa_idx_load_from_disk] read 0 ALT contigs
[M::process] read 858446 sequences (80000186 bp)...
[E::bns_fetch_seq] begin=109745949, mid=109746080, end=95461170, len=14284779, seq=0x7ff5c225e010, rid=21138, far_beg=95459107, far_end=95461170
bwa: bntseq.c:444: bns_fetch_seq: Assertion `seq && *end - *beg == len' failed.

How did you solve this problem

@hfpef
Copy link

hfpef commented May 9, 2022

I run into the same problem. I tried to increase memory at first, but it still didn't work and I solved it by using bwa-mem2.

First I installed bwa-mem2:

curl -L https://github.com/bwa-mem2/bwa-mem2/releases/download/v2.0pre2/bwa-mem2-2.0pre2_x64-linux.tar.bz2 \
  | tar jxf -

and instead of using the standard:

bwa mem ref.fa read1.fq read2.fq > aln-pe.sam

after installing bwa-mem2 the code will look like this:

bwa-mem2-2.0pre2_x64-linux/bwa-mem2 mem ref.fa read1.fq read2.fq > aln-pe.sam

In my case it looked like this:

bwa-mem2-2.0pre2_x64-linux/bwa-mem2 mem -R "@RG\tID:id\tSM:nr\tLB:nr" chr1.fa chr1_ptn_R1.fastq chr1_ptn_R2.fastq \
| samblaster --excludeDups --addMateTags --maxSplitCount 2 --minNonOverlap 20 \
| samtools view -S -b - \
 > sample_ptn_chr1.bam

I hope it's still useful and it will work for you guys!

PS I will try to give an update to make bwa-mem2 possible to be used while running speedseq or other tools that base on bwa algorythm.

@heihaheihaha
Copy link

Reindex the reference fasta helps me under the same problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants