@platforma-sdk/model 1.39.8 → 1.40.0

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/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const PlatformaSDKVersion = "1.39.8";
1
+ export declare const PlatformaSDKVersion = "1.40.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platforma-sdk/model",
3
- "version": "1.39.8",
3
+ "version": "1.40.0",
4
4
  "description": "Platforma.bio SDK / Block Model",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",
@@ -21,7 +21,7 @@
21
21
  "utility-types": "^3.11.0",
22
22
  "canonicalize": "~2.1.0",
23
23
  "zod": "~3.23.8",
24
- "@milaboratories/pl-model-common": "^1.16.3",
24
+ "@milaboratories/pl-model-common": "^1.16.4",
25
25
  "@milaboratories/pl-error-like": "^1.12.2"
26
26
  },
27
27
  "devDependencies": {
@@ -32,8 +32,8 @@
32
32
  "@jest/globals": "^29.7.0",
33
33
  "ts-jest": "^29.2.6",
34
34
  "@platforma-sdk/eslint-config": "1.0.3",
35
- "@milaboratories/build-configs": "1.0.4",
36
- "@milaboratories/helpers": "^1.6.17"
35
+ "@milaboratories/helpers": "^1.6.17",
36
+ "@milaboratories/build-configs": "1.0.4"
37
37
  },
38
38
  "scripts": {
39
39
  "type-check": "node ./scripts/save-package-version.cjs && tsc --noEmit --composite false",
@@ -9,7 +9,9 @@ import type {
9
9
  import {
10
10
  canonicalizeJson,
11
11
  getAxisId,
12
+ isDataInfo,
12
13
  matchAxisId, parseJson,
14
+ visitDataInfo,
13
15
  } from '@milaboratories/pl-model-common';
14
16
  import type { PColumnDataUniversal, RenderCtx } from '../render';
15
17
  import { PColumnCollection, TreeNodeAccessor } from '../render';
@@ -203,6 +205,22 @@ function getAdditionalColumnsForColumn(
203
205
  return [column, ...additionalColumns];
204
206
  }
205
207
 
208
+ export function isColumnReady(c: PColumn<PColumnDataUniversal>) {
209
+ let ready = true;
210
+ if (c.data instanceof TreeNodeAccessor) {
211
+ ready = ready && c.data.getIsReadyOrError();
212
+ } else if (isDataInfo(c.data)) {
213
+ visitDataInfo(c.data, (v) => {
214
+ ready = ready && v.getIsReadyOrError();
215
+ });
216
+ }
217
+ return ready;
218
+ }
219
+
220
+ export function allColumnsReady(columns: PColumn<PColumnDataUniversal>[]): boolean {
221
+ return columns.every(isColumnReady);
222
+ }
223
+
206
224
  /**
207
225
  The aim of createPFrameForGraphs: to create pframe with block’s columns and all compatible columns from result pool
208
226
  (including linker columns and all label columns).
@@ -217,10 +235,37 @@ function getAdditionalColumnsForColumn(
217
235
  */
218
236
  export function createPFrameForGraphs<A, U>(
219
237
  ctx: RenderCtx<A, U>,
220
- blockColumns: PColumn<PColumnDataUniversal>[] | undefined,
238
+ blockColumns?: PColumn<PColumnDataUniversal>[],
221
239
  ): PFrameHandle | undefined {
222
- if (!blockColumns) return undefined;
240
+ // if current block doesn't produce own columns then use all columns from result pool
241
+ if (!blockColumns) {
242
+ const columns = new PColumnCollection();
243
+ columns.addColumnProvider(ctx.resultPool);
244
+
245
+ const allColumns = columns.getColumns(() => true, { dontWaitAllData: true, overrideLabelAnnotation: false }) ?? [];
246
+ // if at least one column is not yet ready, we can't show the graph
247
+ if (!allColumnsReady(allColumns)) {
248
+ return undefined;
249
+ }
250
+
251
+ const allAxes = new Map(allColumns
252
+ .flatMap((column) => column.spec.axesSpec)
253
+ .map((axisSpec) => {
254
+ const axisId = getAxisId(axisSpec);
255
+ return [canonicalizeJson(axisId), axisId];
256
+ }));
257
+
258
+ // additional columns are duplicates with extra fields in domains for compatibility if there are ones with partial match
259
+ const extendedColumns = enrichCompatible(allAxes, allColumns);
260
+
261
+ return ctx.createPFrame(extendedColumns);
262
+ };
223
263
 
264
+ if (!allColumnsReady(blockColumns)) {
265
+ return undefined;
266
+ }
267
+
268
+ // if current block has its own columns then take from result pool only compatible with them
224
269
  const columns = new PColumnCollection();
225
270
  columns.addColumnProvider(ctx.resultPool);
226
271
  columns.addColumns(blockColumns);
@@ -258,6 +303,11 @@ export function createPFrameForGraphs<A, U>(
258
303
  return false;
259
304
  }), { dontWaitAllData: true, overrideLabelAnnotation: false }) ?? []).filter((column) => !isLabelColumn(column.spec));
260
305
 
306
+ // if at least one column is not yet ready, we can't show the graph
307
+ if (!allColumnsReady(compatibleWithoutLabels)) {
308
+ return undefined;
309
+ }
310
+
261
311
  // extend axes set for label columns request
262
312
  for (const c of compatibleWithoutLabels) {
263
313
  for (const id of c.spec.axesSpec) {
@@ -277,18 +327,15 @@ export function createPFrameForGraphs<A, U>(
277
327
  return false;
278
328
  }), { dontWaitAllData: true, overrideLabelAnnotation: false }) ?? []).filter((column) => isLabelColumn(column.spec));
279
329
 
330
+ // if at least one column is not yet ready, we can't show the graph
331
+ if (!allColumnsReady(compatibleLabels)) {
332
+ return undefined;
333
+ }
334
+
280
335
  const compatible = [...compatibleWithoutLabels, ...compatibleLabels];
281
336
 
282
337
  // additional columns are duplicates with extra fields in domains for compatibility if there are ones with partial match
283
338
  const extendedColumns = enrichCompatible(blockAxes, compatible);
284
339
 
285
- // if at least one column is not yet ready, we can't show the table
286
- if (
287
- extendedColumns.some(
288
- (a) => a.data instanceof TreeNodeAccessor && !a.data.getIsReadyOrError(),
289
- )
290
- )
291
- return undefined;
292
-
293
340
  return ctx.createPFrame(extendedColumns);
294
341
  }
@@ -12,11 +12,27 @@ import { type PlSelectionModel } from './PlSelectionModel';
12
12
 
13
13
  export type PColumnPredicate = (column: PColumnIdAndSpec) => boolean;
14
14
 
15
- export type PlMultiSequenceAlignmentModel = {
16
- version?: number;
15
+ export interface PlMultiSequenceAlignmentSettings {
17
16
  sequenceColumnIds?: PObjectId[];
18
17
  labelColumnIds?: PTableColumnId[];
19
- };
18
+ colorScheme: PlMultiSequenceAlignmentColorSchemeOption;
19
+ widgets: ('consensus' | 'seqLogo' | 'legend')[];
20
+ alignmentParams: {
21
+ gpo: number;
22
+ gpe: number;
23
+ tgpe: number;
24
+ };
25
+ }
26
+
27
+ export interface PlMultiSequenceAlignmentModel
28
+ extends Partial<PlMultiSequenceAlignmentSettings> {
29
+ version?: number;
30
+ }
31
+
32
+ export type PlMultiSequenceAlignmentColorSchemeOption =
33
+ | { type: 'no-color' }
34
+ | { type: 'chemical-properties' }
35
+ | { type: 'markup'; columnId: PObjectId };
20
36
 
21
37
  export function createRowSelectionColumn({
22
38
  selection,