diff --git a/.changeset/per-cluster-centroid-dataset.md b/.changeset/per-cluster-centroid-dataset.md new file mode 100644 index 0000000..c65b688 --- /dev/null +++ b/.changeset/per-cluster-centroid-dataset.md @@ -0,0 +1,6 @@ +--- +"@platforma-open/milaboratories.sequence-properties.workflow": patch +"@platforma-open/milaboratories.sequence-properties.model": patch +--- + +Add support for per-cluster centroid datasets (clonotype-clustering). The model accepts a 2-axis `[sampleId, centroidId]` anchor, and the workflow processes the synthetic per-cluster consensus sequence in peptide mode (the upstream "Export consensus sequences as a dataset" feature is peptide-only, so the centroid sequence column is a peptide amino-acid column). diff --git a/model/src/index.ts b/model/src/index.ts index bc1eb47..0f9c56d 100644 --- a/model/src/index.ts +++ b/model/src/index.ts @@ -33,6 +33,16 @@ const inputAnchorSpecs = [ axes: [{ name: "pl7.app/sampleId" }, { name: "pl7.app/vdj/scClonotypeKey" }], annotations: { "pl7.app/isAnchor": "true" }, }, + // Per-cluster centroid dataset (clonotype-clustering). A clonotype-shaped 2-axis + // dataset where the row entity is a cluster: axis[0] = sampleId (real per-sample + // abundance anchor), axis[1] = "pl7.app/clustering/centroidId" (values = real + // clusterId) carrying the synthetic per-cluster centroid sequence. The dedicated + // centroidId axis (not the producer's plain clusterId) keeps anchoring here from + // pulling its clusters table's centroid_*/reference_centroid_* columns. + { + axes: [{ name: "pl7.app/sampleId" }, { name: "pl7.app/clustering/centroidId" }], + annotations: { "pl7.app/isAnchor": "true" }, + }, ]; export const platforma = BlockModelV3.create(blockDataModel) diff --git a/workflow/src/main.tpl.tengo b/workflow/src/main.tpl.tengo index 603fcf7..960105d 100644 --- a/workflow/src/main.tpl.tengo +++ b/workflow/src/main.tpl.tengo @@ -52,6 +52,17 @@ detectMode := func(axisSpec) { if axisSpec.name == "pl7.app/vdj/scClonotypeKey" { return "antibody_tcr_legacy_sc" } + // Per-cluster centroid dataset (clonotype-clustering): a synthetic 2-axis + // [sampleId, centroidId] anchor carrying one consensus sequence per cluster. The + // "Export consensus sequences as a dataset" feature is peptide-only (the producer + // gates the export on peptide inputs), so the centroid sequence column is a peptide + // aminoacid column (pl7.app/sequence, pl7.app/feature: "peptide") and the dataset is + // processed in peptide mode — the peptideSequences matcher in prepare() picks it up. + // NOTE: if VDJ/single-cell centroid export is ever re-enabled upstream, this must + // branch on the centroid sequence column's feature instead of assuming peptide. + if axisSpec.name == "pl7.app/clustering/centroidId" { + return "peptide" + } return "" }