Packages

Read CRAM 3.0 and 3.1 alignment files from Elixir.

Current section

Files

Jump to
cram docs compatibility.md
Raw

docs/compatibility.md

# Compatibility

Honest matrix for the working tree. "Native" means Elixir code in this repository. "Delegated" means a pinned library does the work and this repository does not claim the algorithm as its own. "Unsupported" means the function is absent or returns an error.

Library version: 0.1.0. A tag `v0.1.0` is what publishes this version. The matrix below is the working tree, not a conformance claim.

## Capability matrix

| Capability | CRAM 2.1 | CRAM 3.0 | CRAM 3.1 | Notes |
| --- | --- | --- | --- | --- |
| ITF-8 / LTF-8 integers | native | native | native | Stage 0 |
| File definition | native (version only) | native | native | 2.1 is reported and not walked |
| Container / block inspect | unsupported | native | native | Boundaries, CRC, methods. No data series |
| SAM header text | unsupported | native | native | Raw or gzip `FILE_HEADER` only |
| Reference fetch | unsupported | native | native | Local FASTA and checksum cache. Not called by inspection |
| Record decode | unsupported | delegated | delegated | noodles-cram 0.103.0, dirty-CPU batches |
| Stream records | unsupported | delegated | delegated | `CRAM.stream/2`, default batch 256 |
| CRAI / region query | unsupported | delegated | delegated | Elixir parses the six-column text. noodles `query` filters records |
| Write | unsupported | unsupported | unsupported | Remains unsupported in v0.1 |
| Embedded reference | unsupported | native (flag only) | native (flag only) | Raw slice headers. No fetch, no base reconstruction |
| Refget | unsupported | opt-in | opt-in | `allow_network: true` only. Default open does not build it |

## Block compression methods

Names from CRAMv3 §8. Decoding is delegated to noodles-cram 0.103.0. This repository does not implement the algorithms. The synthetic fixtures use raw, gzip, and rans4x16. The other methods are delegated and not separately tested.

| Method byte | Name | First version | Status |
| --- | --- | --- | --- |
| 0 | raw | 1.x | native for block boundaries; header text is read. Record payloads are delegated |
| 1 | gzip | 1.x | native for the SAM header block. Other gzip blocks are delegated |
| 2 | bzip2 | 2.0 | delegated, not separately tested |
| 3 | lzma | 3.0 | delegated, not separately tested |
| 4 | rans4x8 | 3.0 | delegated, not separately tested |
| 5 | rans4x16 | 3.1 | delegated; present in `test/fixtures/decode` |
| 6 | adaptive arithmetic | 3.1 | delegated, not separately tested |
| 7 | fqzcomp | 3.1 | delegated, not separately tested |
| 8 | name tokeniser | 3.1 | delegated, not separately tested |

## Data-series codecs

NULL, EXTERNAL, GOLOMB (deprecated), HUFFMAN, BYTE_ARRAY_LEN, BYTE_ARRAY_STOP, BETA, SUBEXP, GOLOMB_RICE (deprecated), GAMMA. Delegated to noodles-cram. Not marked native. The synthetic differential test does not name which series it exercised.

## Platforms

| Platform | CI | This workspace |
| --- | --- | --- |
| Linux x86_64 | `.github/workflows/ci.yml` on `ubuntu-latest`: Elixir 1.20/OTP 29, 1.19/OTP 28, 1.18/OTP 27. **not run** | not run |
| macOS arm64 | Elixir tests are not on this platform. The NIF job builds `aarch64-apple-darwin`. **not run** | Elixir 1.20.2 / OTP 28.3.1, Rust 1.97.1. Compile, tests, Credo, doctor, Clippy, and `cargo test` passed locally |

The NIF job also builds `x86_64-apple-darwin`, `x86_64-unknown-linux-gnu`, `aarch64-unknown-linux-gnu`, and `x86_64-pc-windows-msvc` (NIF 2.15). Those jobs are **not run**. Musl is not a target.

## Known limitations

- Writing is unsupported. `CRAM.write/3` returns `reason: :unsupported`. CRAI text is parsed here; the record filter is noodles `query` / `query_unmapped`.
- Record decoding is delegated to noodles-cram 0.103.0. This repository does not implement the codecs.
- Reference lookup is explicit. `CRAM.info/1` does not call a provider stored on the handle. `CRAM.Reference.Refget` returns `reason: :network_disabled` unless `allow_network: true`.
- CRAM 2.1 and older containers are not parsed.
- Block methods other than raw and gzip-on-the-SAM-header are named, not decoded.
- No conformance claim against a CRAM test corpus. One synthetic file matches `samtools view -H` from samtools 1.25.
- Writing is out of scope for v0.1 even though noodles-cram can write.