@platforma-open/milaboratories.repertoire-diversity-2.model 1.1.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/.turbo/turbo-build.log +31 -0
- package/CHANGELOG.md +19 -0
- package/dist/bundle.js +6091 -0
- package/dist/bundle.js.map +1 -0
- package/dist/index.cjs +82 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +38 -0
- package/dist/index.d.ts +38 -0
- package/dist/index.js +80 -0
- package/dist/index.js.map +1 -0
- package/dist/model.json +1 -0
- package/eslint.config.mjs +4 -0
- package/package.json +39 -0
- package/src/index.ts +130 -0
- package/tsconfig.json +16 -0
- package/vite.config.mts +20 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var model$1 = require('@platforma-sdk/model');
|
|
4
|
+
|
|
5
|
+
// src/index.ts
|
|
6
|
+
function isNumericType(c) {
|
|
7
|
+
return c.valueType === "Double" || c.valueType === "Int" || c.valueType === "Float" || c.valueType === "Long";
|
|
8
|
+
}
|
|
9
|
+
var model = model$1.BlockModel.create().withArgs({
|
|
10
|
+
metrics: [
|
|
11
|
+
{
|
|
12
|
+
type: "observed",
|
|
13
|
+
downsampling: {
|
|
14
|
+
type: "hypergeometric",
|
|
15
|
+
valueChooser: "auto"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
type: "shannonWiener",
|
|
20
|
+
downsampling: {
|
|
21
|
+
type: "hypergeometric",
|
|
22
|
+
valueChooser: "auto"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
type: "chao1",
|
|
27
|
+
downsampling: {
|
|
28
|
+
type: "hypergeometric",
|
|
29
|
+
valueChooser: "auto"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
type: "gini",
|
|
34
|
+
downsampling: {
|
|
35
|
+
type: "hypergeometric",
|
|
36
|
+
valueChooser: "auto"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
type: "d50",
|
|
41
|
+
downsampling: {
|
|
42
|
+
type: "hypergeometric",
|
|
43
|
+
valueChooser: "auto"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
}).withUiState({
|
|
48
|
+
blockTitle: "Repertoire Diversity",
|
|
49
|
+
graphState: {
|
|
50
|
+
title: "Repertoire Diversity",
|
|
51
|
+
template: "bar",
|
|
52
|
+
currentTab: null
|
|
53
|
+
},
|
|
54
|
+
tableState: {
|
|
55
|
+
gridState: {},
|
|
56
|
+
pTableParams: {
|
|
57
|
+
sorting: [],
|
|
58
|
+
filters: []
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}).argsValid((ctx) => ctx.args.abundanceRef !== void 0).output("abundanceOptions", (ctx) => ctx.resultPool.getOptions(
|
|
62
|
+
(c) => model$1.isPColumnSpec(c) && isNumericType(c) && c.annotations?.["pl7.app/isAbundance"] === "true" && c.annotations?.["pl7.app/abundance/normalized"] === "false"
|
|
63
|
+
)).output("pt", (ctx) => {
|
|
64
|
+
const pCols = ctx.outputs?.resolve("pf")?.getPColumns();
|
|
65
|
+
if (pCols === void 0) {
|
|
66
|
+
return void 0;
|
|
67
|
+
}
|
|
68
|
+
return model$1.createPlDataTable(ctx, pCols, ctx.uiState?.tableState);
|
|
69
|
+
}).output("pf", (ctx) => {
|
|
70
|
+
const pCols = ctx.outputs?.resolve("pf")?.getPColumns();
|
|
71
|
+
if (pCols === void 0) {
|
|
72
|
+
return void 0;
|
|
73
|
+
}
|
|
74
|
+
return model$1.createPFrameForGraphs(ctx, pCols);
|
|
75
|
+
}).output("isRunning", (ctx) => ctx.outputs?.getIsReadyOrError() === false).title((ctx) => ctx.uiState?.blockTitle ?? "Repertoire Diversity").sections((_) => [
|
|
76
|
+
{ type: "link", href: "/", label: "Main" },
|
|
77
|
+
{ type: "link", href: "/diversityGraph", label: "Diversity Graph" }
|
|
78
|
+
]).done();
|
|
79
|
+
|
|
80
|
+
exports.model = model;
|
|
81
|
+
//# sourceMappingURL=index.cjs.map
|
|
82
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":["BlockModel","isPColumnSpec","createPlDataTable","createPFrameForGraphs"],"mappings":";;;;;AA4BA,SAAS,cAAc,CAAyB,EAAA;AAC9C,EAAO,OAAA,CAAA,CAAE,SAAc,KAAA,QAAA,IAAY,CAAE,CAAA,SAAA,KAAc,SAAS,CAAE,CAAA,SAAA,KAAc,OAAW,IAAA,CAAA,CAAE,SAAc,KAAA,MAAA;AACzG;AAEO,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;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,KAAK,KAAK,CAAA;AACzC,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, PColumnSpec, PlDataTableState, PlRef } from '@platforma-sdk/model';\nimport { BlockModel, createPFrameForGraphs, createPlDataTable, isPColumnSpec } 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\nfunction isNumericType(c: PColumnSpec): boolean {\n return c.valueType === 'Double' || c.valueType === 'Int' || c.valueType === 'Float' || c.valueType === 'Long';\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((c) =>\n isPColumnSpec(c) && isNumericType(c)\n && c.annotations?.['pl7.app/isAbundance'] === 'true'\n && c.annotations?.['pl7.app/abundance/normalized'] === 'false',\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 .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
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as _platforma_sdk_model from '@platforma-sdk/model';
|
|
2
|
+
import { PlRef, PlDataTableState, InferOutputsType } from '@platforma-sdk/model';
|
|
3
|
+
import { GraphMakerState } from '@milaboratories/graph-maker';
|
|
4
|
+
|
|
5
|
+
type DiversityType = 'chao1' | 'd50' | 'efronThisted' | 'observed' | 'shannonWienerIndex' | 'shannonWiener' | 'normalizedShannonWiener' | 'inverseSimpson' | 'gini';
|
|
6
|
+
type Metric = {
|
|
7
|
+
type: DiversityType | undefined;
|
|
8
|
+
downsampling: {
|
|
9
|
+
type?: 'none' | 'top' | 'cumtop' | 'hypergeometric';
|
|
10
|
+
valueChooser?: 'min' | 'fixed' | 'max' | 'auto';
|
|
11
|
+
n?: number;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
type BlockArgs = {
|
|
15
|
+
abundanceRef?: PlRef;
|
|
16
|
+
metrics: Metric[];
|
|
17
|
+
};
|
|
18
|
+
type UiState = {
|
|
19
|
+
blockTitle: string;
|
|
20
|
+
tableState?: PlDataTableState;
|
|
21
|
+
graphState: GraphMakerState;
|
|
22
|
+
};
|
|
23
|
+
declare const model: _platforma_sdk_model.Platforma<BlockArgs, {
|
|
24
|
+
abundanceOptions: _platforma_sdk_model.ValueOrErrors<{
|
|
25
|
+
readonly ref: {
|
|
26
|
+
readonly __isRef: true;
|
|
27
|
+
readonly blockId: string;
|
|
28
|
+
readonly name: string;
|
|
29
|
+
};
|
|
30
|
+
readonly label: string;
|
|
31
|
+
}[]>;
|
|
32
|
+
pt: _platforma_sdk_model.ValueOrErrors<_platforma_sdk_model.PTableHandle | undefined>;
|
|
33
|
+
pf: _platforma_sdk_model.ValueOrErrors<_platforma_sdk_model.PFrameHandle | undefined>;
|
|
34
|
+
isRunning: _platforma_sdk_model.ValueOrErrors<boolean>;
|
|
35
|
+
}, UiState, "/" | "/diversityGraph">;
|
|
36
|
+
type BlockOutputs = InferOutputsType<typeof model>;
|
|
37
|
+
|
|
38
|
+
export { type BlockArgs, type BlockOutputs, type DiversityType, type Metric, type UiState, model };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as _platforma_sdk_model from '@platforma-sdk/model';
|
|
2
|
+
import { PlRef, PlDataTableState, InferOutputsType } from '@platforma-sdk/model';
|
|
3
|
+
import { GraphMakerState } from '@milaboratories/graph-maker';
|
|
4
|
+
|
|
5
|
+
type DiversityType = 'chao1' | 'd50' | 'efronThisted' | 'observed' | 'shannonWienerIndex' | 'shannonWiener' | 'normalizedShannonWiener' | 'inverseSimpson' | 'gini';
|
|
6
|
+
type Metric = {
|
|
7
|
+
type: DiversityType | undefined;
|
|
8
|
+
downsampling: {
|
|
9
|
+
type?: 'none' | 'top' | 'cumtop' | 'hypergeometric';
|
|
10
|
+
valueChooser?: 'min' | 'fixed' | 'max' | 'auto';
|
|
11
|
+
n?: number;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
type BlockArgs = {
|
|
15
|
+
abundanceRef?: PlRef;
|
|
16
|
+
metrics: Metric[];
|
|
17
|
+
};
|
|
18
|
+
type UiState = {
|
|
19
|
+
blockTitle: string;
|
|
20
|
+
tableState?: PlDataTableState;
|
|
21
|
+
graphState: GraphMakerState;
|
|
22
|
+
};
|
|
23
|
+
declare const model: _platforma_sdk_model.Platforma<BlockArgs, {
|
|
24
|
+
abundanceOptions: _platforma_sdk_model.ValueOrErrors<{
|
|
25
|
+
readonly ref: {
|
|
26
|
+
readonly __isRef: true;
|
|
27
|
+
readonly blockId: string;
|
|
28
|
+
readonly name: string;
|
|
29
|
+
};
|
|
30
|
+
readonly label: string;
|
|
31
|
+
}[]>;
|
|
32
|
+
pt: _platforma_sdk_model.ValueOrErrors<_platforma_sdk_model.PTableHandle | undefined>;
|
|
33
|
+
pf: _platforma_sdk_model.ValueOrErrors<_platforma_sdk_model.PFrameHandle | undefined>;
|
|
34
|
+
isRunning: _platforma_sdk_model.ValueOrErrors<boolean>;
|
|
35
|
+
}, UiState, "/" | "/diversityGraph">;
|
|
36
|
+
type BlockOutputs = InferOutputsType<typeof model>;
|
|
37
|
+
|
|
38
|
+
export { type BlockArgs, type BlockOutputs, type DiversityType, type Metric, type UiState, model };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { BlockModel, isPColumnSpec, createPlDataTable, createPFrameForGraphs } from '@platforma-sdk/model';
|
|
2
|
+
|
|
3
|
+
// src/index.ts
|
|
4
|
+
function isNumericType(c) {
|
|
5
|
+
return c.valueType === "Double" || c.valueType === "Int" || c.valueType === "Float" || c.valueType === "Long";
|
|
6
|
+
}
|
|
7
|
+
var model = BlockModel.create().withArgs({
|
|
8
|
+
metrics: [
|
|
9
|
+
{
|
|
10
|
+
type: "observed",
|
|
11
|
+
downsampling: {
|
|
12
|
+
type: "hypergeometric",
|
|
13
|
+
valueChooser: "auto"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
type: "shannonWiener",
|
|
18
|
+
downsampling: {
|
|
19
|
+
type: "hypergeometric",
|
|
20
|
+
valueChooser: "auto"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
type: "chao1",
|
|
25
|
+
downsampling: {
|
|
26
|
+
type: "hypergeometric",
|
|
27
|
+
valueChooser: "auto"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
type: "gini",
|
|
32
|
+
downsampling: {
|
|
33
|
+
type: "hypergeometric",
|
|
34
|
+
valueChooser: "auto"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
type: "d50",
|
|
39
|
+
downsampling: {
|
|
40
|
+
type: "hypergeometric",
|
|
41
|
+
valueChooser: "auto"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
]
|
|
45
|
+
}).withUiState({
|
|
46
|
+
blockTitle: "Repertoire Diversity",
|
|
47
|
+
graphState: {
|
|
48
|
+
title: "Repertoire Diversity",
|
|
49
|
+
template: "bar",
|
|
50
|
+
currentTab: null
|
|
51
|
+
},
|
|
52
|
+
tableState: {
|
|
53
|
+
gridState: {},
|
|
54
|
+
pTableParams: {
|
|
55
|
+
sorting: [],
|
|
56
|
+
filters: []
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}).argsValid((ctx) => ctx.args.abundanceRef !== void 0).output("abundanceOptions", (ctx) => ctx.resultPool.getOptions(
|
|
60
|
+
(c) => isPColumnSpec(c) && isNumericType(c) && c.annotations?.["pl7.app/isAbundance"] === "true" && c.annotations?.["pl7.app/abundance/normalized"] === "false"
|
|
61
|
+
)).output("pt", (ctx) => {
|
|
62
|
+
const pCols = ctx.outputs?.resolve("pf")?.getPColumns();
|
|
63
|
+
if (pCols === void 0) {
|
|
64
|
+
return void 0;
|
|
65
|
+
}
|
|
66
|
+
return createPlDataTable(ctx, pCols, ctx.uiState?.tableState);
|
|
67
|
+
}).output("pf", (ctx) => {
|
|
68
|
+
const pCols = ctx.outputs?.resolve("pf")?.getPColumns();
|
|
69
|
+
if (pCols === void 0) {
|
|
70
|
+
return void 0;
|
|
71
|
+
}
|
|
72
|
+
return createPFrameForGraphs(ctx, pCols);
|
|
73
|
+
}).output("isRunning", (ctx) => ctx.outputs?.getIsReadyOrError() === false).title((ctx) => ctx.uiState?.blockTitle ?? "Repertoire Diversity").sections((_) => [
|
|
74
|
+
{ type: "link", href: "/", label: "Main" },
|
|
75
|
+
{ type: "link", href: "/diversityGraph", label: "Diversity Graph" }
|
|
76
|
+
]).done();
|
|
77
|
+
|
|
78
|
+
export { model };
|
|
79
|
+
//# sourceMappingURL=index.js.map
|
|
80
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;AA4BA,SAAS,cAAc,CAAyB,EAAA;AAC9C,EAAO,OAAA,CAAA,CAAE,SAAc,KAAA,QAAA,IAAY,CAAE,CAAA,SAAA,KAAc,SAAS,CAAE,CAAA,SAAA,KAAc,OAAW,IAAA,CAAA,CAAE,SAAc,KAAA,MAAA;AACzG;AAEO,IAAM,KAAQ,GAAA,UAAA,CAAW,MAAO,EAAA,CAEpC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AC,CAAA,IAAK,cAAc,CAAC,CAAA,IAChC,CAAE,CAAA,WAAA,GAAc,qBAAqB,CAAM,KAAA,MAAA,IAC3C,CAAE,CAAA,WAAA,GAAc,8BAA8B,CAAM,KAAA;AACzD,CAAC,CAEF,CAAA,MAAA,CAAO,IAAM,EAAA,CAAC,GAAQ,KAAA;AACrB,EAAA,MAAM,QAAQ,GAAI,CAAA,OAAA,EAAS,OAAQ,CAAA,IAAI,GAAG,WAAY,EAAA;AACtD,EAAA,IAAI,UAAU,MAAW,EAAA;AACvB,IAAO,OAAA,MAAA;AAAA;AAGT,EAAA,OAAO,iBAAkB,CAAA,GAAA,EAAK,KAAO,EAAA,GAAA,CAAI,SAAS,UAAU,CAAA;AAC9D,CAAC,CAEA,CAAA,MAAA,CAAO,IAAM,EAAA,CAAC,GAAQ,KAAA;AACrB,EAAA,MAAM,QAAQ,GAAI,CAAA,OAAA,EAAS,OAAQ,CAAA,IAAI,GAAG,WAAY,EAAA;AACtD,EAAA,IAAI,UAAU,MAAW,EAAA;AACvB,IAAO,OAAA,MAAA;AAAA;AAGT,EAAO,OAAA,qBAAA,CAAsB,KAAK,KAAK,CAAA;AACzC,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.js","sourcesContent":["import type { GraphMakerState } from '@milaboratories/graph-maker';\nimport type { InferOutputsType, PColumnSpec, PlDataTableState, PlRef } from '@platforma-sdk/model';\nimport { BlockModel, createPFrameForGraphs, createPlDataTable, isPColumnSpec } 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\nfunction isNumericType(c: PColumnSpec): boolean {\n return c.valueType === 'Double' || c.valueType === 'Int' || c.valueType === 'Float' || c.valueType === 'Long';\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((c) =>\n isPColumnSpec(c) && isNumericType(c)\n && c.annotations?.['pl7.app/isAbundance'] === 'true'\n && c.annotations?.['pl7.app/abundance/normalized'] === 'false',\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 .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"]}
|