@platforma-open/milaboratories.sequence-properties.model 1.2.1 → 1.2.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platforma-open/milaboratories.sequence-properties.model",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
4
4
  "description": "Block model",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/src/index.ts CHANGED
@@ -1,14 +1,9 @@
1
- import type {
2
- ColumnSource,
3
- InferOutputsType,
4
- PColumnIdAndSpec,
5
- PFrameHandle,
6
- } from "@platforma-sdk/model";
1
+ import type { InferOutputsType, PColumnIdAndSpec, PFrameHandle } from "@platforma-sdk/model";
7
2
  import {
8
3
  Annotation,
9
- ArrayColumnProvider,
10
4
  BlockModelV3,
11
- createPlDataTableV3,
5
+ createPFrameForGraphs,
6
+ createPlDataTableV2,
12
7
  } from "@platforma-sdk/model";
13
8
  import { blockDataModel } from "./dataModel";
14
9
  import type { BlockArgs, WorkflowInfo } from "./types";
@@ -59,88 +54,14 @@ export const platforma = BlockModelV3.create(blockDataModel)
59
54
  if (ctx.data.inputAnchor === undefined) return undefined;
60
55
  const ownCols = ctx.outputs?.resolve("propertiesPf")?.getPColumns();
61
56
  if (ownCols === undefined) return undefined;
62
- // `coverageTier` is set in workflow/main.tpl.tengo and surfaced via the
63
- // `info` JSON resource. Allowed values are defined in types.ts::WorkflowInfo.
64
- // Gate on `info` so the table renders consistently with the chosen aa
65
- // column rather than briefly without it while `info` is still resolving.
66
- const info = ctx.outputs?.resolve("info")?.getDataAsJson<WorkflowInfo>();
67
- if (info === undefined) return undefined;
68
- const tier = info.coverageTier;
69
-
70
- // Build sources explicitly: upstream cols from the result pool minus
71
- // anything traced back to this block, plus this block's own cols from
72
- // `propertiesPf`. The workflow also publishes `exports.properties` —
73
- // a blockId-stamped score-only variant for downstream consumers like
74
- // Lead Selection — into the result pool. Filtering by trace excludes
75
- // it here so score cols don't duplicate the propertiesPf variant.
76
- const upstreamCols = ctx.resultPool.selectColumns(
77
- (spec) =>
78
- !spec.annotations?.[Annotation.Trace]?.includes("milaboratories.sequence-properties"),
79
- );
80
- const sources: ColumnSource[] = [
81
- new ArrayColumnProvider(upstreamCols),
82
- new ArrayColumnProvider(ownCols),
83
- ];
84
-
85
- return createPlDataTableV3(ctx, {
86
- tableState: ctx.data.tableState,
87
- columns: {
88
- sources,
89
- anchors: { main: ctx.data.inputAnchor },
90
- selector: { mode: "enrichment" },
91
- },
92
- // Default-visible: this block's columns + a single source amino-acid
93
- // sequence column matching the analysed coverage tier. Reviewer asked
94
- // for one sequence next to the properties — full-chain VDJRegion when
95
- // available (it contains the CDR3); CDR3 alone when that is all the
96
- // input has; peptide for peptide mode. Chain A (heavy / alpha / gamma)
97
- // only — chain B stays available via the column picker. Other upstream
98
- // cols → optional. This block's cols fall through unmatched and keep
99
- // their workflow-time `pl7.app/table/visibility` annotation.
100
- displayOptions: {
101
- visibility: [
102
- {
103
- match: (spec) => {
104
- if (spec.domain?.["pl7.app/vdj/scClonotypeChain/index"] === "secondary") {
105
- return false;
106
- }
107
- if (spec.domain?.["pl7.app/alphabet"] !== "aminoacid") return false;
108
-
109
- const isVdj = spec.name === "pl7.app/vdj/sequence";
110
- const isUniversal = spec.name === "pl7.app/sequence";
111
- if (!isVdj && !isUniversal) return false;
112
-
113
- const feature = isVdj
114
- ? spec.domain?.["pl7.app/vdj/feature"]
115
- : spec.domain?.["pl7.app/feature"];
116
-
117
- if (tier === "peptide") {
118
- return isUniversal && feature === "peptide";
119
- }
120
-
121
- const chain = spec.domain?.["pl7.app/vdj/scClonotypeChain"];
122
- if (chain !== undefined && chain !== "A") return false;
123
-
124
- if (tier === "full_chain") {
125
- return feature === "VDJRegion" || feature === "VDJRegionInFrame";
126
- }
127
- if (tier === "cdr3_only" || tier === "partial") {
128
- return feature === "CDR3";
129
- }
130
- return false;
131
- },
132
- visibility: "default",
133
- },
134
- {
135
- match: (spec) =>
136
- !spec.annotations?.[Annotation.Trace]?.includes(
137
- "milaboratories.sequence-properties",
138
- ) && spec.annotations?.["pl7.app/isLinkerColumn"] !== "true",
139
- visibility: "optional",
140
- },
141
- ],
142
- },
143
- });
57
+ // Temporary downgrade to V2 with a fixed, propertiesPf-only column list.
58
+ // V3 default-visibility rules and the column picker are not yet stable for
59
+ // the multi-source layout this block needs (upstream sequence column +
60
+ // own scalar properties). Once V3 supports it natively, rewire across
61
+ // blocks. aaFraction is 2-axis (variantKey × aminoAcid) — already filtered
62
+ // from the graph pFrame; filtered here too so it doesn't widen the table.
63
+ const tableCols = ownCols.filter((c) => c.spec.axesSpec.length === 1);
64
+ return createPlDataTableV2(ctx, tableCols, ctx.data.tableState);
144
65
  })
145
66
  .outputWithStatus("propertiesPfHandle", (ctx): PFrameHandle | undefined => {
146
67
  const allPCols = ctx.outputs?.resolve("propertiesPf")?.getPColumns();
@@ -178,7 +99,7 @@ export const platforma = BlockModelV3.create(blockDataModel)
178
99
  ),
179
100
  )
180
101
  : [];
181
- return ctx.createPFrame([...pCols, ...upstreamMeta]);
102
+ return createPFrameForGraphs(ctx, [...pCols, ...upstreamMeta]);
182
103
  })
183
104
  .output("propertiesPfCols", (ctx): PColumnIdAndSpec[] | undefined => {
184
105
  const pCols = ctx.outputs?.resolve("propertiesPf")?.getPColumns();