From cd80343072c51caa122c81c6f38a989489ce3d70 Mon Sep 17 00:00:00 2001 From: siebourj Date: Tue, 9 Jul 2024 16:18:28 +0200 Subject: [PATCH 1/2] Set p = 1, penalize_lines = "none" for plate scoring functions in optimize_multi_plate_design --- R/score_plates.R | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/R/score_plates.R b/R/score_plates.R index 1c84d95c..62ae3b27 100644 --- a/R/score_plates.R +++ b/R/score_plates.R @@ -250,7 +250,9 @@ optimize_multi_plate_design <- function(batch_container, across_plates_variables if (!is.null(within_plate_variables)) { plate_levels <- unique(bc$get_locations()[[plate]]) - scoring_funcs <- purrr::map(within_plate_variables, ~ mk_plate_scoring_functions(bc, plate = plate, row = row, column = column, group = .x)) |> + scoring_funcs <- purrr::map(within_plate_variables, + ~ mk_plate_scoring_functions(bc, plate = plate, row = row, column = column, group = .x, + p = 1, penalize_lines = "none")) |> unlist() names(scoring_funcs) <- paste(rep(within_plate_variables, each = length(plate_levels)), names(scoring_funcs)) From cedd39f55904da2371dc6042026819ef26631613 Mon Sep 17 00:00:00 2001 From: siebourj Date: Tue, 9 Jul 2024 17:18:14 +0200 Subject: [PATCH 2/2] _styler --- R/score_plates.R | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/R/score_plates.R b/R/score_plates.R index 62ae3b27..1c0e2f93 100644 --- a/R/score_plates.R +++ b/R/score_plates.R @@ -1,5 +1,3 @@ - - #' Internal helper function to set up an (n m) x (n m) pairwise distance matrix for a plate with n rows and m columns #' #' @param plate_x Dimension of plate in x direction (i.e number of columns) @@ -99,7 +97,6 @@ mk_plate_scoring_functions <- function(batch_container, plate = NULL, row, colum ) plate_scoring_func <- function(samples, plate, plate_name, row, column, group) { - # Have to distinguish between empty positions on plate and NA-levels of experimental factors which may happen for real samples, too nonempty_pos <- !is.na(samples[[".sample_id"]]) @@ -250,9 +247,13 @@ optimize_multi_plate_design <- function(batch_container, across_plates_variables if (!is.null(within_plate_variables)) { plate_levels <- unique(bc$get_locations()[[plate]]) - scoring_funcs <- purrr::map(within_plate_variables, - ~ mk_plate_scoring_functions(bc, plate = plate, row = row, column = column, group = .x, - p = 1, penalize_lines = "none")) |> + scoring_funcs <- purrr::map( + within_plate_variables, + ~ mk_plate_scoring_functions(bc, + plate = plate, row = row, column = column, group = .x, + p = 1, penalize_lines = "none" + ) + ) |> unlist() names(scoring_funcs) <- paste(rep(within_plate_variables, each = length(plate_levels)), names(scoring_funcs))