@platforma-open/milaboratories.sequence-properties.model 1.2.2 → 1.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -27,38 +27,7 @@ const platforma = _platforma_sdk_model.BlockModelV3.create(require_dataModel.blo
27
27
  if (ctx.data.inputAnchor === void 0) return void 0;
28
28
  const ownCols = ctx.outputs?.resolve("propertiesPf")?.getPColumns();
29
29
  if (ownCols === void 0) return void 0;
30
- const info = ctx.outputs?.resolve("info")?.getDataAsJson();
31
- if (info === void 0) return void 0;
32
- const tier = info.coverageTier;
33
- const sources = [new _platforma_sdk_model.ArrayColumnProvider(ctx.resultPool.selectColumns((spec) => !spec.annotations?.[_platforma_sdk_model.Annotation.Trace]?.includes("milaboratories.sequence-properties"))), new _platforma_sdk_model.ArrayColumnProvider(ownCols)];
34
- return (0, _platforma_sdk_model.createPlDataTableV3)(ctx, {
35
- tableState: ctx.data.tableState,
36
- columns: {
37
- sources,
38
- anchors: { main: ctx.data.inputAnchor },
39
- selector: { mode: "enrichment" }
40
- },
41
- displayOptions: { visibility: [{
42
- match: (spec) => {
43
- if (spec.domain?.["pl7.app/vdj/scClonotypeChain/index"] === "secondary") return false;
44
- if (spec.domain?.["pl7.app/alphabet"] !== "aminoacid") return false;
45
- const isVdj = spec.name === "pl7.app/vdj/sequence";
46
- const isUniversal = spec.name === "pl7.app/sequence";
47
- if (!isVdj && !isUniversal) return false;
48
- const feature = isVdj ? spec.domain?.["pl7.app/vdj/feature"] : spec.domain?.["pl7.app/feature"];
49
- if (tier === "peptide") return isUniversal && feature === "peptide";
50
- const chain = spec.domain?.["pl7.app/vdj/scClonotypeChain"];
51
- if (chain !== void 0 && chain !== "A") return false;
52
- if (tier === "full_chain") return feature === "VDJRegion" || feature === "VDJRegionInFrame";
53
- if (tier === "cdr3_only" || tier === "partial") return feature === "CDR3";
54
- return false;
55
- },
56
- visibility: "default"
57
- }, {
58
- match: (spec) => !spec.annotations?.[_platforma_sdk_model.Annotation.Trace]?.includes("milaboratories.sequence-properties") && spec.annotations?.["pl7.app/isLinkerColumn"] !== "true" && spec.annotations?.["pl7.app/isOutput"] !== "true",
59
- visibility: "optional"
60
- }] }
61
- });
30
+ return (0, _platforma_sdk_model.createPlDataTableV2)(ctx, ownCols.filter((c) => c.spec.axesSpec.length === 1), ctx.data.tableState);
62
31
  }).outputWithStatus("propertiesPfHandle", (ctx) => {
63
32
  const allPCols = ctx.outputs?.resolve("propertiesPf")?.getPColumns();
64
33
  if (allPCols === void 0) return void 0;
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["BlockModelV3","blockDataModel","ArrayColumnProvider","Annotation"],"sources":["../src/index.ts"],"sourcesContent":["import type {\n ColumnSource,\n InferOutputsType,\n PColumnIdAndSpec,\n PFrameHandle,\n} from \"@platforma-sdk/model\";\nimport {\n Annotation,\n ArrayColumnProvider,\n BlockModelV3,\n createPFrameForGraphs,\n createPlDataTableV3,\n} from \"@platforma-sdk/model\";\nimport { blockDataModel } from \"./dataModel\";\nimport type { BlockArgs, WorkflowInfo } from \"./types\";\n\nexport type * from \"@milaboratories/helpers\";\nexport { blockDataModel } from \"./dataModel\";\nexport type { BlockArgs, BlockData, WorkflowInfo, WorkflowMode, WorkflowReceptor } from \"./types\";\n\nconst inputAnchorSpecs = [\n // Peptide mode — universal naming\n {\n axes: [{ name: \"pl7.app/sampleId\" }, { name: \"pl7.app/variantKey\" }],\n annotations: { \"pl7.app/isAnchor\": \"true\" },\n },\n // Antibody/TCR — legacy MiXCR bulk (cloneId per spec; clonotypeKey per current MiXCR output)\n {\n axes: [{ name: \"pl7.app/sampleId\" }, { name: \"pl7.app/vdj/cloneId\" }],\n annotations: { \"pl7.app/isAnchor\": \"true\" },\n },\n {\n axes: [{ name: \"pl7.app/sampleId\" }, { name: \"pl7.app/vdj/clonotypeKey\" }],\n annotations: { \"pl7.app/isAnchor\": \"true\" },\n },\n // Antibody/TCR — legacy MiXCR single-cell\n {\n axes: [{ name: \"pl7.app/sampleId\" }, { name: \"pl7.app/vdj/scClonotypeKey\" }],\n annotations: { \"pl7.app/isAnchor\": \"true\" },\n },\n];\n\nexport const platforma = BlockModelV3.create(blockDataModel)\n .args<BlockArgs>((data) => {\n if (data.inputAnchor === undefined) {\n throw new Error(\"Select an input dataset\");\n }\n return {\n inputAnchor: data.inputAnchor,\n };\n })\n .output(\"inputOptions\", (ctx) => ctx.resultPool.getOptions(inputAnchorSpecs))\n .output(\"inputSpec\", (ctx) =>\n ctx.data.inputAnchor ? ctx.resultPool.getPColumnSpecByRef(ctx.data.inputAnchor) : undefined,\n )\n .output(\"info\", (ctx) => ctx.outputs?.resolve(\"info\")?.getDataAsJson<WorkflowInfo>())\n .output(\"isRunning\", (ctx) => ctx.outputs?.getIsReadyOrError() === false)\n .output(\"processingLog\", (ctx) => ctx.outputs?.resolve(\"processingLog\")?.getLogHandle())\n .outputWithStatus(\"propertiesTable\", (ctx) => {\n if (ctx.data.inputAnchor === undefined) return undefined;\n const ownCols = ctx.outputs?.resolve(\"propertiesPf\")?.getPColumns();\n if (ownCols === undefined) return undefined;\n // `coverageTier` is set in workflow/main.tpl.tengo and surfaced via the\n // `info` JSON resource. Allowed values are defined in types.ts::WorkflowInfo.\n // Gate on `info` so the table renders consistently with the chosen aa\n // column rather than briefly without it while `info` is still resolving.\n const info = ctx.outputs?.resolve(\"info\")?.getDataAsJson<WorkflowInfo>();\n if (info === undefined) return undefined;\n const tier = info.coverageTier;\n\n // Build sources explicitly: upstream cols from the result pool minus\n // anything traced back to this block, plus this block's own cols from\n // `propertiesPf`. The workflow also publishes `exports.properties` —\n // a blockId-stamped score-only variant for downstream consumers like\n // Lead Selection — into the result pool. Filtering by trace excludes\n // it here so score cols don't duplicate the propertiesPf variant.\n const upstreamCols = ctx.resultPool.selectColumns(\n (spec) =>\n !spec.annotations?.[Annotation.Trace]?.includes(\"milaboratories.sequence-properties\"),\n );\n const sources: ColumnSource[] = [\n new ArrayColumnProvider(upstreamCols),\n new ArrayColumnProvider(ownCols),\n ];\n\n return createPlDataTableV3(ctx, {\n tableState: ctx.data.tableState,\n columns: {\n sources,\n anchors: { main: ctx.data.inputAnchor },\n selector: { mode: \"enrichment\" },\n },\n // Default-visible: this block's columns + a single source amino-acid\n // sequence column matching the analysed coverage tier. Reviewer asked\n // for one sequence next to the properties — full-chain VDJRegion when\n // available (it contains the CDR3); CDR3 alone when that is all the\n // input has; peptide for peptide mode. Chain A (heavy / alpha / gamma)\n // only — chain B stays available via the column picker. Other upstream\n // cols → optional. This block's cols fall through unmatched and keep\n // their workflow-time `pl7.app/table/visibility` annotation.\n displayOptions: {\n visibility: [\n {\n match: (spec) => {\n if (spec.domain?.[\"pl7.app/vdj/scClonotypeChain/index\"] === \"secondary\") {\n return false;\n }\n if (spec.domain?.[\"pl7.app/alphabet\"] !== \"aminoacid\") return false;\n\n const isVdj = spec.name === \"pl7.app/vdj/sequence\";\n const isUniversal = spec.name === \"pl7.app/sequence\";\n if (!isVdj && !isUniversal) return false;\n\n const feature = isVdj\n ? spec.domain?.[\"pl7.app/vdj/feature\"]\n : spec.domain?.[\"pl7.app/feature\"];\n\n if (tier === \"peptide\") {\n return isUniversal && feature === \"peptide\";\n }\n\n const chain = spec.domain?.[\"pl7.app/vdj/scClonotypeChain\"];\n if (chain !== undefined && chain !== \"A\") return false;\n\n if (tier === \"full_chain\") {\n return feature === \"VDJRegion\" || feature === \"VDJRegionInFrame\";\n }\n if (tier === \"cdr3_only\" || tier === \"partial\") {\n return feature === \"CDR3\";\n }\n return false;\n },\n visibility: \"default\",\n },\n {\n match: (spec) =>\n !spec.annotations?.[Annotation.Trace]?.includes(\n \"milaboratories.sequence-properties\",\n ) &&\n spec.annotations?.[\"pl7.app/isLinkerColumn\"] !== \"true\" &&\n spec.annotations?.[\"pl7.app/isOutput\"] !== \"true\",\n visibility: \"optional\",\n },\n ],\n },\n });\n })\n .outputWithStatus(\"propertiesPfHandle\", (ctx): PFrameHandle | undefined => {\n const allPCols = ctx.outputs?.resolve(\"propertiesPf\")?.getPColumns();\n if (allPCols === undefined) return undefined;\n // Drop the AA fraction column from the pframe entirely. Two-axis\n // (variantKey × aminoAcid), at 50k peptides ~1M cells — enough to trip\n // graph-maker's cell-count guard on its own. The picker already excludes\n // it via `isNumericScalar` (axesSpec.length === 1), so the data was\n // pure overhead.\n const pCols = allPCols.filter((c) => c.spec.name !== \"pl7.app/aaFraction\");\n // Use `ctx.createPFrame` instead of `createPFrameForGraphs`. The latter\n // walks the result pool and pulls in this block's `exports.properties`\n // — a `trace.inject`-stamped re-emission of every column already in\n // `propertiesPf`, published for Lead Selection — so axis dropdowns\n // show e.g. \"Net Charge (pH7) / IG\" twice. Same workaround chosen by\n // cdr3-spectratype, batch-correction, cell-type-annotation, and\n // dimensionality-reduction.\n //\n // Pull single-axis metadata anchored to the input dataset's two axes\n // (idx 0 = sample, idx 1 = entity key) so sample groups / patient IDs /\n // peptide abundance and similar cols remain available for grouping and\n // filtering. Drop self-trace to keep our own exports out.\n const inputAnchor = ctx.data.inputAnchor;\n const upstreamMeta =\n inputAnchor !== undefined\n ? (\n ctx.resultPool.getAnchoredPColumns({ main: inputAnchor }, [\n { axes: [{ anchor: \"main\", idx: 0 }] },\n { axes: [{ anchor: \"main\", idx: 1 }] },\n ]) ?? []\n ).filter(\n (c) =>\n !c.spec.annotations?.[Annotation.Trace]?.includes(\n \"milaboratories.sequence-properties\",\n ),\n )\n : [];\n return createPFrameForGraphs(ctx, [...pCols, ...upstreamMeta]);\n })\n .output(\"propertiesPfCols\", (ctx): PColumnIdAndSpec[] | undefined => {\n const pCols = ctx.outputs?.resolve(\"propertiesPf\")?.getPColumns();\n if (pCols === undefined) return undefined;\n return pCols.map((c) => ({ columnId: c.id, spec: c.spec }) satisfies PColumnIdAndSpec);\n })\n .title(() => \"Sequence Properties\")\n .subtitle((ctx) => ctx.data.defaultBlockLabel ?? \"\")\n .sections(() => [\n { type: \"link\", href: \"/\", label: \"Main\" },\n { type: \"link\", href: \"/scatter\", label: \"Property Relationships\" },\n { type: \"link\", href: \"/histogram\", label: \"Property Distribution\" },\n ])\n .done();\n\nexport type BlockOutputs = InferOutputsType<typeof platforma>;\n"],"mappings":";;;;AAoBA,MAAM,mBAAmB;CAEvB;EACE,MAAM,CAAC,EAAE,MAAM,oBAAoB,EAAE,EAAE,MAAM,sBAAsB,CAAC;EACpE,aAAa,EAAE,oBAAoB,QAAQ;EAC5C;CAED;EACE,MAAM,CAAC,EAAE,MAAM,oBAAoB,EAAE,EAAE,MAAM,uBAAuB,CAAC;EACrE,aAAa,EAAE,oBAAoB,QAAQ;EAC5C;CACD;EACE,MAAM,CAAC,EAAE,MAAM,oBAAoB,EAAE,EAAE,MAAM,4BAA4B,CAAC;EAC1E,aAAa,EAAE,oBAAoB,QAAQ;EAC5C;CAED;EACE,MAAM,CAAC,EAAE,MAAM,oBAAoB,EAAE,EAAE,MAAM,8BAA8B,CAAC;EAC5E,aAAa,EAAE,oBAAoB,QAAQ;EAC5C;CACF;AAED,MAAa,YAAYA,qBAAAA,aAAa,OAAOC,kBAAAA,eAAe,CACzD,MAAiB,SAAS;AACzB,KAAI,KAAK,gBAAgB,KAAA,EACvB,OAAM,IAAI,MAAM,0BAA0B;AAE5C,QAAO,EACL,aAAa,KAAK,aACnB;EACD,CACD,OAAO,iBAAiB,QAAQ,IAAI,WAAW,WAAW,iBAAiB,CAAC,CAC5E,OAAO,cAAc,QACpB,IAAI,KAAK,cAAc,IAAI,WAAW,oBAAoB,IAAI,KAAK,YAAY,GAAG,KAAA,EACnF,CACA,OAAO,SAAS,QAAQ,IAAI,SAAS,QAAQ,OAAO,EAAE,eAA6B,CAAC,CACpF,OAAO,cAAc,QAAQ,IAAI,SAAS,mBAAmB,KAAK,MAAM,CACxE,OAAO,kBAAkB,QAAQ,IAAI,SAAS,QAAQ,gBAAgB,EAAE,cAAc,CAAC,CACvF,iBAAiB,oBAAoB,QAAQ;AAC5C,KAAI,IAAI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DataModel","Annotation"],"sources":["../src/index.ts"],"sourcesContent":["import type { InferOutputsType, PColumnIdAndSpec, PFrameHandle } from \"@platforma-sdk/model\";\nimport {\n Annotation,\n BlockModelV3,\n createPFrameForGraphs,\n createPlDataTableV2,\n} from \"@platforma-sdk/model\";\nimport { blockDataModel } from \"./dataModel\";\nimport type { BlockArgs, WorkflowInfo } from \"./types\";\n\nexport type * from \"@milaboratories/helpers\";\nexport { blockDataModel } from \"./dataModel\";\nexport type { BlockArgs, BlockData, WorkflowInfo, WorkflowMode, WorkflowReceptor } from \"./types\";\n\nconst inputAnchorSpecs = [\n // Peptide mode — universal naming\n {\n axes: [{ name: \"pl7.app/sampleId\" }, { name: \"pl7.app/variantKey\" }],\n annotations: { \"pl7.app/isAnchor\": \"true\" },\n },\n // Antibody/TCR — legacy MiXCR bulk (cloneId per spec; clonotypeKey per current MiXCR output)\n {\n axes: [{ name: \"pl7.app/sampleId\" }, { name: \"pl7.app/vdj/cloneId\" }],\n annotations: { \"pl7.app/isAnchor\": \"true\" },\n },\n {\n axes: [{ name: \"pl7.app/sampleId\" }, { name: \"pl7.app/vdj/clonotypeKey\" }],\n annotations: { \"pl7.app/isAnchor\": \"true\" },\n },\n // Antibody/TCR — legacy MiXCR single-cell\n {\n axes: [{ name: \"pl7.app/sampleId\" }, { name: \"pl7.app/vdj/scClonotypeKey\" }],\n annotations: { \"pl7.app/isAnchor\": \"true\" },\n },\n];\n\nexport const platforma = BlockModelV3.create(blockDataModel)\n .args<BlockArgs>((data) => {\n if (data.inputAnchor === undefined) {\n throw new Error(\"Select an input dataset\");\n }\n return {\n inputAnchor: data.inputAnchor,\n };\n })\n .output(\"inputOptions\", (ctx) => ctx.resultPool.getOptions(inputAnchorSpecs))\n .output(\"inputSpec\", (ctx) =>\n ctx.data.inputAnchor ? ctx.resultPool.getPColumnSpecByRef(ctx.data.inputAnchor) : undefined,\n )\n .output(\"info\", (ctx) => ctx.outputs?.resolve(\"info\")?.getDataAsJson<WorkflowInfo>())\n .output(\"isRunning\", (ctx) => ctx.outputs?.getIsReadyOrError() === false)\n .output(\"processingLog\", (ctx) => ctx.outputs?.resolve(\"processingLog\")?.getLogHandle())\n .outputWithStatus(\"propertiesTable\", (ctx) => {\n if (ctx.data.inputAnchor === undefined) return undefined;\n const ownCols = ctx.outputs?.resolve(\"propertiesPf\")?.getPColumns();\n if (ownCols === undefined) return undefined;\n // Temporary downgrade to V2 with a fixed, propertiesPf-only column list.\n // V3 default-visibility rules and the column picker are not yet stable for\n // the multi-source layout this block needs (upstream sequence column +\n // own scalar properties). Once V3 supports it natively, rewire across\n // blocks. aaFraction is 2-axis (variantKey × aminoAcid) — already filtered\n // from the graph pFrame; filtered here too so it doesn't widen the table.\n const tableCols = ownCols.filter((c) => c.spec.axesSpec.length === 1);\n return createPlDataTableV2(ctx, tableCols, ctx.data.tableState);\n })\n .outputWithStatus(\"propertiesPfHandle\", (ctx): PFrameHandle | undefined => {\n const allPCols = ctx.outputs?.resolve(\"propertiesPf\")?.getPColumns();\n if (allPCols === undefined) return undefined;\n // Drop the AA fraction column from the pframe entirely. Two-axis\n // (variantKey × aminoAcid), at 50k peptides ~1M cells — enough to trip\n // graph-maker's cell-count guard on its own. The picker already excludes\n // it via `isNumericScalar` (axesSpec.length === 1), so the data was\n // pure overhead.\n const pCols = allPCols.filter((c) => c.spec.name !== \"pl7.app/aaFraction\");\n // Use `ctx.createPFrame` instead of `createPFrameForGraphs`. The latter\n // walks the result pool and pulls in this block's `exports.properties`\n // — a `trace.inject`-stamped re-emission of every column already in\n // `propertiesPf`, published for Lead Selection — so axis dropdowns\n // show e.g. \"Net Charge (pH7) / IG\" twice. Same workaround chosen by\n // cdr3-spectratype, batch-correction, cell-type-annotation, and\n // dimensionality-reduction.\n //\n // Pull single-axis metadata anchored to the input dataset's two axes\n // (idx 0 = sample, idx 1 = entity key) so sample groups / patient IDs /\n // peptide abundance and similar cols remain available for grouping and\n // filtering. Drop self-trace to keep our own exports out.\n const inputAnchor = ctx.data.inputAnchor;\n const upstreamMeta =\n inputAnchor !== undefined\n ? (\n ctx.resultPool.getAnchoredPColumns({ main: inputAnchor }, [\n { axes: [{ anchor: \"main\", idx: 0 }] },\n { axes: [{ anchor: \"main\", idx: 1 }] },\n ]) ?? []\n ).filter(\n (c) =>\n !c.spec.annotations?.[Annotation.Trace]?.includes(\n \"milaboratories.sequence-properties\",\n ),\n )\n : [];\n return createPFrameForGraphs(ctx, [...pCols, ...upstreamMeta]);\n })\n .output(\"propertiesPfCols\", (ctx): PColumnIdAndSpec[] | undefined => {\n const pCols = ctx.outputs?.resolve(\"propertiesPf\")?.getPColumns();\n if (pCols === undefined) return undefined;\n return pCols.map((c) => ({ columnId: c.id, spec: c.spec }) satisfies PColumnIdAndSpec);\n })\n .title(() => \"Sequence Properties\")\n .subtitle((ctx) => ctx.data.defaultBlockLabel ?? \"\")\n .sections(() => [\n { type: \"link\", href: \"/\", label: \"Main\" },\n { type: \"link\", href: \"/scatter\", label: \"Property Relationships\" },\n { type: \"link\", href: \"/histogram\", label: \"Property Distribution\" },\n ])\n .done();\n\nexport type BlockOutputs = InferOutputsType<typeof platforma>;\n"],"mappings":";;;;AAcA,MAAM,mBAAmB;CAEvB;EACE,MAAM,CAAC,EAAE,MAAM,oBAAoB,EAAE,EAAE,MAAM,sBAAsB,CAAC;EACpE,aAAa,EAAE,oBAAoB,QAAQ;EAC5C;CAED;EACE,MAAM,CAAC,EAAE,MAAM,oBAAoB,EAAE,EAAE,MAAM,uBAAuB,CAAC;EACrE,aAAa,EAAE,oBAAoB,QAAQ;EAC5C;CACD;EACE,MAAM,CAAC,EAAE,MAAM,oBAAoB,EAAE,EAAE,MAAM,4BAA4B,CAAC;EAC1E,aAAa,EAAE,oBAAoB,QAAQ;EAC5C;CAED;EACE,MAAM,CAAC,EAAE,MAAM,oBAAoB,EAAE,EAAE,MAAM,8BAA8B,CAAC;EAC5E,aAAa,EAAE,oBAAoB,QAAQ;EAC5C;CACF;AAED,MAAa,YAAYA,q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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yCAAA,uBAAA,CAAA,sBAAA;AAAA,KAiFV,YAAA,GAAe,gBAAA,QAAwB,SAAA"}
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { blockDataModel } from "./dataModel.js";
2
- import { Annotation, ArrayColumnProvider, BlockModelV3, createPFrameForGraphs, createPlDataTableV3 } from "@platforma-sdk/model";
2
+ import { Annotation, BlockModelV3, createPFrameForGraphs, createPlDataTableV2 } from "@platforma-sdk/model";
3
3
  //#region src/index.ts
4
4
  const inputAnchorSpecs = [
5
5
  {
@@ -26,38 +26,7 @@ const platforma = BlockModelV3.create(blockDataModel).args((data) => {
26
26
  if (ctx.data.inputAnchor === void 0) return void 0;
27
27
  const ownCols = ctx.outputs?.resolve("propertiesPf")?.getPColumns();
28
28
  if (ownCols === void 0) return void 0;
29
- const info = ctx.outputs?.resolve("info")?.getDataAsJson();
30
- if (info === void 0) return void 0;
31
- const tier = info.coverageTier;
32
- const sources = [new ArrayColumnProvider(ctx.resultPool.selectColumns((spec) => !spec.annotations?.[Annotation.Trace]?.includes("milaboratories.sequence-properties"))), new ArrayColumnProvider(ownCols)];
33
- return createPlDataTableV3(ctx, {
34
- tableState: ctx.data.tableState,
35
- columns: {
36
- sources,
37
- anchors: { main: ctx.data.inputAnchor },
38
- selector: { mode: "enrichment" }
39
- },
40
- displayOptions: { visibility: [{
41
- match: (spec) => {
42
- if (spec.domain?.["pl7.app/vdj/scClonotypeChain/index"] === "secondary") return false;
43
- if (spec.domain?.["pl7.app/alphabet"] !== "aminoacid") return false;
44
- const isVdj = spec.name === "pl7.app/vdj/sequence";
45
- const isUniversal = spec.name === "pl7.app/sequence";
46
- if (!isVdj && !isUniversal) return false;
47
- const feature = isVdj ? spec.domain?.["pl7.app/vdj/feature"] : spec.domain?.["pl7.app/feature"];
48
- if (tier === "peptide") return isUniversal && feature === "peptide";
49
- const chain = spec.domain?.["pl7.app/vdj/scClonotypeChain"];
50
- if (chain !== void 0 && chain !== "A") return false;
51
- if (tier === "full_chain") return feature === "VDJRegion" || feature === "VDJRegionInFrame";
52
- if (tier === "cdr3_only" || tier === "partial") return feature === "CDR3";
53
- return false;
54
- },
55
- visibility: "default"
56
- }, {
57
- match: (spec) => !spec.annotations?.[Annotation.Trace]?.includes("milaboratories.sequence-properties") && spec.annotations?.["pl7.app/isLinkerColumn"] !== "true" && spec.annotations?.["pl7.app/isOutput"] !== "true",
58
- visibility: "optional"
59
- }] }
60
- });
29
+ return createPlDataTableV2(ctx, ownCols.filter((c) => c.spec.axesSpec.length === 1), ctx.data.tableState);
61
30
  }).outputWithStatus("propertiesPfHandle", (ctx) => {
62
31
  const allPCols = ctx.outputs?.resolve("propertiesPf")?.getPColumns();
63
32
  if (allPCols === void 0) return void 0;
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import type {\n ColumnSource,\n InferOutputsType,\n PColumnIdAndSpec,\n PFrameHandle,\n} from \"@platforma-sdk/model\";\nimport {\n Annotation,\n ArrayColumnProvider,\n BlockModelV3,\n createPFrameForGraphs,\n createPlDataTableV3,\n} from \"@platforma-sdk/model\";\nimport { blockDataModel } from \"./dataModel\";\nimport type { BlockArgs, WorkflowInfo } from \"./types\";\n\nexport type * from \"@milaboratories/helpers\";\nexport { blockDataModel } from \"./dataModel\";\nexport type { BlockArgs, BlockData, WorkflowInfo, WorkflowMode, WorkflowReceptor } from \"./types\";\n\nconst inputAnchorSpecs = [\n // Peptide mode — universal naming\n {\n axes: [{ name: \"pl7.app/sampleId\" }, { name: \"pl7.app/variantKey\" }],\n annotations: { \"pl7.app/isAnchor\": \"true\" },\n },\n // Antibody/TCR — legacy MiXCR bulk (cloneId per spec; clonotypeKey per current MiXCR output)\n {\n axes: [{ name: \"pl7.app/sampleId\" }, { name: \"pl7.app/vdj/cloneId\" }],\n annotations: { \"pl7.app/isAnchor\": \"true\" },\n },\n {\n axes: [{ name: \"pl7.app/sampleId\" }, { name: \"pl7.app/vdj/clonotypeKey\" }],\n annotations: { \"pl7.app/isAnchor\": \"true\" },\n },\n // Antibody/TCR — legacy MiXCR single-cell\n {\n axes: [{ name: \"pl7.app/sampleId\" }, { name: \"pl7.app/vdj/scClonotypeKey\" }],\n annotations: { \"pl7.app/isAnchor\": \"true\" },\n },\n];\n\nexport const platforma = BlockModelV3.create(blockDataModel)\n .args<BlockArgs>((data) => {\n if (data.inputAnchor === undefined) {\n throw new Error(\"Select an input dataset\");\n }\n return {\n inputAnchor: data.inputAnchor,\n };\n })\n .output(\"inputOptions\", (ctx) => ctx.resultPool.getOptions(inputAnchorSpecs))\n .output(\"inputSpec\", (ctx) =>\n ctx.data.inputAnchor ? ctx.resultPool.getPColumnSpecByRef(ctx.data.inputAnchor) : undefined,\n )\n .output(\"info\", (ctx) => ctx.outputs?.resolve(\"info\")?.getDataAsJson<WorkflowInfo>())\n .output(\"isRunning\", (ctx) => ctx.outputs?.getIsReadyOrError() === false)\n .output(\"processingLog\", (ctx) => ctx.outputs?.resolve(\"processingLog\")?.getLogHandle())\n .outputWithStatus(\"propertiesTable\", (ctx) => {\n if (ctx.data.inputAnchor === undefined) return undefined;\n const ownCols = ctx.outputs?.resolve(\"propertiesPf\")?.getPColumns();\n if (ownCols === undefined) return undefined;\n // `coverageTier` is set in workflow/main.tpl.tengo and surfaced via the\n // `info` JSON resource. Allowed values are defined in types.ts::WorkflowInfo.\n // Gate on `info` so the table renders consistently with the chosen aa\n // column rather than briefly without it while `info` is still resolving.\n const info = ctx.outputs?.resolve(\"info\")?.getDataAsJson<WorkflowInfo>();\n if (info === undefined) return undefined;\n const tier = info.coverageTier;\n\n // Build sources explicitly: upstream cols from the result pool minus\n // anything traced back to this block, plus this block's own cols from\n // `propertiesPf`. The workflow also publishes `exports.properties` —\n // a blockId-stamped score-only variant for downstream consumers like\n // Lead Selection — into the result pool. Filtering by trace excludes\n // it here so score cols don't duplicate the propertiesPf variant.\n const upstreamCols = ctx.resultPool.selectColumns(\n (spec) =>\n !spec.annotations?.[Annotation.Trace]?.includes(\"milaboratories.sequence-properties\"),\n );\n const sources: ColumnSource[] = [\n new ArrayColumnProvider(upstreamCols),\n new ArrayColumnProvider(ownCols),\n ];\n\n return createPlDataTableV3(ctx, {\n tableState: ctx.data.tableState,\n columns: {\n sources,\n anchors: { main: ctx.data.inputAnchor },\n selector: { mode: \"enrichment\" },\n },\n // Default-visible: this block's columns + a single source amino-acid\n // sequence column matching the analysed coverage tier. Reviewer asked\n // for one sequence next to the properties — full-chain VDJRegion when\n // available (it contains the CDR3); CDR3 alone when that is all the\n // input has; peptide for peptide mode. Chain A (heavy / alpha / gamma)\n // only — chain B stays available via the column picker. Other upstream\n // cols → optional. This block's cols fall through unmatched and keep\n // their workflow-time `pl7.app/table/visibility` annotation.\n displayOptions: {\n visibility: [\n {\n match: (spec) => {\n if (spec.domain?.[\"pl7.app/vdj/scClonotypeChain/index\"] === \"secondary\") {\n return false;\n }\n if (spec.domain?.[\"pl7.app/alphabet\"] !== \"aminoacid\") return false;\n\n const isVdj = spec.name === \"pl7.app/vdj/sequence\";\n const isUniversal = spec.name === \"pl7.app/sequence\";\n if (!isVdj && !isUniversal) return false;\n\n const feature = isVdj\n ? spec.domain?.[\"pl7.app/vdj/feature\"]\n : spec.domain?.[\"pl7.app/feature\"];\n\n if (tier === \"peptide\") {\n return isUniversal && feature === \"peptide\";\n }\n\n const chain = spec.domain?.[\"pl7.app/vdj/scClonotypeChain\"];\n if (chain !== undefined && chain !== \"A\") return false;\n\n if (tier === \"full_chain\") {\n return feature === \"VDJRegion\" || feature === \"VDJRegionInFrame\";\n }\n if (tier === \"cdr3_only\" || tier === \"partial\") {\n return feature === \"CDR3\";\n }\n return false;\n },\n visibility: \"default\",\n },\n {\n match: (spec) =>\n !spec.annotations?.[Annotation.Trace]?.includes(\n \"milaboratories.sequence-properties\",\n ) &&\n spec.annotations?.[\"pl7.app/isLinkerColumn\"] !== \"true\" &&\n spec.annotations?.[\"pl7.app/isOutput\"] !== \"true\",\n visibility: \"optional\",\n },\n ],\n },\n });\n })\n .outputWithStatus(\"propertiesPfHandle\", (ctx): PFrameHandle | undefined => {\n const allPCols = ctx.outputs?.resolve(\"propertiesPf\")?.getPColumns();\n if (allPCols === undefined) return undefined;\n // Drop the AA fraction column from the pframe entirely. Two-axis\n // (variantKey × aminoAcid), at 50k peptides ~1M cells — enough to trip\n // graph-maker's cell-count guard on its own. The picker already excludes\n // it via `isNumericScalar` (axesSpec.length === 1), so the data was\n // pure overhead.\n const pCols = allPCols.filter((c) => c.spec.name !== \"pl7.app/aaFraction\");\n // Use `ctx.createPFrame` instead of `createPFrameForGraphs`. The latter\n // walks the result pool and pulls in this block's `exports.properties`\n // — a `trace.inject`-stamped re-emission of every column already in\n // `propertiesPf`, published for Lead Selection — so axis dropdowns\n // show e.g. \"Net Charge (pH7) / IG\" twice. Same workaround chosen by\n // cdr3-spectratype, batch-correction, cell-type-annotation, and\n // dimensionality-reduction.\n //\n // Pull single-axis metadata anchored to the input dataset's two axes\n // (idx 0 = sample, idx 1 = entity key) so sample groups / patient IDs /\n // peptide abundance and similar cols remain available for grouping and\n // filtering. Drop self-trace to keep our own exports out.\n const inputAnchor = ctx.data.inputAnchor;\n const upstreamMeta =\n inputAnchor !== undefined\n ? (\n ctx.resultPool.getAnchoredPColumns({ main: inputAnchor }, [\n { axes: [{ anchor: \"main\", idx: 0 }] },\n { axes: [{ anchor: \"main\", idx: 1 }] },\n ]) ?? []\n ).filter(\n (c) =>\n !c.spec.annotations?.[Annotation.Trace]?.includes(\n \"milaboratories.sequence-properties\",\n ),\n )\n : [];\n return createPFrameForGraphs(ctx, [...pCols, ...upstreamMeta]);\n })\n .output(\"propertiesPfCols\", (ctx): PColumnIdAndSpec[] | undefined => {\n const pCols = ctx.outputs?.resolve(\"propertiesPf\")?.getPColumns();\n if (pCols === undefined) return undefined;\n return pCols.map((c) => ({ columnId: c.id, spec: c.spec }) satisfies PColumnIdAndSpec);\n })\n .title(() => \"Sequence Properties\")\n .subtitle((ctx) => ctx.data.defaultBlockLabel ?? \"\")\n .sections(() => [\n { type: \"link\", href: \"/\", label: \"Main\" },\n { type: \"link\", href: \"/scatter\", label: \"Property Relationships\" },\n { type: \"link\", href: \"/histogram\", label: \"Property Distribution\" },\n ])\n .done();\n\nexport type BlockOutputs = InferOutputsType<typeof platforma>;\n"],"mappings":";;;AAoBA,MAAM,mBAAmB;CAEvB;EACE,MAAM,CAAC,EAAE,MAAM,oBAAoB,EAAE,EAAE,MAAM,sBAAsB,CAAC;EACpE,aAAa,EAAE,oBAAoB,QAAQ;EAC5C;CAED;EACE,MAAM,CAAC,EAAE,MAAM,oBAAoB,EAAE,EAAE,MAAM,uBAAuB,CAAC;EACrE,aAAa,EAAE,oBAAoB,QAAQ;EAC5C;CACD;EACE,MAAM,CAAC,EAAE,MAAM,oBAAoB,EAAE,EAAE,MAAM,4BAA4B,CAAC;EAC1E,aAAa,EAAE,oBAAoB,QAAQ;EAC5C;CAED;EACE,MAAM,CAAC,EAAE,MAAM,oBAAoB,EAAE,EAAE,MAAM,8BAA8B,CAAC;EAC5E,aAAa,EAAE,oBAAoB,QAAQ;EAC5C;CACF;AAED,MAAa,YAAY,aAAa,OAAO,eAAe,CACzD,MAAiB,SAAS;AACzB,KAAI,KAAK,gBAAgB,KAAA,EACvB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AAA,EAAW,QAAO,KAAA;AAChC,QAAO,MAAM,KAAK,OAAO;EAAE,UAAU,EAAE;EAAI,MAAM,EAAE;EAAM,EAA6B;EACtF,CACD,YAAY,sBAAsB,CAClC,UAAU,QAAQ,IAAI,KAAK,qBAAqB,GAAG,CACnD,eAAe;CACd;EAAE,MAAM;EAAQ,MAAM;EAAK,OAAO;EAAQ;CAC1C;EAAE,MAAM;EAAQ,MAAM;EAAY,OAAO;EAA0B;CACnE;EAAE,MAAM;EAAQ,MAAM;EAAc,OAAO;EAAyB;CACrE,CAAC,CACD,MAAM"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import type { InferOutputsType, PColumnIdAndSpec, PFrameHandle } from \"@platforma-sdk/model\";\nimport {\n Annotation,\n BlockModelV3,\n createPFrameForGraphs,\n createPlDataTableV2,\n} from \"@platforma-sdk/model\";\nimport { blockDataModel } from \"./dataModel\";\nimport type { BlockArgs, WorkflowInfo } from \"./types\";\n\nexport type * from \"@milaboratories/helpers\";\nexport { blockDataModel } from \"./dataModel\";\nexport type { BlockArgs, BlockData, WorkflowInfo, WorkflowMode, WorkflowReceptor } from \"./types\";\n\nconst inputAnchorSpecs = [\n // Peptide mode — universal naming\n {\n axes: [{ name: \"pl7.app/sampleId\" }, { name: \"pl7.app/variantKey\" }],\n annotations: { \"pl7.app/isAnchor\": \"true\" },\n },\n // Antibody/TCR — legacy MiXCR bulk (cloneId per spec; clonotypeKey per current MiXCR output)\n {\n axes: [{ name: \"pl7.app/sampleId\" }, { name: \"pl7.app/vdj/cloneId\" }],\n annotations: { \"pl7.app/isAnchor\": \"true\" },\n },\n {\n axes: [{ name: \"pl7.app/sampleId\" }, { name: \"pl7.app/vdj/clonotypeKey\" }],\n annotations: { \"pl7.app/isAnchor\": \"true\" },\n },\n // Antibody/TCR — legacy MiXCR single-cell\n {\n axes: [{ name: \"pl7.app/sampleId\" }, { name: \"pl7.app/vdj/scClonotypeKey\" }],\n annotations: { \"pl7.app/isAnchor\": \"true\" },\n },\n];\n\nexport const platforma = BlockModelV3.create(blockDataModel)\n .args<BlockArgs>((data) => {\n if (data.inputAnchor === undefined) {\n throw new Error(\"Select an input dataset\");\n }\n return {\n inputAnchor: data.inputAnchor,\n };\n })\n .output(\"inputOptions\", (ctx) => ctx.resultPool.getOptions(inputAnchorSpecs))\n .output(\"inputSpec\", (ctx) =>\n ctx.data.inputAnchor ? ctx.resultPool.getPColumnSpecByRef(ctx.data.inputAnchor) : undefined,\n )\n .output(\"info\", (ctx) => ctx.outputs?.resolve(\"info\")?.getDataAsJson<WorkflowInfo>())\n .output(\"isRunning\", (ctx) => ctx.outputs?.getIsReadyOrError() === false)\n .output(\"processingLog\", (ctx) => ctx.outputs?.resolve(\"processingLog\")?.getLogHandle())\n .outputWithStatus(\"propertiesTable\", (ctx) => {\n if (ctx.data.inputAnchor === undefined) return undefined;\n const ownCols = ctx.outputs?.resolve(\"propertiesPf\")?.getPColumns();\n if (ownCols === undefined) return undefined;\n // Temporary downgrade to V2 with a fixed, propertiesPf-only column list.\n // V3 default-visibility rules and the column picker are not yet stable for\n // the multi-source layout this block needs (upstream sequence column +\n // own scalar properties). Once V3 supports it natively, rewire across\n // blocks. aaFraction is 2-axis (variantKey × aminoAcid) — already filtered\n // from the graph pFrame; filtered here too so it doesn't widen the table.\n const tableCols = ownCols.filter((c) => c.spec.axesSpec.length === 1);\n return createPlDataTableV2(ctx, tableCols, ctx.data.tableState);\n })\n .outputWithStatus(\"propertiesPfHandle\", (ctx): PFrameHandle | undefined => {\n const allPCols = ctx.outputs?.resolve(\"propertiesPf\")?.getPColumns();\n if (allPCols === undefined) return undefined;\n // Drop the AA fraction column from the pframe entirely. Two-axis\n // (variantKey × aminoAcid), at 50k peptides ~1M cells — enough to trip\n // graph-maker's cell-count guard on its own. The picker already excludes\n // it via `isNumericScalar` (axesSpec.length === 1), so the data was\n // pure overhead.\n const pCols = allPCols.filter((c) => c.spec.name !== \"pl7.app/aaFraction\");\n // Use `ctx.createPFrame` instead of `createPFrameForGraphs`. The latter\n // walks the result pool and pulls in this block's `exports.properties`\n // — a `trace.inject`-stamped re-emission of every column already in\n // `propertiesPf`, published for Lead Selection — so axis dropdowns\n // show e.g. \"Net Charge (pH7) / IG\" twice. Same workaround chosen by\n // cdr3-spectratype, batch-correction, cell-type-annotation, and\n // dimensionality-reduction.\n //\n // Pull single-axis metadata anchored to the input dataset's two axes\n // (idx 0 = sample, idx 1 = entity key) so sample groups / patient IDs /\n // peptide abundance and similar cols remain available for grouping and\n // filtering. Drop self-trace to keep our own exports out.\n const inputAnchor = ctx.data.inputAnchor;\n const upstreamMeta =\n inputAnchor !== undefined\n ? (\n ctx.resultPool.getAnchoredPColumns({ main: inputAnchor }, [\n { axes: [{ anchor: \"main\", idx: 0 }] },\n { axes: [{ anchor: \"main\", idx: 1 }] },\n ]) ?? []\n ).filter(\n (c) =>\n !c.spec.annotations?.[Annotation.Trace]?.includes(\n \"milaboratories.sequence-properties\",\n ),\n )\n : [];\n return createPFrameForGraphs(ctx, [...pCols, ...upstreamMeta]);\n })\n .output(\"propertiesPfCols\", (ctx): PColumnIdAndSpec[] | undefined => {\n const pCols = ctx.outputs?.resolve(\"propertiesPf\")?.getPColumns();\n if (pCols === undefined) return undefined;\n return pCols.map((c) => ({ columnId: c.id, spec: c.spec }) satisfies PColumnIdAndSpec);\n })\n .title(() => \"Sequence Properties\")\n .subtitle((ctx) => ctx.data.defaultBlockLabel ?? \"\")\n .sections(() => [\n { type: \"link\", href: \"/\", label: \"Main\" },\n { type: \"link\", href: \"/scatter\", label: \"Property Relationships\" },\n { type: \"link\", href: \"/histogram\", label: \"Property Distribution\" },\n ])\n .done();\n\nexport type BlockOutputs = InferOutputsType<typeof platforma>;\n"],"mappings":";;;AAcA,MAAM,mBAAmB;CAEvB;EACE,MAAM,CAAC,EAAE,MAAM,oBAAoB,EAAE,EAAE,MAAM,sBAAsB,CAAC;EACpE,aAAa,EAAE,oBAAoB,QAAQ;EAC5C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