Skip to content

feat: read and write fgbio and fgumi metrics - #5

Merged
clintval merged 6 commits into
mainfrom
cv_fgbio_fgumi
Oct 27, 2026
Merged

clintval merged 6 commits into
mainfrom
cv_fgbio_fgumi

Conversation

@clintval

Copy link
Copy Markdown
Owner

No description provided.

make_fg.sh simulates a small set of duplex UMI reads with simulate_umis.py,
aligns them with bwa, and runs fgbio 4.1.1 and fgumi 0.8.0 over them to write
every metrics file each tool can, into tests/data/fgbio and tests/data/fgumi.
No input is downloaded, and a rerun writes the same bytes.
Adds captainslog.fgbio and captainslog.fgumi, with a frozen dataclass for
every metrics file each tool writes, an FgbioReader and FgumiReader, an
FgbioWriter and FgumiWriter, and a metrics_class that names a file's
dataclass by its header row, since both tools write under any path.

The dataclasses are generated, as Picard's are:

- fgbio's from its jar: FgbioSchema.java reads the columns Metric.write
  writes with Scala reflection, and the docstrings come from the Scaladoc.
  Four histograms fgbio writes line by line are written by hand.
- fgumi's from its published column contract, metric_columns.json, and the
  structs its contract test pairs with each file. The generator follows
  serde's rename and skip, and refuses to run unless every struct's columns
  are the published ones.

Both tools write NaN and the infinities as NaN, Infinity and -Infinity, which
fgbio's Metric.read needs, and whole-number floats without a point; the
writers do the same. fgbio and fgumi write eleven files with one header, and
a test pins those pairs and their types, so either tool's dataclass reads
the other's file.
PairOrientation was declared by Picard, fgbio, and Riker, and ReadType by
fgbio and fgumi, so the same column read as a different class from each
tool. Each now lives once, in captainslog/_htsjdk.py and
captainslog/_fulcrum.py, and every tool's module re-exports it.

The generators import a shared enumeration through SHARED_ENUMS rather
than declaring it, and refuse to run unless it holds the values the tool
writes.
@clintval
clintval marked this pull request as ready for review October 27, 2026 20:22
@clintval
clintval merged commit 45cf30d into main Oct 27, 2026
5 checks passed
@clintval
clintval deleted the cv_fgbio_fgumi branch October 27, 2026 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant