@platforma-open/milaboratories.repertoire-diversity-2.model 1.5.4 → 1.5.6
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 +13 -28
- package/.turbo/turbo-lint.log +5 -0
- package/.turbo/turbo-type-check.log +6 -0
- package/CHANGELOG.md +12 -0
- package/dist/bundle.js +8166 -7256
- package/dist/bundle.js.map +1 -1
- package/dist/converters.cjs +13 -0
- package/dist/converters.cjs.map +1 -0
- package/dist/converters.d.ts +3 -0
- package/dist/converters.d.ts.map +1 -0
- package/dist/converters.js +11 -0
- package/dist/converters.js.map +1 -0
- package/dist/index.cjs +106 -110
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +36 -30
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +106 -110
- package/dist/index.js.map +1 -1
- package/dist/model.json +1 -1
- package/package.json +28 -28
- package/src/index.ts +11 -9
- package/tsconfig.json +1 -12
- package/vitest.config.mts +9 -0
- package/dist/index.d.cts +0 -76
- package/vite.config.mts +0 -20
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const convertMetricsUiToArgs = (metrics) => {
|
|
4
|
+
return metrics.map((metric) => {
|
|
5
|
+
return {
|
|
6
|
+
type: metric.type,
|
|
7
|
+
downsampling: metric.downsampling,
|
|
8
|
+
};
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
exports.convertMetricsUiToArgs = convertMetricsUiToArgs;
|
|
13
|
+
//# sourceMappingURL=converters.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"converters.cjs","sources":["../src/converters.ts"],"sourcesContent":["import type { Metric, MetricUI } from './index';\n\nexport const convertMetricsUiToArgs = (metrics: MetricUI[]): Metric[] => {\n return metrics.map((metric): Metric => {\n return {\n type: metric.type,\n downsampling: metric.downsampling,\n };\n });\n};\n"],"names":[],"mappings":";;AAEO,MAAM,sBAAsB,GAAG,CAAC,OAAmB,KAAc;AACtE,IAAA,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,KAAY;QACpC,OAAO;YACL,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,YAAY,EAAE,MAAM,CAAC,YAAY;SAClC;AACH,IAAA,CAAC,CAAC;AACJ;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"converters.d.ts","sourceRoot":"","sources":["../src/converters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEhD,eAAO,MAAM,sBAAsB,YAAa,QAAQ,EAAE,KAAG,MAAM,EAOlE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"converters.js","sources":["../src/converters.ts"],"sourcesContent":["import type { Metric, MetricUI } from './index';\n\nexport const convertMetricsUiToArgs = (metrics: MetricUI[]): Metric[] => {\n return metrics.map((metric): Metric => {\n return {\n type: metric.type,\n downsampling: metric.downsampling,\n };\n });\n};\n"],"names":[],"mappings":"AAEO,MAAM,sBAAsB,GAAG,CAAC,OAAmB,KAAc;AACtE,IAAA,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,KAAY;QACpC,OAAO;YACL,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,YAAY,EAAE,MAAM,CAAC,YAAY;SAClC;AACH,IAAA,CAAC,CAAC;AACJ;;;;"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,121 +1,117 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var model$1 = require('@platforma-sdk/model');
|
|
4
|
+
var converters = require('./converters.cjs');
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
// src/index.ts
|
|
18
|
-
var model = model$1.BlockModel.create().withArgs({
|
|
19
|
-
metrics: []
|
|
20
|
-
}).withUiState({
|
|
21
|
-
blockTitle: "Repertoire Diversity",
|
|
22
|
-
graphState: {
|
|
23
|
-
title: "Repertoire Diversity",
|
|
24
|
-
template: "bar",
|
|
25
|
-
currentTab: null
|
|
26
|
-
},
|
|
27
|
-
tableState: model$1.createPlDataTableStateV2(),
|
|
28
|
-
metrics: [
|
|
29
|
-
{
|
|
30
|
-
id: "observed",
|
|
31
|
-
type: "observed",
|
|
32
|
-
downsampling: {
|
|
33
|
-
type: "hypergeometric",
|
|
34
|
-
valueChooser: "auto"
|
|
35
|
-
},
|
|
36
|
-
isExpanded: false
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
id: "shannonWiener",
|
|
40
|
-
type: "shannonWiener",
|
|
41
|
-
downsampling: {
|
|
42
|
-
type: "hypergeometric",
|
|
43
|
-
valueChooser: "auto"
|
|
44
|
-
},
|
|
45
|
-
isExpanded: false
|
|
6
|
+
const model = model$1.BlockModel.create()
|
|
7
|
+
.withArgs({
|
|
8
|
+
metrics: [],
|
|
9
|
+
defaultBlockLabel: '',
|
|
10
|
+
customBlockLabel: '',
|
|
11
|
+
})
|
|
12
|
+
.withUiState({
|
|
13
|
+
graphState: {
|
|
14
|
+
title: 'Repertoire Diversity',
|
|
15
|
+
template: 'bar',
|
|
16
|
+
currentTab: null,
|
|
46
17
|
},
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
18
|
+
tableState: model$1.createPlDataTableStateV2(),
|
|
19
|
+
metrics: [
|
|
20
|
+
{
|
|
21
|
+
id: 'observed',
|
|
22
|
+
type: 'observed',
|
|
23
|
+
downsampling: {
|
|
24
|
+
type: 'hypergeometric',
|
|
25
|
+
valueChooser: 'auto',
|
|
26
|
+
},
|
|
27
|
+
isExpanded: false,
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
id: 'shannonWiener',
|
|
31
|
+
type: 'shannonWiener',
|
|
32
|
+
downsampling: {
|
|
33
|
+
type: 'hypergeometric',
|
|
34
|
+
valueChooser: 'auto',
|
|
35
|
+
},
|
|
36
|
+
isExpanded: false,
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
id: 'chao1',
|
|
40
|
+
type: 'chao1',
|
|
41
|
+
downsampling: {
|
|
42
|
+
type: 'hypergeometric',
|
|
43
|
+
valueChooser: 'auto',
|
|
44
|
+
},
|
|
45
|
+
isExpanded: false,
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
id: 'gini',
|
|
49
|
+
type: 'gini',
|
|
50
|
+
downsampling: {
|
|
51
|
+
type: 'hypergeometric',
|
|
52
|
+
valueChooser: 'auto',
|
|
53
|
+
},
|
|
54
|
+
isExpanded: false,
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
id: 'd50',
|
|
58
|
+
type: 'd50',
|
|
59
|
+
downsampling: {
|
|
60
|
+
type: 'hypergeometric',
|
|
61
|
+
valueChooser: 'auto',
|
|
62
|
+
},
|
|
63
|
+
isExpanded: false,
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
})
|
|
67
|
+
.argsValid((ctx) => ctx.args.abundanceRef !== undefined
|
|
68
|
+
&& ctx.args.metrics.every((metric) => metric.type !== undefined))
|
|
69
|
+
.output('abundanceOptions', (ctx) => ctx.resultPool.getOptions([{
|
|
70
|
+
axes: [
|
|
71
|
+
{ name: 'pl7.app/sampleId' },
|
|
72
|
+
{},
|
|
73
|
+
],
|
|
74
|
+
annotations: {
|
|
75
|
+
'pl7.app/isAbundance': 'true',
|
|
76
|
+
'pl7.app/abundance/normalized': 'false',
|
|
77
|
+
'pl7.app/abundance/isPrimary': 'true',
|
|
78
|
+
},
|
|
55
79
|
},
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
downsampling: {
|
|
69
|
-
type: "hypergeometric",
|
|
70
|
-
valueChooser: "auto"
|
|
71
|
-
},
|
|
72
|
-
isExpanded: false
|
|
80
|
+
], { includeNativeLabel: true }))
|
|
81
|
+
.outputWithStatus('pt', (ctx) => {
|
|
82
|
+
const pCols = ctx.outputs?.resolve('pf')?.getPColumns();
|
|
83
|
+
if (pCols === undefined) {
|
|
84
|
+
return undefined;
|
|
85
|
+
}
|
|
86
|
+
return model$1.createPlDataTableV2(ctx, pCols, ctx.uiState.tableState);
|
|
87
|
+
})
|
|
88
|
+
.outputWithStatus('pf', (ctx) => {
|
|
89
|
+
const pCols = ctx.outputs?.resolve('pf')?.getPColumns();
|
|
90
|
+
if (pCols === undefined) {
|
|
91
|
+
return undefined;
|
|
73
92
|
}
|
|
74
|
-
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
{}
|
|
82
|
-
],
|
|
83
|
-
annotations: {
|
|
84
|
-
"pl7.app/isAbundance": "true",
|
|
85
|
-
"pl7.app/abundance/normalized": "false",
|
|
86
|
-
"pl7.app/abundance/isPrimary": "true"
|
|
87
|
-
}
|
|
93
|
+
return model$1.createPFrameForGraphs(ctx, pCols);
|
|
94
|
+
})
|
|
95
|
+
// Return a list of Pcols for plot defaults
|
|
96
|
+
.output('pcols', (ctx) => {
|
|
97
|
+
const pCols = ctx.outputs?.resolve('pf')?.getPColumns();
|
|
98
|
+
if (pCols === undefined || pCols.length === 0) {
|
|
99
|
+
return undefined;
|
|
88
100
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}).output("pcols", (ctx) => {
|
|
103
|
-
const pCols = ctx.outputs?.resolve("pf")?.getPColumns();
|
|
104
|
-
if (pCols === void 0 || pCols.length === 0) {
|
|
105
|
-
return void 0;
|
|
106
|
-
}
|
|
107
|
-
return pCols.map(
|
|
108
|
-
(c) => ({
|
|
109
|
-
columnId: c.id,
|
|
110
|
-
spec: c.spec
|
|
111
|
-
})
|
|
112
|
-
);
|
|
113
|
-
}).output("isRunning", (ctx) => ctx.outputs?.getIsReadyOrError() === false).title((ctx) => ctx.uiState?.blockTitle ?? "Repertoire Diversity").sections((_) => [
|
|
114
|
-
{ type: "link", href: "/", label: "Main" },
|
|
115
|
-
{ type: "link", href: "/diversityGraph", label: "Diversity Graph" }
|
|
116
|
-
]).done(2);
|
|
101
|
+
return pCols.map((c) => ({
|
|
102
|
+
columnId: c.id,
|
|
103
|
+
spec: c.spec,
|
|
104
|
+
}));
|
|
105
|
+
})
|
|
106
|
+
.output('isRunning', (ctx) => ctx.outputs?.getIsReadyOrError() === false)
|
|
107
|
+
.title(() => 'Repertoire Diversity')
|
|
108
|
+
.subtitle((ctx) => ctx.args.customBlockLabel || ctx.args.defaultBlockLabel)
|
|
109
|
+
.sections((_) => [
|
|
110
|
+
{ type: 'link', href: '/', label: 'Main' },
|
|
111
|
+
{ type: 'link', href: '/diversityGraph', label: 'Diversity Graph' },
|
|
112
|
+
])
|
|
113
|
+
.done(2);
|
|
117
114
|
|
|
118
|
-
exports.convertMetricsUiToArgs = convertMetricsUiToArgs;
|
|
115
|
+
exports.convertMetricsUiToArgs = converters.convertMetricsUiToArgs;
|
|
119
116
|
exports.model = model;
|
|
120
117
|
//# sourceMappingURL=index.cjs.map
|
|
121
|
-
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/index.ts"],"sourcesContent":["import type { GraphMakerState } from '@milaboratories/graph-maker';\nimport type { PColumnIdAndSpec, PlDataTableStateV2, PlRef } from '@platforma-sdk/model';\nimport { BlockModel, createPFrameForGraphs, createPlDataTableStateV2, createPlDataTableV2 } from '@platforma-sdk/model';\n\nexport * from './converters';\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 MetricUI = Metric & {\n id: string;\n isExpanded?: boolean;\n};\n\nexport type BlockArgs = {\n defaultBlockLabel: string;\n customBlockLabel: string;\n abundanceRef?: PlRef;\n metrics: Metric[];\n};\n\nexport type UiState = {\n metrics: MetricUI[];\n tableState: PlDataTableStateV2;\n graphState: GraphMakerState;\n};\n\nexport const model = BlockModel.create()\n .withArgs<BlockArgs>({\n metrics: [],\n defaultBlockLabel: '',\n customBlockLabel: '',\n })\n\n .withUiState<UiState>({\n graphState: {\n title: 'Repertoire Diversity',\n template: 'bar',\n currentTab: null,\n },\n\n tableState: createPlDataTableStateV2(),\n\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 .argsValid((ctx) => ctx.args.abundanceRef !== undefined\n && ctx.args.metrics.every((metric) => metric.type !== 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 ], { includeNativeLabel: true }),\n )\n\n .outputWithStatus('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 .outputWithStatus('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(() => 'Repertoire Diversity')\n\n .subtitle((ctx) => ctx.args.customBlockLabel || ctx.args.defaultBlockLabel)\n\n .sections((_) => [\n { type: 'link', href: '/', label: 'Main' },\n { type: 'link', href: '/diversityGraph', label: 'Diversity Graph' },\n ])\n\n .done(2);\n"],"names":["BlockModel","createPlDataTableStateV2","createPlDataTableV2","createPFrameForGraphs"],"mappings":";;;;;AAqCO,MAAM,KAAK,GAAGA,kBAAU,CAAC,MAAM;AACnC,KAAA,QAAQ,CAAY;AACnB,IAAA,OAAO,EAAE,EAAE;AACX,IAAA,iBAAiB,EAAE,EAAE;AACrB,IAAA,gBAAgB,EAAE,EAAE;CACrB;A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AK,CAAC;AAC1C,CAAC;;AAGA,KAAA,MAAM,CAAC,OAAO,EAAE,CAAC,GAAG,KAAI;AACvB,IAAA,MAAM,KAAK,GAAG,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,EAAE,WAAW,EAAE;IAEvD,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;AAC7C,QAAA,OAAO,SAAS;IAClB;IAEA,OAAO,KAAK,CAAC,GAAG,CACd,CAAC,CAAC,MACC;QACC,QAAQ,EAAE,CAAC,CAAC,EAAE;QACd,IAAI,EAAE,CAAC,CAAC,IAAI;AACe,KAAA,CAAA,CAChC;AACH,CAAC;AAEA,KAAA,MAAM,CAAC,WAAW,EAAE,CAAC,GAAG,KAAK,GAAG,CAAC,OAAO,EAAE,iBAAiB,EAAE,KAAK,KAAK;AAEvE,KAAA,KAAK,CAAC,MAAM,sBAAsB;AAElC,KAAA,QAAQ,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,IAAI,CAAC,gBAAgB,IAAI,GAAG,CAAC,IAAI,CAAC,iBAAiB;AAEzE,KAAA,QAAQ,CAAC,CAAC,CAAC,KAAK;IACf,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE;IAC1C,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,iBAAiB,EAAE,KAAK,EAAE,iBAAiB,EAAE;CACpE;KAEA,IAAI,CAAC,CAAC;;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
type DiversityType = 'chao1' | 'd50' | 'efronThisted' | 'observed' | 'shannonWienerIndex' | 'shannonWiener' | 'normalizedShannonWiener' | 'inverseSimpson' | 'gini';
|
|
8
|
-
type Metric = {
|
|
1
|
+
import type { GraphMakerState } from '@milaboratories/graph-maker';
|
|
2
|
+
import type { PlDataTableStateV2, PlRef } from '@platforma-sdk/model';
|
|
3
|
+
export * from './converters';
|
|
4
|
+
export type DiversityType = 'chao1' | 'd50' | 'efronThisted' | 'observed' | 'shannonWienerIndex' | 'shannonWiener' | 'normalizedShannonWiener' | 'inverseSimpson' | 'gini';
|
|
5
|
+
export type Metric = {
|
|
9
6
|
type: DiversityType | undefined;
|
|
10
7
|
downsampling: {
|
|
11
8
|
type?: 'none' | 'top' | 'cumtop' | 'hypergeometric';
|
|
@@ -13,22 +10,23 @@ type Metric = {
|
|
|
13
10
|
n?: number;
|
|
14
11
|
};
|
|
15
12
|
};
|
|
16
|
-
type MetricUI = Metric & {
|
|
13
|
+
export type MetricUI = Metric & {
|
|
17
14
|
id: string;
|
|
18
15
|
isExpanded?: boolean;
|
|
19
16
|
};
|
|
20
|
-
type BlockArgs = {
|
|
17
|
+
export type BlockArgs = {
|
|
18
|
+
defaultBlockLabel: string;
|
|
19
|
+
customBlockLabel: string;
|
|
21
20
|
abundanceRef?: PlRef;
|
|
22
21
|
metrics: Metric[];
|
|
23
22
|
};
|
|
24
|
-
type UiState = {
|
|
23
|
+
export type UiState = {
|
|
25
24
|
metrics: MetricUI[];
|
|
26
|
-
blockTitle: string;
|
|
27
25
|
tableState: PlDataTableStateV2;
|
|
28
26
|
graphState: GraphMakerState;
|
|
29
27
|
};
|
|
30
|
-
declare const model:
|
|
31
|
-
abundanceOptions:
|
|
28
|
+
export declare const model: import("@platforma-sdk/model").PlatformaExtended<import("@platforma-sdk/model").PlatformaV2<BlockArgs, {
|
|
29
|
+
abundanceOptions: import("@platforma-sdk/model").OutputWithStatus<{
|
|
32
30
|
readonly ref: {
|
|
33
31
|
readonly __isRef: true;
|
|
34
32
|
readonly blockId: string;
|
|
@@ -36,17 +34,22 @@ declare const model: _platforma_sdk_model.PlatformaV2<BlockArgs, {
|
|
|
36
34
|
readonly requireEnrichments?: true | undefined;
|
|
37
35
|
};
|
|
38
36
|
readonly label: string;
|
|
39
|
-
}[]
|
|
40
|
-
|
|
37
|
+
}[]> & {
|
|
38
|
+
__unwrap: true;
|
|
39
|
+
};
|
|
40
|
+
pt: import("@platforma-sdk/model").OutputWithStatus<{
|
|
41
41
|
sourceId: string | null;
|
|
42
|
-
fullTableHandle:
|
|
43
|
-
visibleTableHandle:
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
42
|
+
fullTableHandle: import("@platforma-sdk/model").PTableHandle;
|
|
43
|
+
visibleTableHandle: import("@platforma-sdk/model").PTableHandle;
|
|
44
|
+
}> & {
|
|
45
|
+
__unwrap: false;
|
|
46
|
+
};
|
|
47
|
+
pf: import("@platforma-sdk/model").OutputWithStatus<import("@platforma-sdk/model").PFrameHandle> & {
|
|
48
|
+
__unwrap: false;
|
|
49
|
+
};
|
|
50
|
+
pcols: import("@platforma-sdk/model").OutputWithStatus<{
|
|
51
|
+
columnId: import("@platforma-sdk/model").PObjectId;
|
|
48
52
|
spec: {
|
|
49
|
-
readonly valueType: _platforma_sdk_model.ValueType;
|
|
50
53
|
readonly kind: "PColumn";
|
|
51
54
|
readonly name: string;
|
|
52
55
|
readonly domain?: {
|
|
@@ -55,9 +58,10 @@ declare const model: _platforma_sdk_model.PlatformaV2<BlockArgs, {
|
|
|
55
58
|
readonly annotations?: {
|
|
56
59
|
[x: string]: string;
|
|
57
60
|
} | undefined;
|
|
61
|
+
readonly valueType: "Int" | "Long" | "Float" | "Double" | "String" | "Bytes";
|
|
58
62
|
readonly parentAxes?: number[] | undefined;
|
|
59
63
|
readonly axesSpec: {
|
|
60
|
-
readonly type:
|
|
64
|
+
readonly type: import("@platforma-sdk/model").ValueType;
|
|
61
65
|
readonly name: string;
|
|
62
66
|
readonly domain?: {
|
|
63
67
|
[x: string]: string;
|
|
@@ -68,9 +72,11 @@ declare const model: _platforma_sdk_model.PlatformaV2<BlockArgs, {
|
|
|
68
72
|
readonly parentAxes?: number[] | undefined;
|
|
69
73
|
}[];
|
|
70
74
|
};
|
|
71
|
-
}[] | undefined
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
}[] | undefined> & {
|
|
76
|
+
__unwrap: true;
|
|
77
|
+
};
|
|
78
|
+
isRunning: import("@platforma-sdk/model").OutputWithStatus<boolean> & {
|
|
79
|
+
__unwrap: true;
|
|
80
|
+
};
|
|
81
|
+
}, UiState, "/" | "/diversityGraph">>;
|
|
82
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,KAAK,EAAoB,kBAAkB,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAGxF,cAAc,cAAc,CAAC;AAE7B,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,KAAK,GAAG,cAAc,GAC1D,UAAU,GAAG,oBAAoB,GAAG,eAAe,GACnD,yBAAyB,GAAG,gBAAgB,GAAG,MAAM,CAAC;AAExD,MAAM,MAAM,MAAM,GAAG;IACnB,IAAI,EAAE,aAAa,GAAG,SAAS,CAAC;IAChC,YAAY,EAAE;QACZ,IAAI,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,gBAAgB,CAAE;QACrD,YAAY,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,CAAC;QAChD,CAAC,CAAC,EAAE,MAAM,CAAC;KACZ,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,gBAAgB,EAAE,MAAM,CAAC;IACzB,YAAY,CAAC,EAAE,KAAK,CAAC;IACrB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG;IACpB,OAAO,EAAE,QAAQ,EAAE,CAAC;IACpB,UAAU,EAAE,kBAAkB,CAAC;IAC/B,UAAU,EAAE,eAAe,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qCAiIR,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,118 +1,114 @@
|
|
|
1
1
|
import { BlockModel, createPlDataTableStateV2, createPlDataTableV2, createPFrameForGraphs } from '@platforma-sdk/model';
|
|
2
|
+
export { convertMetricsUiToArgs } from './converters.js';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
// src/index.ts
|
|
16
|
-
var model = BlockModel.create().withArgs({
|
|
17
|
-
metrics: []
|
|
18
|
-
}).withUiState({
|
|
19
|
-
blockTitle: "Repertoire Diversity",
|
|
20
|
-
graphState: {
|
|
21
|
-
title: "Repertoire Diversity",
|
|
22
|
-
template: "bar",
|
|
23
|
-
currentTab: null
|
|
24
|
-
},
|
|
25
|
-
tableState: createPlDataTableStateV2(),
|
|
26
|
-
metrics: [
|
|
27
|
-
{
|
|
28
|
-
id: "observed",
|
|
29
|
-
type: "observed",
|
|
30
|
-
downsampling: {
|
|
31
|
-
type: "hypergeometric",
|
|
32
|
-
valueChooser: "auto"
|
|
33
|
-
},
|
|
34
|
-
isExpanded: false
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
id: "shannonWiener",
|
|
38
|
-
type: "shannonWiener",
|
|
39
|
-
downsampling: {
|
|
40
|
-
type: "hypergeometric",
|
|
41
|
-
valueChooser: "auto"
|
|
42
|
-
},
|
|
43
|
-
isExpanded: false
|
|
4
|
+
const model = BlockModel.create()
|
|
5
|
+
.withArgs({
|
|
6
|
+
metrics: [],
|
|
7
|
+
defaultBlockLabel: '',
|
|
8
|
+
customBlockLabel: '',
|
|
9
|
+
})
|
|
10
|
+
.withUiState({
|
|
11
|
+
graphState: {
|
|
12
|
+
title: 'Repertoire Diversity',
|
|
13
|
+
template: 'bar',
|
|
14
|
+
currentTab: null,
|
|
44
15
|
},
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
16
|
+
tableState: createPlDataTableStateV2(),
|
|
17
|
+
metrics: [
|
|
18
|
+
{
|
|
19
|
+
id: 'observed',
|
|
20
|
+
type: 'observed',
|
|
21
|
+
downsampling: {
|
|
22
|
+
type: 'hypergeometric',
|
|
23
|
+
valueChooser: 'auto',
|
|
24
|
+
},
|
|
25
|
+
isExpanded: false,
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
id: 'shannonWiener',
|
|
29
|
+
type: 'shannonWiener',
|
|
30
|
+
downsampling: {
|
|
31
|
+
type: 'hypergeometric',
|
|
32
|
+
valueChooser: 'auto',
|
|
33
|
+
},
|
|
34
|
+
isExpanded: false,
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
id: 'chao1',
|
|
38
|
+
type: 'chao1',
|
|
39
|
+
downsampling: {
|
|
40
|
+
type: 'hypergeometric',
|
|
41
|
+
valueChooser: 'auto',
|
|
42
|
+
},
|
|
43
|
+
isExpanded: false,
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
id: 'gini',
|
|
47
|
+
type: 'gini',
|
|
48
|
+
downsampling: {
|
|
49
|
+
type: 'hypergeometric',
|
|
50
|
+
valueChooser: 'auto',
|
|
51
|
+
},
|
|
52
|
+
isExpanded: false,
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: 'd50',
|
|
56
|
+
type: 'd50',
|
|
57
|
+
downsampling: {
|
|
58
|
+
type: 'hypergeometric',
|
|
59
|
+
valueChooser: 'auto',
|
|
60
|
+
},
|
|
61
|
+
isExpanded: false,
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
})
|
|
65
|
+
.argsValid((ctx) => ctx.args.abundanceRef !== undefined
|
|
66
|
+
&& ctx.args.metrics.every((metric) => metric.type !== undefined))
|
|
67
|
+
.output('abundanceOptions', (ctx) => ctx.resultPool.getOptions([{
|
|
68
|
+
axes: [
|
|
69
|
+
{ name: 'pl7.app/sampleId' },
|
|
70
|
+
{},
|
|
71
|
+
],
|
|
72
|
+
annotations: {
|
|
73
|
+
'pl7.app/isAbundance': 'true',
|
|
74
|
+
'pl7.app/abundance/normalized': 'false',
|
|
75
|
+
'pl7.app/abundance/isPrimary': 'true',
|
|
76
|
+
},
|
|
53
77
|
},
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
downsampling: {
|
|
67
|
-
type: "hypergeometric",
|
|
68
|
-
valueChooser: "auto"
|
|
69
|
-
},
|
|
70
|
-
isExpanded: false
|
|
78
|
+
], { includeNativeLabel: true }))
|
|
79
|
+
.outputWithStatus('pt', (ctx) => {
|
|
80
|
+
const pCols = ctx.outputs?.resolve('pf')?.getPColumns();
|
|
81
|
+
if (pCols === undefined) {
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
return createPlDataTableV2(ctx, pCols, ctx.uiState.tableState);
|
|
85
|
+
})
|
|
86
|
+
.outputWithStatus('pf', (ctx) => {
|
|
87
|
+
const pCols = ctx.outputs?.resolve('pf')?.getPColumns();
|
|
88
|
+
if (pCols === undefined) {
|
|
89
|
+
return undefined;
|
|
71
90
|
}
|
|
72
|
-
|
|
73
|
-
})
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
{}
|
|
80
|
-
],
|
|
81
|
-
annotations: {
|
|
82
|
-
"pl7.app/isAbundance": "true",
|
|
83
|
-
"pl7.app/abundance/normalized": "false",
|
|
84
|
-
"pl7.app/abundance/isPrimary": "true"
|
|
85
|
-
}
|
|
91
|
+
return createPFrameForGraphs(ctx, pCols);
|
|
92
|
+
})
|
|
93
|
+
// Return a list of Pcols for plot defaults
|
|
94
|
+
.output('pcols', (ctx) => {
|
|
95
|
+
const pCols = ctx.outputs?.resolve('pf')?.getPColumns();
|
|
96
|
+
if (pCols === undefined || pCols.length === 0) {
|
|
97
|
+
return undefined;
|
|
86
98
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}).output("pcols", (ctx) => {
|
|
101
|
-
const pCols = ctx.outputs?.resolve("pf")?.getPColumns();
|
|
102
|
-
if (pCols === void 0 || pCols.length === 0) {
|
|
103
|
-
return void 0;
|
|
104
|
-
}
|
|
105
|
-
return pCols.map(
|
|
106
|
-
(c) => ({
|
|
107
|
-
columnId: c.id,
|
|
108
|
-
spec: c.spec
|
|
109
|
-
})
|
|
110
|
-
);
|
|
111
|
-
}).output("isRunning", (ctx) => ctx.outputs?.getIsReadyOrError() === false).title((ctx) => ctx.uiState?.blockTitle ?? "Repertoire Diversity").sections((_) => [
|
|
112
|
-
{ type: "link", href: "/", label: "Main" },
|
|
113
|
-
{ type: "link", href: "/diversityGraph", label: "Diversity Graph" }
|
|
114
|
-
]).done(2);
|
|
99
|
+
return pCols.map((c) => ({
|
|
100
|
+
columnId: c.id,
|
|
101
|
+
spec: c.spec,
|
|
102
|
+
}));
|
|
103
|
+
})
|
|
104
|
+
.output('isRunning', (ctx) => ctx.outputs?.getIsReadyOrError() === false)
|
|
105
|
+
.title(() => 'Repertoire Diversity')
|
|
106
|
+
.subtitle((ctx) => ctx.args.customBlockLabel || ctx.args.defaultBlockLabel)
|
|
107
|
+
.sections((_) => [
|
|
108
|
+
{ type: 'link', href: '/', label: 'Main' },
|
|
109
|
+
{ type: 'link', href: '/diversityGraph', label: 'Diversity Graph' },
|
|
110
|
+
])
|
|
111
|
+
.done(2);
|
|
115
112
|
|
|
116
|
-
export {
|
|
113
|
+
export { model };
|
|
117
114
|
//# sourceMappingURL=index.js.map
|
|
118
|
-
//# sourceMappingURL=index.js.map
|