@platforma-open/milaboratories.repertoire-mutation-heatmap.block 1.1.8 → 1.2.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/dist/index.js CHANGED
@@ -23,7 +23,8 @@ function makeLandscapeChartState(title, currentTab) {
23
23
  },
24
24
  axisY: {
25
25
  hideAxisLabels: false,
26
- cellSize: 20
26
+ cellSize: 20,
27
+ annotationTitlePosition: "bottom"
27
28
  }
28
29
  }
29
30
  };
@@ -163,6 +164,22 @@ function withParentOnXAxis(state) {
163
164
  }
164
165
  };
165
166
  }
167
+ /**
168
+ * Puts the Y annotation track titles at the bottom on a saved chart. Axes settings are seeded once,
169
+ * when a chart is created, so a chart saved before the Y-axis tracks keeps the default (top).
170
+ */
171
+ function withYAnnotationTitleAtBottom(state) {
172
+ return {
173
+ ...state,
174
+ axesSettings: {
175
+ ...state.axesSettings,
176
+ axisY: {
177
+ ...state.axesSettings?.axisY,
178
+ annotationTitlePosition: "bottom"
179
+ }
180
+ }
181
+ };
182
+ }
166
183
  function mapChartStates(data, rewrite) {
167
184
  return {
168
185
  compositionHeatmapState: rewrite(data.compositionHeatmapState),
@@ -13752,6 +13769,35 @@ function landscapePanelsFrom(pCols) {
13752
13769
  panels.sort((a, b) => a.index - b.index);
13753
13770
  return panels;
13754
13771
  }
13772
+ /**
13773
+ * Whether a discovered column can be plotted as a landscape score.
13774
+ *
13775
+ * A cell is ONE variant's value, so the column must be numeric and keyed on the variant axis and
13776
+ * nothing else. Numeric alone — all this used to check — admitted two kinds that cannot be drawn:
13777
+ *
13778
+ * - Keyed on the anchor's OTHER axes. Sort-Seq's baselines sit on `[parentId]` and
13779
+ * `[parentId, position]`, both reachable from the state matrix, so they were offered as scores.
13780
+ * The workflow reads `pt.axis(variantKey)` off whatever it is given, which those do not have.
13781
+ * - Keyed on the variant axis PLUS another, such as `[variantKey, gate]`. Those do join, but give
13782
+ * several rows per variant, and the landscape's one-row-per-cell `first` would then pick one of
13783
+ * them with nothing reporting it — the worst of the three outcomes.
13784
+ *
13785
+ * Deliberately NOT filtered on `pl7.app/isScore`, though Sort-Seq sets it and an earlier comment
13786
+ * in the picker expected to use it once that block landed. It would also drop variant-keyed
13787
+ * columns a user may legitimately plot — an abundance, a mutation count — which carry no such
13788
+ * annotation. The axis shape is a hard requirement of the plot; the annotation is a statement of
13789
+ * intent, and the two should not be confused.
13790
+ */
13791
+ function isLandscapeScoreColumn(spec, variantAxisName) {
13792
+ if (!(/* @__PURE__ */ new Set([
13793
+ "Int",
13794
+ "Long",
13795
+ "Float",
13796
+ "Double"
13797
+ ])).has(spec.valueType)) return false;
13798
+ if (variantAxisName === void 0) return false;
13799
+ return spec.axesSpec.length === 1 && spec.axesSpec[0].name === variantAxisName;
13800
+ }
13755
13801
  /** The section href of one landscape page. */
13756
13802
  function landscapeHref(scoreKey) {
13757
13803
  return `/?score=${encodeURIComponent(scoreKey)}`;
@@ -13791,6 +13837,10 @@ const dataModel = new DataModelBuilder({ kind }).from("v1").migrate("v2", (v1) =
13791
13837
  drillDownChartState: makeDrillDownChartState(),
13792
13838
  drillDownTableState: createPlDataTableStateV2(),
13793
13839
  ...mapChartStates(v4, withRegionColoursReseeded)
13840
+ })).migrate("v6", (v5) => ({
13841
+ ...v5,
13842
+ ...mapChartStates(v5, withYAnnotationTitleAtBottom),
13843
+ drillDownChartState: withYAnnotationTitleAtBottom(v5.drillDownChartState)
13794
13844
  })).init(() => ({
13795
13845
  drillDowns: [],
13796
13846
  drillDownChartState: makeDrillDownChartState(),
@@ -13816,7 +13866,8 @@ const dataModel = new DataModelBuilder({ kind }).from("v1").migrate("v2", (v1) =
13816
13866
  },
13817
13867
  axisY: {
13818
13868
  hideAxisLabels: false,
13819
- cellSize: 20
13869
+ cellSize: 20,
13870
+ annotationTitlePosition: "bottom"
13820
13871
  }
13821
13872
  }
13822
13873
  }
@@ -13859,17 +13910,12 @@ const platforma$1 = BlockModelV3.create({
13859
13910
  maxHops: 0,
13860
13911
  exclude: [{ annotations: { "pl7.app/isLinkerColumn": exactMatch("true") } }]
13861
13912
  }).getColumns();
13862
- const numeric = /* @__PURE__ */ new Set([
13863
- "Int",
13864
- "Long",
13865
- "Float",
13866
- "Double"
13867
- ]);
13913
+ const variantAxisName = stateSpec.axesSpec[0]?.name;
13868
13914
  const seen = /* @__PURE__ */ new Set();
13869
13915
  const options = [];
13870
13916
  for (const recipe of columns) {
13871
13917
  const spec = recipe.getSpec();
13872
- if (!numeric.has(spec.valueType)) continue;
13918
+ if (!isLandscapeScoreColumn(spec, variantAxisName)) continue;
13873
13919
  const dedupKey = spec.name + "|" + JSON.stringify(spec.domain ?? {});
13874
13920
  if (seen.has(dedupKey)) continue;
13875
13921
  seen.add(dedupKey);
@@ -13911,7 +13957,9 @@ const platforma$1 = BlockModelV3.create({
13911
13957
  return createPFrameForGraphs(ctx, pCols);
13912
13958
  }).output("singleMutantHeatmapPCols", (ctx) => {
13913
13959
  return outputPColumns(ctx, "singleMutantHeatmapPf");
13914
- }).output("landscapePanels", (ctx) => landscapePanelsFrom(outputPColumns(ctx, "singleMutantHeatmapPf"))).outputWithStatus("drillDownHeatmapPf", (ctx) => {
13960
+ }).output("landscapePanels", (ctx) => landscapePanelsFrom(outputPColumns(ctx, "singleMutantHeatmapPf"))).output("singleMutantCount", (ctx) => {
13961
+ return ctx.outputs?.resolve("singleMutantCount")?.getDataAsJson()?.singleMutantCount;
13962
+ }).outputWithStatus("drillDownHeatmapPf", (ctx) => {
13915
13963
  const pCols = outputPColumns(ctx, "drillDownHeatmapPf");
13916
13964
  if (pCols === void 0) return void 0;
13917
13965
  return createPFrameForGraphs(ctx, pCols);