@platforma-open/milaboratories.repertoire-diversity-2.model 1.3.1 → 1.4.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/index.cjs CHANGED
@@ -6,39 +6,49 @@ var model$1 = require('@platforma-sdk/model');
6
6
  var model = model$1.BlockModel.create().withArgs({
7
7
  metrics: [
8
8
  {
9
+ id: "observed",
9
10
  type: "observed",
10
11
  downsampling: {
11
12
  type: "hypergeometric",
12
13
  valueChooser: "auto"
13
- }
14
+ },
15
+ isExpanded: false
14
16
  },
15
17
  {
18
+ id: "shannonWiener",
16
19
  type: "shannonWiener",
17
20
  downsampling: {
18
21
  type: "hypergeometric",
19
22
  valueChooser: "auto"
20
- }
23
+ },
24
+ isExpanded: false
21
25
  },
22
26
  {
27
+ id: "chao1",
23
28
  type: "chao1",
24
29
  downsampling: {
25
30
  type: "hypergeometric",
26
31
  valueChooser: "auto"
27
- }
32
+ },
33
+ isExpanded: false
28
34
  },
29
35
  {
36
+ id: "gini",
30
37
  type: "gini",
31
38
  downsampling: {
32
39
  type: "hypergeometric",
33
40
  valueChooser: "auto"
34
- }
41
+ },
42
+ isExpanded: false
35
43
  },
36
44
  {
45
+ id: "d50",
37
46
  type: "d50",
38
47
  downsampling: {
39
48
  type: "hypergeometric",
40
49
  valueChooser: "auto"
41
- }
50
+ },
51
+ isExpanded: false
42
52
  }
43
53
  ]
44
54
  }).withUiState({
@@ -48,13 +58,7 @@ var model = model$1.BlockModel.create().withArgs({
48
58
  template: "bar",
49
59
  currentTab: null
50
60
  },
51
- tableState: {
52
- gridState: {},
53
- pTableParams: {
54
- sorting: [],
55
- filters: []
56
- }
57
- }
61
+ tableState: model$1.createPlDataTableStateV2()
58
62
  }).argsValid((ctx) => ctx.args.abundanceRef !== void 0).output(
59
63
  "abundanceOptions",
60
64
  (ctx) => ctx.resultPool.getOptions([
@@ -75,7 +79,7 @@ var model = model$1.BlockModel.create().withArgs({
75
79
  if (pCols === void 0) {
76
80
  return void 0;
77
81
  }
78
- return model$1.createPlDataTable(ctx, pCols, ctx.uiState?.tableState);
82
+ return model$1.createPlDataTableV2(ctx, pCols, ctx.uiState?.tableState);
79
83
  }).output("pf", (ctx) => {
80
84
  const pCols = ctx.outputs?.resolve("pf")?.getPColumns();
81
85
  if (pCols === void 0) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":["BlockModel","createPlDataTable","createPFrameForGraphs"],"mappings":";;;;;AA4BO,IAAM,KAAQ,GAAAA,kBAAA,CAAW,MAAO,EAAA,CAEpC,QAAoB,CAAA;AAAA,EACnB,OAAS,EAAA;AAAA,IACP;AAAA,MACE,IAAM,EAAA,UAAA;AAAA,MACN,YAAc,EAAA;AAAA,QACZ,IAAM,EAAA,gBAAA;AAAA,QACN,YAAc,EAAA;AAAA;AAChB,KACF;AAAA,IACA;AAAA,MACE,IAAM,EAAA,eAAA;AAAA,MACN,YAAc,EAAA;AAAA,QACZ,IAAM,EAAA,gBAAA;AAAA,QACN,YAAc,EAAA;AAAA;AAChB,KACF;AAAA,IACA;AAAA,MACE,IAAM,EAAA,OAAA;AAAA,MACN,YAAc,EAAA;AAAA,QACZ,IAAM,EAAA,gBAAA;AAAA,QACN,YAAc,EAAA;AAAA;AAChB,KACF;AAAA,IACA;AAAA,MACE,IAAM,EAAA,MAAA;AAAA,MACN,YAAc,EAAA;AAAA,QACZ,IAAM,EAAA,gBAAA;AAAA,QACN,YAAc,EAAA;AAAA;AAChB,KACF;AAAA,IACA;AAAA,MACE,IAAM,EAAA,KAAA;AAAA,MACN,YAAc,EAAA;AAAA,QACZ,IAAM,EAAA,gBAAA;AAAA,QACN,YAAc,EAAA;AAAA;AAChB;AACF;AAEJ,CAAC,EAEA,WAAqB,CAAA;AAAA,EACpB,UAAY,EAAA,sBAAA;AAAA,EACZ,UAAY,EAAA;AAAA,IACV,KAAO,EAAA,sBAAA;AAAA,IACP,QAAU,EAAA,KAAA;AAAA,IACV,UAAY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AAQ,GAAI,CAAA,OAAA,EAAS,OAAQ,CAAA,IAAI,GAAG,WAAY,EAAA;AAEtD,EAAA,IAAI,KAAU,KAAA,MAAA,IAAa,KAAM,CAAA,MAAA,KAAW,CAAG,EAAA;AAC7C,IAAO,OAAA,MAAA;AAAA;AAGT,EAAA,OAAO,KAAM,CAAA,GAAA;AAAA,IACX,CAAC,CACE,MAAA;AAAA,MACC,UAAU,CAAE,CAAA,EAAA;AAAA,MACZ,MAAM,CAAE,CAAA;AAAA,KACV;AAAA,GACJ;AACF,CAAC,CAAA,CAEA,OAAO,WAAa,EAAA,CAAC,QAAQ,GAAI,CAAA,OAAA,EAAS,mBAAwB,KAAA,KAAK,EAEvE,KAAM,CAAA,CAAC,QAAQ,GAAI,CAAA,OAAA,EAAS,cAAc,sBAAsB,CAAA,CAEhE,QAAS,CAAA,CAAC,CAAM,KAAA;AAAA,EACf,EAAE,IAAM,EAAA,MAAA,EAAQ,IAAM,EAAA,GAAA,EAAK,OAAO,MAAO,EAAA;AAAA,EACzC,EAAE,IAAM,EAAA,MAAA,EAAQ,IAAM,EAAA,iBAAA,EAAmB,OAAO,iBAAkB;AACpE,CAAC,EAEA,IAAK","file":"index.cjs","sourcesContent":["import type { GraphMakerState } from '@milaboratories/graph-maker';\nimport type { InferOutputsType, PColumnIdAndSpec, PlDataTableState, PlRef } from '@platforma-sdk/model';\nimport { BlockModel, createPFrameForGraphs, createPlDataTable } from '@platforma-sdk/model';\n\nexport type DiversityType = 'chao1' | 'd50' | 'efronThisted' |\n 'observed' | 'shannonWienerIndex' | 'shannonWiener' |\n 'normalizedShannonWiener' | 'inverseSimpson' | 'gini';\n\nexport type Metric = {\n type: DiversityType | undefined;\n downsampling: {\n type?: 'none' | 'top' | 'cumtop' | 'hypergeometric' ;\n valueChooser?: 'min' | 'fixed' | 'max' | 'auto';\n n?: number;\n };\n};\n\nexport type BlockArgs = {\n abundanceRef?: PlRef;\n metrics: Metric[];\n};\n\nexport type UiState = {\n blockTitle: string;\n tableState?: PlDataTableState;\n graphState: GraphMakerState;\n};\n\nexport const model = BlockModel.create()\n\n .withArgs<BlockArgs>({\n metrics: [\n {\n type: 'observed',\n downsampling: {\n type: 'hypergeometric',\n valueChooser: 'auto',\n },\n },\n {\n type: 'shannonWiener',\n downsampling: {\n type: 'hypergeometric',\n valueChooser: 'auto',\n },\n },\n {\n type: 'chao1',\n downsampling: {\n type: 'hypergeometric',\n valueChooser: 'auto',\n },\n },\n {\n type: 'gini',\n downsampling: {\n type: 'hypergeometric',\n valueChooser: 'auto',\n },\n },\n {\n type: 'd50',\n downsampling: {\n type: 'hypergeometric',\n valueChooser: 'auto',\n },\n },\n ],\n })\n\n .withUiState<UiState>({\n blockTitle: 'Repertoire Diversity',\n graphState: {\n title: 'Repertoire Diversity',\n template: 'bar',\n currentTab: null,\n },\n\n tableState: {\n gridState: {},\n pTableParams: {\n sorting: [],\n filters: [],\n },\n },\n })\n\n .argsValid((ctx) => ctx.args.abundanceRef !== undefined)\n\n .output('abundanceOptions', (ctx) =>\n ctx.resultPool.getOptions([{\n axes: [\n { name: 'pl7.app/sampleId' },\n { },\n ],\n annotations: {\n 'pl7.app/isAbundance': 'true',\n 'pl7.app/abundance/normalized': 'false',\n 'pl7.app/abundance/isPrimary': 'true',\n },\n },\n ]),\n )\n\n .output('pt', (ctx) => {\n const pCols = ctx.outputs?.resolve('pf')?.getPColumns();\n if (pCols === undefined) {\n return undefined;\n }\n\n return createPlDataTable(ctx, pCols, ctx.uiState?.tableState);\n })\n\n .output('pf', (ctx) => {\n const pCols = ctx.outputs?.resolve('pf')?.getPColumns();\n if (pCols === undefined) {\n return undefined;\n }\n\n return createPFrameForGraphs(ctx, pCols);\n })\n\n // Return a list of Pcols for plot defaults\n .output('pcols', (ctx) => {\n const pCols = ctx.outputs?.resolve('pf')?.getPColumns();\n\n if (pCols === undefined || pCols.length === 0) {\n return undefined;\n }\n\n return pCols.map(\n (c) =>\n ({\n columnId: c.id,\n spec: c.spec,\n } satisfies PColumnIdAndSpec),\n );\n })\n\n .output('isRunning', (ctx) => ctx.outputs?.getIsReadyOrError() === false)\n\n .title((ctx) => ctx.uiState?.blockTitle ?? 'Repertoire Diversity')\n\n .sections((_) => [\n { type: 'link', href: '/', label: 'Main' },\n { type: 'link', href: '/diversityGraph', label: 'Diversity Graph' },\n ])\n\n .done();\n\nexport type BlockOutputs = InferOutputsType<typeof model>;\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":["BlockModel","createPlDataTableStateV2","createPlDataTableV2","createPFrameForGraphs"],"mappings":";;;;;AA8BO,IAAM,KAAQ,GAAAA,kBAAA,CAAW,MAAO,EAAA,CAEpC,QAAoB,CAAA;AAAA,EACnB,OAAS,EAAA;AAAA,IACP;AAAA,MACE,EAAI,EAAA,UAAA;AAAA,MACJ,IAAM,EAAA,UAAA;AAAA,MACN,YAAc,EAAA;AAAA,QACZ,IAAM,EAAA,gBAAA;AAAA,QACN,YAAc,EAAA;AAAA,OAChB;AAAA,MACA,UAAY,EAAA;AAAA,KACd;AAAA,IACA;AAAA,MACE,EAAI,EAAA,eAAA;AAAA,MACJ,IAAM,EAAA,eAAA;AAAA,MACN,YAAc,EAAA;AAAA,QACZ,IAAM,EAAA,gBAAA;AAAA,QACN,YAAc,EAAA;AAAA,OAChB;AAAA,MACA,UAAY,EAAA;AAAA,KACd;AAAA,IACA;AAAA,MACE,EAAI,EAAA,OAAA;AAAA,MACJ,IAAM,EAAA,OAAA;AAAA,MACN,YAAc,EAAA;AAAA,QACZ,IAAM,EAAA,gBAAA;AAAA,QACN,YAAc,EAAA;AAAA,OAChB;AAAA,MACA,UAAY,EAAA;AAAA,KACd;AAAA,IACA;AAAA,MACE,EAAI,EAAA,MAAA;AAAA,MACJ,IAAM,EAAA,MAAA;AAAA,MACN,YAAc,EAAA;AAAA,QACZ,IAAM,EAAA,gBAAA;AAAA,QACN,YAAc,EAAA;AAAA,OAChB;AAAA,MACA,UAAY,EAAA;AAAA,KACd;AAAA,IACA;AAAA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AAQ,CAAA,IAAI,GAAG,WAAY,EAAA;AACtD,EAAA,IAAI,UAAU,MAAW,EAAA;AACvB,IAAO,OAAA,MAAA;AAAA;AAGT,EAAO,OAAAC,6BAAA,CAAsB,KAAK,KAAK,CAAA;AACzC,CAAC,CAGA,CAAA,MAAA,CAAO,OAAS,EAAA,CAAC,GAAQ,KAAA;AACxB,EAAA,MAAM,QAAQ,GAAI,CAAA,OAAA,EAAS,OAAQ,CAAA,IAAI,GAAG,WAAY,EAAA;AAEtD,EAAA,IAAI,KAAU,KAAA,MAAA,IAAa,KAAM,CAAA,MAAA,KAAW,CAAG,EAAA;AAC7C,IAAO,OAAA,MAAA;AAAA;AAGT,EAAA,OAAO,KAAM,CAAA,GAAA;AAAA,IACX,CAAC,CACE,MAAA;AAAA,MACC,UAAU,CAAE,CAAA,EAAA;AAAA,MACZ,MAAM,CAAE,CAAA;AAAA,KACV;AAAA,GACJ;AACF,CAAC,CAAA,CAEA,OAAO,WAAa,EAAA,CAAC,QAAQ,GAAI,CAAA,OAAA,EAAS,mBAAwB,KAAA,KAAK,EAEvE,KAAM,CAAA,CAAC,QAAQ,GAAI,CAAA,OAAA,EAAS,cAAc,sBAAsB,CAAA,CAEhE,QAAS,CAAA,CAAC,CAAM,KAAA;AAAA,EACf,EAAE,IAAM,EAAA,MAAA,EAAQ,IAAM,EAAA,GAAA,EAAK,OAAO,MAAO,EAAA;AAAA,EACzC,EAAE,IAAM,EAAA,MAAA,EAAQ,IAAM,EAAA,iBAAA,EAAmB,OAAO,iBAAkB;AACpE,CAAC,EAEA,IAAK","file":"index.cjs","sourcesContent":["import type { GraphMakerState } from '@milaboratories/graph-maker';\nimport type { InferOutputsType, PColumnIdAndSpec, PlDataTableStateV2, PlRef } from '@platforma-sdk/model';\nimport { BlockModel, createPFrameForGraphs, createPlDataTableStateV2, createPlDataTableV2 } from '@platforma-sdk/model';\n\nexport type DiversityType = 'chao1' | 'd50' | 'efronThisted' |\n 'observed' | 'shannonWienerIndex' | 'shannonWiener' |\n 'normalizedShannonWiener' | 'inverseSimpson' | 'gini';\n\nexport type Metric = {\n id: string;\n type: DiversityType | undefined;\n downsampling: {\n type?: 'none' | 'top' | 'cumtop' | 'hypergeometric' ;\n valueChooser?: 'min' | 'fixed' | 'max' | 'auto';\n n?: number;\n };\n isExpanded?: boolean;\n};\n\nexport type BlockArgs = {\n abundanceRef?: PlRef;\n metrics: Metric[];\n};\n\nexport type UiState = {\n blockTitle: string;\n tableState: PlDataTableStateV2;\n graphState: GraphMakerState;\n};\n\nexport const model = BlockModel.create()\n\n .withArgs<BlockArgs>({\n metrics: [\n {\n id: 'observed',\n type: 'observed',\n downsampling: {\n type: 'hypergeometric',\n valueChooser: 'auto',\n },\n isExpanded: false,\n },\n {\n id: 'shannonWiener',\n type: 'shannonWiener',\n downsampling: {\n type: 'hypergeometric',\n valueChooser: 'auto',\n },\n isExpanded: false,\n },\n {\n id: 'chao1',\n type: 'chao1',\n downsampling: {\n type: 'hypergeometric',\n valueChooser: 'auto',\n },\n isExpanded: false,\n },\n {\n id: 'gini',\n type: 'gini',\n downsampling: {\n type: 'hypergeometric',\n valueChooser: 'auto',\n },\n isExpanded: false,\n },\n {\n id: 'd50',\n type: 'd50',\n downsampling: {\n type: 'hypergeometric',\n valueChooser: 'auto',\n },\n isExpanded: false,\n },\n ],\n })\n\n .withUiState<UiState>({\n blockTitle: 'Repertoire Diversity',\n graphState: {\n title: 'Repertoire Diversity',\n template: 'bar',\n currentTab: null,\n },\n\n tableState: createPlDataTableStateV2(),\n })\n\n .argsValid((ctx) => ctx.args.abundanceRef !== undefined)\n\n .output('abundanceOptions', (ctx) =>\n ctx.resultPool.getOptions([{\n axes: [\n { name: 'pl7.app/sampleId' },\n { },\n ],\n annotations: {\n 'pl7.app/isAbundance': 'true',\n 'pl7.app/abundance/normalized': 'false',\n 'pl7.app/abundance/isPrimary': 'true',\n },\n },\n ]),\n )\n\n .output('pt', (ctx) => {\n const pCols = ctx.outputs?.resolve('pf')?.getPColumns();\n if (pCols === undefined) {\n return undefined;\n }\n\n return createPlDataTableV2(ctx, pCols, ctx.uiState?.tableState);\n })\n\n .output('pf', (ctx) => {\n const pCols = ctx.outputs?.resolve('pf')?.getPColumns();\n if (pCols === undefined) {\n return undefined;\n }\n\n return createPFrameForGraphs(ctx, pCols);\n })\n\n // Return a list of Pcols for plot defaults\n .output('pcols', (ctx) => {\n const pCols = ctx.outputs?.resolve('pf')?.getPColumns();\n\n if (pCols === undefined || pCols.length === 0) {\n return undefined;\n }\n\n return pCols.map(\n (c) =>\n ({\n columnId: c.id,\n spec: c.spec,\n } satisfies PColumnIdAndSpec),\n );\n })\n\n .output('isRunning', (ctx) => ctx.outputs?.getIsReadyOrError() === false)\n\n .title((ctx) => ctx.uiState?.blockTitle ?? 'Repertoire Diversity')\n\n .sections((_) => [\n { type: 'link', href: '/', label: 'Main' },\n { type: 'link', href: '/diversityGraph', label: 'Diversity Graph' },\n ])\n\n .done();\n\nexport type BlockOutputs = InferOutputsType<typeof model>;\n"]}
package/dist/index.d.cts CHANGED
@@ -1,15 +1,17 @@
1
1
  import * as _platforma_sdk_model from '@platforma-sdk/model';
2
- import { PlRef, PlDataTableState, InferOutputsType } from '@platforma-sdk/model';
2
+ import { PlRef, PlDataTableStateV2, InferOutputsType } from '@platforma-sdk/model';
3
3
  import { GraphMakerState } from '@milaboratories/graph-maker';
4
4
 
5
5
  type DiversityType = 'chao1' | 'd50' | 'efronThisted' | 'observed' | 'shannonWienerIndex' | 'shannonWiener' | 'normalizedShannonWiener' | 'inverseSimpson' | 'gini';
6
6
  type Metric = {
7
+ id: string;
7
8
  type: DiversityType | undefined;
8
9
  downsampling: {
9
10
  type?: 'none' | 'top' | 'cumtop' | 'hypergeometric';
10
11
  valueChooser?: 'min' | 'fixed' | 'max' | 'auto';
11
12
  n?: number;
12
13
  };
14
+ isExpanded?: boolean;
13
15
  };
14
16
  type BlockArgs = {
15
17
  abundanceRef?: PlRef;
@@ -17,7 +19,7 @@ type BlockArgs = {
17
19
  };
18
20
  type UiState = {
19
21
  blockTitle: string;
20
- tableState?: PlDataTableState;
22
+ tableState: PlDataTableStateV2;
21
23
  graphState: GraphMakerState;
22
24
  };
23
25
  declare const model: _platforma_sdk_model.Platforma<BlockArgs, {
@@ -30,7 +32,11 @@ declare const model: _platforma_sdk_model.Platforma<BlockArgs, {
30
32
  };
31
33
  readonly label: string;
32
34
  }[]>;
33
- pt: _platforma_sdk_model.ValueOrErrors<_platforma_sdk_model.PTableHandle | undefined>;
35
+ pt: _platforma_sdk_model.ValueOrErrors<{
36
+ sourceId: string | null;
37
+ fullTableHandle: _platforma_sdk_model.PTableHandle;
38
+ visibleTableHandle: _platforma_sdk_model.PTableHandle;
39
+ } | undefined>;
34
40
  pf: _platforma_sdk_model.ValueOrErrors<_platforma_sdk_model.PFrameHandle | undefined>;
35
41
  pcols: _platforma_sdk_model.ValueOrErrors<{
36
42
  columnId: _platforma_sdk_model.PObjectId;
package/dist/index.d.ts CHANGED
@@ -1,15 +1,17 @@
1
1
  import * as _platforma_sdk_model from '@platforma-sdk/model';
2
- import { PlRef, PlDataTableState, InferOutputsType } from '@platforma-sdk/model';
2
+ import { PlRef, PlDataTableStateV2, InferOutputsType } from '@platforma-sdk/model';
3
3
  import { GraphMakerState } from '@milaboratories/graph-maker';
4
4
 
5
5
  type DiversityType = 'chao1' | 'd50' | 'efronThisted' | 'observed' | 'shannonWienerIndex' | 'shannonWiener' | 'normalizedShannonWiener' | 'inverseSimpson' | 'gini';
6
6
  type Metric = {
7
+ id: string;
7
8
  type: DiversityType | undefined;
8
9
  downsampling: {
9
10
  type?: 'none' | 'top' | 'cumtop' | 'hypergeometric';
10
11
  valueChooser?: 'min' | 'fixed' | 'max' | 'auto';
11
12
  n?: number;
12
13
  };
14
+ isExpanded?: boolean;
13
15
  };
14
16
  type BlockArgs = {
15
17
  abundanceRef?: PlRef;
@@ -17,7 +19,7 @@ type BlockArgs = {
17
19
  };
18
20
  type UiState = {
19
21
  blockTitle: string;
20
- tableState?: PlDataTableState;
22
+ tableState: PlDataTableStateV2;
21
23
  graphState: GraphMakerState;
22
24
  };
23
25
  declare const model: _platforma_sdk_model.Platforma<BlockArgs, {
@@ -30,7 +32,11 @@ declare const model: _platforma_sdk_model.Platforma<BlockArgs, {
30
32
  };
31
33
  readonly label: string;
32
34
  }[]>;
33
- pt: _platforma_sdk_model.ValueOrErrors<_platforma_sdk_model.PTableHandle | undefined>;
35
+ pt: _platforma_sdk_model.ValueOrErrors<{
36
+ sourceId: string | null;
37
+ fullTableHandle: _platforma_sdk_model.PTableHandle;
38
+ visibleTableHandle: _platforma_sdk_model.PTableHandle;
39
+ } | undefined>;
34
40
  pf: _platforma_sdk_model.ValueOrErrors<_platforma_sdk_model.PFrameHandle | undefined>;
35
41
  pcols: _platforma_sdk_model.ValueOrErrors<{
36
42
  columnId: _platforma_sdk_model.PObjectId;
package/dist/index.js CHANGED
@@ -1,42 +1,52 @@
1
- import { BlockModel, createPlDataTable, createPFrameForGraphs } from '@platforma-sdk/model';
1
+ import { BlockModel, createPlDataTableStateV2, createPlDataTableV2, createPFrameForGraphs } from '@platforma-sdk/model';
2
2
 
3
3
  // src/index.ts
4
4
  var model = BlockModel.create().withArgs({
5
5
  metrics: [
6
6
  {
7
+ id: "observed",
7
8
  type: "observed",
8
9
  downsampling: {
9
10
  type: "hypergeometric",
10
11
  valueChooser: "auto"
11
- }
12
+ },
13
+ isExpanded: false
12
14
  },
13
15
  {
16
+ id: "shannonWiener",
14
17
  type: "shannonWiener",
15
18
  downsampling: {
16
19
  type: "hypergeometric",
17
20
  valueChooser: "auto"
18
- }
21
+ },
22
+ isExpanded: false
19
23
  },
20
24
  {
25
+ id: "chao1",
21
26
  type: "chao1",
22
27
  downsampling: {
23
28
  type: "hypergeometric",
24
29
  valueChooser: "auto"
25
- }
30
+ },
31
+ isExpanded: false
26
32
  },
27
33
  {
34
+ id: "gini",
28
35
  type: "gini",
29
36
  downsampling: {
30
37
  type: "hypergeometric",
31
38
  valueChooser: "auto"
32
- }
39
+ },
40
+ isExpanded: false
33
41
  },
34
42
  {
43
+ id: "d50",
35
44
  type: "d50",
36
45
  downsampling: {
37
46
  type: "hypergeometric",
38
47
  valueChooser: "auto"
39
- }
48
+ },
49
+ isExpanded: false
40
50
  }
41
51
  ]
42
52
  }).withUiState({
@@ -46,13 +56,7 @@ var model = BlockModel.create().withArgs({
46
56
  template: "bar",
47
57
  currentTab: null
48
58
  },
49
- tableState: {
50
- gridState: {},
51
- pTableParams: {
52
- sorting: [],
53
- filters: []
54
- }
55
- }
59
+ tableState: createPlDataTableStateV2()
56
60
  }).argsValid((ctx) => ctx.args.abundanceRef !== void 0).output(
57
61
  "abundanceOptions",
58
62
  (ctx) => ctx.resultPool.getOptions([
@@ -73,7 +77,7 @@ var model = BlockModel.create().withArgs({
73
77
  if (pCols === void 0) {
74
78
  return void 0;
75
79
  }
76
- return createPlDataTable(ctx, pCols, ctx.uiState?.tableState);
80
+ return createPlDataTableV2(ctx, pCols, ctx.uiState?.tableState);
77
81
  }).output("pf", (ctx) => {
78
82
  const pCols = ctx.outputs?.resolve("pf")?.getPColumns();
79
83
  if (pCols === void 0) {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;AA4BO,IAAM,KAAQ,GAAA,UAAA,CAAW,MAAO,EAAA,CAEpC,QAAoB,CAAA;AAAA,EACnB,OAAS,EAAA;AAAA,IACP;AAAA,MACE,IAAM,EAAA,UAAA;AAAA,MACN,YAAc,EAAA;AAAA,QACZ,IAAM,EAAA,gBAAA;AAAA,QACN,YAAc,EAAA;AAAA;AAChB,KACF;AAAA,IACA;AAAA,MACE,IAAM,EAAA,eAAA;AAAA,MACN,YAAc,EAAA;AAAA,QACZ,IAAM,EAAA,gBAAA;AAAA,QACN,YAAc,EAAA;AAAA;AAChB,KACF;AAAA,IACA;AAAA,MACE,IAAM,EAAA,OAAA;AAAA,MACN,YAAc,EAAA;AAAA,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.js","sourcesContent":["import type { GraphMakerState } from '@milaboratories/graph-maker';\nimport type { InferOutputsType, PColumnIdAndSpec, PlDataTableState, PlRef } from '@platforma-sdk/model';\nimport { BlockModel, createPFrameForGraphs, createPlDataTable } from '@platforma-sdk/model';\n\nexport type DiversityType = 'chao1' | 'd50' | 'efronThisted' |\n 'observed' | 'shannonWienerIndex' | 'shannonWiener' |\n 'normalizedShannonWiener' | 'inverseSimpson' | 'gini';\n\nexport type Metric = {\n type: DiversityType | undefined;\n downsampling: {\n type?: 'none' | 'top' | 'cumtop' | 'hypergeometric' ;\n valueChooser?: 'min' | 'fixed' | 'max' | 'auto';\n n?: number;\n };\n};\n\nexport type BlockArgs = {\n abundanceRef?: PlRef;\n metrics: Metric[];\n};\n\nexport type UiState = {\n blockTitle: string;\n tableState?: PlDataTableState;\n graphState: GraphMakerState;\n};\n\nexport const model = BlockModel.create()\n\n .withArgs<BlockArgs>({\n metrics: [\n {\n type: 'observed',\n downsampling: {\n type: 'hypergeometric',\n valueChooser: 'auto',\n },\n },\n {\n type: 'shannonWiener',\n downsampling: {\n type: 'hypergeometric',\n valueChooser: 'auto',\n },\n },\n {\n type: 'chao1',\n downsampling: {\n type: 'hypergeometric',\n valueChooser: 'auto',\n },\n },\n {\n type: 'gini',\n downsampling: {\n type: 'hypergeometric',\n valueChooser: 'auto',\n },\n },\n {\n type: 'd50',\n downsampling: {\n type: 'hypergeometric',\n valueChooser: 'auto',\n },\n },\n ],\n })\n\n .withUiState<UiState>({\n blockTitle: 'Repertoire Diversity',\n graphState: {\n title: 'Repertoire Diversity',\n template: 'bar',\n currentTab: null,\n },\n\n tableState: {\n gridState: {},\n pTableParams: {\n sorting: [],\n filters: [],\n },\n },\n })\n\n .argsValid((ctx) => ctx.args.abundanceRef !== undefined)\n\n .output('abundanceOptions', (ctx) =>\n ctx.resultPool.getOptions([{\n axes: [\n { name: 'pl7.app/sampleId' },\n { },\n ],\n annotations: {\n 'pl7.app/isAbundance': 'true',\n 'pl7.app/abundance/normalized': 'false',\n 'pl7.app/abundance/isPrimary': 'true',\n },\n },\n ]),\n )\n\n .output('pt', (ctx) => {\n const pCols = ctx.outputs?.resolve('pf')?.getPColumns();\n if (pCols === undefined) {\n return undefined;\n }\n\n return createPlDataTable(ctx, pCols, ctx.uiState?.tableState);\n })\n\n .output('pf', (ctx) => {\n const pCols = ctx.outputs?.resolve('pf')?.getPColumns();\n if (pCols === undefined) {\n return undefined;\n }\n\n return createPFrameForGraphs(ctx, pCols);\n })\n\n // Return a list of Pcols for plot defaults\n .output('pcols', (ctx) => {\n const pCols = ctx.outputs?.resolve('pf')?.getPColumns();\n\n if (pCols === undefined || pCols.length === 0) {\n return undefined;\n }\n\n return pCols.map(\n (c) =>\n ({\n columnId: c.id,\n spec: c.spec,\n } satisfies PColumnIdAndSpec),\n );\n })\n\n .output('isRunning', (ctx) => ctx.outputs?.getIsReadyOrError() === false)\n\n .title((ctx) => ctx.uiState?.blockTitle ?? 'Repertoire Diversity')\n\n .sections((_) => [\n { type: 'link', href: '/', label: 'Main' },\n { type: 'link', href: '/diversityGraph', label: 'Diversity Graph' },\n ])\n\n .done();\n\nexport type BlockOutputs = InferOutputsType<typeof model>;\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;AA8BO,IAAM,KAAQ,GAAA,UAAA,CAAW,MAAO,EAAA,CAEpC,QAAoB,CAAA;AAAA,EACnB,OAAS,EAAA;AAAA,IACP;AAAA,MACE,EAAI,EAAA,UAAA;AAAA,MACJ,IAAM,EAAA,UAAA;AAAA,MACN,YAAc,EAAA;AAAA,QACZ,IAAM,EAAA,gBAAA;AAAA,QACN,YAAc,EAAA;AAAA,OAChB;AAAA,MACA,UAAY,EAAA;AAAA,KACd;AAAA,IACA;AAAA,MACE,EAAI,EAAA,eAAA;AAAA,MACJ,IAAM,EAAA,eAAA;AAAA,MACN,YAAc,EAAA;AAAA,QACZ,IAAM,EAAA,gBAAA;AAAA,QACN,YAAc,EAAA;AAAA,OA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E,IAAM,EAAA,MAAA,EAAQ,IAAM,EAAA,GAAA,EAAK,OAAO,MAAO,EAAA;AAAA,EACzC,EAAE,IAAM,EAAA,MAAA,EAAQ,IAAM,EAAA,iBAAA,EAAmB,OAAO,iBAAkB;AACpE,CAAC,EAEA,IAAK","file":"index.js","sourcesContent":["import type { GraphMakerState } from '@milaboratories/graph-maker';\nimport type { InferOutputsType, PColumnIdAndSpec, PlDataTableStateV2, PlRef } from '@platforma-sdk/model';\nimport { BlockModel, createPFrameForGraphs, createPlDataTableStateV2, createPlDataTableV2 } from '@platforma-sdk/model';\n\nexport type DiversityType = 'chao1' | 'd50' | 'efronThisted' |\n 'observed' | 'shannonWienerIndex' | 'shannonWiener' |\n 'normalizedShannonWiener' | 'inverseSimpson' | 'gini';\n\nexport type Metric = {\n id: string;\n type: DiversityType | undefined;\n downsampling: {\n type?: 'none' | 'top' | 'cumtop' | 'hypergeometric' ;\n valueChooser?: 'min' | 'fixed' | 'max' | 'auto';\n n?: number;\n };\n isExpanded?: boolean;\n};\n\nexport type BlockArgs = {\n abundanceRef?: PlRef;\n metrics: Metric[];\n};\n\nexport type UiState = {\n blockTitle: string;\n tableState: PlDataTableStateV2;\n graphState: GraphMakerState;\n};\n\nexport const model = BlockModel.create()\n\n .withArgs<BlockArgs>({\n metrics: [\n {\n id: 'observed',\n type: 'observed',\n downsampling: {\n type: 'hypergeometric',\n valueChooser: 'auto',\n },\n isExpanded: false,\n },\n {\n id: 'shannonWiener',\n type: 'shannonWiener',\n downsampling: {\n type: 'hypergeometric',\n valueChooser: 'auto',\n },\n isExpanded: false,\n },\n {\n id: 'chao1',\n type: 'chao1',\n downsampling: {\n type: 'hypergeometric',\n valueChooser: 'auto',\n },\n isExpanded: false,\n },\n {\n id: 'gini',\n type: 'gini',\n downsampling: {\n type: 'hypergeometric',\n valueChooser: 'auto',\n },\n isExpanded: false,\n },\n {\n id: 'd50',\n type: 'd50',\n downsampling: {\n type: 'hypergeometric',\n valueChooser: 'auto',\n },\n isExpanded: false,\n },\n ],\n })\n\n .withUiState<UiState>({\n blockTitle: 'Repertoire Diversity',\n graphState: {\n title: 'Repertoire Diversity',\n template: 'bar',\n currentTab: null,\n },\n\n tableState: createPlDataTableStateV2(),\n })\n\n .argsValid((ctx) => ctx.args.abundanceRef !== undefined)\n\n .output('abundanceOptions', (ctx) =>\n ctx.resultPool.getOptions([{\n axes: [\n { name: 'pl7.app/sampleId' },\n { },\n ],\n annotations: {\n 'pl7.app/isAbundance': 'true',\n 'pl7.app/abundance/normalized': 'false',\n 'pl7.app/abundance/isPrimary': 'true',\n },\n },\n ]),\n )\n\n .output('pt', (ctx) => {\n const pCols = ctx.outputs?.resolve('pf')?.getPColumns();\n if (pCols === undefined) {\n return undefined;\n }\n\n return createPlDataTableV2(ctx, pCols, ctx.uiState?.tableState);\n })\n\n .output('pf', (ctx) => {\n const pCols = ctx.outputs?.resolve('pf')?.getPColumns();\n if (pCols === undefined) {\n return undefined;\n }\n\n return createPFrameForGraphs(ctx, pCols);\n })\n\n // Return a list of Pcols for plot defaults\n .output('pcols', (ctx) => {\n const pCols = ctx.outputs?.resolve('pf')?.getPColumns();\n\n if (pCols === undefined || pCols.length === 0) {\n return undefined;\n }\n\n return pCols.map(\n (c) =>\n ({\n columnId: c.id,\n spec: c.spec,\n } satisfies PColumnIdAndSpec),\n );\n })\n\n .output('isRunning', (ctx) => ctx.outputs?.getIsReadyOrError() === false)\n\n .title((ctx) => ctx.uiState?.blockTitle ?? 'Repertoire Diversity')\n\n .sections((_) => [\n { type: 'link', href: '/', label: 'Main' },\n { type: 'link', href: '/diversityGraph', label: 'Diversity Graph' },\n ])\n\n .done();\n\nexport type BlockOutputs = InferOutputsType<typeof model>;\n"]}