Skip to content

Assertion error when samtools merge is run with threading and auto indexing #1328

@lacek

Description

@lacek

Are you using the latest version of samtools and HTSlib?

Yes.
samtools 1.11
Using htslib 1.11

Please describe your environment.

  • OS: 4.15.0-46-generic
  • machine architecture: x86_64
  • compiler: gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0

Please specify the steps taken to generate the issue, the command you are running and the relevant output.

Run merge command with threading and auto indexing options with these BAM files (bam.tar.gz):

$ samtools merge -f --write-index -@1 test.bam##idx##test.bam.bai input/*.bam
samtools: bgzf.c:276: bgzf_idx_flush: Assertion `mt->idx_cache.nentries == 0 || mt->block_written >= e[0].block_number' failed.
Aborted (core dumped)

When either --write-index or -@ is removed, the command works fine. samtools index works fine too on latter case.

The BAM files attached are subset from a WGS sample. So far I've only observed the problem when working with WGS samples, but not smaller dataset from other kinds of experiment, such as WES and amplicon.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions