@platforma-open/milaboratories.vj-usage.model 2.1.4 → 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,39 +1,36 @@
1
1
  {
2
2
  "name": "@platforma-open/milaboratories.vj-usage.model",
3
- "version": "2.1.4",
3
+ "version": "2.1.6",
4
4
  "description": "Block model",
5
5
  "type": "module",
6
- "main": "dist/index.cjs",
7
- "module": "dist/index.js",
8
- "types": "dist/index.d.ts",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js",
12
+ "default": "./dist/index.js",
13
+ "sources": "./src/index.ts"
14
+ },
15
+ "./dist/model.json": "./dist/model.json"
16
+ },
9
17
  "dependencies": {
10
- "@platforma-sdk/model": "^1.45.0",
11
- "@milaboratories/graph-maker": "^1.1.174"
18
+ "@platforma-sdk/model": "1.53.3",
19
+ "@milaboratories/graph-maker": "1.1.216"
12
20
  },
13
21
  "devDependencies": {
14
- "@platforma-sdk/block-tools": "^2.6.25",
15
- "typescript": "~5.5.4",
16
- "vite": "^6.2.2",
17
- "tsup": "~8.3.5",
18
- "@platforma-sdk/eslint-config": "^1.1.0"
19
- },
20
- "tsup": {
21
- "entry": [
22
- "src/index.ts"
23
- ],
24
- "splitting": false,
25
- "treeshake": true,
26
- "clean": true,
27
- "format": [
28
- "cjs",
29
- "esm"
30
- ],
31
- "dts": true,
32
- "minify": false,
33
- "sourcemap": true
22
+ "@milaboratories/ts-builder": "1.2.4",
23
+ "@milaboratories/ts-configs": "1.2.0",
24
+ "@platforma-sdk/block-tools": "2.6.36",
25
+ "@platforma-sdk/eslint-config": "1.2.0",
26
+ "eslint": "^9.25.1",
27
+ "typescript": "~5.6.3",
28
+ "vitest": "^4.0.7"
34
29
  },
35
30
  "scripts": {
36
- "build": "tsup && vite build && block-tools build-model",
31
+ "build": "ts-builder build --target block-model && block-tools build-model",
32
+ "watch": "ts-builder build --target block-model --watch",
33
+ "type-check": "ts-builder types --target block-model",
37
34
  "lint": "eslint ."
38
35
  }
39
36
  }
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: {
@@ -88,7 +94,7 @@ export const model = BlockModel.create()
88
94
  return ctx.resultPool.getPColumnSpecByRef(ctx.args.datasetRef);
89
95
  })
90
96
 
91
- .output('pf', (ctx) => {
97
+ .outputWithStatus('pf', (ctx) => {
92
98
  const pCols = ctx.outputs?.resolve('pf')?.getPColumns();
93
99
  if (pCols === undefined) {
94
100
  return undefined;
@@ -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
+ }
package/tsconfig.json CHANGED
@@ -1,16 +1,4 @@
1
1
  {
2
- "compilerOptions": {
3
- "target": "es2022",
4
- "module": "commonjs",
5
- "moduleResolution": "node",
6
- "esModuleInterop": true,
7
- "strict": true,
8
- "outDir": "./dist",
9
- "rootDir": "./src",
10
- "sourceMap": true,
11
- "declaration": true
12
- },
13
- "types": [],
14
- "include": ["src/**/*"],
15
- "exclude": ["node_modules", "dist"]
2
+ "extends": "@milaboratories/ts-configs/block/model",
3
+ "include": ["src/**/*"]
16
4
  }
@@ -0,0 +1,8 @@
1
+ import { defineConfig } from 'vitest/config';
2
+
3
+ export default defineConfig({
4
+ test: {
5
+ globals: true
6
+ }
7
+ });
8
+
package/dist/index.d.cts DELETED
@@ -1,55 +0,0 @@
1
- import * as _platforma_sdk_model from '@platforma-sdk/model';
2
- import { PlRef, InferOutputsType } from '@platforma-sdk/model';
3
- import { GraphMakerState } from '@milaboratories/graph-maker';
4
-
5
- type BlockArgs = {
6
- datasetRef?: PlRef;
7
- scChain?: string;
8
- allele?: boolean;
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.PlatformaV2<BlockArgs, {
18
- datasetOptions: _platforma_sdk_model.ValueOrErrors<{
19
- readonly ref: {
20
- readonly __isRef: true;
21
- readonly blockId: string;
22
- readonly name: string;
23
- readonly requireEnrichments?: true | undefined;
24
- };
25
- readonly label: string;
26
- }[]>;
27
- datasetSpec: _platforma_sdk_model.ValueOrErrors<{
28
- readonly valueType: _platforma_sdk_model.ValueType;
29
- readonly kind: "PColumn";
30
- readonly name: string;
31
- readonly domain?: {
32
- [x: string]: string;
33
- } | undefined;
34
- readonly annotations?: {
35
- [x: string]: string;
36
- } | undefined;
37
- readonly parentAxes?: number[] | undefined;
38
- readonly axesSpec: {
39
- readonly type: _platforma_sdk_model.ValueType;
40
- readonly name: string;
41
- readonly domain?: {
42
- [x: string]: string;
43
- } | undefined;
44
- readonly annotations?: {
45
- [x: string]: string;
46
- } | undefined;
47
- readonly parentAxes?: number[] | undefined;
48
- }[];
49
- } | undefined>;
50
- pf: _platforma_sdk_model.ValueOrErrors<_platforma_sdk_model.PFrameHandle | undefined>;
51
- isRunning: _platforma_sdk_model.ValueOrErrors<boolean>;
52
- }, UiState, "/" | "/jUsage" | "/vjUsage">;
53
- type BlockOutputs = InferOutputsType<typeof model>;
54
-
55
- export { type BlockArgs, type BlockOutputs, type UiState, model };
package/vite.config.mts DELETED
@@ -1,20 +0,0 @@
1
- import { defineConfig } from 'vite';
2
-
3
- export default defineConfig({
4
- build: {
5
- emptyOutDir: false,
6
- lib: {
7
- entry: 'src/index.ts',
8
- name: 'model',
9
- fileName: (format) => `my-lib.${format}.js`
10
- },
11
- minify: false,
12
- sourcemap: true,
13
- rollupOptions: {
14
- output: {
15
- format: 'iife',
16
- entryFileNames: 'bundle.js'
17
- }
18
- }
19
- }
20
- });