@platforma-open/milaboratories.vj-usage.model 2.0.0 → 2.1.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/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@platforma-open/milaboratories.vj-usage.model",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "Block model",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
7
7
  "module": "dist/index.js",
8
8
  "types": "dist/index.d.ts",
9
9
  "dependencies": {
10
- "@platforma-sdk/model": "^1.29.2",
11
- "@milaboratories/graph-maker": "^1.1.71"
10
+ "@platforma-sdk/model": "^1.34.10",
11
+ "@milaboratories/graph-maker": "^1.1.119"
12
12
  },
13
13
  "devDependencies": {
14
- "@platforma-sdk/block-tools": "^2.5.36",
14
+ "@platforma-sdk/block-tools": "^2.5.57",
15
15
  "typescript": "~5.5.4",
16
16
  "vite": "^6.2.2",
17
17
  "tsup": "~8.3.5",
package/src/index.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import type { GraphMakerState } from '@milaboratories/graph-maker';
2
- import type { InferOutputsType, PlRef, SUniversalPColumnId } from '@platforma-sdk/model';
3
- import { BlockModel, createPFrameForGraphs, isPColumnSpec } from '@platforma-sdk/model';
2
+ import type { InferOutputsType, PlRef } from '@platforma-sdk/model';
3
+ import { BlockModel, createPFrameForGraphs } from '@platforma-sdk/model';
4
4
 
5
5
  export type BlockArgs = {
6
- vGeneRef?: PlRef;
7
- jGeneRef?: SUniversalPColumnId;
8
- abundanceRef?: SUniversalPColumnId;
6
+ datasetRef?: PlRef;
7
+ scChain?: string;
8
+ allele?: boolean;
9
9
  };
10
10
 
11
11
  export type UiState = {
@@ -18,71 +18,74 @@ export type UiState = {
18
18
 
19
19
  export const model = BlockModel.create()
20
20
 
21
- .withArgs<BlockArgs>({})
21
+ .withArgs<BlockArgs>({
22
+ scChain: 'A',
23
+ allele: false,
24
+ })
22
25
 
23
26
  .withUiState<UiState>({
24
27
  blockTitle: 'V/J Usage',
25
28
  weightedFlag: true,
26
29
  vUsagePlotState: {
27
30
  title: 'V Usage',
28
- template: 'heatmap',
31
+ template: 'heatmapClustered',
29
32
  currentTab: 'settings',
33
+ layersSettings: {
34
+ heatmapClustered: {
35
+ normalizationDirection: null,
36
+ },
37
+ },
30
38
  },
31
39
  jUsagePlotState: {
32
40
  title: 'V Usage',
33
- template: 'heatmap',
41
+ template: 'heatmapClustered',
34
42
  currentTab: null,
43
+ layersSettings: {
44
+ heatmapClustered: {
45
+ normalizationDirection: null,
46
+ },
47
+ },
35
48
  },
36
49
  vjUsagePlotState: {
37
50
  title: 'V/J Usage',
38
- template: 'heatmap',
51
+ template: 'heatmapClustered',
39
52
  currentTab: null,
53
+ layersSettings: {
54
+ heatmapClustered: {
55
+ normalizationDirection: null,
56
+ },
57
+ },
40
58
  },
41
59
  })
42
60
 
43
- .argsValid((ctx) =>
44
- ctx.args.vGeneRef !== undefined
45
- && ctx.args.jGeneRef !== undefined
46
- && ctx.args.abundanceRef !== undefined,
61
+ .argsValid((ctx) => ctx.args.datasetRef !== undefined)
62
+
63
+ .output('datasetOptions', (ctx) =>
64
+ ctx.resultPool.getOptions([{
65
+ axes: [
66
+ { name: 'pl7.app/sampleId' },
67
+ { name: 'pl7.app/vdj/clonotypeKey' },
68
+ ],
69
+ annotations: { 'pl7.app/isAnchor': 'true' },
70
+ }, {
71
+ axes: [
72
+ { name: 'pl7.app/sampleId' },
73
+ { name: 'pl7.app/vdj/scClonotypeKey' },
74
+ ],
75
+ annotations: { 'pl7.app/isAnchor': 'true' },
76
+ }],
77
+ {
78
+ // suppress native label of the column (e.g. "Number of Reads") to show only the dataset label
79
+ label: { includeNativeLabel: false },
80
+ }),
47
81
  )
48
82
 
49
- .output('vGeneOptions', (ctx) =>
50
- ctx.resultPool.getOptions((c) =>
51
- isPColumnSpec(c) && c.valueType === 'String'
52
- && (c.name === 'pl7.app/vdj/geneHit' || c.name === 'pl7.app/vdj/geneHitWithAllele')
53
- && c.domain?.['pl7.app/vdj/reference'] === 'VGene',
54
- ))
55
-
56
- .output('jGeneOptions', (ctx) => {
57
- const inputRef = ctx.args.vGeneRef;
58
- if (inputRef === undefined) return undefined;
59
- const vGeneSpec = ctx.resultPool.getPColumnSpecByRef(inputRef);
60
- if (vGeneSpec === undefined) return undefined;
61
- return ctx.resultPool.getCanonicalOptions({ main: inputRef }, [
62
- {
63
- axes: [{ anchor: 'main', idx: 0 }],
64
- name: vGeneSpec.name,
65
- domain: {
66
- 'pl7.app/vdj/reference': 'JGene',
67
- 'pl7.app/vdj/scClonotypeChain': { anchor: 'main' },
68
- 'pl7.app/vdj/scClonotypeChain/index': { anchor: 'main' },
69
- },
70
- },
71
- ], { ignoreMissingDomains: true });
72
- })
83
+ .output('datasetSpec', (ctx) => {
84
+ if (ctx.args.datasetRef === undefined) {
85
+ return undefined;
86
+ }
73
87
 
74
- .output('abundanceOptions', (ctx) => {
75
- const inputRef = ctx.args.vGeneRef;
76
- if (inputRef === undefined) return undefined;
77
- return ctx.resultPool.getCanonicalOptions({ main: inputRef },
78
- {
79
- axes: [{/* sampleId */}, { anchor: 'main', idx: 0 }],
80
- annotations: {
81
- 'pl7.app/isAbundance': 'true',
82
- 'pl7.app/abundance/normalized': 'false',
83
- },
84
- },
85
- );
88
+ return ctx.resultPool.getPColumnSpecByRef(ctx.args.datasetRef);
86
89
  })
87
90
 
88
91
  .output('pf', (ctx) => {