@platforma-open/milaboratories.humanization-score.model 0.3.0 → 0.3.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/package.json CHANGED
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "name": "@platforma-open/milaboratories.humanization-score.model",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Block model",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "dependencies": {
9
- "@platforma-sdk/model": "1.77.15",
9
+ "@platforma-sdk/model": "1.77.17",
10
10
  "@milaboratories/helpers": "1.14.2",
11
- "@milaboratories/graph-maker": "1.4.3"
11
+ "@milaboratories/graph-maker": "1.4.4"
12
12
  },
13
13
  "devDependencies": {
14
14
  "@milaboratories/ts-builder": "1.5.0",
15
15
  "@milaboratories/ts-configs": "1.2.3",
16
- "@platforma-sdk/block-tools": "2.9.3",
16
+ "@platforma-sdk/block-tools": "2.10.0",
17
17
  "@platforma-sdk/eslint-config": "1.2.0",
18
18
  "eslint": "^9.25.1",
19
19
  "vitest": "^4.0.7",
package/src/index.ts CHANGED
@@ -24,7 +24,6 @@ type OldArgs = {
24
24
  type OldUiState = {
25
25
  tableState: PlDataTableStateV2;
26
26
  graphStateHistogram?: GraphMakerState;
27
- graphStateBoxplot?: GraphMakerState;
28
27
  };
29
28
 
30
29
  export type BlockData = {
@@ -34,8 +33,6 @@ export type BlockData = {
34
33
  tableState: PlDataTableStateV2;
35
34
  // Distribution of the per-clonotype humanness score across the whole dataset.
36
35
  graphStateHistogram: GraphMakerState;
37
- // Per-sample distribution of humanness (box/violin), grouped by sampleId.
38
- graphStateBoxplot: GraphMakerState;
39
36
  };
40
37
 
41
38
  // Humanness score column name emitted by `clonotype-process.tpl.tengo`.
@@ -48,12 +45,11 @@ export const defaultGraphStateHistogram = (): GraphMakerState => ({
48
45
  axesSettings: {
49
46
  other: { binsCount: 20 },
50
47
  },
51
- });
52
-
53
- export const defaultGraphStateBoxplot = (): GraphMakerState => ({
54
- title: 'Humanness by Sample',
55
- template: 'box',
56
- currentTab: null,
48
+ // Give the bars a solid fill instead of the default white — colour values
49
+ // taken from graph-maker's fixed palette ("Blue").
50
+ layersSettings: {
51
+ bins: { fillColor: '#2D93FA' },
52
+ },
57
53
  });
58
54
 
59
55
  // Selectors for the input dataset anchor — shared between `inputOptions`
@@ -78,13 +74,11 @@ const dataModel = new DataModelBuilder()
78
74
  ...args,
79
75
  tableState: uiState.tableState,
80
76
  graphStateHistogram: uiState.graphStateHistogram ?? defaultGraphStateHistogram(),
81
- graphStateBoxplot: uiState.graphStateBoxplot ?? defaultGraphStateBoxplot(),
82
77
  }))
83
78
  .init(() => ({
84
79
  customBlockLabel: '',
85
80
  tableState: createPlDataTableStateV2(),
86
81
  graphStateHistogram: defaultGraphStateHistogram(),
87
- graphStateBoxplot: defaultGraphStateBoxplot(),
88
82
  }));
89
83
 
90
84
  export const platforma = BlockModelV3.create(dataModel)
@@ -137,55 +131,6 @@ export const platforma = BlockModelV3.create(dataModel)
137
131
  return pCols.map((c) => ({ columnId: c.id, spec: c.spec }));
138
132
  })
139
133
 
140
- // --- Per-sample distribution (box / violin) --------------------------------
141
- // The humanness column is keyed by clonotypeKey only (sample-agnostic). To get
142
- // a per-sample view we join it with the input dataset's primary abundance
143
- // column, which carries the [sampleId, clonotypeKey] axes. graph-maker joins on
144
- // the shared clonotypeKey axis, so each (sample, clonotype) pair contributes the
145
- // clonotype's score — grouping by sampleId then yields a distribution per sample.
146
- // This is a box/violin (median + spread + tails) on purpose, not a per-sample
147
- // mean: the spread is exactly what a single mean would hide.
148
- // Degrades gracefully: if the dataset has no primary-abundance column the join
149
- // adds nothing, the sampleId axis is absent, and the page simply can't preselect
150
- // a grouping (the chart still opens). VDJ datasets almost always carry abundance.
151
- .outputWithStatus('perSamplePf', (ctx): PFrameHandle | undefined => {
152
- const humanness = ctx.outputs?.resolve('outputHumanness')?.getPColumns();
153
- if (humanness === undefined) return undefined;
154
-
155
- const ref = ctx.data.inputAnchor;
156
- if (ref === undefined) return undefined;
157
-
158
- const abundance = ctx.resultPool.getAnchoredPColumns({ main: ref }, [{
159
- axes: [{ anchor: 'main', idx: 0 }, { anchor: 'main', idx: 1 }],
160
- annotations: {
161
- 'pl7.app/isAbundance': 'true',
162
- 'pl7.app/abundance/normalized': 'false',
163
- 'pl7.app/abundance/isPrimary': 'true',
164
- },
165
- }]);
166
-
167
- return createPFrameForGraphs(ctx, [...humanness, ...(abundance ?? [])]);
168
- })
169
-
170
- .output('perSamplePfPcols', (ctx): PColumnIdAndSpec[] | undefined => {
171
- const humanness = ctx.outputs?.resolve('outputHumanness')?.getPColumns();
172
- if (humanness === undefined || humanness.length === 0) return undefined;
173
-
174
- const ref = ctx.data.inputAnchor;
175
- if (ref === undefined) return undefined;
176
-
177
- const abundance = ctx.resultPool.getAnchoredPColumns({ main: ref }, [{
178
- axes: [{ anchor: 'main', idx: 0 }, { anchor: 'main', idx: 1 }],
179
- annotations: {
180
- 'pl7.app/isAbundance': 'true',
181
- 'pl7.app/abundance/normalized': 'false',
182
- 'pl7.app/abundance/isPrimary': 'true',
183
- },
184
- }]);
185
-
186
- return [...humanness, ...(abundance ?? [])].map((c) => ({ columnId: c.id, spec: c.spec }));
187
- })
188
-
189
134
  .output('isRunning', (ctx) => ctx.outputs?.getIsReadyOrError() === false)
190
135
 
191
136
  .title(() => 'Humanization Score')
@@ -198,7 +143,6 @@ export const platforma = BlockModelV3.create(dataModel)
198
143
  .sections((_) => [
199
144
  { type: 'link', href: '/', label: 'Table' },
200
145
  { type: 'link', href: '/histogram', label: 'Score Distribution' },
201
- { type: 'link', href: '/by-sample', label: 'By Sample' },
202
146
  ])
203
147
 
204
148
  .done();