@platforma-open/milaboratories.repertoire-diversity-2.model 1.2.0 → 1.3.1
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 -13
- package/CHANGELOG.md +12 -0
- package/dist/bundle.js +851 -717
- package/dist/bundle.js.map +1 -1
- package/dist/index.cjs +11 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +27 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -1
- package/dist/model.json +1 -1
- package/package.json +4 -4
- package/src/index.ts +18 -5
package/dist/index.cjs
CHANGED
|
@@ -82,6 +82,17 @@ var model = model$1.BlockModel.create().withArgs({
|
|
|
82
82
|
return void 0;
|
|
83
83
|
}
|
|
84
84
|
return model$1.createPFrameForGraphs(ctx, pCols);
|
|
85
|
+
}).output("pcols", (ctx) => {
|
|
86
|
+
const pCols = ctx.outputs?.resolve("pf")?.getPColumns();
|
|
87
|
+
if (pCols === void 0 || pCols.length === 0) {
|
|
88
|
+
return void 0;
|
|
89
|
+
}
|
|
90
|
+
return pCols.map(
|
|
91
|
+
(c) => ({
|
|
92
|
+
columnId: c.id,
|
|
93
|
+
spec: c.spec
|
|
94
|
+
})
|
|
95
|
+
);
|
|
85
96
|
}).output("isRunning", (ctx) => ctx.outputs?.getIsReadyOrError() === false).title((ctx) => ctx.uiState?.blockTitle ?? "Repertoire Diversity").sections((_) => [
|
|
86
97
|
{ type: "link", href: "/", label: "Main" },
|
|
87
98
|
{ type: "link", href: "/diversityGraph", label: "Diversity Graph" }
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":["BlockModel","createPlDataTable","createPFrameForGraphs"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":["BlockModel","createPlDataTable","createPFrameForGraphs"],"mappings":";;;;;AA4BO,IAAM,K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AAA,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"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -26,11 +26,38 @@ declare const model: _platforma_sdk_model.Platforma<BlockArgs, {
|
|
|
26
26
|
readonly __isRef: true;
|
|
27
27
|
readonly blockId: string;
|
|
28
28
|
readonly name: string;
|
|
29
|
+
readonly requireEnrichments?: true | undefined;
|
|
29
30
|
};
|
|
30
31
|
readonly label: string;
|
|
31
32
|
}[]>;
|
|
32
33
|
pt: _platforma_sdk_model.ValueOrErrors<_platforma_sdk_model.PTableHandle | undefined>;
|
|
33
34
|
pf: _platforma_sdk_model.ValueOrErrors<_platforma_sdk_model.PFrameHandle | undefined>;
|
|
35
|
+
pcols: _platforma_sdk_model.ValueOrErrors<{
|
|
36
|
+
columnId: _platforma_sdk_model.PObjectId;
|
|
37
|
+
spec: {
|
|
38
|
+
readonly valueType: _platforma_sdk_model.ValueType;
|
|
39
|
+
readonly kind: "PColumn";
|
|
40
|
+
readonly name: string;
|
|
41
|
+
readonly domain?: {
|
|
42
|
+
[x: string]: string;
|
|
43
|
+
} | undefined;
|
|
44
|
+
readonly annotations?: {
|
|
45
|
+
[x: string]: string;
|
|
46
|
+
} | undefined;
|
|
47
|
+
readonly parentAxes?: number[] | undefined;
|
|
48
|
+
readonly axesSpec: {
|
|
49
|
+
readonly type: _platforma_sdk_model.ValueType;
|
|
50
|
+
readonly name: string;
|
|
51
|
+
readonly domain?: {
|
|
52
|
+
[x: string]: string;
|
|
53
|
+
} | undefined;
|
|
54
|
+
readonly annotations?: {
|
|
55
|
+
[x: string]: string;
|
|
56
|
+
} | undefined;
|
|
57
|
+
readonly parentAxes?: number[] | undefined;
|
|
58
|
+
}[];
|
|
59
|
+
};
|
|
60
|
+
}[] | undefined>;
|
|
34
61
|
isRunning: _platforma_sdk_model.ValueOrErrors<boolean>;
|
|
35
62
|
}, UiState, "/" | "/diversityGraph">;
|
|
36
63
|
type BlockOutputs = InferOutputsType<typeof model>;
|
package/dist/index.d.ts
CHANGED
|
@@ -26,11 +26,38 @@ declare const model: _platforma_sdk_model.Platforma<BlockArgs, {
|
|
|
26
26
|
readonly __isRef: true;
|
|
27
27
|
readonly blockId: string;
|
|
28
28
|
readonly name: string;
|
|
29
|
+
readonly requireEnrichments?: true | undefined;
|
|
29
30
|
};
|
|
30
31
|
readonly label: string;
|
|
31
32
|
}[]>;
|
|
32
33
|
pt: _platforma_sdk_model.ValueOrErrors<_platforma_sdk_model.PTableHandle | undefined>;
|
|
33
34
|
pf: _platforma_sdk_model.ValueOrErrors<_platforma_sdk_model.PFrameHandle | undefined>;
|
|
35
|
+
pcols: _platforma_sdk_model.ValueOrErrors<{
|
|
36
|
+
columnId: _platforma_sdk_model.PObjectId;
|
|
37
|
+
spec: {
|
|
38
|
+
readonly valueType: _platforma_sdk_model.ValueType;
|
|
39
|
+
readonly kind: "PColumn";
|
|
40
|
+
readonly name: string;
|
|
41
|
+
readonly domain?: {
|
|
42
|
+
[x: string]: string;
|
|
43
|
+
} | undefined;
|
|
44
|
+
readonly annotations?: {
|
|
45
|
+
[x: string]: string;
|
|
46
|
+
} | undefined;
|
|
47
|
+
readonly parentAxes?: number[] | undefined;
|
|
48
|
+
readonly axesSpec: {
|
|
49
|
+
readonly type: _platforma_sdk_model.ValueType;
|
|
50
|
+
readonly name: string;
|
|
51
|
+
readonly domain?: {
|
|
52
|
+
[x: string]: string;
|
|
53
|
+
} | undefined;
|
|
54
|
+
readonly annotations?: {
|
|
55
|
+
[x: string]: string;
|
|
56
|
+
} | undefined;
|
|
57
|
+
readonly parentAxes?: number[] | undefined;
|
|
58
|
+
}[];
|
|
59
|
+
};
|
|
60
|
+
}[] | undefined>;
|
|
34
61
|
isRunning: _platforma_sdk_model.ValueOrErrors<boolean>;
|
|
35
62
|
}, UiState, "/" | "/diversityGraph">;
|
|
36
63
|
type BlockOutputs = InferOutputsType<typeof model>;
|
package/dist/index.js
CHANGED
|
@@ -80,6 +80,17 @@ var model = BlockModel.create().withArgs({
|
|
|
80
80
|
return void 0;
|
|
81
81
|
}
|
|
82
82
|
return createPFrameForGraphs(ctx, pCols);
|
|
83
|
+
}).output("pcols", (ctx) => {
|
|
84
|
+
const pCols = ctx.outputs?.resolve("pf")?.getPColumns();
|
|
85
|
+
if (pCols === void 0 || pCols.length === 0) {
|
|
86
|
+
return void 0;
|
|
87
|
+
}
|
|
88
|
+
return pCols.map(
|
|
89
|
+
(c) => ({
|
|
90
|
+
columnId: c.id,
|
|
91
|
+
spec: c.spec
|
|
92
|
+
})
|
|
93
|
+
);
|
|
83
94
|
}).output("isRunning", (ctx) => ctx.outputs?.getIsReadyOrError() === false).title((ctx) => ctx.uiState?.blockTitle ?? "Repertoire Diversity").sections((_) => [
|
|
84
95
|
{ type: "link", href: "/", label: "Main" },
|
|
85
96
|
{ type: "link", href: "/diversityGraph", label: "Diversity Graph" }
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;
|
|
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,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,E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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,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.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"]}
|