@platforma-open/milaboratories.repertoire-diversity-2.model 1.1.2 → 1.3.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/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@platforma-open/milaboratories.repertoire-diversity-2.model",
3
- "version": "1.1.2",
3
+ "version": "1.3.0",
4
4
  "description": "Block model",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
7
7
  "module": "dist/index.js",
8
8
  "types": "dist/index.d.ts",
9
9
  "dependencies": {
10
- "@platforma-sdk/model": "^1.29.2",
11
- "@milaboratories/graph-maker": "^1.1.71"
10
+ "@platforma-sdk/model": "^1.34.8",
11
+ "@milaboratories/graph-maker": "^1.1.114"
12
12
  },
13
13
  "devDependencies": {
14
- "@platforma-sdk/block-tools": "^2.5.36",
14
+ "@platforma-sdk/block-tools": "^2.5.55",
15
15
  "typescript": "~5.5.4",
16
16
  "vite": "^6.2.2",
17
17
  "tsup": "~8.3.5",
package/src/index.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { GraphMakerState } from '@milaboratories/graph-maker';
2
- import type { InferOutputsType, PColumnSpec, PlDataTableState, PlRef } from '@platforma-sdk/model';
3
- import { BlockModel, createPFrameForGraphs, createPlDataTable, isPColumnSpec } from '@platforma-sdk/model';
2
+ import type { InferOutputsType, PColumnIdAndSpec, PlDataTableState, PlRef } from '@platforma-sdk/model';
3
+ import { BlockModel, createPFrameForGraphs, createPlDataTable } from '@platforma-sdk/model';
4
4
 
5
5
  export type DiversityType = 'chao1' | 'd50' | 'efronThisted' |
6
6
  'observed' | 'shannonWienerIndex' | 'shannonWiener' |
@@ -26,10 +26,6 @@ export type UiState = {
26
26
  graphState: GraphMakerState;
27
27
  };
28
28
 
29
- function isNumericType(c: PColumnSpec): boolean {
30
- return c.valueType === 'Double' || c.valueType === 'Int' || c.valueType === 'Float' || c.valueType === 'Long';
31
- }
32
-
33
29
  export const model = BlockModel.create()
34
30
 
35
31
  .withArgs<BlockArgs>({
@@ -92,11 +88,19 @@ export const model = BlockModel.create()
92
88
  .argsValid((ctx) => ctx.args.abundanceRef !== undefined)
93
89
 
94
90
  .output('abundanceOptions', (ctx) =>
95
- ctx.resultPool.getOptions((c) =>
96
- isPColumnSpec(c) && isNumericType(c)
97
- && c.annotations?.['pl7.app/isAbundance'] === 'true'
98
- && c.annotations?.['pl7.app/abundance/normalized'] === 'false',
99
- ))
91
+ ctx.resultPool.getOptions([{
92
+ axes: [
93
+ { name: 'pl7.app/sampleId' },
94
+ { },
95
+ ],
96
+ annotations: {
97
+ 'pl7.app/isAbundance': 'true',
98
+ 'pl7.app/abundance/normalized': 'false',
99
+ 'pl7.app/abundance/isPrimary': 'true',
100
+ },
101
+ },
102
+ ]),
103
+ )
100
104
 
101
105
  .output('pt', (ctx) => {
102
106
  const pCols = ctx.outputs?.resolve('pf')?.getPColumns();
@@ -116,6 +120,23 @@ export const model = BlockModel.create()
116
120
  return createPFrameForGraphs(ctx, pCols);
117
121
  })
118
122
 
123
+ // Return a list of Pcols for plot defaults
124
+ .output('pcols', (ctx) => {
125
+ const pCols = ctx.outputs?.resolve('pf')?.getPColumns();
126
+
127
+ if (pCols === undefined || pCols.length === 0) {
128
+ return undefined;
129
+ }
130
+
131
+ return pCols.map(
132
+ (c) =>
133
+ ({
134
+ columnId: c.id,
135
+ spec: c.spec,
136
+ } satisfies PColumnIdAndSpec),
137
+ );
138
+ })
139
+
119
140
  .output('isRunning', (ctx) => ctx.outputs?.getIsReadyOrError() === false)
120
141
 
121
142
  .title((ctx) => ctx.uiState?.blockTitle ?? 'Repertoire Diversity')