Skip to content

Milab-6847: vj usage abundance dtype - #41

Merged
erohinaelena merged 3 commits into
mainfrom
MILAB-6847_vj-usage-abundance-dtype
Aug 27, 2026
Merged

Milab-6847: vj usage abundance dtype#41
erohinaelena merged 3 commits into
mainfrom
MILAB-6847_vj-usage-abundance-dtype

Conversation

@erohinaelena

@erohinaelena erohinaelena commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR fixes abundance normalization for empty or all-null input by preserving the analysis table’s declared schema, while also updating CI identity, Node, and publication tooling.

  • Abundance — Numeric clonotype weight used for weighted gene-usage calculations. Its declared numeric type is now preserved even when no parseable values are present.
  • PTabler schema — Structural metadata describing table column and axis types. The analysis table now uses buildForPT() to carry this schema into the calculation.
  • Analysis table — Intermediate sample/clonotype/V-gene/J-gene/abundance table consumed by the usage calculation. Its construction changes from an inferred TSV to a typed PTabler artifact.
  • Usage normalization — Division of grouped abundance or row counts by per-sample totals. It now receives a schema-defined abundance dtype rather than relying on CSV inference.
  • V/J gene usage — Per-sample weighted and unweighted frequencies for V genes, J genes, and paired V/J combinations. The calculation itself is unchanged; only typed input loading changes.
  • @platforma-sdk/block-tools — Build, packaging, publication, and stable-marking tooling. It is upgraded from 2.12.6 to 2.14.3.
  • CI runtime — Node environment used by build and mark-stable workflows. It changes from Node 20.x to 22.x, and workflow labels are corrected for V/J Gene Usage.

Confidence Score: 5/5

The PR appears safe to merge, with no concrete blocking or independently actionable non-blocking defects identified.

The paired typed-table construction and frame-loading changes preserve existing headers and calculation contracts while preventing empty or all-null abundance data from being inferred as strings; the CI and tooling updates show no established incompatibility.

Important Files Changed

Filename Overview
workflow/src/main.tpl.tengo Replaces inferred TSV construction with a typed PTabler artifact while preserving existing analysis-table headers.
workflow/src/usage.lib.tengo Loads the structural table directly so its embedded format and schema drive the usage frame.
.github/workflows/build.yaml Corrects application identity and moves the build workflow from Node 20.x to 22.x.
.github/workflows/mark-stable.yaml Corrects the stable-marking application label and moves its runtime to Node 22.x.
pnpm-workspace.yaml Upgrades the shared block-tools catalog entry to 2.14.3.
pnpm-lock.yaml Resolves block-tools 2.14.3 and its updated build-time transitive dependency graph.
.changeset/vj-usage-abundance-dtype.md Documents the schema-inference failure, typed-table fix, and associated tooling release.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Resolved sample, clonotype, V, J, and abundance columns] --> B[Build typed PTabler table]
  B --> C[Load frame with declared schema]
  C --> D[Compute per-sample totals]
  C --> E[Group V, J, and V/J usage]
  D --> F[Normalize weighted and unweighted measures]
  E --> F
  F --> G[Publish typed usage results]
Loading

Reviews (1): Last reviewed commit: "MILAB-6847: run CI on node 22, fix copy-..." | Re-trigger Greptile

Context used (3)

The input table was built with tsvFileBuilder.build(), which emits an untyped
TSV, so ptabler let polars infer the column types. An abundance column with no
parseable numeric value in the exported table -- an empty join result, or
all-null abundance -- is inferred as String; sum() keeps that dtype and the
per-sample normalisation then fails during query planning with
"division with 'String' datatypes is not allowed".

Build the table with buildForPT() instead, so column types come from the
p-column and axis specs and nulls are written as the "%%NA%%" sentinel that
ptabler declares per column. wf.frame() reads xsvType and the schema straight
off the structural input, so its options argument is no longer needed.

This changes the exported TSV bytes, so cached results for this block are
invalidated -- correct here, since the previous output was wrong.
The shared CI gates publication on @platforma-sdk/block-tools being at the
latest version (node-simple-pnpm.yaml, require-latest step), so the build is
rejected otherwise. pnpm-lock.yaml is updated alongside, which the same
workflow also enforces for any pnpm-workspace.yaml change.
Both workflows pinned node-version to '20.x'. Move them to '22.x', matching the
12 blocks already on it against the same shared workflows (node-simple-pnpm.yaml
and block-mark-stable.yaml at @v4).

Both also carried a copy-paste leftover naming this block "CDR3 SpectraType",
with app-name-slug 'block-cdr3-spectratype' colliding with the real
cdr3-spectratype block. Since the slug is part of the release file name and
app-name is what CI reports in messages, this block's builds and releases were
labelled as another one. Name it after itself instead.
@erohinaelena
erohinaelena merged commit 34a9338 into main Aug 27, 2026
11 checks passed
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.

2 participants