@platforma-open/milaboratories.vj-usage.model 2.1.5 → 2.1.6

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@platforma-open/milaboratories.vj-usage.model",
3
- "version": "2.1.5",
3
+ "version": "2.1.6",
4
4
  "description": "Block model",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -15,13 +15,13 @@
15
15
  "./dist/model.json": "./dist/model.json"
16
16
  },
17
17
  "dependencies": {
18
- "@platforma-sdk/model": "1.51.2",
19
- "@milaboratories/graph-maker": "1.1.202"
18
+ "@platforma-sdk/model": "1.53.3",
19
+ "@milaboratories/graph-maker": "1.1.216"
20
20
  },
21
21
  "devDependencies": {
22
- "@milaboratories/ts-builder": "1.2.1",
22
+ "@milaboratories/ts-builder": "1.2.4",
23
23
  "@milaboratories/ts-configs": "1.2.0",
24
- "@platforma-sdk/block-tools": "2.6.29",
24
+ "@platforma-sdk/block-tools": "2.6.36",
25
25
  "@platforma-sdk/eslint-config": "1.2.0",
26
26
  "eslint": "^9.25.1",
27
27
  "typescript": "~5.6.3",
package/src/index.ts CHANGED
@@ -1,15 +1,17 @@
1
1
  import type { GraphMakerState } from '@milaboratories/graph-maker';
2
2
  import type { InferOutputsType, PlRef } from '@platforma-sdk/model';
3
3
  import { BlockModel, createPFrameForGraphs } from '@platforma-sdk/model';
4
+ import { getDefaultBlockLabel } from './label';
4
5
 
5
6
  export type BlockArgs = {
7
+ defaultBlockLabel: string;
8
+ customBlockLabel: string;
6
9
  datasetRef?: PlRef;
7
10
  scChain?: string;
8
11
  allele?: boolean;
9
12
  };
10
13
 
11
14
  export type UiState = {
12
- blockTitle: string;
13
15
  weightedFlag: boolean;
14
16
  vUsagePlotState: GraphMakerState;
15
17
  jUsagePlotState: GraphMakerState;
@@ -19,12 +21,16 @@ export type UiState = {
19
21
  export const model = BlockModel.create()
20
22
 
21
23
  .withArgs<BlockArgs>({
24
+ defaultBlockLabel: getDefaultBlockLabel({
25
+ allele: false,
26
+ isSingleCell: false,
27
+ }),
28
+ customBlockLabel: '',
22
29
  scChain: 'A',
23
30
  allele: false,
24
31
  })
25
32
 
26
33
  .withUiState<UiState>({
27
- blockTitle: 'V/J Usage',
28
34
  weightedFlag: true,
29
35
  vUsagePlotState: {
30
36
  title: 'V Usage',
@@ -37,7 +43,7 @@ export const model = BlockModel.create()
37
43
  },
38
44
  },
39
45
  jUsagePlotState: {
40
- title: 'V Usage',
46
+ title: 'J Usage',
41
47
  template: 'heatmapClustered',
42
48
  currentTab: null,
43
49
  layersSettings: {
@@ -99,7 +105,9 @@ export const model = BlockModel.create()
99
105
 
100
106
  .output('isRunning', (ctx) => ctx.outputs?.getIsReadyOrError() === false)
101
107
 
102
- .title((ctx) => ctx.uiState?.blockTitle ?? 'V/J Usage')
108
+ .title(() => 'V/J Usage')
109
+
110
+ .subtitle((ctx) => ctx.args.customBlockLabel || ctx.args.defaultBlockLabel)
103
111
 
104
112
  .sections((_) => [
105
113
  { type: 'link', href: '/', label: 'V Gene Usage' },
@@ -110,3 +118,5 @@ export const model = BlockModel.create()
110
118
  .done(2);
111
119
 
112
120
  export type BlockOutputs = InferOutputsType<typeof model>;
121
+
122
+ export { getDefaultBlockLabel } from './label';
package/src/label.ts ADDED
@@ -0,0 +1,23 @@
1
+ export function getDefaultBlockLabel(data: {
2
+ datasetLabel?: string;
3
+ allele: boolean;
4
+ isSingleCell: boolean;
5
+ chainLabel?: string;
6
+ }) {
7
+ const parts: string[] = [];
8
+
9
+ // Add dataset name
10
+ if (data.datasetLabel) {
11
+ parts.push(data.datasetLabel);
12
+ }
13
+
14
+ // Add allele/gene
15
+ parts.push(data.allele ? 'Allele' : 'Gene');
16
+
17
+ // Add chain info for single-cell datasets
18
+ if (data.isSingleCell && data.chainLabel) {
19
+ parts.push(data.chainLabel);
20
+ }
21
+
22
+ return parts.join(' - ');
23
+ }