@platforma-open/milaboratories.vj-usage.model 2.0.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 ADDED
@@ -0,0 +1,73 @@
1
+ 'use strict';
2
+
3
+ var model$1 = require('@platforma-sdk/model');
4
+
5
+ // src/index.ts
6
+ var model = model$1.BlockModel.create().withArgs({}).withUiState({
7
+ blockTitle: "V/J Usage",
8
+ weightedFlag: true,
9
+ vUsagePlotState: {
10
+ title: "V Usage",
11
+ template: "heatmap",
12
+ currentTab: "settings"
13
+ },
14
+ jUsagePlotState: {
15
+ title: "V Usage",
16
+ template: "heatmap",
17
+ currentTab: null
18
+ },
19
+ vjUsagePlotState: {
20
+ title: "V/J Usage",
21
+ template: "heatmap",
22
+ currentTab: null
23
+ }
24
+ }).argsValid(
25
+ (ctx) => ctx.args.vGeneRef !== void 0 && ctx.args.jGeneRef !== void 0 && ctx.args.abundanceRef !== void 0
26
+ ).output("vGeneOptions", (ctx) => ctx.resultPool.getOptions(
27
+ (c) => model$1.isPColumnSpec(c) && c.valueType === "String" && (c.name === "pl7.app/vdj/geneHit" || c.name === "pl7.app/vdj/geneHitWithAllele") && c.domain?.["pl7.app/vdj/reference"] === "VGene"
28
+ )).output("jGeneOptions", (ctx) => {
29
+ const inputRef = ctx.args.vGeneRef;
30
+ if (inputRef === void 0) return void 0;
31
+ const vGeneSpec = ctx.resultPool.getPColumnSpecByRef(inputRef);
32
+ if (vGeneSpec === void 0) return void 0;
33
+ return ctx.resultPool.getCanonicalOptions({ main: inputRef }, [
34
+ {
35
+ axes: [{ anchor: "main", idx: 0 }],
36
+ name: vGeneSpec.name,
37
+ domain: {
38
+ "pl7.app/vdj/reference": "JGene",
39
+ "pl7.app/vdj/scClonotypeChain": { anchor: "main" },
40
+ "pl7.app/vdj/scClonotypeChain/index": { anchor: "main" }
41
+ }
42
+ }
43
+ ], { ignoreMissingDomains: true });
44
+ }).output("abundanceOptions", (ctx) => {
45
+ const inputRef = ctx.args.vGeneRef;
46
+ if (inputRef === void 0) return void 0;
47
+ return ctx.resultPool.getCanonicalOptions(
48
+ { main: inputRef },
49
+ {
50
+ axes: [{
51
+ /* sampleId */
52
+ }, { anchor: "main", idx: 0 }],
53
+ annotations: {
54
+ "pl7.app/isAbundance": "true",
55
+ "pl7.app/abundance/normalized": "false"
56
+ }
57
+ }
58
+ );
59
+ }).output("pf", (ctx) => {
60
+ const pCols = ctx.outputs?.resolve("pf")?.getPColumns();
61
+ if (pCols === void 0) {
62
+ return void 0;
63
+ }
64
+ return model$1.createPFrameForGraphs(ctx, pCols);
65
+ }).output("isRunning", (ctx) => ctx.outputs?.getIsReadyOrError() === false).title((ctx) => ctx.uiState?.blockTitle ?? "V/J Usage").sections((_) => [
66
+ { type: "link", href: "/", label: "V Gene Usage" },
67
+ { type: "link", href: "/jUsage", label: "J Gene Usage" },
68
+ { type: "link", href: "/vjUsage", label: "V/J Gene Usage" }
69
+ ]).done();
70
+
71
+ exports.model = model;
72
+ //# sourceMappingURL=index.cjs.map
73
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"names":["BlockModel","isPColumnSpec","createPFrameForGraphs"],"mappings":";;;;;AAkBa,IAAA,KAAA,GAAQA,mBAAW,MAAO,EAAA,CAEpC,SAAoB,EAAE,EAEtB,WAAqB,CAAA;AAAA,EACpB,UAAY,EAAA,WAAA;AAAA,EACZ,YAAc,EAAA,IAAA;AAAA,EACd,eAAiB,EAAA;AAAA,IACf,KAAO,EAAA,SAAA;AAAA,IACP,QAAU,EAAA,SAAA;AAAA,IACV,UAAY,EAAA;AAAA,GACd;AAAA,EACA,eAAiB,EAAA;AAAA,IACf,KAAO,EAAA,SAAA;AAAA,IACP,QAAU,EAAA,SAAA;AAAA,IACV,UAAY,EAAA;AAAA,GACd;AAAA,EACA,gBAAkB,EAAA;AAAA,IAChB,KAAO,EAAA,WAAA;AAAA,IACP,QAA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AAiB;AAC5D,CAAC,EAEA,IAAK","file":"index.cjs","sourcesContent":["import type { GraphMakerState } from '@milaboratories/graph-maker';\nimport type { InferOutputsType, PlRef, SUniversalPColumnId } from '@platforma-sdk/model';\nimport { BlockModel, createPFrameForGraphs, isPColumnSpec } from '@platforma-sdk/model';\n\nexport type BlockArgs = {\n vGeneRef?: PlRef;\n jGeneRef?: SUniversalPColumnId;\n abundanceRef?: SUniversalPColumnId;\n};\n\nexport type UiState = {\n blockTitle: string;\n weightedFlag: boolean;\n vUsagePlotState: GraphMakerState;\n jUsagePlotState: GraphMakerState;\n vjUsagePlotState: GraphMakerState;\n};\n\nexport const model = BlockModel.create()\n\n .withArgs<BlockArgs>({})\n\n .withUiState<UiState>({\n blockTitle: 'V/J Usage',\n weightedFlag: true,\n vUsagePlotState: {\n title: 'V Usage',\n template: 'heatmap',\n currentTab: 'settings',\n },\n jUsagePlotState: {\n title: 'V Usage',\n template: 'heatmap',\n currentTab: null,\n },\n vjUsagePlotState: {\n title: 'V/J Usage',\n template: 'heatmap',\n currentTab: null,\n },\n })\n\n .argsValid((ctx) =>\n ctx.args.vGeneRef !== undefined\n && ctx.args.jGeneRef !== undefined\n && ctx.args.abundanceRef !== undefined,\n )\n\n .output('vGeneOptions', (ctx) =>\n ctx.resultPool.getOptions((c) =>\n isPColumnSpec(c) && c.valueType === 'String'\n && (c.name === 'pl7.app/vdj/geneHit' || c.name === 'pl7.app/vdj/geneHitWithAllele')\n && c.domain?.['pl7.app/vdj/reference'] === 'VGene',\n ))\n\n .output('jGeneOptions', (ctx) => {\n const inputRef = ctx.args.vGeneRef;\n if (inputRef === undefined) return undefined;\n const vGeneSpec = ctx.resultPool.getPColumnSpecByRef(inputRef);\n if (vGeneSpec === undefined) return undefined;\n return ctx.resultPool.getCanonicalOptions({ main: inputRef }, [\n {\n axes: [{ anchor: 'main', idx: 0 }],\n name: vGeneSpec.name,\n domain: {\n 'pl7.app/vdj/reference': 'JGene',\n 'pl7.app/vdj/scClonotypeChain': { anchor: 'main' },\n 'pl7.app/vdj/scClonotypeChain/index': { anchor: 'main' },\n },\n },\n ], { ignoreMissingDomains: true });\n })\n\n .output('abundanceOptions', (ctx) => {\n const inputRef = ctx.args.vGeneRef;\n if (inputRef === undefined) return undefined;\n return ctx.resultPool.getCanonicalOptions({ main: inputRef },\n {\n axes: [{/* sampleId */}, { anchor: 'main', idx: 0 }],\n annotations: {\n 'pl7.app/isAbundance': 'true',\n 'pl7.app/abundance/normalized': 'false',\n },\n },\n );\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 ?? 'V/J Usage')\n\n .sections((_) => [\n { type: 'link', href: '/', label: 'V Gene Usage' },\n { type: 'link', href: '/jUsage', label: 'J Gene Usage' },\n { type: 'link', href: '/vjUsage', label: 'V/J Gene Usage' },\n ])\n\n .done();\n\nexport type BlockOutputs = InferOutputsType<typeof model>;\n"]}
@@ -0,0 +1,39 @@
1
+ import * as _platforma_sdk_model from '@platforma-sdk/model';
2
+ import { PlRef, SUniversalPColumnId, InferOutputsType } from '@platforma-sdk/model';
3
+ import { GraphMakerState } from '@milaboratories/graph-maker';
4
+
5
+ type BlockArgs = {
6
+ vGeneRef?: PlRef;
7
+ jGeneRef?: SUniversalPColumnId;
8
+ abundanceRef?: SUniversalPColumnId;
9
+ };
10
+ type UiState = {
11
+ blockTitle: string;
12
+ weightedFlag: boolean;
13
+ vUsagePlotState: GraphMakerState;
14
+ jUsagePlotState: GraphMakerState;
15
+ vjUsagePlotState: GraphMakerState;
16
+ };
17
+ declare const model: _platforma_sdk_model.Platforma<BlockArgs, {
18
+ vGeneOptions: _platforma_sdk_model.ValueOrErrors<{
19
+ readonly ref: {
20
+ readonly __isRef: true;
21
+ readonly blockId: string;
22
+ readonly name: string;
23
+ };
24
+ readonly label: string;
25
+ }[]>;
26
+ jGeneOptions: _platforma_sdk_model.ValueOrErrors<{
27
+ label: string;
28
+ value: SUniversalPColumnId;
29
+ }[] | undefined>;
30
+ abundanceOptions: _platforma_sdk_model.ValueOrErrors<{
31
+ label: string;
32
+ value: SUniversalPColumnId;
33
+ }[] | undefined>;
34
+ pf: _platforma_sdk_model.ValueOrErrors<_platforma_sdk_model.PFrameHandle | undefined>;
35
+ isRunning: _platforma_sdk_model.ValueOrErrors<boolean>;
36
+ }, UiState, "/" | "/jUsage" | "/vjUsage">;
37
+ type BlockOutputs = InferOutputsType<typeof model>;
38
+
39
+ export { type BlockArgs, type BlockOutputs, type UiState, model };
@@ -0,0 +1,39 @@
1
+ import * as _platforma_sdk_model from '@platforma-sdk/model';
2
+ import { PlRef, SUniversalPColumnId, InferOutputsType } from '@platforma-sdk/model';
3
+ import { GraphMakerState } from '@milaboratories/graph-maker';
4
+
5
+ type BlockArgs = {
6
+ vGeneRef?: PlRef;
7
+ jGeneRef?: SUniversalPColumnId;
8
+ abundanceRef?: SUniversalPColumnId;
9
+ };
10
+ type UiState = {
11
+ blockTitle: string;
12
+ weightedFlag: boolean;
13
+ vUsagePlotState: GraphMakerState;
14
+ jUsagePlotState: GraphMakerState;
15
+ vjUsagePlotState: GraphMakerState;
16
+ };
17
+ declare const model: _platforma_sdk_model.Platforma<BlockArgs, {
18
+ vGeneOptions: _platforma_sdk_model.ValueOrErrors<{
19
+ readonly ref: {
20
+ readonly __isRef: true;
21
+ readonly blockId: string;
22
+ readonly name: string;
23
+ };
24
+ readonly label: string;
25
+ }[]>;
26
+ jGeneOptions: _platforma_sdk_model.ValueOrErrors<{
27
+ label: string;
28
+ value: SUniversalPColumnId;
29
+ }[] | undefined>;
30
+ abundanceOptions: _platforma_sdk_model.ValueOrErrors<{
31
+ label: string;
32
+ value: SUniversalPColumnId;
33
+ }[] | undefined>;
34
+ pf: _platforma_sdk_model.ValueOrErrors<_platforma_sdk_model.PFrameHandle | undefined>;
35
+ isRunning: _platforma_sdk_model.ValueOrErrors<boolean>;
36
+ }, UiState, "/" | "/jUsage" | "/vjUsage">;
37
+ type BlockOutputs = InferOutputsType<typeof model>;
38
+
39
+ export { type BlockArgs, type BlockOutputs, type UiState, model };
package/dist/index.js ADDED
@@ -0,0 +1,71 @@
1
+ import { BlockModel, isPColumnSpec, createPFrameForGraphs } from '@platforma-sdk/model';
2
+
3
+ // src/index.ts
4
+ var model = BlockModel.create().withArgs({}).withUiState({
5
+ blockTitle: "V/J Usage",
6
+ weightedFlag: true,
7
+ vUsagePlotState: {
8
+ title: "V Usage",
9
+ template: "heatmap",
10
+ currentTab: "settings"
11
+ },
12
+ jUsagePlotState: {
13
+ title: "V Usage",
14
+ template: "heatmap",
15
+ currentTab: null
16
+ },
17
+ vjUsagePlotState: {
18
+ title: "V/J Usage",
19
+ template: "heatmap",
20
+ currentTab: null
21
+ }
22
+ }).argsValid(
23
+ (ctx) => ctx.args.vGeneRef !== void 0 && ctx.args.jGeneRef !== void 0 && ctx.args.abundanceRef !== void 0
24
+ ).output("vGeneOptions", (ctx) => ctx.resultPool.getOptions(
25
+ (c) => isPColumnSpec(c) && c.valueType === "String" && (c.name === "pl7.app/vdj/geneHit" || c.name === "pl7.app/vdj/geneHitWithAllele") && c.domain?.["pl7.app/vdj/reference"] === "VGene"
26
+ )).output("jGeneOptions", (ctx) => {
27
+ const inputRef = ctx.args.vGeneRef;
28
+ if (inputRef === void 0) return void 0;
29
+ const vGeneSpec = ctx.resultPool.getPColumnSpecByRef(inputRef);
30
+ if (vGeneSpec === void 0) return void 0;
31
+ return ctx.resultPool.getCanonicalOptions({ main: inputRef }, [
32
+ {
33
+ axes: [{ anchor: "main", idx: 0 }],
34
+ name: vGeneSpec.name,
35
+ domain: {
36
+ "pl7.app/vdj/reference": "JGene",
37
+ "pl7.app/vdj/scClonotypeChain": { anchor: "main" },
38
+ "pl7.app/vdj/scClonotypeChain/index": { anchor: "main" }
39
+ }
40
+ }
41
+ ], { ignoreMissingDomains: true });
42
+ }).output("abundanceOptions", (ctx) => {
43
+ const inputRef = ctx.args.vGeneRef;
44
+ if (inputRef === void 0) return void 0;
45
+ return ctx.resultPool.getCanonicalOptions(
46
+ { main: inputRef },
47
+ {
48
+ axes: [{
49
+ /* sampleId */
50
+ }, { anchor: "main", idx: 0 }],
51
+ annotations: {
52
+ "pl7.app/isAbundance": "true",
53
+ "pl7.app/abundance/normalized": "false"
54
+ }
55
+ }
56
+ );
57
+ }).output("pf", (ctx) => {
58
+ const pCols = ctx.outputs?.resolve("pf")?.getPColumns();
59
+ if (pCols === void 0) {
60
+ return void 0;
61
+ }
62
+ return createPFrameForGraphs(ctx, pCols);
63
+ }).output("isRunning", (ctx) => ctx.outputs?.getIsReadyOrError() === false).title((ctx) => ctx.uiState?.blockTitle ?? "V/J Usage").sections((_) => [
64
+ { type: "link", href: "/", label: "V Gene Usage" },
65
+ { type: "link", href: "/jUsage", label: "J Gene Usage" },
66
+ { type: "link", href: "/vjUsage", label: "V/J Gene Usage" }
67
+ ]).done();
68
+
69
+ export { model };
70
+ //# sourceMappingURL=index.js.map
71
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;AAkBa,IAAA,KAAA,GAAQ,WAAW,MAAO,EAAA,CAEpC,SAAoB,EAAE,EAEtB,WAAqB,CAAA;AAAA,EACpB,UAAY,EAAA,WAAA;AAAA,EACZ,YAAc,EAAA,IAAA;AAAA,EACd,eAAiB,EAAA;AAAA,IACf,KAAO,EAAA,SAAA;AAAA,IACP,QAAU,EAAA,SAAA;AAAA,IACV,UAAY,EAAA;AAAA,GACd;AAAA,EACA,eAAiB,EAAA;AAAA,IACf,KAAO,EAAA,SAAA;AAAA,IACP,QAAU,EAAA,SAAA;AAAA,IACV,UAAY,EAAA;AAAA,GACd;AAAA,EACA,gBAAkB,EAAA;AAAA,IAChB,KAAO,EAAA,WAA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AAY,OAAO,gBAAiB;AAC5D,CAAC,EAEA,IAAK","file":"index.js","sourcesContent":["import type { GraphMakerState } from '@milaboratories/graph-maker';\nimport type { InferOutputsType, PlRef, SUniversalPColumnId } from '@platforma-sdk/model';\nimport { BlockModel, createPFrameForGraphs, isPColumnSpec } from '@platforma-sdk/model';\n\nexport type BlockArgs = {\n vGeneRef?: PlRef;\n jGeneRef?: SUniversalPColumnId;\n abundanceRef?: SUniversalPColumnId;\n};\n\nexport type UiState = {\n blockTitle: string;\n weightedFlag: boolean;\n vUsagePlotState: GraphMakerState;\n jUsagePlotState: GraphMakerState;\n vjUsagePlotState: GraphMakerState;\n};\n\nexport const model = BlockModel.create()\n\n .withArgs<BlockArgs>({})\n\n .withUiState<UiState>({\n blockTitle: 'V/J Usage',\n weightedFlag: true,\n vUsagePlotState: {\n title: 'V Usage',\n template: 'heatmap',\n currentTab: 'settings',\n },\n jUsagePlotState: {\n title: 'V Usage',\n template: 'heatmap',\n currentTab: null,\n },\n vjUsagePlotState: {\n title: 'V/J Usage',\n template: 'heatmap',\n currentTab: null,\n },\n })\n\n .argsValid((ctx) =>\n ctx.args.vGeneRef !== undefined\n && ctx.args.jGeneRef !== undefined\n && ctx.args.abundanceRef !== undefined,\n )\n\n .output('vGeneOptions', (ctx) =>\n ctx.resultPool.getOptions((c) =>\n isPColumnSpec(c) && c.valueType === 'String'\n && (c.name === 'pl7.app/vdj/geneHit' || c.name === 'pl7.app/vdj/geneHitWithAllele')\n && c.domain?.['pl7.app/vdj/reference'] === 'VGene',\n ))\n\n .output('jGeneOptions', (ctx) => {\n const inputRef = ctx.args.vGeneRef;\n if (inputRef === undefined) return undefined;\n const vGeneSpec = ctx.resultPool.getPColumnSpecByRef(inputRef);\n if (vGeneSpec === undefined) return undefined;\n return ctx.resultPool.getCanonicalOptions({ main: inputRef }, [\n {\n axes: [{ anchor: 'main', idx: 0 }],\n name: vGeneSpec.name,\n domain: {\n 'pl7.app/vdj/reference': 'JGene',\n 'pl7.app/vdj/scClonotypeChain': { anchor: 'main' },\n 'pl7.app/vdj/scClonotypeChain/index': { anchor: 'main' },\n },\n },\n ], { ignoreMissingDomains: true });\n })\n\n .output('abundanceOptions', (ctx) => {\n const inputRef = ctx.args.vGeneRef;\n if (inputRef === undefined) return undefined;\n return ctx.resultPool.getCanonicalOptions({ main: inputRef },\n {\n axes: [{/* sampleId */}, { anchor: 'main', idx: 0 }],\n annotations: {\n 'pl7.app/isAbundance': 'true',\n 'pl7.app/abundance/normalized': 'false',\n },\n },\n );\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 ?? 'V/J Usage')\n\n .sections((_) => [\n { type: 'link', href: '/', label: 'V Gene Usage' },\n { type: 'link', href: '/jUsage', label: 'J Gene Usage' },\n { type: 'link', href: '/vjUsage', label: 'V/J Gene Usage' },\n ])\n\n .done();\n\nexport type BlockOutputs = InferOutputsType<typeof model>;\n"]}