From 624ed48344fee1c5e61f64e0d739b28838b95222 Mon Sep 17 00:00:00 2001 From: Robrecht Cannoodt Date: Tue, 28 Jul 2026 13:34:23 +0200 Subject: [PATCH 1/2] clean up stale mock parameters and dead code * Point info.image at thumbnail.svg instead of the template placeholder * Fix the VIASH START blocks of process_dataset, gaussnorm and shuffle_integration_within_batch so the scripts can be run locally again * Drop the unused subset_by_celltype() helper * Drop the unused imports and a debugging print in average_batch_r2 --- _viash.yaml | 2 +- .../script.py | 10 +++-- src/data_processors/process_dataset/script.py | 2 +- src/methods/gaussnorm/script.R | 7 ++-- src/metrics/average_batch_r2/script.py | 7 +--- src/utils/helper_functions.R | 40 ------------------- 6 files changed, 15 insertions(+), 53 deletions(-) diff --git a/_viash.yaml b/_viash.yaml index 0b3f920fb..8d76cbf23 100644 --- a/_viash.yaml +++ b/_viash.yaml @@ -38,7 +38,7 @@ description: | references: {} info: - image: The name of the image file to use for the component on the website. + image: thumbnail.svg test_resources: - type: s3 path: s3://openproblems-data/resources_test/task_cyto_batch_integration/ diff --git a/src/control_methods/shuffle_integration_within_batch/script.py b/src/control_methods/shuffle_integration_within_batch/script.py index bae2a987a..928425f9b 100644 --- a/src/control_methods/shuffle_integration_within_batch/script.py +++ b/src/control_methods/shuffle_integration_within_batch/script.py @@ -4,10 +4,14 @@ ## VIASH START par = { - "input_unintegrated": "resources_test/task_cyto_batch_integration/mouse_spleen_flow_cytometry_subset/unintegrated_censored.h5ad", - "output": "output.h5ad", + "input_unintegrated": "resources_test/task_cyto_batch_integration/mouse_spleen_flow_cytometry_subset/unintegrated.h5ad", + "output_integrated_split1": "resources_test/task_cyto_batch_integration/mouse_spleen_flow_cytometry_subset/control_integrated_split1.h5ad", + "output_integrated_split2": "resources_test/task_cyto_batch_integration/mouse_spleen_flow_cytometry_subset/control_integrated_split2.h5ad", +} +meta = { + "name": "shuffle_integration_within_batch", + "resources_dir": "src/control_methods", } -meta = {"name": "shuffle_integration_within_batch"} ## VIASH END print("Importing helper functions", flush=True) diff --git a/src/data_processors/process_dataset/script.py b/src/data_processors/process_dataset/script.py index 196225ec0..3e95d99b4 100644 --- a/src/data_processors/process_dataset/script.py +++ b/src/data_processors/process_dataset/script.py @@ -7,7 +7,7 @@ 'input': 'resources_test/task_cyto_batch_integration/mouse_spleen_flow_cytometry_subset/common_dataset.h5ad', 'output_censored_split1': 'resources_test/task_cyto_batch_integration/mouse_spleen_flow_cytometry_subset/censored_split1.h5ad', 'output_censored_split2': 'resources_test/task_cyto_batch_integration/mouse_spleen_flow_cytometry_subset/censored_split2.h5ad', - 'output_validation': 'resources_test/task_cyto_batch_integration/mouse_spleen_flow_cytometry_subset/validation.h5ad' + 'output_unintegrated': 'resources_test/task_cyto_batch_integration/mouse_spleen_flow_cytometry_subset/unintegrated.h5ad' } meta = { 'resources_dir': 'target/executable/data_processors/process_dataset', diff --git a/src/methods/gaussnorm/script.R b/src/methods/gaussnorm/script.R index 4109fcb1d..b1ad0093f 100644 --- a/src/methods/gaussnorm/script.R +++ b/src/methods/gaussnorm/script.R @@ -4,12 +4,13 @@ library(flowStats) ## VIASH START par <- list( - input = "resources_test/task_cyto_batch_integration/cyto_spleen_subset/unintegrated_censored.h5ad", + input = "resources_test/task_cyto_batch_integration/mouse_spleen_flow_cytometry_subset/censored_split1.h5ad", output = "output.h5ad" ) meta <- list( - name = "gaussNorm", - temp_dir: '/tmp' + name = "gaussnorm", + temp_dir = "/tmp", + resources_dir = "src/utils" ) ## VIASH END diff --git a/src/metrics/average_batch_r2/script.py b/src/metrics/average_batch_r2/script.py index 93fbd6204..299ac690f 100644 --- a/src/metrics/average_batch_r2/script.py +++ b/src/metrics/average_batch_r2/script.py @@ -16,7 +16,7 @@ ## VIASH END sys.path.append(meta["resources_dir"]) -from helper import batch_r2, concat_paired_samples, fit_r2 +from helper import batch_r2 from helper_functions import ( get_obs_var_for_integrated, remove_unlabelled, @@ -40,10 +40,7 @@ integrated_s2 = subset_nocontrols(integrated_s2) integrated_s2 = subset_markers_tocorrect(integrated_s2) -print( - integrated_s1.obs, integrated_s2.obs, flush=True -) ### Debugging line, can be removed later -print("Computing average_batch_r2 global", flush=True) +print("Computing average_batch_r2 per cell type", flush=True) donor_list = integrated_s1.obs["donor"].unique() diff --git a/src/utils/helper_functions.R b/src/utils/helper_functions.R index 9b384de8b..0fbc3f751 100644 --- a/src/utils/helper_functions.R +++ b/src/utils/helper_functions.R @@ -150,43 +150,3 @@ remove_unlabelled <- function(adata) { c("unlabelled", "unlabeled") adata[!is_unlabelled, ] } - -#' Subsets the anndata object in a stratified manner -#' with 'cell type' and 'sample' as strata. -#' -#' @param adata AnnData object -#' @param frac numeric, fraction of cells to keep for each cell type -#' @param seed numeric, seed for reproducibility -#' @param anndatar logical, whether the input is anndataR object or not -#' @return AnnData object with only the markers to correct -subset_by_celltype <- function(adata, frac = 0.5, seed = 1, anndatar = TRUE) { - set.seed(seed) - - obs <- adata$obs - obs$cell_id <- rownames(obs) - obs$.row <- seq_len(nrow(obs)) # original order - - keep_ids <- obs %>% - group_by(cell_type, sample) %>% - slice_sample(prop = frac) %>% - ungroup() %>% - arrange(.row) %>% # restore original order - pull(cell_id) - - if (anndatar == TRUE){ - keep_idx <- match(keep_ids, adata$obs_names) - - adata_sub <- anndataR::AnnData( - X = NULL, - obs = adata$obs[keep_idx, , drop = FALSE], - var = adata$var, - uns = adata$uns, - layers = list( - "integrated" = adata$layers$integrated[keep_idx, , drop = FALSE] - ) - ) - } else{ - adata_sub <- adata[keep_ids, ] - } -} - From 80c77f673aaac98090af1e3845124faf22eb3636 Mon Sep 17 00:00:00 2001 From: Robrecht Cannoodt Date: Tue, 28 Jul 2026 13:39:33 +0200 Subject: [PATCH 2/2] update changelog --- CHANGELOG.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 271fda0d5..fc65338ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -239,4 +239,10 @@ and thus can't be directly overriden (new values given by get_donor_batch_map is int) (PR #119). * Update flowsom mapping similarity so we subset to just markers to correct, and lisi to remove control samples - and unlabelled cells (PR #119). \ No newline at end of file + and unlabelled cells (PR #119). + +* Clean up stale mock parameters and dead code (PR #133): + * Point `info.image` in `_viash.yaml` at `thumbnail.svg` instead of the template placeholder. + * Fix the `VIASH START` blocks of `process_dataset`, `gaussnorm` and `shuffle_integration_within_batch`. + * Remove the unused `subset_by_celltype()` helper, and the unused imports and debugging print + in `average_batch_r2`.