Skip to content

Fix downstream errors with range assembling features (Liabilities, Lead Selection)#87

Merged
aiturbidemil merged 7 commits into
mainfrom
fix-range-assembling-feature-aa-export
Jun 23, 2026
Merged

Fix downstream errors with range assembling features (Liabilities, Lead Selection)#87
aiturbidemil merged 7 commits into
mainfrom
fix-range-assembling-feature-aa-export

Conversation

@aiturbidemil

@aiturbidemil aiturbidemil commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Range assembling features previously exported the combined assembling-feature sequence only in nucleotide form (the clonotype key), with no aminoacid counterpart and without the main sequence flag. Downstream blocks broke as a result: Sequence Liabilities panicked ("No sequences found to determine the primary feature") because it needs an aminoacid column flagged isAssemblingFeature, and Lead Selection crashed because its mainSeqsVdj query found no column flagged isMainSequence.

This PR brings range assembling features in line with MiXCR Clonotyping:

  • Export the combined assembling feature sequence in amino acid form alongside the existing nucleotide column.
  • Flag both as isAssemblingFeature: true and isMainSequence: true.
  • Handle FR1:FR4 so its assembling feature flags land on the right column.

Fixes the Sequence Liabilities and Lead Selection errors for range assembling features, with and without germline imputation.

Greptile Summary

This PR fixes downstream breakage (Sequence Liabilities panic, Lead Selection crash) for range assembling features by exporting the combined aminoacid assembling-feature sequence column alongside the existing nucleotide column and flagging both with isAssemblingFeature: true and isMainSequence: true. A separate fix ensures the FR1:FR4 feature correctly anchors its flags to the VDJRegion column (the name MiXCR uses for that range) rather than the literal string "FR1:FR4", which never appears as an individual feature name in the export loop.

  • Range feature AA column added: A new aaSeq<feature> column is appended to columnsSpecPerClonotypeNoAggregates alongside the existing nSeq column in the needsAssemblingFeatureExport block, with both marked isAssemblingFeature: true / isMainSequence: true and the corresponding -aaFeature export arg added.
  • FR1:FR4 anchor alignment: anchorFeature is now normalized to outputProductiveFeature (\"VDJRegion\") when assemblingFeature == \"FR1:FR4\", so the flags land on the right column in the per-feature loop.
  • SDK dependency bumps: @platforma-sdk/workflow-tengo 6.3.0 → 6.6.4, @platforma-sdk/model / test / ui-vue 1.78.4 → 1.79.17, block-tools 2.10.5 → 2.11.2, tengo-builder 4.0.5 → 4.0.9.

Confidence Score: 4/5

The change is narrowly scoped to adding an aminoacid column for range assembling features and fixing the FR1:FR4 anchor alignment; the core export pipeline for CDR3 and VDJRegion is untouched.

The new aaSeq column is appended to columnsSpecPerClonotypeNoAggregates but not to aminoAcidSeqColumns, so the stop-codon replacement/filtering pass in mixcr-export.tpl.tengo skips it. In the common case this causes no visible problem, but the gap is real and worth closing.

workflow/src/calculate-export-specs.lib.tengo — the needsAssemblingFeatureExport block where the new aa column is constructed without updating aminoAcidSeqColumns.

Important Files Changed

Filename Overview
workflow/src/calculate-export-specs.lib.tengo Core logic fix: adds aaSeq assembling-feature column for range features, corrects isMainSequence flag on the nt column, and aligns FR1:FR4 anchorFeature to VDJRegion; new aa column is not added to aminoAcidSeqColumns, leaving stop-codon filtering incomplete for combined range sequences.
pnpm-workspace.yaml SDK catalog version bumps across all @platforma-sdk/* packages; no logic changes.
pnpm-lock.yaml Lock file regenerated to match pnpm-workspace.yaml catalog bumps; no code changes.
.changeset/some-birds-build.md New changeset entry recording a patch release for the aminoacid assembling-feature export fix.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[assemblingFeature input] --> B{is CDR3 or VDJRegion?}
    B -- Yes --> C[Standard path: flags set in feature loop]
    B -- No --> D{VDJRegion in imputed list?}
    D -- No / FR1:FR4 --> E[anchorFeature = VDJRegion\nFlags land on VDJRegion in loop]
    D -- Yes / sub-range --> F[needsAssemblingFeatureExport = true]
    F --> G[Add nSeq column\nisAssemblingFeature=true\nisMainSequence=true]
    F --> H[Add aaSeq column NEW\nisAssemblingFeature=true\nisMainSequence=true]
    F --> I[exportArgs += -nFeature\nexportArgs += -aaFeature NEW]
    G --> J[columnsSpecPerClonotypeNoAggregates]
    H --> J
    J --> K[columnsSpec returned to callers]
    K --> L[Sequence Liabilities\nfinds aaSeq with isAssemblingFeature]
    K --> M[Lead Selection\nfinds col with isMainSequence]
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A[assemblingFeature input] --> B{is CDR3 or VDJRegion?}
    B -- Yes --> C[Standard path: flags set in feature loop]
    B -- No --> D{VDJRegion in imputed list?}
    D -- No / FR1:FR4 --> E[anchorFeature = VDJRegion\nFlags land on VDJRegion in loop]
    D -- Yes / sub-range --> F[needsAssemblingFeatureExport = true]
    F --> G[Add nSeq column\nisAssemblingFeature=true\nisMainSequence=true]
    F --> H[Add aaSeq column NEW\nisAssemblingFeature=true\nisMainSequence=true]
    F --> I[exportArgs += -nFeature\nexportArgs += -aaFeature NEW]
    G --> J[columnsSpecPerClonotypeNoAggregates]
    H --> J
    J --> K[columnsSpec returned to callers]
    K --> L[Sequence Liabilities\nfinds aaSeq with isAssemblingFeature]
    K --> M[Lead Selection\nfinds col with isMainSequence]
Loading

Fix All in Claude Code

Prompt To Fix All With AI
Fix the following 2 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 2
workflow/src/calculate-export-specs.lib.tengo:280-282
The new `aaSeq` column is appended directly to `columnsSpecPerClonotypeNoAggregates` but is never added to `aminoAcidSeqColumns` (or `aminoAcidSeqColumnPairs`). In `mixcr-export.tpl.tengo`, `applyStopCodonReplacementsPt` iterates `aminoAcidSeqColumns` to apply stop-codon replacement and to build the filter that drops rows containing `*`. If the combined range sequence spans a feature boundary where a stop codon only appears in the joined region (not in any individual sub-feature), that row would pass through filtering undetected. Adding the column to `aminoAcidSeqColumns` here keeps the combined sequence subject to the same stop-codon rules as every other aminoacid column.

```suggestion
		// aa sibling: downstream blocks need an aminoacid assembling-feature column.
		aaColName := "aaSeq" + outputProductiveFeature
		aminoAcidSeqColumns += [ aaColName ]
		aminoAcidSeqColumnPairs += [ { aa: aaColName, nt: keyColName } ]
		columnsSpecPerClonotypeNoAggregates += [ {
```

### Issue 2 of 2
workflow/src/calculate-export-specs.lib.tengo:279-299
Both the nucleotide and aminoacid assembling-feature columns are assigned the same `orderPriority` value (`80100`). With identical priorities the display order between the two siblings is non-deterministic. Offsetting the aa column by a small amount ensures a stable ordering consistent with how other nt/aa pairs work in this file.

```suggestion
		} ]
		// aa sibling: downstream blocks need an aminoacid assembling-feature column.
		aaColName := "aaSeq" + outputProductiveFeature
		columnsSpecPerClonotypeNoAggregates += [ {
			column: aaColName,
			id: "aa-seq-" + featureIdL,
			naRegex: "region_not_covered",
			spec: {
				name: "pl7.app/vdj/sequence",
				valueType: "String",
				domain: {
					"pl7.app/vdj/feature": outputProductiveFeature,
					"pl7.app/alphabet": "aminoacid"
				},
				annotations: a(80099, false, {
					"pl7.app/vdj/isAssemblingFeature": "true",
					"pl7.app/vdj/isMainSequence": "true",
					"pl7.app/vdj/imputed": "false",
					"pl7.app/table/fontFamily": "monospace",
					"pl7.app/label": outputProductiveFeature + " aa"
				})
```

Reviews (1): Last reviewed commit: "changeset" | Re-trigger Greptile

Greptile also left 2 inline comments 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 resolves downstream Sequence Liabilities and Lead Selection errors by exporting the amino acid sequence for range assembling features. In calculate-export-specs.lib.tengo, the anchor feature is aligned for full-span ranges, the nucleotide sequence of the productive feature is marked as the main sequence, and a corresponding amino acid sequence column is exported. Feedback on the changes highlights that the newly added amino acid column is not appended to the aminoAcidSeqColumns and aminoAcidSeqColumnPairs arrays, which will prevent downstream stop codon replacements from being applied to this combined range column.

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 thread workflow/src/calculate-export-specs.lib.tengo
Comment thread workflow/src/calculate-export-specs.lib.tengo
Comment thread workflow/src/calculate-export-specs.lib.tengo
@aiturbidemil
aiturbidemil merged commit 40633e7 into main Jun 23, 2026
11 checks passed
@aiturbidemil
aiturbidemil deleted the fix-range-assembling-feature-aa-export branch June 23, 2026 21:11
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