Skip to content

feat: add support for per-cluster centroid dataset in sequence processing#19

Closed
AStaroverov wants to merge 4 commits into
mainfrom
feat/accept-single-axis-sequence-dataset
Closed

feat: add support for per-cluster centroid dataset in sequence processing#19
AStaroverov wants to merge 4 commits into
mainfrom
feat/accept-single-axis-sequence-dataset

Conversation

@AStaroverov

@AStaroverov AStaroverov commented Jun 15, 2026

Copy link
Copy Markdown

Greptile Summary

This PR adds support for per-cluster centroid datasets (produced by clonotype-clustering) as a valid input to the sequence-properties block. Both the model anchor-spec list and the workflow mode-detection function are extended to recognise the two-axis [sampleId, centroidId] shape and route it through the existing antibody_tcr_legacy_bulk processing path.

  • model/src/index.ts: A new entry is appended to inputAnchorSpecs for pl7.app/clustering/centroidId, making the block's inputOptions output include centroid datasets without changing any other model logic.
  • workflow/src/main.tpl.tengo: A new detectMode branch maps pl7.app/clustering/centroidId"antibody_tcr_legacy_bulk", so the Python plan receives the correct mode and the per-chain sequence-column loop runs unchanged. Receptor detection for centroid data relies entirely on pl7.app/vdj/chain annotations present on the sequence columns rather than on the axis domain.

Confidence Score: 4/5

Safe to merge; changes are additive and isolated to anchor registration and mode routing.

Both changes are small and additive. The model change only extends the accepted-input list; the workflow change adds one branch to a detection function that has no side effects on existing paths. The one open question is whether centroid sequence columns from bulk-clustering producers always carry pl7.app/vdj/chain in their domain — if they do not, receptor detection silently defaults to IG with a user-visible warning, which could produce incorrect property calculations for TCR centroid datasets.

workflow/src/main.tpl.tengo — the receptor-detection path for centroid data relies entirely on sequence-column domain annotations rather than the axis domain; worth confirming that all centroid-producing blocks emit chain metadata on their sequence columns.

Important Files Changed

Filename Overview
model/src/index.ts Adds a new entry to inputAnchorSpecs for the per-cluster centroid axis [sampleId, centroidId]; additive-only change, consistent with existing entries.
workflow/src/main.tpl.tengo Adds a detectMode branch mapping pl7.app/clustering/centroidId to antibody_tcr_legacy_bulk; receptor detection for centroid data falls back to per-column chain scanning with no axis-level VDJ domain.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Input Anchor] --> B{detectMode on axis name}
    B -->|variantKey + peptide domain| C[peptide]
    B -->|variantKey + vdj domain| D[antibody_tcr_universal]
    B -->|vdj/cloneId or clonotypeKey| E[antibody_tcr_legacy_bulk]
    B -->|vdj/scClonotypeKey| F[antibody_tcr_legacy_sc]
    B -->|clustering/centroidId NEW| E
    E --> G[Receptor from sequence column domains]
    F --> G
    D --> H[Receptor from axis domain]
    C --> I[Peptide sequence column]
    G --> J[Python plan: antibody_tcr_legacy_bulk]
    H --> J
    I --> J
    J --> K[propertiesPf output]
Loading
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
workflow/src/main.tpl.tengo:59-61
**Receptor detection fully deferred to sequence-column domains**

Unlike `pl7.app/vdj/cloneId` / `clonotypeKey`, the `centroidId` axis domain carries no VDJ keys (`pl7.app/vdj/receptor`, `pl7.app/vdj/chain`), so `resolveReceptor` will always return `seen: false` from the axis-level check. Receptor is then determined solely by the `d["pl7.app/vdj/chain"]` lookup on each sequence column inside the `for s in vdjCols` loop. If the centroid sequence columns happen to omit that domain key — e.g. a bulk-clustering producer that does not propagate chain metadata — `receptorSeen` stays false, the default "IG" is used silently, and `messages.receptorNotDetected()` fires at line 323. The comment says "single-cell centroids still carry the chain domain on the sequence columns", so this is likely safe in practice, but a missing chain annotation on the centroid sequence columns would silently produce IG properties for what might be a TCR dataset.

Reviews (1): Last reviewed commit: "feat: add support for per-cluster centro..." | Re-trigger Greptile

Greptile also left 1 inline comment on this PR.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for a per-cluster centroid dataset (clonotype-clustering) by adding a new anchor specification with the axis "pl7.app/clustering/centroidId" in the model. It also updates the workflow logic to detect this axis and treat it as "antibody_tcr_legacy_bulk" for sequence pulling. There are no review comments, and I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +59 to +61
if axisSpec.name == "pl7.app/clustering/centroidId" {
return "antibody_tcr_legacy_bulk"
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Receptor detection fully deferred to sequence-column domains

Unlike pl7.app/vdj/cloneId / clonotypeKey, the centroidId axis domain carries no VDJ keys (pl7.app/vdj/receptor, pl7.app/vdj/chain), so resolveReceptor will always return seen: false from the axis-level check. Receptor is then determined solely by the d["pl7.app/vdj/chain"] lookup on each sequence column inside the for s in vdjCols loop. If the centroid sequence columns happen to omit that domain key — e.g. a bulk-clustering producer that does not propagate chain metadata — receptorSeen stays false, the default "IG" is used silently, and messages.receptorNotDetected() fires at line 323. The comment says "single-cell centroids still carry the chain domain on the sequence columns", so this is likely safe in practice, but a missing chain annotation on the centroid sequence columns would silently produce IG properties for what might be a TCR dataset.

Prompt To Fix With AI
This is a comment left during a code review.
Path: workflow/src/main.tpl.tengo
Line: 59-61

Comment:
**Receptor detection fully deferred to sequence-column domains**

Unlike `pl7.app/vdj/cloneId` / `clonotypeKey`, the `centroidId` axis domain carries no VDJ keys (`pl7.app/vdj/receptor`, `pl7.app/vdj/chain`), so `resolveReceptor` will always return `seen: false` from the axis-level check. Receptor is then determined solely by the `d["pl7.app/vdj/chain"]` lookup on each sequence column inside the `for s in vdjCols` loop. If the centroid sequence columns happen to omit that domain key — e.g. a bulk-clustering producer that does not propagate chain metadata — `receptorSeen` stays false, the default "IG" is used silently, and `messages.receptorNotDetected()` fires at line 323. The comment says "single-cell centroids still carry the chain domain on the sequence columns", so this is likely safe in practice, but a missing chain annotation on the centroid sequence columns would silently produce IG properties for what might be a TCR dataset.

How can I resolve this? If you propose a fix, please make it concise.

@AStaroverov AStaroverov force-pushed the feat/accept-single-axis-sequence-dataset branch from 3973eea to 8d8bc4c Compare June 15, 2026 14:14
The clonotype-clustering centroid dataset export is peptide-only, so detectMode now maps the pl7.app/clustering/centroidId axis to peptide mode (was antibody_tcr_legacy_bulk, which filtered by VDJ REQUIRED_FEATURES and crashed building an empty XSV).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@AStaroverov AStaroverov deleted the feat/accept-single-axis-sequence-dataset branch June 17, 2026 15:19
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