@platforma-open/milaboratories.humanization-score.model 0.3.1 → 0.3.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/dist/index.cjs CHANGED
@@ -35,12 +35,14 @@ const platforma = _platforma_sdk_model.BlockModelV3.create(dataModel).args((data
35
35
  }).output("inputOptions", (ctx) => ctx.resultPool.getOptions(inputSelectors)).outputWithStatus("pt", (ctx) => {
36
36
  const pCols = ctx.outputs?.resolve("outputHumanness")?.getPColumns();
37
37
  if (pCols === void 0) return;
38
+ const anchorCol = pCols[0];
39
+ if (anchorCol === void 0) return;
38
40
  return (0, _platforma_sdk_model.createPlDataTableV3)(ctx, {
39
41
  tableState: ctx.data.tableState,
40
- columns: new _platforma_sdk_model.ArrayColumnProvider(pCols).getAllColumns().map((column) => ({
41
- column,
42
- isPrimary: true
43
- }))
42
+ columns: {
43
+ anchors: { main: anchorCol.spec },
44
+ selector: { mode: "enrichment" }
45
+ }
44
46
  });
45
47
  }).outputWithStatus("histogramPf", (ctx) => {
46
48
  const pCols = ctx.outputs?.resolve("outputHumanness")?.getPColumns();
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["DataModelBuilder","BlockModelV3","ArrayColumnProvider"],"sources":["../src/index.ts"],"sourcesContent":["import type { GraphMakerState } from '@milaboratories/graph-maker';\nimport type {\n PColumnIdAndSpec,\n PFrameHandle,\n PlDataTableStateV2,\n PlRef,\n} from '@platforma-sdk/model';\nimport {\n ArrayColumnProvider,\n BlockModelV3,\n DataModelBuilder,\n createPFrameForGraphs,\n createPlDataTableStateV2,\n createPlDataTableV3,\n} from '@platforma-sdk/model';\nexport type * from '@milaboratories/helpers';\n\ntype OldArgs = {\n customBlockLabel: string;\n inputAnchor?: PlRef;\n mem?: number;\n};\n\ntype OldUiState = {\n tableState: PlDataTableStateV2;\n graphStateHistogram?: GraphMakerState;\n};\n\nexport type BlockData = {\n customBlockLabel: string;\n inputAnchor?: PlRef;\n mem?: number;\n tableState: PlDataTableStateV2;\n // Distribution of the per-clonotype humanness score across the whole dataset.\n graphStateHistogram: GraphMakerState;\n};\n\n// Humanness score column name emitted by `clonotype-process.tpl.tengo`.\nexport const HUMANNESS_SCORE_COLUMN = 'pl7.app/humannessScore';\n\nexport const defaultGraphStateHistogram = (): GraphMakerState => ({\n title: 'Humanness Score Distribution',\n template: 'bins',\n currentTab: null,\n axesSettings: {\n other: { binsCount: 20 },\n },\n // Give the bars a solid fill instead of the default white — colour values\n // taken from graph-maker's fixed palette (\"Blue\").\n layersSettings: {\n bins: { fillColor: '#2D93FA' },\n },\n});\n\n// Selectors for the input dataset anchor — shared between `inputOptions`\n// (the dropdown) and `subtitle` (so the default label matches the dataset name).\nconst inputSelectors = [{\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}];\n\nconst dataModel = new DataModelBuilder()\n .from<BlockData>('v1')\n .upgradeLegacy<OldArgs, OldUiState>(({ args, uiState }) => ({\n ...args,\n tableState: uiState.tableState,\n graphStateHistogram: uiState.graphStateHistogram ?? defaultGraphStateHistogram(),\n }))\n .init(() => ({\n customBlockLabel: '',\n tableState: createPlDataTableStateV2(),\n graphStateHistogram: defaultGraphStateHistogram(),\n }));\n\nexport const platforma = BlockModelV3.create(dataModel)\n\n .args((data) => {\n if (!data.inputAnchor) throw new Error('Input anchor is required');\n\n return {\n // Empty when unset; the workflow falls back to the input dataset name so\n // the provenance trace label matches the block subtitle.\n customBlockLabel: data.customBlockLabel || '',\n inputAnchor: data.inputAnchor,\n mem: data.mem,\n };\n })\n\n .output('inputOptions', (ctx) =>\n ctx.resultPool.getOptions(inputSelectors),\n )\n\n .outputWithStatus('pt', (ctx) => {\n const pCols = ctx.outputs?.resolve('outputHumanness')?.getPColumns();\n if (pCols === undefined) {\n return undefined;\n }\n return createPlDataTableV3(ctx, {\n tableState: ctx.data.tableState,\n columns: new ArrayColumnProvider(pCols)\n .getAllColumns()\n .map((column) => ({ column, isPrimary: true })),\n });\n })\n\n // --- Score distribution (histogram) ---------------------------------------\n // One row per clonotype, so the histogram counts UNIQUE clonotypes by humanness\n // score — it is deliberately NOT weighted by clonotype abundance. The question it\n // answers is \"how many distinct candidates sit below/above a humanness level\"\n // (i.e. how much humanization work is there), not \"how human is the repertoire by\n // read mass\". No human-like threshold line is drawn: this score is a 9-mer\n // fraction rescaled to 0..100, not a cutoff validated against therapeutic mAbs.\n .outputWithStatus('histogramPf', (ctx): PFrameHandle | undefined => {\n const pCols = ctx.outputs?.resolve('outputHumanness')?.getPColumns();\n if (pCols === undefined) return undefined;\n return createPFrameForGraphs(ctx, pCols);\n })\n\n .output('histogramPfPcols', (ctx): PColumnIdAndSpec[] | undefined => {\n const pCols = ctx.outputs?.resolve('outputHumanness')?.getPColumns();\n if (pCols === undefined || pCols.length === 0) return undefined;\n return pCols.map((c) => ({ columnId: c.id, spec: c.spec }));\n })\n\n .output('isRunning', (ctx) => ctx.outputs?.getIsReadyOrError() === false)\n\n .title(() => 'Humanization Score')\n\n .subtitle((ctx) => {\n if (ctx.data.customBlockLabel) return ctx.data.customBlockLabel;\n return 'Humanization Score';\n })\n\n .sections((_) => [\n { type: 'link', href: '/', label: 'Table' },\n { type: 'link', href: '/histogram', label: 'Score Distribution' },\n ])\n\n .done();\n"],"mappings":";;;AAsCA,MAAa,yBAAyB;AAEtC,MAAa,oCAAqD;CAChE,OAAO;CACP,UAAU;CACV,YAAY;CACZ,cAAc,EACZ,OAAO,EAAE,WAAW,IAAI,EACzB;CAGD,gBAAgB,EACd,MAAM,EAAE,WAAW,WAAW,EAC/B;CACF;AAID,MAAM,iBAAiB,CAAC;CACtB,MAAM,CACJ,EAAE,MAAM,oBAAoB,EAC5B,EAAE,MAAM,4BAA4B,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AI,SAAS,QAAQ,kBAAkB,EAAE,aAAa;CACpE,IAAI,UAAU,KAAA,KAAa,MAAM,WAAW,GAAG,OAAO,KAAA;CACtD,OAAO,MAAM,KAAK,OAAO;EAAE,UAAU,EAAE;EAAI,MAAM,EAAE;EAAM,EAAE;EAC3D,CAED,OAAO,cAAc,QAAQ,IAAI,SAAS,mBAAmB,KAAK,MAAM,CAExE,YAAY,qBAAqB,CAEjC,UAAU,QAAQ;CACjB,IAAI,IAAI,KAAK,kBAAkB,OAAO,IAAI,KAAK;CAC/C,OAAO;EACP,CAED,UAAU,MAAM,CACf;CAAE,MAAM;CAAQ,MAAM;CAAK,OAAO;CAAS,EAC3C;CAAE,MAAM;CAAQ,MAAM;CAAc,OAAO;CAAsB,CAClE,CAAC,CAED,MAAM"}
1
+ {"version":3,"file":"index.cjs","names":["DataModelBuilder","BlockModelV3"],"sources":["../src/index.ts"],"sourcesContent":["import type { GraphMakerState } from '@milaboratories/graph-maker';\nimport type {\n PColumnIdAndSpec,\n PFrameHandle,\n PlDataTableStateV2,\n PlRef,\n} from '@platforma-sdk/model';\nimport {\n BlockModelV3,\n DataModelBuilder, createPFrameForGraphs,\n createPlDataTableStateV2,\n createPlDataTableV3,\n} from '@platforma-sdk/model';\nexport type * from '@milaboratories/helpers';\n\ntype OldArgs = {\n customBlockLabel: string;\n inputAnchor?: PlRef;\n mem?: number;\n};\n\ntype OldUiState = {\n tableState: PlDataTableStateV2;\n graphStateHistogram?: GraphMakerState;\n};\n\nexport type BlockData = {\n customBlockLabel: string;\n inputAnchor?: PlRef;\n mem?: number;\n tableState: PlDataTableStateV2;\n // Distribution of the per-clonotype humanness score across the whole dataset.\n graphStateHistogram: GraphMakerState;\n};\n\n// Humanness score column name emitted by `clonotype-process.tpl.tengo`.\nexport const HUMANNESS_SCORE_COLUMN = 'pl7.app/humannessScore';\n\nexport const defaultGraphStateHistogram = (): GraphMakerState => ({\n title: 'Humanness Score Distribution',\n template: 'bins',\n currentTab: null,\n axesSettings: {\n other: { binsCount: 20 },\n },\n // Give the bars a solid fill instead of the default white — colour values\n // taken from graph-maker's fixed palette (\"Blue\").\n layersSettings: {\n bins: { fillColor: '#2D93FA' },\n },\n});\n\n// Selectors for the input dataset anchor — shared between `inputOptions`\n// (the dropdown) and `subtitle` (so the default label matches the dataset name).\nconst inputSelectors = [{\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}];\n\nconst dataModel = new DataModelBuilder()\n .from<BlockData>('v1')\n .upgradeLegacy<OldArgs, OldUiState>(({ args, uiState }) => ({\n ...args,\n tableState: uiState.tableState,\n graphStateHistogram: uiState.graphStateHistogram ?? defaultGraphStateHistogram(),\n }))\n .init(() => ({\n customBlockLabel: '',\n tableState: createPlDataTableStateV2(),\n graphStateHistogram: defaultGraphStateHistogram(),\n }));\n\nexport const platforma = BlockModelV3.create(dataModel)\n\n .args((data) => {\n if (!data.inputAnchor) throw new Error('Input anchor is required');\n\n return {\n // Empty when unset; the workflow falls back to the input dataset name so\n // the provenance trace label matches the block subtitle.\n customBlockLabel: data.customBlockLabel || '',\n inputAnchor: data.inputAnchor,\n mem: data.mem,\n };\n })\n\n .output('inputOptions', (ctx) =>\n ctx.resultPool.getOptions(inputSelectors),\n )\n\n .outputWithStatus('pt', (ctx) => {\n const pCols = ctx.outputs?.resolve('outputHumanness')?.getPColumns();\n if (pCols === undefined) {\n return undefined;\n }\n\n const anchorCol = pCols[0];\n if (anchorCol === undefined) {\n return undefined;\n }\n\n return createPlDataTableV3(ctx, {\n tableState: ctx.data.tableState,\n columns: {\n anchors: { main: anchorCol.spec },\n selector: { mode: 'enrichment' },\n },\n });\n })\n\n .outputWithStatus('histogramPf', (ctx): PFrameHandle | undefined => {\n const pCols = ctx.outputs?.resolve('outputHumanness')?.getPColumns();\n if (pCols === undefined) return undefined;\n return createPFrameForGraphs(ctx, pCols);\n })\n\n .output('histogramPfPcols', (ctx): PColumnIdAndSpec[] | undefined => {\n const pCols = ctx.outputs?.resolve('outputHumanness')?.getPColumns();\n if (pCols === undefined || pCols.length === 0) return undefined;\n return pCols.map((c) => ({ columnId: c.id, spec: c.spec }));\n })\n\n .output('isRunning', (ctx) => ctx.outputs?.getIsReadyOrError() === false)\n\n .title(() => 'Humanization Score')\n\n .subtitle((ctx) => {\n if (ctx.data.customBlockLabel) return ctx.data.customBlockLabel;\n return 'Humanization Score';\n })\n\n .sections((_) => [\n { type: 'link', href: '/', label: 'Table' },\n { type: 'link', href: '/histogram', label: 'Score Distribution' },\n ])\n\n .done();\n"],"mappings":";;;AAoCA,MAAa,yBAAyB;AAEtC,MAAa,oCAAqD;CAChE,OAAO;CACP,UAAU;CACV,YAAY;CACZ,cAAc,EACZ,OAAO,EAAE,WAAW,IAAI,EACzB;CAGD,gBAAgB,EACd,MAAM,EAAE,WAAW,WAAW,EAC/B;CACF;AAID,MAAM,iBAAiB,CAAC;CACtB,MAAM,CACJ,EAAE,MAAM,oBAAoB,EAC5B,EAAE,MAAM,4BAA4B,CACrC;CACD,aAAa,EAAE,oBAAoB,QAAQ;CAC5C,EAAE;CACD,MAAM,CACJ,EAAE,MAAM,oBAAoB,EAC5B,EAAE,MAAM,8BAA8B,CACvC;CACD,aAAa,EAAE,oBAAoB,QAAQ;CAC5C,CAAC;AAEF,MAAM,YAAY,IAAIA,qBAAAA,kBAAkB,CACrC,KAAgB,KAAK,CACrB,eAAoC,EAAE,MAAM,eAAe;CAC1D,GAAG;CACH,YAAY,QAAQ;CACpB,qBAAqB,QAAQ,uBAAuB,4BAA4B;CACjF,EAAE,CACF,YAAY;CACX,kBAAkB;CAClB,aAAA,GAAA,qBAAA,2BAAsC;CACtC,qBAAqB,4BAA4B;CAClD,EAAE;AAEL,MAAa,YAAYC,qBAAAA,a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M;CAAQ,MAAM;CAAc,OAAO;CAAsB,CAClE,CAAC,CAED,MAAM"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;KA4BY,SAAA;EACV,gBAAA;EACA,WAAA,GAAc,KAAA;EACd,GAAA;EACA,UAAA,EAAY,kBAAA;EAEZ,mBAAA,EAAqB,eAAA;AAAA;AAAA,cAIV,sBAAA;AAAA,cAEA,0BAAA,QAAiC,eAAA;AAAA,cA2CjC,SAAA,EAAS,uBAAA,CAAA,iBAAA,yBAAA,WAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAAA"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;KA0BY,SAAA;EACV,gBAAA;EACA,WAAA,GAAc,KAAA;EACd,GAAA;EACA,UAAA,EAAY,kBAAA;EAEZ,mBAAA,EAAqB,eAAA;AAAA;AAAA,cAIV,sBAAA;AAAA,cAEA,0BAAA,QAAiC,eAAA;AAAA,cA2CjC,SAAA,EAAS,uBAAA,CAAA,iBAAA,yBAAA,WAAA,CAAA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAAA"}
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { ArrayColumnProvider, BlockModelV3, DataModelBuilder, createPFrameForGraphs, createPlDataTableStateV2, createPlDataTableV3 } from "@platforma-sdk/model";
1
+ import { BlockModelV3, DataModelBuilder, createPFrameForGraphs, createPlDataTableStateV2, createPlDataTableV3 } from "@platforma-sdk/model";
2
2
  //#region src/index.ts
3
3
  const HUMANNESS_SCORE_COLUMN = "pl7.app/humannessScore";
4
4
  const defaultGraphStateHistogram = () => ({
@@ -34,12 +34,14 @@ const platforma = BlockModelV3.create(dataModel).args((data) => {
34
34
  }).output("inputOptions", (ctx) => ctx.resultPool.getOptions(inputSelectors)).outputWithStatus("pt", (ctx) => {
35
35
  const pCols = ctx.outputs?.resolve("outputHumanness")?.getPColumns();
36
36
  if (pCols === void 0) return;
37
+ const anchorCol = pCols[0];
38
+ if (anchorCol === void 0) return;
37
39
  return createPlDataTableV3(ctx, {
38
40
  tableState: ctx.data.tableState,
39
- columns: new ArrayColumnProvider(pCols).getAllColumns().map((column) => ({
40
- column,
41
- isPrimary: true
42
- }))
41
+ columns: {
42
+ anchors: { main: anchorCol.spec },
43
+ selector: { mode: "enrichment" }
44
+ }
43
45
  });
44
46
  }).outputWithStatus("histogramPf", (ctx) => {
45
47
  const pCols = ctx.outputs?.resolve("outputHumanness")?.getPColumns();
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import type { GraphMakerState } from '@milaboratories/graph-maker';\nimport type {\n PColumnIdAndSpec,\n PFrameHandle,\n PlDataTableStateV2,\n PlRef,\n} from '@platforma-sdk/model';\nimport {\n ArrayColumnProvider,\n BlockModelV3,\n DataModelBuilder,\n createPFrameForGraphs,\n createPlDataTableStateV2,\n createPlDataTableV3,\n} from '@platforma-sdk/model';\nexport type * from '@milaboratories/helpers';\n\ntype OldArgs = {\n customBlockLabel: string;\n inputAnchor?: PlRef;\n mem?: number;\n};\n\ntype OldUiState = {\n tableState: PlDataTableStateV2;\n graphStateHistogram?: GraphMakerState;\n};\n\nexport type BlockData = {\n customBlockLabel: string;\n inputAnchor?: PlRef;\n mem?: number;\n tableState: PlDataTableStateV2;\n // Distribution of the per-clonotype humanness score across the whole dataset.\n graphStateHistogram: GraphMakerState;\n};\n\n// Humanness score column name emitted by `clonotype-process.tpl.tengo`.\nexport const HUMANNESS_SCORE_COLUMN = 'pl7.app/humannessScore';\n\nexport const defaultGraphStateHistogram = (): GraphMakerState => ({\n title: 'Humanness Score Distribution',\n template: 'bins',\n currentTab: null,\n axesSettings: {\n other: { binsCount: 20 },\n },\n // Give the bars a solid fill instead of the default white — colour values\n // taken from graph-maker's fixed palette (\"Blue\").\n layersSettings: {\n bins: { fillColor: '#2D93FA' },\n },\n});\n\n// Selectors for the input dataset anchor — shared between `inputOptions`\n// (the dropdown) and `subtitle` (so the default label matches the dataset name).\nconst inputSelectors = [{\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}];\n\nconst dataModel = new DataModelBuilder()\n .from<BlockData>('v1')\n .upgradeLegacy<OldArgs, OldUiState>(({ args, uiState }) => ({\n ...args,\n tableState: uiState.tableState,\n graphStateHistogram: uiState.graphStateHistogram ?? defaultGraphStateHistogram(),\n }))\n .init(() => ({\n customBlockLabel: '',\n tableState: createPlDataTableStateV2(),\n graphStateHistogram: defaultGraphStateHistogram(),\n }));\n\nexport const platforma = BlockModelV3.create(dataModel)\n\n .args((data) => {\n if (!data.inputAnchor) throw new Error('Input anchor is required');\n\n return {\n // Empty when unset; the workflow falls back to the input dataset name so\n // the provenance trace label matches the block subtitle.\n customBlockLabel: data.customBlockLabel || '',\n inputAnchor: data.inputAnchor,\n mem: data.mem,\n };\n })\n\n .output('inputOptions', (ctx) =>\n ctx.resultPool.getOptions(inputSelectors),\n )\n\n .outputWithStatus('pt', (ctx) => {\n const pCols = ctx.outputs?.resolve('outputHumanness')?.getPColumns();\n if (pCols === undefined) {\n return undefined;\n }\n return createPlDataTableV3(ctx, {\n tableState: ctx.data.tableState,\n columns: new ArrayColumnProvider(pCols)\n .getAllColumns()\n .map((column) => ({ column, isPrimary: true })),\n });\n })\n\n // --- Score distribution (histogram) ---------------------------------------\n // One row per clonotype, so the histogram counts UNIQUE clonotypes by humanness\n // score — it is deliberately NOT weighted by clonotype abundance. The question it\n // answers is \"how many distinct candidates sit below/above a humanness level\"\n // (i.e. how much humanization work is there), not \"how human is the repertoire by\n // read mass\". No human-like threshold line is drawn: this score is a 9-mer\n // fraction rescaled to 0..100, not a cutoff validated against therapeutic mAbs.\n .outputWithStatus('histogramPf', (ctx): PFrameHandle | undefined => {\n const pCols = ctx.outputs?.resolve('outputHumanness')?.getPColumns();\n if (pCols === undefined) return undefined;\n return createPFrameForGraphs(ctx, pCols);\n })\n\n .output('histogramPfPcols', (ctx): PColumnIdAndSpec[] | undefined => {\n const pCols = ctx.outputs?.resolve('outputHumanness')?.getPColumns();\n if (pCols === undefined || pCols.length === 0) return undefined;\n return pCols.map((c) => ({ columnId: c.id, spec: c.spec }));\n })\n\n .output('isRunning', (ctx) => ctx.outputs?.getIsReadyOrError() === false)\n\n .title(() => 'Humanization Score')\n\n .subtitle((ctx) => {\n if (ctx.data.customBlockLabel) return ctx.data.customBlockLabel;\n return 'Humanization Score';\n })\n\n .sections((_) => [\n { type: 'link', href: '/', label: 'Table' },\n { type: 'link', href: '/histogram', label: 'Score Distribution' },\n ])\n\n .done();\n"],"mappings":";;AAsCA,MAAa,yBAAyB;AAEtC,MAAa,oCAAqD;CAChE,OAAO;CACP,UAAU;CACV,YAAY;CACZ,cAAc,EACZ,OAAO,EAAE,WAAW,IAAI,EACzB;CAGD,gBAAgB,EACd,MAAM,EAAE,WAAW,WAAW,EAC/B;CACF;AAID,MAAM,iBAAiB,CAAC;CACtB,MAAM,CACJ,EAAE,MAAM,oBAAoB,EAC5B,EAAE,MAAM,4BAA4B,CACrC;CACD,aAAa,EAAE,oBAAoB,QAAQ;CAC5C,EAAE;CACD,MAAM,CACJ,EAAE,MAAM,oBAAoB,EAC5B,EAAE,MAAM,8BAA8B,CACvC;CACD,aAAa,EAAE,oBAAoB,QAAQ;CAC5C,CAAC;AAEF,MAAM,YAAY,IAAI,kBAAkB,CACrC,KAAgB,KAAK,CACrB,eAAoC,EAAE,MAAM,eAAe;CAC1D,GAAG;CACH,YAAY,QAAQ;CACpB,qBAAqB,QAAQ,uBAAuB,4BAA4B;CACjF,EAAE,CACF,YAAY;CACX,kBAAkB;CAClB,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;CAAQ,MAAM;CAAc,OAAO;CAAsB,CAClE,CAAC,CAED,MAAM"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import type { GraphMakerState } from '@milaboratories/graph-maker';\nimport type {\n PColumnIdAndSpec,\n PFrameHandle,\n PlDataTableStateV2,\n PlRef,\n} from '@platforma-sdk/model';\nimport {\n BlockModelV3,\n DataModelBuilder, createPFrameForGraphs,\n createPlDataTableStateV2,\n createPlDataTableV3,\n} from '@platforma-sdk/model';\nexport type * from '@milaboratories/helpers';\n\ntype OldArgs = {\n customBlockLabel: string;\n inputAnchor?: PlRef;\n mem?: number;\n};\n\ntype OldUiState = {\n tableState: PlDataTableStateV2;\n graphStateHistogram?: GraphMakerState;\n};\n\nexport type BlockData = {\n customBlockLabel: string;\n inputAnchor?: PlRef;\n mem?: number;\n tableState: PlDataTableStateV2;\n // Distribution of the per-clonotype humanness score across the whole dataset.\n graphStateHistogram: GraphMakerState;\n};\n\n// Humanness score column name emitted by `clonotype-process.tpl.tengo`.\nexport const HUMANNESS_SCORE_COLUMN = 'pl7.app/humannessScore';\n\nexport const defaultGraphStateHistogram = (): GraphMakerState => ({\n title: 'Humanness Score Distribution',\n template: 'bins',\n currentTab: null,\n axesSettings: {\n other: { binsCount: 20 },\n },\n // Give the bars a solid fill instead of the default white — colour values\n // taken from graph-maker's fixed palette (\"Blue\").\n layersSettings: {\n bins: { fillColor: '#2D93FA' },\n },\n});\n\n// Selectors for the input dataset anchor — shared between `inputOptions`\n// (the dropdown) and `subtitle` (so the default label matches the dataset name).\nconst inputSelectors = [{\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}];\n\nconst dataModel = new DataModelBuilder()\n .from<BlockData>('v1')\n .upgradeLegacy<OldArgs, OldUiState>(({ args, uiState }) => ({\n ...args,\n tableState: uiState.tableState,\n graphStateHistogram: uiState.graphStateHistogram ?? defaultGraphStateHistogram(),\n }))\n .init(() => ({\n customBlockLabel: '',\n tableState: createPlDataTableStateV2(),\n graphStateHistogram: defaultGraphStateHistogram(),\n }));\n\nexport const platforma = BlockModelV3.create(dataModel)\n\n .args((data) => {\n if (!data.inputAnchor) throw new Error('Input anchor is required');\n\n return {\n // Empty when unset; the workflow falls back to the input dataset name so\n // the provenance trace label matches the block subtitle.\n customBlockLabel: data.customBlockLabel || '',\n inputAnchor: data.inputAnchor,\n mem: data.mem,\n };\n })\n\n .output('inputOptions', (ctx) =>\n ctx.resultPool.getOptions(inputSelectors),\n )\n\n .outputWithStatus('pt', (ctx) => {\n const pCols = ctx.outputs?.resolve('outputHumanness')?.getPColumns();\n if (pCols === undefined) {\n return undefined;\n }\n\n const anchorCol = pCols[0];\n if (anchorCol === undefined) {\n return undefined;\n }\n\n return createPlDataTableV3(ctx, {\n tableState: ctx.data.tableState,\n columns: {\n anchors: { main: anchorCol.spec },\n selector: { mode: 'enrichment' },\n },\n });\n })\n\n .outputWithStatus('histogramPf', (ctx): PFrameHandle | undefined => {\n const pCols = ctx.outputs?.resolve('outputHumanness')?.getPColumns();\n if (pCols === undefined) return undefined;\n return createPFrameForGraphs(ctx, pCols);\n })\n\n .output('histogramPfPcols', (ctx): PColumnIdAndSpec[] | undefined => {\n const pCols = ctx.outputs?.resolve('outputHumanness')?.getPColumns();\n if (pCols === undefined || pCols.length === 0) return undefined;\n return pCols.map((c) => ({ columnId: c.id, spec: c.spec }));\n })\n\n .output('isRunning', (ctx) => ctx.outputs?.getIsReadyOrError() === false)\n\n .title(() => 'Humanization Score')\n\n .subtitle((ctx) => {\n if (ctx.data.customBlockLabel) return ctx.data.customBlockLabel;\n return 'Humanization Score';\n })\n\n .sections((_) => [\n { type: 'link', href: '/', label: 'Table' },\n { type: 'link', href: '/histogram', label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