@platforma-open/milaboratories.immune-assay-data.model 1.5.1 → 1.5.2

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.immune-assay-data.model",
3
- "version": "1.5.1",
3
+ "version": "1.5.2",
4
4
  "description": "Block model",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -15,13 +15,13 @@
15
15
  "./dist/model.json": "./dist/model.json"
16
16
  },
17
17
  "dependencies": {
18
- "@platforma-sdk/model": "1.51.6",
19
- "@milaboratories/graph-maker": "1.1.211"
18
+ "@platforma-sdk/model": "1.53.2",
19
+ "@milaboratories/graph-maker": "1.1.216"
20
20
  },
21
21
  "devDependencies": {
22
- "@milaboratories/ts-builder": "1.2.2",
22
+ "@milaboratories/ts-builder": "1.2.4",
23
23
  "@milaboratories/ts-configs": "1.2.0",
24
- "@platforma-sdk/block-tools": "2.6.29",
24
+ "@platforma-sdk/block-tools": "2.6.35",
25
25
  "@platforma-sdk/eslint-config": "1.2.0",
26
26
  "eslint": "^9.25.1",
27
27
  "typescript": "~5.6.3",
package/src/index.ts CHANGED
@@ -1,11 +1,19 @@
1
1
  import type {
2
+ DataInfo,
2
3
  ImportFileHandle,
4
+ PColumn,
5
+ PColumnSpec,
6
+ PColumnValues,
3
7
  PlDataTableStateV2,
8
+ PlMultiSequenceAlignmentModel,
4
9
  PlRef,
10
+ RenderCtxLegacy,
5
11
  SUniversalPColumnId,
12
+ TreeNodeAccessor,
6
13
  } from '@platforma-sdk/model';
7
14
  import {
8
15
  BlockModel,
16
+ createPFrameForGraphs,
9
17
  createPlDataTableStateV2,
10
18
  createPlDataTableV2,
11
19
  } from '@platforma-sdk/model';
@@ -39,8 +47,39 @@ export type BlockArgs = {
39
47
  export type UiState = {
40
48
  fileImportError?: string;
41
49
  tableState: PlDataTableStateV2;
50
+ alignmentModel: PlMultiSequenceAlignmentModel;
42
51
  };
43
52
 
53
+ type Column = PColumn<DataInfo<TreeNodeAccessor> | TreeNodeAccessor | PColumnValues>;
54
+
55
+ type Columns = {
56
+ props: Column[];
57
+ };
58
+
59
+ function getColumns(ctx: RenderCtxLegacy<BlockArgs, UiState>): Columns | undefined {
60
+ const anchor = ctx.args.datasetRef;
61
+ if (anchor === undefined)
62
+ return undefined;
63
+
64
+ const anchorSpec = ctx.resultPool.getPColumnSpecByRef(anchor);
65
+ if (anchorSpec === undefined)
66
+ return undefined;
67
+
68
+ // all clone properties
69
+ const props = (ctx.resultPool.getAnchoredPColumns(
70
+ { main: anchor },
71
+ [
72
+ {
73
+ axes: [{ anchor: 'main', idx: 1 }],
74
+ },
75
+ ]) ?? [])
76
+ .filter((p) => p.spec.annotations?.['pl7.app/sequence/isAnnotation'] !== 'true');
77
+
78
+ return {
79
+ props: props,
80
+ };
81
+ }
82
+
44
83
  export const model = BlockModel.create()
45
84
 
46
85
  .withArgs<BlockArgs>({
@@ -56,6 +95,7 @@ export const model = BlockModel.create()
56
95
 
57
96
  .withUiState<UiState>({
58
97
  tableState: createPlDataTableStateV2(),
98
+ alignmentModel: {},
59
99
  })
60
100
 
61
101
  .argsValid((ctx) =>
@@ -143,6 +183,48 @@ export const model = BlockModel.create()
143
183
  );
144
184
  })
145
185
 
186
+ .output('pf', (ctx) => {
187
+ if (ctx.outputs?.resolve('emptyResults')?.getDataAsJson<boolean>()) {
188
+ return undefined;
189
+ }
190
+ const cols = ctx.outputs?.resolve('table')?.getPColumns();
191
+ if (cols === undefined)
192
+ return undefined;
193
+
194
+ return createPFrameForGraphs(ctx, cols);
195
+ })
196
+
197
+ .output('assaySequenceSpec', (ctx): PColumnSpec | undefined => {
198
+ if (ctx.outputs?.resolve('emptyResults')?.getDataAsJson<boolean>()) {
199
+ return undefined;
200
+ }
201
+ const cols = ctx.outputs?.resolve('table')?.getPColumns();
202
+ if (cols === undefined)
203
+ return undefined;
204
+ // Return only sequence column
205
+ return cols.find((c) => c.spec.name === 'pl7.app/vdj/sequence'
206
+ && c.spec.axesSpec[0].name === 'pl7.app/vdj/assay/sequenceId')?.spec;
207
+ })
208
+
209
+ .output('msaPf', (ctx) => {
210
+ if (ctx.outputs?.resolve('emptyResults')?.getDataAsJson<boolean>()) {
211
+ return undefined;
212
+ }
213
+ const cols = ctx.outputs?.resolve('table')?.getPColumns();
214
+ if (cols === undefined)
215
+ return undefined;
216
+
217
+ const msaCols = ctx.outputs?.resolve('assayLinkerPframe')?.getPColumns();
218
+ if (!msaCols) return undefined;
219
+
220
+ const columns = getColumns(ctx);
221
+ if (columns === undefined) {
222
+ return undefined;
223
+ }
224
+
225
+ return createPFrameForGraphs(ctx, [...msaCols, ...cols, ...columns.props]);
226
+ })
227
+
146
228
  .output('isRunning', (ctx) => ctx.outputs?.getIsReadyOrError() === false)
147
229
 
148
230
  .title(() => 'Immune Assay Data')