Skip to content

E::sam_hdr_sanitise after samtools sort #1105

Description

@aroelo

Environment:
-samtools version 1.9
-Linux 4.15.0-1056-azure
-x86_64
-gcc (Ubuntu 8.3.0-16ubuntu3~16.04) 8.3.0

I ran minimap with 9.948 reads against a large reference containing 17.289.278 sequences. I am trying to sort the resulting sam file, but am getting an error when I use samtools sort. Converting the sam to bam does not give any problems.

Converting to bam:
samtools view -b error.sam > error.bam

Sorting bam:
samtools sort error.bam -o error_sorted.bam

Attempting to view the sorted bam file:
samtools view error_sorted.bam | head

Error message:

[E::sam_hdr_sanitise] Malformed SAM header at line 2
[main_samview] fail to read the header from "error_sorted.bam".

Upon inspecting the header of the (unsorted) bam file I can't see anything that would cause this error when sorting.
samtools view -H error.bam | head

@PG	ID:minimap2	PN:minimap2	VN:2.17-r941	CL:minimap2 -ax map-ont -t 32 --split-prefix tmp_minimap -o error.sam error_ref.fa reads.fastq
@SQ	SN:C7|tid|9913|X51700.1|Bos_taurus_mRNA_for_bone_Gla_protein	LN:437
@SQ	SN:C9|tid|9913|X68321.1|B.taurus_mRNA_for_cyclin_A	LN:1512
@SQ	SN:C11|tid|9913|X55027.1|Bovine_mRNA_for_chromogranin_B	LN:2367
@SQ	SN:C29|tid|9913|X60495.1|B.taurus_exon_1_for_bovine_seminal_vesicle_secretory_protein_SVSP109_signal_peptide	LN:896
@SQ	SN:C33|tid|9913|X60496.1|B.taurus_exon_2_for_bovine_seminal_vesicle_secretory_protein_SVSP109	LN:371
@SQ	SN:C36|tid|9913|X60497.1|B.taurus_exon_3_for_bovine_seminal_vesicle_secretory_protein_SVSP109	LN:494
@SQ	SN:C37|tid|9913|X60498.1|B.taurus_exon_4_for_bovine_seminal_vesicle_secretory_protein_SVSP109	LN:551
@SQ	SN:C38|tid|9913|Z11996.1|B.taurus_5-region_of_gene_for_beta-lactoglobulin	LN:1633
@SQ	SN:C39|tid|9913|X57170.1|B.taurus_5S_rRNA_gene	LN:120

I have also attached two links to the full error.bam and error_sorted.bam files.
error.bam: https://we.tl/t-NSmxps1wBg
error_sorted.bam: https://we.tl/t-WoRrT4QjqL

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