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

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/types.d.ts CHANGED
@@ -1,11 +1,16 @@
1
1
  import { PlDataTableStateV2, PlRef } from "@platforma-sdk/model";
2
+ import { GraphMakerState } from "@milaboratories/graph-maker";
2
3
 
3
4
  //#region src/types.d.ts
4
- type BlockData = {
5
+ type BlockDataV1 = {
5
6
  inputAnchor?: PlRef;
6
7
  tableState: PlDataTableStateV2;
7
8
  defaultBlockLabel?: string;
8
9
  };
10
+ type BlockData = BlockDataV1 & {
11
+ graphStateScatter: GraphMakerState;
12
+ graphStateHistogram: GraphMakerState;
13
+ };
9
14
  type BlockArgs = {
10
15
  inputAnchor: PlRef;
11
16
  };
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","names":[],"sources":["../src/types.ts"],"mappings":";;;KAEY,SAAA;EACV,WAAA,GAAc,KAAA;EACd,UAAA,EAAY,kBAAA;EAIZ,iBAAA;AAAA;AAAA,KAGU,SAAA;EACV,WAAA,EAAa,KAAA;AAAA;AAAA,KAGH,YAAA;AAAA,KAMA,gBAAA;AAAA,KAEA,YAAA;EACV,IAAA,GAAO,YAAA;EACP,QAAA,GAAW,gBAAA;EACX,YAAA;EACA,QAAA;AAAA"}
1
+ {"version":3,"file":"types.d.ts","names":[],"sources":["../src/types.ts"],"mappings":";;;;KAKY,WAAA;EACV,WAAA,GAAc,KAAA;EACd,UAAA,EAAY,kBAAA;EAIZ,iBAAA;AAAA;AAAA,KAGU,SAAA,GAAY,WAAA;EACtB,iBAAA,EAAmB,eAAA;EACnB,mBAAA,EAAqB,eAAA;AAAA;AAAA,KAGX,SAAA;EACV,WAAA,EAAa,KAAA;AAAA;AAAA,KAGH,YAAA;AAAA,KAMA,gBAAA;AAAA,KAEA,YAAA;EACV,IAAA,GAAO,YAAA;EACP,QAAA,GAAW,gBAAA;EACX,YAAA;EACA,QAAA;AAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platforma-open/milaboratories.sequence-properties.model",
3
- "version": "1.1.2",
3
+ "version": "1.2.1",
4
4
  "description": "Block model",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -14,13 +14,14 @@
14
14
  "./dist/*": "./dist/*"
15
15
  },
16
16
  "dependencies": {
17
- "@milaboratories/helpers": "^1.14.1",
18
- "@platforma-sdk/model": "1.69.0"
17
+ "@milaboratories/graph-maker": "1.4.0",
18
+ "@milaboratories/helpers": "1.14.2",
19
+ "@platforma-sdk/model": "1.75.5"
19
20
  },
20
21
  "devDependencies": {
21
- "@milaboratories/ts-builder": "1.3.2",
22
+ "@milaboratories/ts-builder": "1.4.0",
22
23
  "@milaboratories/ts-configs": "1.2.3",
23
- "@platforma-sdk/block-tools": "2.7.16"
24
+ "@platforma-sdk/block-tools": "2.7.23"
24
25
  },
25
26
  "peerDependencies": {
26
27
  "@types/node": "*",
package/src/dataModel.ts CHANGED
@@ -1,6 +1,31 @@
1
+ import type { GraphMakerState } from "@milaboratories/graph-maker";
1
2
  import { createPlDataTableStateV2, DataModelBuilder } from "@platforma-sdk/model";
2
- import type { BlockData } from "./types";
3
+ import type { BlockData, BlockDataV1 } from "./types";
3
4
 
4
- export const blockDataModel = new DataModelBuilder().from<BlockData>("Ver_2026_04_28").init(() => ({
5
- tableState: createPlDataTableStateV2(),
6
- }));
5
+ const DEFAULT_SCATTER_STATE: GraphMakerState = {
6
+ title: "Property Relationships",
7
+ template: "dots",
8
+ currentTab: null,
9
+ };
10
+
11
+ const DEFAULT_HISTOGRAM_STATE: GraphMakerState = {
12
+ title: "Property Distribution",
13
+ template: "bins",
14
+ currentTab: null,
15
+ layersSettings: {
16
+ bins: { fillColor: "#99e099" },
17
+ },
18
+ };
19
+
20
+ export const blockDataModel = new DataModelBuilder()
21
+ .from<BlockDataV1>("Ver_2026_04_28")
22
+ .migrate<BlockData>("Ver_2026_05_05", (v1) => ({
23
+ ...v1,
24
+ graphStateScatter: { ...DEFAULT_SCATTER_STATE },
25
+ graphStateHistogram: { ...DEFAULT_HISTOGRAM_STATE },
26
+ }))
27
+ .init(() => ({
28
+ tableState: createPlDataTableStateV2(),
29
+ graphStateScatter: { ...DEFAULT_SCATTER_STATE },
30
+ graphStateHistogram: { ...DEFAULT_HISTOGRAM_STATE },
31
+ }));
package/src/index.ts CHANGED
@@ -1,4 +1,9 @@
1
- import type { ColumnSource, InferOutputsType } from "@platforma-sdk/model";
1
+ import type {
2
+ ColumnSource,
3
+ InferOutputsType,
4
+ PColumnIdAndSpec,
5
+ PFrameHandle,
6
+ } from "@platforma-sdk/model";
2
7
  import {
3
8
  Annotation,
4
9
  ArrayColumnProvider,
@@ -8,8 +13,9 @@ import {
8
13
  import { blockDataModel } from "./dataModel";
9
14
  import type { BlockArgs, WorkflowInfo } from "./types";
10
15
 
11
- export type { BlockArgs, BlockData, WorkflowInfo, WorkflowMode, WorkflowReceptor } from "./types";
16
+ export type * from "@milaboratories/helpers";
12
17
  export { blockDataModel } from "./dataModel";
18
+ export type { BlockArgs, BlockData, WorkflowInfo, WorkflowMode, WorkflowReceptor } from "./types";
13
19
 
14
20
  const inputAnchorSpecs = [
15
21
  // Peptide mode — universal naming
@@ -42,9 +48,7 @@ export const platforma = BlockModelV3.create(blockDataModel)
42
48
  inputAnchor: data.inputAnchor,
43
49
  };
44
50
  })
45
- .output("inputOptions", (ctx) =>
46
- ctx.resultPool.getOptions(inputAnchorSpecs, { refsWithEnrichments: true }),
47
- )
51
+ .output("inputOptions", (ctx) => ctx.resultPool.getOptions(inputAnchorSpecs))
48
52
  .output("inputSpec", (ctx) =>
49
53
  ctx.data.inputAnchor ? ctx.resultPool.getPColumnSpecByRef(ctx.data.inputAnchor) : undefined,
50
54
  )
@@ -138,9 +142,56 @@ export const platforma = BlockModelV3.create(blockDataModel)
138
142
  },
139
143
  });
140
144
  })
145
+ .outputWithStatus("propertiesPfHandle", (ctx): PFrameHandle | undefined => {
146
+ const allPCols = ctx.outputs?.resolve("propertiesPf")?.getPColumns();
147
+ if (allPCols === undefined) return undefined;
148
+ // Drop the AA fraction column from the pframe entirely. Two-axis
149
+ // (variantKey × aminoAcid), at 50k peptides ~1M cells — enough to trip
150
+ // graph-maker's cell-count guard on its own. The picker already excludes
151
+ // it via `isNumericScalar` (axesSpec.length === 1), so the data was
152
+ // pure overhead.
153
+ const pCols = allPCols.filter((c) => c.spec.name !== "pl7.app/aaFraction");
154
+ // Use `ctx.createPFrame` instead of `createPFrameForGraphs`. The latter
155
+ // walks the result pool and pulls in this block's `exports.properties`
156
+ // — a `trace.inject`-stamped re-emission of every column already in
157
+ // `propertiesPf`, published for Lead Selection — so axis dropdowns
158
+ // show e.g. "Net Charge (pH7) / IG" twice. Same workaround chosen by
159
+ // cdr3-spectratype, batch-correction, cell-type-annotation, and
160
+ // dimensionality-reduction.
161
+ //
162
+ // Pull single-axis metadata anchored to the input dataset's two axes
163
+ // (idx 0 = sample, idx 1 = entity key) so sample groups / patient IDs /
164
+ // peptide abundance and similar cols remain available for grouping and
165
+ // filtering. Drop self-trace to keep our own exports out.
166
+ const inputAnchor = ctx.data.inputAnchor;
167
+ const upstreamMeta =
168
+ inputAnchor !== undefined
169
+ ? (
170
+ ctx.resultPool.getAnchoredPColumns({ main: inputAnchor }, [
171
+ { axes: [{ anchor: "main", idx: 0 }] },
172
+ { axes: [{ anchor: "main", idx: 1 }] },
173
+ ]) ?? []
174
+ ).filter(
175
+ (c) =>
176
+ !c.spec.annotations?.[Annotation.Trace]?.includes(
177
+ "milaboratories.sequence-properties",
178
+ ),
179
+ )
180
+ : [];
181
+ return ctx.createPFrame([...pCols, ...upstreamMeta]);
182
+ })
183
+ .output("propertiesPfCols", (ctx): PColumnIdAndSpec[] | undefined => {
184
+ const pCols = ctx.outputs?.resolve("propertiesPf")?.getPColumns();
185
+ if (pCols === undefined) return undefined;
186
+ return pCols.map((c) => ({ columnId: c.id, spec: c.spec }) satisfies PColumnIdAndSpec);
187
+ })
141
188
  .title(() => "Sequence Properties")
142
189
  .subtitle((ctx) => ctx.data.defaultBlockLabel ?? "")
143
- .sections(() => [{ type: "link" as const, href: "/" as const, label: "Main" }])
190
+ .sections(() => [
191
+ { type: "link", href: "/", label: "Main" },
192
+ { type: "link", href: "/scatter", label: "Property Relationships" },
193
+ { type: "link", href: "/histogram", label: "Property Distribution" },
194
+ ])
144
195
  .done();
145
196
 
146
197
  export type BlockOutputs = InferOutputsType<typeof platforma>;
package/src/types.ts CHANGED
@@ -1,6 +1,9 @@
1
+ import type { GraphMakerState } from "@milaboratories/graph-maker";
1
2
  import type { PlDataTableStateV2, PlRef } from "@platforma-sdk/model";
2
3
 
3
- export type BlockData = {
4
+ // Pre-Visualizations shape. Retained as the v1 type so the data-model
5
+ // migration chain stays well-typed.
6
+ export type BlockDataV1 = {
4
7
  inputAnchor?: PlRef;
5
8
  tableState: PlDataTableStateV2;
6
9
  // UI-only state. Tracks the selected input dataset's label so the block
@@ -9,6 +12,11 @@ export type BlockData = {
9
12
  defaultBlockLabel?: string;
10
13
  };
11
14
 
15
+ export type BlockData = BlockDataV1 & {
16
+ graphStateScatter: GraphMakerState;
17
+ graphStateHistogram: GraphMakerState;
18
+ };
19
+
12
20
  export type BlockArgs = {
13
21
  inputAnchor: PlRef;
14
22
  };