Skip to content

Samtools 1.19 bam-cram conversion produce cram bigger than bam #1968

Description

@Clockris

Hi,

I am opening this issue because I experienced a wired Samtools behavior: when I try to convert a bam to a cram, I get a cram slightly bigger than the original bam. The following is the code I run

samtools view -C --output-fmt-option store_md=1 --output-fmt-option store_nm=1 input.bam -T ref.bgz -O cram,version=3.1 -o output.cram

I experienced this issue using Samtools 1.19, while when I am using an older version (I tested 1.17, 1.15, 1.13) the output cram is 50% smaller than the bam (as expected). The issue does not seem to be related with the cram version: I tried the 3.0 and the 3.1 versions.

Other information that could be relevant:

  • when I reconvert the information from cram to bam (with Samtools 1.19) the last two columns are switched
  • the bam I am talking about has been created with an old version of Samtools (1.17)

Do you have any idea why this happen and how overcome the problem?

Thanks,

Cristiano

htslib
I am using htslib 1.19

OS
Linux based operative system (RedHat 9.2)

Machine architecture
x86_64

Compiler
I tried the galaxy singularity image and conda installation

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