Skip to content

Commit fc5efe3

Browse files
committed
Merge branch 'main' into fix-average-batch-r2-celltype
2 parents f119b33 + aaf33db commit fc5efe3

10 files changed

Lines changed: 30 additions & 59 deletions

File tree

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,5 +241,14 @@
241241
* Update flowsom mapping similarity so we subset to just markers to correct, and lisi to remove control samples
242242
and unlabelled cells (PR #119).
243243

244+
* Point `scripts/run_benchmark/wehi_hpc/run_full_hpc.sh` at `build/main` instead of
245+
`build/update_ilisi`, and label the seqera full run as `full` instead of `test_subset` (PR #129).
246+
247+
* Fix `average_batch_r2` and `flowsom_mapping_similarity` writing `metric_ids` and `metric_values`
248+
as scalars instead of lists, as required by `file_score.yaml` (PR #130).
249+
250+
* Clean up stale mock parameters and dead code (PR #133).
251+
252+
244253
* Fix bug in `average_batch_r2` where the R2 was computed on all cell types of a donor at once
245254
instead of on each cell type separately (PR #127).

_viash.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ description: |
3838
references: {}
3939

4040
info:
41-
image: The name of the image file to use for the component on the website.
41+
image: thumbnail.svg
4242
test_resources:
4343
- type: s3
4444
path: s3://openproblems-data/resources_test/task_cyto_batch_integration/

scripts/run_benchmark/run_full_seqeracloud.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ tw launch https://github.com/openproblems-bio/task_cyto_batch_integration.git \
2828
--params-file /tmp/params.yaml \
2929
--entry-name auto \
3030
--config common/nextflow_helpers/labels_tw.config \
31-
--labels task_cyto_batch_integration,test_subset
31+
--labels task_cyto_batch_integration,full

scripts/run_benchmark/wehi_hpc/run_full_hpc.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ publish_dir: "$publish_dir"
2121
HERE
2222

2323
tw launch https://github.com/openproblems-bio/task_cyto_batch_integration.git \
24-
--revision build/update_ilisi \
24+
--revision build/main \
2525
--pull-latest \
2626
--main-script target/nextflow/workflows/run_benchmark/main.nf \
2727
--workspace 80689470953249 \

src/control_methods/shuffle_integration_within_batch/script.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@
44

55
## VIASH START
66
par = {
7-
"input_unintegrated": "resources_test/task_cyto_batch_integration/mouse_spleen_flow_cytometry_subset/unintegrated_censored.h5ad",
8-
"output": "output.h5ad",
7+
"input_unintegrated": "resources_test/task_cyto_batch_integration/mouse_spleen_flow_cytometry_subset/unintegrated.h5ad",
8+
"output_integrated_split1": "resources_test/task_cyto_batch_integration/mouse_spleen_flow_cytometry_subset/control_integrated_split1.h5ad",
9+
"output_integrated_split2": "resources_test/task_cyto_batch_integration/mouse_spleen_flow_cytometry_subset/control_integrated_split2.h5ad",
10+
}
11+
meta = {
12+
"name": "shuffle_integration_within_batch",
13+
"resources_dir": "src/control_methods",
914
}
10-
meta = {"name": "shuffle_integration_within_batch"}
1115
## VIASH END
1216

1317
print("Importing helper functions", flush=True)

src/data_processors/process_dataset/script.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
'input': 'resources_test/task_cyto_batch_integration/mouse_spleen_flow_cytometry_subset/common_dataset.h5ad',
88
'output_censored_split1': 'resources_test/task_cyto_batch_integration/mouse_spleen_flow_cytometry_subset/censored_split1.h5ad',
99
'output_censored_split2': 'resources_test/task_cyto_batch_integration/mouse_spleen_flow_cytometry_subset/censored_split2.h5ad',
10-
'output_validation': 'resources_test/task_cyto_batch_integration/mouse_spleen_flow_cytometry_subset/validation.h5ad'
10+
'output_unintegrated': 'resources_test/task_cyto_batch_integration/mouse_spleen_flow_cytometry_subset/unintegrated.h5ad'
1111
}
1212
meta = {
1313
'resources_dir': 'target/executable/data_processors/process_dataset',

src/methods/gaussnorm/script.R

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ library(flowStats)
44

55
## VIASH START
66
par <- list(
7-
input = "resources_test/task_cyto_batch_integration/cyto_spleen_subset/unintegrated_censored.h5ad",
7+
input = "resources_test/task_cyto_batch_integration/mouse_spleen_flow_cytometry_subset/censored_split1.h5ad",
88
output = "output.h5ad"
99
)
1010
meta <- list(
11-
name = "gaussNorm",
12-
temp_dir: '/tmp'
11+
name = "gaussnorm",
12+
temp_dir = "/tmp",
13+
resources_dir = "src/utils"
1314
)
1415
## VIASH END
1516

src/metrics/average_batch_r2/script.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
## VIASH END
1717

1818
sys.path.append(meta["resources_dir"])
19-
from helper import batch_r2, concat_paired_samples, fit_r2
19+
from helper import batch_r2
2020
from helper_functions import (
2121
get_obs_var_for_integrated,
2222
remove_unlabelled,
@@ -40,10 +40,7 @@
4040
integrated_s2 = subset_nocontrols(integrated_s2)
4141
integrated_s2 = subset_markers_tocorrect(integrated_s2)
4242

43-
print(
44-
integrated_s1.obs, integrated_s2.obs, flush=True
45-
) ### Debugging line, can be removed later
46-
print("Computing average_batch_r2 global", flush=True)
43+
print("Computing average_batch_r2 per cell type", flush=True)
4744

4845
donor_list = integrated_s1.obs["donor"].unique()
4946

@@ -84,8 +81,8 @@
8481
uns={
8582
"dataset_id": integrated_s1.uns["dataset_id"],
8683
"method_id": integrated_s1.uns["method_id"],
87-
"metric_ids": "average_batch_r2_ct",
88-
"metric_values": average_batch_r2_ct,
84+
"metric_ids": ["average_batch_r2_ct"],
85+
"metric_values": [average_batch_r2_ct],
8986
"r2_collection_ct": r2_collection_ct,
9087
}
9188
)

src/metrics/flowsom_mapping_similarity/script.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@ output <- anndata::AnnData(
144144
uns = list(
145145
dataset_id = integrated_s1$uns$dataset_id,
146146
method_id = integrated_s1$uns$method_id,
147-
metric_ids = "flowsom_mean_mapping_similarity",
148-
metric_values = fs_mapping_similarity_avg,
147+
metric_ids = list("flowsom_mean_mapping_similarity"),
148+
metric_values = list(fs_mapping_similarity_avg),
149149
fsom_absdiff_by_donor_refsplit = fsom_absdiff_by_donor_refsplit,
150150
fsom_parameters = list(
151151
"xdim" = grid_xdim,

src/utils/helper_functions.R

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -150,43 +150,3 @@ remove_unlabelled <- function(adata) {
150150
c("unlabelled", "unlabeled")
151151
adata[!is_unlabelled, ]
152152
}
153-
154-
#' Subsets the anndata object in a stratified manner
155-
#' with 'cell type' and 'sample' as strata.
156-
#'
157-
#' @param adata AnnData object
158-
#' @param frac numeric, fraction of cells to keep for each cell type
159-
#' @param seed numeric, seed for reproducibility
160-
#' @param anndatar logical, whether the input is anndataR object or not
161-
#' @return AnnData object with only the markers to correct
162-
subset_by_celltype <- function(adata, frac = 0.5, seed = 1, anndatar = TRUE) {
163-
set.seed(seed)
164-
165-
obs <- adata$obs
166-
obs$cell_id <- rownames(obs)
167-
obs$.row <- seq_len(nrow(obs)) # original order
168-
169-
keep_ids <- obs %>%
170-
group_by(cell_type, sample) %>%
171-
slice_sample(prop = frac) %>%
172-
ungroup() %>%
173-
arrange(.row) %>% # restore original order
174-
pull(cell_id)
175-
176-
if (anndatar == TRUE){
177-
keep_idx <- match(keep_ids, adata$obs_names)
178-
179-
adata_sub <- anndataR::AnnData(
180-
X = NULL,
181-
obs = adata$obs[keep_idx, , drop = FALSE],
182-
var = adata$var,
183-
uns = adata$uns,
184-
layers = list(
185-
"integrated" = adata$layers$integrated[keep_idx, , drop = FALSE]
186-
)
187-
)
188-
} else{
189-
adata_sub <- adata[keep_ids, ]
190-
}
191-
}
192-

0 commit comments

Comments
 (0)