Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"fixed": [
[
"@platforma-open/milaboratories.sort-seq-analysis.block",
"@platforma-open/milaboratories.sort-seq-analysis.model",
"@platforma-open/milaboratories.sort-seq-analysis.ui",
"@platforma-open/milaboratories.sort-seq-analysis.workflow"
]
],
"linked": [],
"access": "restricted",
"baseBranch": "main",
Expand Down
8 changes: 8 additions & 0 deletions .changeset/milab-7197-add-filter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@platforma-open/milaboratories.sort-seq-analysis.block": minor
"@platforma-open/milaboratories.sort-seq-analysis.model": minor
"@platforma-open/milaboratories.sort-seq-analysis.ui": minor
"@platforma-open/milaboratories.sort-seq-analysis.workflow": minor
---

Update the SDK and accept a subset filter (e.g. a Repertoire Labeling label) with the input dataset. The dataset list is built with buildDatasetOptions (requireEnrichments: false). The subset restricts the reads before the analysis, so gate frequencies, enrichments and mean bins are computed within the subset and differ from a full-data run; if the parent variant is outside the subset, Mean bin vs parent and the wild-type baseline are not produced. Outputs of a subset run carry pl7.app/inputSubset in their domain and a trace rooted in the subset, so their labels name it. Unfiltered runs are unchanged.
35 changes: 33 additions & 2 deletions model/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import {
BlockModelV3,
type BlockRenderCtx,
buildDatasetOptions,
createGlobalPObjectId,
createPFrameForGraphs,
createPlDataTableV3,
DataColumn,
type DatasetOption,
discoverTableColumnSnaphots,
type InferOutputsType,
isPColumnSpec,
type PColumn,
type PColumnSpec,
type PColumnValues,
Expand Down Expand Up @@ -227,6 +231,13 @@ function buildScoresTable(ctx: BlockRenderCtx<BlockArgs, BlockData>, alphabet: s
});
}

// Key axes of the datasets this block filters: bulk and single-cell clonotypes, and variants.
const DATASET_KEY_AXES: ReadonlySet<string> = new Set([
"pl7.app/vdj/clonotypeKey",
"pl7.app/vdj/scClonotypeKey",
"pl7.app/variantKey",
]);

export const platforma = BlockModelV3.create({ dataModel: blockDataModel, kind })
.args<BlockArgs>((data) => {
// Throwing disables Run but carries no reason to the user; `settingsIssues` names it.
Expand Down Expand Up @@ -267,15 +278,35 @@ export const platforma = BlockModelV3.create({ dataModel: blockDataModel, kind }
BASELINE_AVAILABLE && data.inputGate !== undefined && data.baseline === "sequence"
? data.baselineSequence
: undefined,
// The subset's canonical column id, which the workflow stamps as the outputs'
// `pl7.app/inputSubset`. Absent without a filter, so unfiltered args are unchanged.
...(data.filterRef !== undefined && {
inputFilter: createGlobalPObjectId(data.filterRef.blockId, data.filterRef.name),
}),
};
})

// ---------------------------------------------------------------------------
// Option lists. Four pickers, two predicates.
// ---------------------------------------------------------------------------

/** The anchor. Matched on axis count plus the two abundance annotations, never on a name. */
.output("abundanceOptions", (ctx) => ctx.resultPool.getOptions(isAbundanceAnchor))
/**
* The anchor. Matched on axis count plus the two abundance annotations, never on a name.
* Each carries its subset columns (e.g. Repertoire Labeling labels) as filters.
*/
.output(
"abundanceOptions",
(ctx): DatasetOption[] =>
buildDatasetOptions(ctx, {
primary: isAbundanceAnchor,
// Only subsets keyed by the dataset's key axis alone
filter: (spec) =>
isPColumnSpec(spec) &&
spec.axesSpec.length === 1 &&
DATASET_KEY_AXES.has(spec.axesSpec[0].name),
requireEnrichments: false,
}) ?? [],
)

/** Every per-sample metadata column in the anchor's context — one query, four consumers. */
.output("metadataColumns", (ctx) => {
Expand Down
4 changes: 4 additions & 0 deletions model/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,16 @@ export type BlockArgs = {
baseline?: BaselineOption;
/** 11. The variant key the `sequence` baseline names. Set only with that option. */
baselineSequence?: string;
/** The subset column's canonical id. Absent without a filter, so unfiltered args are unchanged. */
inputFilter?: string;
};

/** What the user edits. Projected to `BlockArgs` by the args lambda; view state never crosses. */
export type BlockData = {
// --- The seven arguments, in argument order ------------------------------
abundanceRef?: PlRef;
/** Subset column picked with the dataset in PlDatasetSelector (e.g. a Repertoire Labeling label). */
filterRef?: PlRef;
conditionColumnRef?: SUniversalPColumnId;
gateColumnRef?: SUniversalPColumnId;
/**
Expand Down
Loading
Loading