diff --git a/CHANGELOG.md b/CHANGELOG.md index a59da1723..31b8988fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -246,3 +246,5 @@ * Fix `average_batch_r2` and `flowsom_mapping_similarity` writing `metric_ids` and `metric_values` as scalars instead of lists, as required by `file_score.yaml` (PR #130). + +* Clean up stale mock parameters and dead code (PR #133). 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 80b1c12e9..6788bf69e 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, ] - } -} -