Skip to content

pmdshodh 0.2.1

Choose a tag to compare

@github-actions github-actions released this 17 Nov 19:39
· 87 commits to main since this release
5f86f9d

pmdshodh 0.2.1 is a bug-fix and speed-up release. Scores of BAMs with MD tags are unchanged, and --pmdtools-compat still matches PMDtools 0.60: in the benchmark round on this release, per-read scores agreed on 37.6 M real reads (largest difference 6.0e-14), and the kept reads were identical.

Upgrade notes

Two inputs that used to be read silently now stop with an input error (exit 2):

  • Truncated BAM or bgzipped SAM. A file that ends without the BGZF end-of-file marker was read up to the cut with exit 0; now it is an error, and filter leaves no output file. Recreate or re-download the file.
  • = read bases without -r. Reads stored with = for bases equal to the reference (as samtools calmd -e writes them) need the reference: pass -r ref.fa. With -r, those reads are now scored from their reference bases, so their default scores change. --pmdtools-compat keeps PMDtools' behaviour.

Highlights

  • Faster, with identical output (medians of 5 alternating runs on 2 M reads, i5-13500H laptop, WSL):
    • damage tables for --summary: 9.16 → 8.33 s;
    • --library ss: 6.98 → 5.53 s;
    • CRAM input with -r at -@ 8 (14 M reads): 45.9 → 38.8 s.
  • Less memory for CRAM against references with many small contigs: 1,010 → 392 MB on a synthetic 10,000-contig reference.
  • New benchmark round (docs/benchmarks.md), on two real libraries of 14.0 M and 23.6 M reads, one laptop:
    • filter was 32–39× faster than the PMDtools pipeline on one thread and 208–217× faster on 8;
    • on one thread, score was faster than metaDMG pmd in all 10 alternating pairs (48.8 vs 61.7 s and 60.6 vs 71.9 s).
    • The PMDtools timings were measured on 2026-11-13 on the same laptop.
  • Clearer errors: score -o no longer leaves a partial table after a failed run, and plain gzip input is named as such.

Install

pip install pmdshodh==0.2.1

Or download the binary for your platform below and check it against SHA256SUMS. A Bioconda package is still to come.

Changes

Added

  • Benchmarks of --library ss, -r and CRAM input, and a new benchmark round on this release: docs/benchmarks.md.

Changed

  • Read bases written as = (same as the reference, as samtools calmd -e writes them) are scored in default mode. With -r they take their reference base; without -r a read with = bases is an input error naming -r, because MD does not give their reference bases. PMDtools never counts = as C or G: a read with nine = at reference C scored 5.03 from 1 site instead of 4.22 from 10. --pmdtools-compat keeps that. Kept records are written with their = bases.
  • Damage tables (--summary, damage) count only positions within --range of the read ends instead of looking at every base. Output is identical. score -@ 1 --summary on 2 M BER11_L_NOuser reads: median 9.16 → 8.33 s (5 alternating runs each; WSL Ubuntu 24.04, i5-13500H).
  • CRAM input: reference sequences are checked against the header M5 on the thread pool instead of the reading thread. score -@ 8 -r on BER11_L_NOuser.cram: median 45.9 → 38.8 s (5 alternating runs each; WSL Ubuntu 24.04, i5-13500H). A wrong reference is still an input error before any record of the batch is used.
  • Single-stranded scoring (--library ss) is faster. The damage, error and null terms are computed once per run instead of at every site (bit-identical), and reads are no longer copied into molecule orientation. score -@ 1 --library ss on 2 M BER11_L_NOuser reads: median 6.98 → 5.53 s (5 alternating runs each; WSL Ubuntu 24.04, i5-13500H).

Fixed

  • BGZF input (BAM, bgzipped SAM) that ends without the end-of-file marker is now an input error (exit 2), and filter leaves no output file. Before, a file cut at a block boundary was read silently: on a samtools-written BAM cut that way, 1,261 of 1,500 reads were scored with exit 0. samtools only warns in this case. CRAM input cut before its end-of-file container was already an error.
  • score -o FILE writes under a temporary name and renames on success, as filter does, so a failed run no longer leaves a partial table.
  • gzip-compressed input that is not BGZF (as gzip writes it) is reported as such, with a hint to recompress with bgzip, instead of "invalid BGZF header".
  • CRAM input: the cache of whole reference sequences is also cleared past its limit (256 Mi bases) when a batch has only multi-reference containers, as samtools writes for many small contigs. Before, such input kept every sequence it had used, up to the whole reference. On a synthetic 1 Gb reference of 10,000 contigs (100 multi-reference containers, samtools 1.25), peak RSS of score -@ 4 -r fell from 1,010 MB to 392 MB, with identical scores.

What's Changed

  • Download only wheels and the sdist for PyPI on a tag push by @dpatel511 in #27
  • Reject BGZF input without the end-of-file marker by @dpatel511 in #28
  • Score '=' read bases from -r; reject them without it by @dpatel511 in #29
  • Write score -o atomically; name plain gzip input by @dpatel511 in #30
  • Count damage only within --range of the read ends by @dpatel511 in #31
  • Clear the CRAM sequence cache for multi-reference batches too by @dpatel511 in #32
  • Check CRAM M5 checksums on the thread pool by @dpatel511 in #33
  • Speed up single-stranded scoring by @dpatel511 in #34
  • Prepare 0.2.1: benchmark round and release notes by @dpatel511 in #35

Full Changelog: v0.2.0...v0.2.1