cram_fd shrinkage and ditching of cram v1.0.

Open
#518 0 comments 0 reactions 1 assignee View on GitHub

@jkbonfield is already working on this.

Since Apr 20, 2017.

Assessment

This issue has not been assessed yet.

Description

To-do when dropping CRAM v1.x support. Realistically it should have been ditched ages ago as I don't believe C and Java implementations were particularly interchangeable due to spec problems. I doubt any 1.x files exist in the wild.

Cram_fd has 32k of pointless data, but changing it now I suspect is an API breakage (I'd need to check the scope of that struct; size changing may be a problem). In cram_structs.h we have:

    // lookup tables, stored here so we can be trivially multi-threaded                                         
    unsigned int bam_flag_swap[0x1000]; // cram -> bam flags                                                    
    unsigned int cram_flag_swap[0x1000];// bam -> cram flags                                                    

These are intialised in cram_io.c. For CRAM v1.0 they were translation tables of BAM flags to CRAM flags and vice versa because the CRAM flags were identical but in a different bit order. This was one of things we sanitised when creating CRAM v2.0 so it is now essentially flag[i]=i and a nop. If we ditched support for v1.0 we could simplify a lot of this code base, including this chunk.

Why does it matter? If we're doing a merge and sharing headers between cram streams then up to 15% of memory usage may be that lookup table!

Dominant language
C
Stars
950
Forks
475
Avg merge
3d 13h
Merged PRs (30d)
11

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from samtools/htslib

All issues in samtools/htslib

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.