@platforma-open/milaboratories.immune-assay-data.model 1.0.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/dist/index.cjs ADDED
@@ -0,0 +1,100 @@
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({
7
+ settings: {
8
+ coverageMode: 2,
9
+ // default to coverage of clone,
10
+ coverageThreshold: 0.95
11
+ // default value matching MMseqs2 default
12
+ }
13
+ }).withUiState({
14
+ title: "Immune Assay Data",
15
+ tableState: {
16
+ gridState: {}
17
+ }
18
+ }).argsValid(
19
+ (ctx) => ctx.args.datasetRef !== void 0 && ctx.args.fileHandle !== void 0 && ctx.args.importColumns !== void 0 && ctx.args.sequenceColumnHeader !== void 0 && ctx.args.targetRef !== void 0 && ctx.uiState.fileImportError === void 0
20
+ ).output(
21
+ "datasetOptions",
22
+ (ctx) => ctx.resultPool.getOptions([{
23
+ axes: [
24
+ { name: "pl7.app/sampleId" },
25
+ { name: "pl7.app/vdj/clonotypeKey" }
26
+ ],
27
+ annotations: { "pl7.app/isAnchor": "true" }
28
+ }, {
29
+ axes: [
30
+ { name: "pl7.app/sampleId" },
31
+ { name: "pl7.app/vdj/scClonotypeKey" }
32
+ ],
33
+ annotations: { "pl7.app/isAnchor": "true" }
34
+ }], { refsWithEnrichments: true })
35
+ ).output("targetOptions", (ctx) => {
36
+ const ref = ctx.args.datasetRef;
37
+ if (ref === void 0) return void 0;
38
+ const isSingleCell = ctx.resultPool.getPColumnSpecByRef(ref)?.axesSpec[1].name === "pl7.app/vdj/scClonotypeKey";
39
+ const sequenceMatchers = [];
40
+ const allowedFeatures = [
41
+ "CDR1",
42
+ "CDR2",
43
+ "CDR3",
44
+ "FR1",
45
+ "FR2",
46
+ "FR3",
47
+ "FR4",
48
+ "VDJRegion"
49
+ ];
50
+ for (const feature of allowedFeatures) {
51
+ if (isSingleCell) {
52
+ sequenceMatchers.push({
53
+ axes: [{ anchor: "main", idx: 1 }],
54
+ name: "pl7.app/vdj/sequence",
55
+ domain: {
56
+ "pl7.app/vdj/feature": feature,
57
+ "pl7.app/vdj/scClonotypeChain/index": "primary"
58
+ }
59
+ });
60
+ } else {
61
+ sequenceMatchers.push({
62
+ axes: [{ anchor: "main", idx: 1 }],
63
+ name: "pl7.app/vdj/sequence",
64
+ domain: {
65
+ "pl7.app/vdj/feature": feature
66
+ }
67
+ });
68
+ }
69
+ }
70
+ return ctx.resultPool.getCanonicalOptions(
71
+ { main: ref },
72
+ sequenceMatchers,
73
+ {
74
+ ignoreMissingDomains: true,
75
+ labelOps: {
76
+ includeNativeLabel: true
77
+ }
78
+ }
79
+ );
80
+ }).output(
81
+ "dataImportHandle",
82
+ (ctx) => ctx.outputs?.resolve("dataImportHandle")?.getImportProgress(),
83
+ { isActive: true }
84
+ ).output("table", (ctx) => {
85
+ const cols = ctx.outputs?.resolve("table")?.getPColumns();
86
+ if (cols === void 0)
87
+ return void 0;
88
+ return model$1.createPlDataTableV2(
89
+ ctx,
90
+ cols,
91
+ (_) => true,
92
+ ctx.uiState.tableState
93
+ );
94
+ }).output("isRunning", (ctx) => ctx.outputs?.getIsReadyOrError() === false).title((ctx) => ctx.uiState.title).sections((_ctx) => [
95
+ { type: "link", href: "/", label: "Main" }
96
+ ]).done();
97
+
98
+ exports.model = model;
99
+ //# sourceMappingURL=index.cjs.map
100
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"names":["BlockModel","createPlDataTableV2"],"mappings":";;;;;AAwCO,IAAM,KAAQ,GAAAA,kBAAA,CAAW,MAAO,EAAA,CAEpC,QAAoB,CAAA;AAAA,EACnB,QAAU,EAAA;AAAA,IACR,YAAc,EAAA,CAAA;AAAA;AAAA,IACd,iBAAmB,EAAA;AAAA;AAAA;AAEvB,CAAC,EAEA,WAAqB,CAAA;AAAA,EACpB,KAAO,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AA,OAAO,GAAG,WAAY,EAAA;AACxD,EAAA,IAAI,IAAS,KAAA,MAAA;AACX,IAAO,OAAA,MAAA;AAET,EAAO,OAAAC,2BAAA;AAAA,IACL,GAAA;AAAA,IACA,IAAA;AAAA,IACA,CAAC,CAAM,KAAA,IAAA;AAAA,IACP,IAAI,OAAQ,CAAA;AAAA,GACd;AACF,CAAC,CAAA,CAEA,OAAO,WAAa,EAAA,CAAC,QAAQ,GAAI,CAAA,OAAA,EAAS,mBAAwB,KAAA,KAAK,EAEvE,KAAM,CAAA,CAAC,QAAQ,GAAI,CAAA,OAAA,CAAQ,KAAK,CAEhC,CAAA,QAAA,CAAS,CAAC,IAAU,KAAA;AAAA,EACnB,EAAE,IAAM,EAAA,MAAA,EAAQ,IAAM,EAAA,GAAA,EAAK,OAAO,MAAO;AAC3C,CAAE,EAED,IAAK","file":"index.cjs","sourcesContent":["import type {\n ImportFileHandle,\n InferOutputsType,\n PlDataTableState,\n PlRef,\n SUniversalPColumnId,\n} from '@platforma-sdk/model';\nimport {\n BlockModel,\n createPlDataTableV2,\n} from '@platforma-sdk/model';\n\ntype Settings = {\n coverageThreshold: number; // fraction of aligned residues required\n coverageMode: 0 | 1 | 2 | 3 | 4 | 5; // MMseqs2 coverage modes\n};\n\nexport type ImportColumnInfo = {\n header: string;\n type: 'Int' | 'Double' | 'String';\n /** If this column is a sequence column, the type of the sequence */\n sequenceType?: 'nucleotide' | 'aminoacid';\n};\n\nexport type BlockArgs = {\n datasetRef?: PlRef;\n targetRef?: SUniversalPColumnId;\n fileHandle?: ImportFileHandle;\n fileExtension?: string;\n importColumns?: ImportColumnInfo[];\n sequenceColumnHeader?: string;\n settings: Settings;\n};\n\nexport type UiState = {\n title: string;\n fileImportError?: string;\n tableState: PlDataTableState;\n};\n\nexport const model = BlockModel.create()\n\n .withArgs<BlockArgs>({\n settings: {\n coverageMode: 2, // default to coverage of clone,\n coverageThreshold: 0.95, // default value matching MMseqs2 default\n },\n })\n\n .withUiState<UiState>({\n title: 'Immune Assay Data',\n tableState: {\n gridState: {},\n },\n })\n\n .argsValid((ctx) =>\n ctx.args.datasetRef !== undefined\n && ctx.args.fileHandle !== undefined\n && ctx.args.importColumns !== undefined\n && ctx.args.sequenceColumnHeader !== undefined\n && ctx.args.targetRef !== undefined\n && ctx.uiState.fileImportError === undefined,\n )\n\n .output('datasetOptions', (ctx) =>\n ctx.resultPool.getOptions([{\n axes: [\n { name: 'pl7.app/sampleId' },\n { name: 'pl7.app/vdj/clonotypeKey' },\n ],\n annotations: { 'pl7.app/isAnchor': 'true' },\n }, {\n axes: [\n { name: 'pl7.app/sampleId' },\n { name: 'pl7.app/vdj/scClonotypeKey' },\n ],\n annotations: { 'pl7.app/isAnchor': 'true' },\n }], { refsWithEnrichments: true }),\n )\n\n .output('targetOptions', (ctx) => {\n const ref = ctx.args.datasetRef;\n if (ref === undefined) return undefined;\n\n const isSingleCell = ctx.resultPool.getPColumnSpecByRef(ref)?.axesSpec[1].name === 'pl7.app/vdj/scClonotypeKey';\n const sequenceMatchers = [];\n const allowedFeatures = ['CDR1', 'CDR2', 'CDR3', 'FR1', 'FR2',\n 'FR3', 'FR4', 'VDJRegion'];\n for (const feature of allowedFeatures) {\n if (isSingleCell) {\n sequenceMatchers.push({\n axes: [{ anchor: 'main', idx: 1 }],\n name: 'pl7.app/vdj/sequence',\n domain: {\n 'pl7.app/vdj/feature': feature,\n 'pl7.app/vdj/scClonotypeChain/index': 'primary',\n },\n });\n } else {\n sequenceMatchers.push({\n axes: [{ anchor: 'main', idx: 1 }],\n name: 'pl7.app/vdj/sequence',\n domain: {\n 'pl7.app/vdj/feature': feature,\n },\n });\n }\n }\n\n return ctx.resultPool.getCanonicalOptions(\n { main: ref },\n sequenceMatchers,\n {\n ignoreMissingDomains: true,\n labelOps: {\n includeNativeLabel: true,\n },\n });\n })\n\n .output(\n 'dataImportHandle',\n (ctx) => ctx.outputs?.resolve('dataImportHandle')?.getImportProgress(),\n { isActive: true },\n )\n\n .output('table', (ctx) => {\n const cols = ctx.outputs?.resolve('table')?.getPColumns();\n if (cols === undefined)\n return undefined;\n\n return createPlDataTableV2(\n ctx,\n cols,\n (_) => true,\n ctx.uiState.tableState,\n );\n })\n\n .output('isRunning', (ctx) => ctx.outputs?.getIsReadyOrError() === false)\n\n .title((ctx) => ctx.uiState.title)\n\n .sections((_ctx) => ([\n { type: 'link', href: '/', label: 'Main' },\n ]))\n\n .done();\n\nexport type BlockOutputs = InferOutputsType<typeof model>;\n"]}
@@ -0,0 +1,97 @@
1
+ import * as _platforma_sdk_model from '@platforma-sdk/model';
2
+ import { PlRef, SUniversalPColumnId, ImportFileHandle, PlDataTableState, InferOutputsType } from '@platforma-sdk/model';
3
+
4
+ type Settings = {
5
+ coverageThreshold: number;
6
+ coverageMode: 0 | 1 | 2 | 3 | 4 | 5;
7
+ };
8
+ type ImportColumnInfo = {
9
+ header: string;
10
+ type: 'Int' | 'Double' | 'String';
11
+ /** If this column is a sequence column, the type of the sequence */
12
+ sequenceType?: 'nucleotide' | 'aminoacid';
13
+ };
14
+ type BlockArgs = {
15
+ datasetRef?: PlRef;
16
+ targetRef?: SUniversalPColumnId;
17
+ fileHandle?: ImportFileHandle;
18
+ fileExtension?: string;
19
+ importColumns?: ImportColumnInfo[];
20
+ sequenceColumnHeader?: string;
21
+ settings: Settings;
22
+ };
23
+ type UiState = {
24
+ title: string;
25
+ fileImportError?: string;
26
+ tableState: PlDataTableState;
27
+ };
28
+ declare const model: _platforma_sdk_model.Platforma<BlockArgs, {
29
+ datasetOptions: _platforma_sdk_model.ValueOrErrors<{
30
+ readonly ref: {
31
+ readonly __isRef: true;
32
+ readonly blockId: string;
33
+ readonly name: string;
34
+ readonly requireEnrichments?: true | undefined;
35
+ };
36
+ readonly label: string;
37
+ }[]>;
38
+ targetOptions: _platforma_sdk_model.ValueOrErrors<{
39
+ label: string;
40
+ value: SUniversalPColumnId;
41
+ }[] | undefined>;
42
+ dataImportHandle: _platforma_sdk_model.ValueOrErrors<_platforma_sdk_model.ImportProgress | undefined>;
43
+ table: _platforma_sdk_model.ValueOrErrors<{
44
+ tableSpec: ({
45
+ type: "axis";
46
+ id: {
47
+ readonly type: _platforma_sdk_model.ValueType;
48
+ readonly name: string;
49
+ readonly domain?: {
50
+ [x: string]: string;
51
+ } | undefined;
52
+ };
53
+ spec: {
54
+ readonly type: _platforma_sdk_model.ValueType;
55
+ readonly name: string;
56
+ readonly domain?: {
57
+ [x: string]: string;
58
+ } | undefined;
59
+ readonly annotations?: {
60
+ [x: string]: string;
61
+ } | undefined;
62
+ readonly parentAxes?: number[] | undefined;
63
+ };
64
+ } | {
65
+ type: "column";
66
+ id: _platforma_sdk_model.PObjectId;
67
+ spec: {
68
+ readonly valueType: _platforma_sdk_model.ValueType;
69
+ readonly kind: "PColumn";
70
+ readonly name: string;
71
+ readonly domain?: {
72
+ [x: string]: string;
73
+ } | undefined;
74
+ readonly annotations?: {
75
+ [x: string]: string;
76
+ } | undefined;
77
+ readonly parentAxes?: number[] | undefined;
78
+ readonly axesSpec: {
79
+ readonly type: _platforma_sdk_model.ValueType;
80
+ readonly name: string;
81
+ readonly domain?: {
82
+ [x: string]: string;
83
+ } | undefined;
84
+ readonly annotations?: {
85
+ [x: string]: string;
86
+ } | undefined;
87
+ readonly parentAxes?: number[] | undefined;
88
+ }[];
89
+ };
90
+ })[];
91
+ tableHandle: _platforma_sdk_model.PTableHandle;
92
+ } | undefined>;
93
+ isRunning: _platforma_sdk_model.ValueOrErrors<boolean>;
94
+ }, UiState, "/">;
95
+ type BlockOutputs = InferOutputsType<typeof model>;
96
+
97
+ export { type BlockArgs, type BlockOutputs, type ImportColumnInfo, type UiState, model };
@@ -0,0 +1,97 @@
1
+ import * as _platforma_sdk_model from '@platforma-sdk/model';
2
+ import { PlRef, SUniversalPColumnId, ImportFileHandle, PlDataTableState, InferOutputsType } from '@platforma-sdk/model';
3
+
4
+ type Settings = {
5
+ coverageThreshold: number;
6
+ coverageMode: 0 | 1 | 2 | 3 | 4 | 5;
7
+ };
8
+ type ImportColumnInfo = {
9
+ header: string;
10
+ type: 'Int' | 'Double' | 'String';
11
+ /** If this column is a sequence column, the type of the sequence */
12
+ sequenceType?: 'nucleotide' | 'aminoacid';
13
+ };
14
+ type BlockArgs = {
15
+ datasetRef?: PlRef;
16
+ targetRef?: SUniversalPColumnId;
17
+ fileHandle?: ImportFileHandle;
18
+ fileExtension?: string;
19
+ importColumns?: ImportColumnInfo[];
20
+ sequenceColumnHeader?: string;
21
+ settings: Settings;
22
+ };
23
+ type UiState = {
24
+ title: string;
25
+ fileImportError?: string;
26
+ tableState: PlDataTableState;
27
+ };
28
+ declare const model: _platforma_sdk_model.Platforma<BlockArgs, {
29
+ datasetOptions: _platforma_sdk_model.ValueOrErrors<{
30
+ readonly ref: {
31
+ readonly __isRef: true;
32
+ readonly blockId: string;
33
+ readonly name: string;
34
+ readonly requireEnrichments?: true | undefined;
35
+ };
36
+ readonly label: string;
37
+ }[]>;
38
+ targetOptions: _platforma_sdk_model.ValueOrErrors<{
39
+ label: string;
40
+ value: SUniversalPColumnId;
41
+ }[] | undefined>;
42
+ dataImportHandle: _platforma_sdk_model.ValueOrErrors<_platforma_sdk_model.ImportProgress | undefined>;
43
+ table: _platforma_sdk_model.ValueOrErrors<{
44
+ tableSpec: ({
45
+ type: "axis";
46
+ id: {
47
+ readonly type: _platforma_sdk_model.ValueType;
48
+ readonly name: string;
49
+ readonly domain?: {
50
+ [x: string]: string;
51
+ } | undefined;
52
+ };
53
+ spec: {
54
+ readonly type: _platforma_sdk_model.ValueType;
55
+ readonly name: string;
56
+ readonly domain?: {
57
+ [x: string]: string;
58
+ } | undefined;
59
+ readonly annotations?: {
60
+ [x: string]: string;
61
+ } | undefined;
62
+ readonly parentAxes?: number[] | undefined;
63
+ };
64
+ } | {
65
+ type: "column";
66
+ id: _platforma_sdk_model.PObjectId;
67
+ spec: {
68
+ readonly valueType: _platforma_sdk_model.ValueType;
69
+ readonly kind: "PColumn";
70
+ readonly name: string;
71
+ readonly domain?: {
72
+ [x: string]: string;
73
+ } | undefined;
74
+ readonly annotations?: {
75
+ [x: string]: string;
76
+ } | undefined;
77
+ readonly parentAxes?: number[] | undefined;
78
+ readonly axesSpec: {
79
+ readonly type: _platforma_sdk_model.ValueType;
80
+ readonly name: string;
81
+ readonly domain?: {
82
+ [x: string]: string;
83
+ } | undefined;
84
+ readonly annotations?: {
85
+ [x: string]: string;
86
+ } | undefined;
87
+ readonly parentAxes?: number[] | undefined;
88
+ }[];
89
+ };
90
+ })[];
91
+ tableHandle: _platforma_sdk_model.PTableHandle;
92
+ } | undefined>;
93
+ isRunning: _platforma_sdk_model.ValueOrErrors<boolean>;
94
+ }, UiState, "/">;
95
+ type BlockOutputs = InferOutputsType<typeof model>;
96
+
97
+ export { type BlockArgs, type BlockOutputs, type ImportColumnInfo, type UiState, model };
package/dist/index.js ADDED
@@ -0,0 +1,98 @@
1
+ import { BlockModel, createPlDataTableV2 } from '@platforma-sdk/model';
2
+
3
+ // src/index.ts
4
+ var model = BlockModel.create().withArgs({
5
+ settings: {
6
+ coverageMode: 2,
7
+ // default to coverage of clone,
8
+ coverageThreshold: 0.95
9
+ // default value matching MMseqs2 default
10
+ }
11
+ }).withUiState({
12
+ title: "Immune Assay Data",
13
+ tableState: {
14
+ gridState: {}
15
+ }
16
+ }).argsValid(
17
+ (ctx) => ctx.args.datasetRef !== void 0 && ctx.args.fileHandle !== void 0 && ctx.args.importColumns !== void 0 && ctx.args.sequenceColumnHeader !== void 0 && ctx.args.targetRef !== void 0 && ctx.uiState.fileImportError === void 0
18
+ ).output(
19
+ "datasetOptions",
20
+ (ctx) => ctx.resultPool.getOptions([{
21
+ axes: [
22
+ { name: "pl7.app/sampleId" },
23
+ { name: "pl7.app/vdj/clonotypeKey" }
24
+ ],
25
+ annotations: { "pl7.app/isAnchor": "true" }
26
+ }, {
27
+ axes: [
28
+ { name: "pl7.app/sampleId" },
29
+ { name: "pl7.app/vdj/scClonotypeKey" }
30
+ ],
31
+ annotations: { "pl7.app/isAnchor": "true" }
32
+ }], { refsWithEnrichments: true })
33
+ ).output("targetOptions", (ctx) => {
34
+ const ref = ctx.args.datasetRef;
35
+ if (ref === void 0) return void 0;
36
+ const isSingleCell = ctx.resultPool.getPColumnSpecByRef(ref)?.axesSpec[1].name === "pl7.app/vdj/scClonotypeKey";
37
+ const sequenceMatchers = [];
38
+ const allowedFeatures = [
39
+ "CDR1",
40
+ "CDR2",
41
+ "CDR3",
42
+ "FR1",
43
+ "FR2",
44
+ "FR3",
45
+ "FR4",
46
+ "VDJRegion"
47
+ ];
48
+ for (const feature of allowedFeatures) {
49
+ if (isSingleCell) {
50
+ sequenceMatchers.push({
51
+ axes: [{ anchor: "main", idx: 1 }],
52
+ name: "pl7.app/vdj/sequence",
53
+ domain: {
54
+ "pl7.app/vdj/feature": feature,
55
+ "pl7.app/vdj/scClonotypeChain/index": "primary"
56
+ }
57
+ });
58
+ } else {
59
+ sequenceMatchers.push({
60
+ axes: [{ anchor: "main", idx: 1 }],
61
+ name: "pl7.app/vdj/sequence",
62
+ domain: {
63
+ "pl7.app/vdj/feature": feature
64
+ }
65
+ });
66
+ }
67
+ }
68
+ return ctx.resultPool.getCanonicalOptions(
69
+ { main: ref },
70
+ sequenceMatchers,
71
+ {
72
+ ignoreMissingDomains: true,
73
+ labelOps: {
74
+ includeNativeLabel: true
75
+ }
76
+ }
77
+ );
78
+ }).output(
79
+ "dataImportHandle",
80
+ (ctx) => ctx.outputs?.resolve("dataImportHandle")?.getImportProgress(),
81
+ { isActive: true }
82
+ ).output("table", (ctx) => {
83
+ const cols = ctx.outputs?.resolve("table")?.getPColumns();
84
+ if (cols === void 0)
85
+ return void 0;
86
+ return createPlDataTableV2(
87
+ ctx,
88
+ cols,
89
+ (_) => true,
90
+ ctx.uiState.tableState
91
+ );
92
+ }).output("isRunning", (ctx) => ctx.outputs?.getIsReadyOrError() === false).title((ctx) => ctx.uiState.title).sections((_ctx) => [
93
+ { type: "link", href: "/", label: "Main" }
94
+ ]).done();
95
+
96
+ export { model };
97
+ //# sourceMappingURL=index.js.map
98
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;AAwCO,IAAM,KAAQ,GAAA,UAAA,CAAW,MAAO,EAAA,CAEpC,QAAoB,CAAA;AAAA,EACnB,QAAU,EAAA;AAAA,IACR,YAAc,EAAA,CAAA;AAAA;AAAA,IACd,iBAAmB,EAAA;AAAA;AAAA;AAEvB,CAAC,EAEA,WAAqB,CAAA;AAAA,EACpB,KAAO,EAAA,mBAAA;AAAA,EACP,UAAY,EAAA;AAAA,IACV,WAAW;AAAC;AAEhB,CAAC,CAEA,CAAA,SAAA;AAAA,EAAU,CAAC,GACV,KAAA,GAAA,CAAI,IAAK,CAAA,UAAA,KAAe,UACrB,GAAI,CAAA,IAAA,CAAK,UAAe,KAAA,MAAA,IACxB,GAAI,CAAA,IAAA,CAAK,kBAAkB,MAC3B,IAAA,GAAA,CAAI,IAAK,CAAA,oBAAA,KAAyB,MAClC,IAAA,GAAA,CAAI,KAAK,SAAc,KAAA,MAAA,IACvB,GAAI,CAAA,OAAA,CAAQ,eAAoB,KAAA;AACrC,CAEC,CAAA,MAAA;AAAA,EAAO,gBAAA;AAAA,EAAkB,CAAC,GAAA,KACzB,GAAI,CAAA,UAAA,CAAW,WAAW,CAAC;AAAA,IACzB,IAAM,EAAA;AAAA,MACJ,EAAE,MAAM,kBAAmB,EAAA;AAAA,MAC3B,EAAE,MAAM,0BAA2B;AAAA,KACrC;AAAA,IACA,WAAA,EAAa,EAAE,kBAAA,EAAoB,MAAO;AAAA,GACzC,EAAA;AAAA,IACD,IAAM,EAAA;AAAA,MACJ,EAAE,MAAM,kBAAmB,EAAA;AAAA,MAC3B,EAAE,MAAM,4BAA6B;AAAA,KACvC;AAAA,IACA,WAAA,EAAa,EAAE,kBAAA,EAAoB,MAAO;AAAA,GAC3C,CAAA,EAAG,EAAE,mBAAA,EA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AA;AAAA,MACtB,QAAU,EAAA;AAAA,QACR,kBAAoB,EAAA;AAAA;AACtB;AACF,GAAC;AACL,CAAC,CAEA,CAAA,MAAA;AAAA,EACC,kBAAA;AAAA,EACA,CAAC,GAAQ,KAAA,GAAA,CAAI,SAAS,OAAQ,CAAA,kBAAkB,GAAG,iBAAkB,EAAA;AAAA,EACrE,EAAE,UAAU,IAAK;AACnB,CAEC,CAAA,MAAA,CAAO,OAAS,EAAA,CAAC,GAAQ,KAAA;AACxB,EAAA,MAAM,OAAO,GAAI,CAAA,OAAA,EAAS,OAAQ,CAAA,OAAO,GAAG,WAAY,EAAA;AACxD,EAAA,IAAI,IAAS,KAAA,MAAA;AACX,IAAO,OAAA,MAAA;AAET,EAAO,OAAA,mBAAA;AAAA,IACL,GAAA;AAAA,IACA,IAAA;AAAA,IACA,CAAC,CAAM,KAAA,IAAA;AAAA,IACP,IAAI,OAAQ,CAAA;AAAA,GACd;AACF,CAAC,CAAA,CAEA,OAAO,WAAa,EAAA,CAAC,QAAQ,GAAI,CAAA,OAAA,EAAS,mBAAwB,KAAA,KAAK,EAEvE,KAAM,CAAA,CAAC,QAAQ,GAAI,CAAA,OAAA,CAAQ,KAAK,CAEhC,CAAA,QAAA,CAAS,CAAC,IAAU,KAAA;AAAA,EACnB,EAAE,IAAM,EAAA,MAAA,EAAQ,IAAM,EAAA,GAAA,EAAK,OAAO,MAAO;AAC3C,CAAE,EAED,IAAK","file":"index.js","sourcesContent":["import type {\n ImportFileHandle,\n InferOutputsType,\n PlDataTableState,\n PlRef,\n SUniversalPColumnId,\n} from '@platforma-sdk/model';\nimport {\n BlockModel,\n createPlDataTableV2,\n} from '@platforma-sdk/model';\n\ntype Settings = {\n coverageThreshold: number; // fraction of aligned residues required\n coverageMode: 0 | 1 | 2 | 3 | 4 | 5; // MMseqs2 coverage modes\n};\n\nexport type ImportColumnInfo = {\n header: string;\n type: 'Int' | 'Double' | 'String';\n /** If this column is a sequence column, the type of the sequence */\n sequenceType?: 'nucleotide' | 'aminoacid';\n};\n\nexport type BlockArgs = {\n datasetRef?: PlRef;\n targetRef?: SUniversalPColumnId;\n fileHandle?: ImportFileHandle;\n fileExtension?: string;\n importColumns?: ImportColumnInfo[];\n sequenceColumnHeader?: string;\n settings: Settings;\n};\n\nexport type UiState = {\n title: string;\n fileImportError?: string;\n tableState: PlDataTableState;\n};\n\nexport const model = BlockModel.create()\n\n .withArgs<BlockArgs>({\n settings: {\n coverageMode: 2, // default to coverage of clone,\n coverageThreshold: 0.95, // default value matching MMseqs2 default\n },\n })\n\n .withUiState<UiState>({\n title: 'Immune Assay Data',\n tableState: {\n gridState: {},\n },\n })\n\n .argsValid((ctx) =>\n ctx.args.datasetRef !== undefined\n && ctx.args.fileHandle !== undefined\n && ctx.args.importColumns !== undefined\n && ctx.args.sequenceColumnHeader !== undefined\n && ctx.args.targetRef !== undefined\n && ctx.uiState.fileImportError === undefined,\n )\n\n .output('datasetOptions', (ctx) =>\n ctx.resultPool.getOptions([{\n axes: [\n { name: 'pl7.app/sampleId' },\n { name: 'pl7.app/vdj/clonotypeKey' },\n ],\n annotations: { 'pl7.app/isAnchor': 'true' },\n }, {\n axes: [\n { name: 'pl7.app/sampleId' },\n { name: 'pl7.app/vdj/scClonotypeKey' },\n ],\n annotations: { 'pl7.app/isAnchor': 'true' },\n }], { refsWithEnrichments: true }),\n )\n\n .output('targetOptions', (ctx) => {\n const ref = ctx.args.datasetRef;\n if (ref === undefined) return undefined;\n\n const isSingleCell = ctx.resultPool.getPColumnSpecByRef(ref)?.axesSpec[1].name === 'pl7.app/vdj/scClonotypeKey';\n const sequenceMatchers = [];\n const allowedFeatures = ['CDR1', 'CDR2', 'CDR3', 'FR1', 'FR2',\n 'FR3', 'FR4', 'VDJRegion'];\n for (const feature of allowedFeatures) {\n if (isSingleCell) {\n sequenceMatchers.push({\n axes: [{ anchor: 'main', idx: 1 }],\n name: 'pl7.app/vdj/sequence',\n domain: {\n 'pl7.app/vdj/feature': feature,\n 'pl7.app/vdj/scClonotypeChain/index': 'primary',\n },\n });\n } else {\n sequenceMatchers.push({\n axes: [{ anchor: 'main', idx: 1 }],\n name: 'pl7.app/vdj/sequence',\n domain: {\n 'pl7.app/vdj/feature': feature,\n },\n });\n }\n }\n\n return ctx.resultPool.getCanonicalOptions(\n { main: ref },\n sequenceMatchers,\n {\n ignoreMissingDomains: true,\n labelOps: {\n includeNativeLabel: true,\n },\n });\n })\n\n .output(\n 'dataImportHandle',\n (ctx) => ctx.outputs?.resolve('dataImportHandle')?.getImportProgress(),\n { isActive: true },\n )\n\n .output('table', (ctx) => {\n const cols = ctx.outputs?.resolve('table')?.getPColumns();\n if (cols === undefined)\n return undefined;\n\n return createPlDataTableV2(\n ctx,\n cols,\n (_) => true,\n ctx.uiState.tableState,\n );\n })\n\n .output('isRunning', (ctx) => ctx.outputs?.getIsReadyOrError() === false)\n\n .title((ctx) => ctx.uiState.title)\n\n .sections((_ctx) => ([\n { type: 'link', href: '/', label: 'Main' },\n ]))\n\n .done();\n\nexport type BlockOutputs = InferOutputsType<typeof model>;\n"]}