Skip to content

Segmentation fault when running samtools coverage --excl-flags 1540 #2076

Description

@mcolpus

Are you using the latest version of samtools and HTSlib? If not, please specify.

(run samtools --version)

Please describe your environment.

  • OS: Linux 5.15.0-1049-oracle
  • machine architecture: x86_64
  • compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0

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

Using the attached aln.sam file:

samtools coverage --excl-flags 1540 aln.sam -o coverage.secondary.tsv

This gave a segmentation fault and produces a tsv output which stops part way through:

...
NOZR01000027.1	1	87550	1	109	0.1245	0.001245	53.9	0
NOZR01000030.1	1	70745	1	204	0.28836	0.0028836	61.7	0
NOZR01000039.1	1	35613	1	178	0.499817	0.00499817	66	0
NOZR01000054.1	1	5463	4	1072	19.6229	0.221856	61.3	0
NZ_RARC01000012.1	1	175888	1	47	0.0267216	0.000267216	50.6	0
NZ_RARC01000016.1	1	129040	2	167	0.129417	0.00129417	67.1	0
NZ_RARC0100002

The error occurs when samtools is installed via conda or installed from the github release. It runs fine if --excl-flags 1540 is removed.
Doing an initial debug it seems to be coming from here, but couldn't figure out beyond that:

Program received signal SIGSEGV, Segmentation fault.
0x0000555555593e43 in main_coverage (argc=argc@entry=6, argv=<optimised out>, argv@entry=0x7fffffffdc60) at coverage.c:614
614	                        bam_get_qual(p->b)[p->qpos] < opt_min_baseQ) --depth_at_pos; // low base quality

sam file came from mapping ont reads against an multifasta reference, which was then sorted.

minimap2 -ax map-ont --secondary yes -N 1000 ref.fa reads.fastq > alignments.sam

aln.zip

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions