diff options
| author | Pjotr Prins <pjotr.public01@thebird.nl> | 2026-11-16 17:17:11 +0000 |
|---|---|---|
| committer | Pjotr Prins <pjotr.public01@thebird.nl> | 2026-11-16 17:17:11 +0000 |
| commit | ea3dd926211e8db4a0d7d3739a606440b888e8b0 (patch) | |
| tree | 31b58cd0126960e70a76e45dc2c3b7c9a1c6d0b6 /src/config.rs | |
| parent | 33e837e771e07936c808fb3aeb3540525691718c (diff) | |
| download | genenetwork4-main.tar.gz | |
`"cluster": true` adds `heatmap: {order, merges, max_height}` to the matrix
reply and `POST /plot/heatmap` draws it: the r matrix in that order, the
dendrogram that produced it, and a diverging scale with blue negative and red
positive. A reader can see *why* two traits are neighbours instead of trusting
an ordering.
Clustering decisions, all recorded because an unrepeatable clustering is worse
than none:
* distance `1 - r` -- the usual choice for correlations, and it keeps
anti-correlated traits apart, which is what a heatmap of correlations should
show;
* **average linkage (UPGMA)** -- single linkage chains along a gradient and
complete linkage makes one flat blob out of noisy traits; average is the
compromise GN1's R heatmaps used too;
* **deterministic ties and leaf order** (lower index first), so two runs on one
matrix produce the same picture and plots stay diffable;
* a matrix with a **gap is refused** rather than clustered: an unknown distance
treated as 1 would invent a structure, and the reply's note says to drop
those traits and ask again.
Pairing with the PCA work this is the visual half of a collection: scree plot
for how much structure there is, clustered heatmap for where it is.
Monitor, as asked: `compute-correlation-heatmap` (order must be a permutation
with n-1 merges), `plot-heatmap`, and the plot endpoints that had no check at
all -- `plot-gemma` and `plot-bnw`, each posting a real compute result back.
Plots tier is now five checks, all ok; full run 47 ok, 0 failed, 1 skipped.
Diffstat (limited to 'src/config.rs')
| -rw-r--r-- | src/config.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/config.rs b/src/config.rs index a4a078c..c6a1553 100644 --- a/src/config.rs +++ b/src/config.rs @@ -173,6 +173,8 @@ pub struct Config { pub bnw_plotter: String, /// Script that draws the scree plot of a correlation-matrix PCA (PCA_PLOTTER). pub pca_plotter: String, + /// Script that draws the clustered heatmap of a correlation matrix (HEATMAP_PLOTTER). + pub heatmap_plotter: String, /// Directory holding BNW's worked example datasets (`BNW_EXAMPLES_DIR`), /// served by `/compute/bnw/examples`. Empty means the endpoint reports /// that no examples are configured. @@ -413,6 +415,10 @@ impl Config { "PCA_PLOTTER".to_string(), "scripts/plot-pca.py".to_string(), ); + values.insert( + "HEATMAP_PLOTTER".to_string(), + "scripts/plot-heatmap.py".to_string(), + ); // Per-user baskets: one SQLite file each (src/baskets.rs). Never // MariaDB -- a user's edited column is theirs. values.insert( @@ -480,6 +486,7 @@ impl Config { "BASKET_DIR", "GENOTYPE_PLOTTER", "PCA_PLOTTER", + "HEATMAP_PLOTTER", "BNW_CMD", "BNW_BIN_DIR", "BNW_CACHE_DIR", @@ -546,6 +553,7 @@ impl Config { bnw_cache_dir: values["BNW_CACHE_DIR"].clone(), bnw_plotter: values["BNW_PLOTTER"].clone(), pca_plotter: values["PCA_PLOTTER"].clone(), + heatmap_plotter: values["HEATMAP_PLOTTER"].clone(), bnw_examples_dir: values["BNW_EXAMPLES_DIR"].clone(), bulklmm_cmd: values["BULKLMM_CMD"].clone(), bulklmm_env: values["BULKLMM_ENV"].clone(), |
