From 603e08ee139475cdc02fd70e6e6a2a2178ee1393 Mon Sep 17 00:00:00 2001 From: WackerO Date: Thu, 12 Oct 2023 11:25:47 +0200 Subject: [PATCH 1/6] added na.omit to assay reading --- R/accessory.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/accessory.R b/R/accessory.R index 5653e5b..bca49d5 100644 --- a/R/accessory.R +++ b/R/accessory.R @@ -789,7 +789,7 @@ read_matrix <- function(matrix_file, sample_metadata, feature_metadata = NULL, s } } - matrix_data <- as.matrix(matrix_data[, rownames(sample_metadata)]) + matrix_data <- na.omit(as.matrix(matrix_data[, rownames(sample_metadata)])) # Guess the log status From 69392e00a9047323c1df24a2f7d73c40854a3015 Mon Sep 17 00:00:00 2001 From: WackerO Date: Tue, 17 Oct 2023 15:05:53 +0200 Subject: [PATCH 2/6] making blocking column optional --- R/accessory.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/accessory.R b/R/accessory.R index bca49d5..01620ef 100644 --- a/R/accessory.R +++ b/R/accessory.R @@ -913,7 +913,7 @@ read_contrasts <- # Read the contrasts contrasts <- read_metadata(filename) - contrast_cols <- c(variable_column, reference_column, target_column, blocking_column) + contrast_cols <- c(variable_column, reference_column, target_column) # Check contrast headers are as expected From 4e36ed0df748d984c3d959113c41906ea87690f6 Mon Sep 17 00:00:00 2001 From: WackerO <43847497+WackerO@users.noreply.github.com> Date: Tue, 17 Oct 2023 15:29:13 +0200 Subject: [PATCH 3/6] Update R/accessory.R Co-authored-by: Jonathan Manning --- R/accessory.R | 3 +++ 1 file changed, 3 insertions(+) diff --git a/R/accessory.R b/R/accessory.R index 01620ef..96ae97d 100644 --- a/R/accessory.R +++ b/R/accessory.R @@ -914,6 +914,9 @@ read_contrasts <- contrasts <- read_metadata(filename) contrast_cols <- c(variable_column, reference_column, target_column) + if (! blocking_col %in% names(contrasts)){ + contrasts[[blocking_col]] <- '' + } # Check contrast headers are as expected From cd2b4fed92ea1d626e586858fe2efa15601d1523 Mon Sep 17 00:00:00 2001 From: WackerO Date: Tue, 17 Oct 2023 15:33:26 +0200 Subject: [PATCH 4/6] Added conditional around blocking --- R/accessory.R | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/R/accessory.R b/R/accessory.R index 96ae97d..1c044ae 100644 --- a/R/accessory.R +++ b/R/accessory.R @@ -930,10 +930,12 @@ read_contrasts <- success <- checkListIsSubset(contrasts$variable, colnames(samples), "contrast variables", "sample metadata") - blocking <- unlist(lapply(contrasts$blocking, function(x) simpleSplit(x, ";"))) - blocking <- blocking[!is.na(blocking)] - if (length(blocking > 0)) { - success <- checkListIsSubset(blocking, colnames(samples), "blocking variables", "sample metadata") + if (! blocking_col %in% names(contrasts)){ + blocking <- unlist(lapply(contrasts[[blocking_col]], function(x) simpleSplit(x, ";"))) + blocking <- blocking[!is.na(blocking)] + if (length(blocking > 0)) { + success <- checkListIsSubset(blocking, colnames(samples), "blocking variables", "sample metadata") + } } ## 'reference', 'target', and 'blocking' should be values of their variable From 052f46174d0e6d93004b5df80a99c8214aa2c143 Mon Sep 17 00:00:00 2001 From: WackerO Date: Tue, 17 Oct 2023 15:58:21 +0200 Subject: [PATCH 5/6] fixed incorrect var names --- R/accessory.R | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/R/accessory.R b/R/accessory.R index 1c044ae..82f1731 100644 --- a/R/accessory.R +++ b/R/accessory.R @@ -914,8 +914,8 @@ read_contrasts <- contrasts <- read_metadata(filename) contrast_cols <- c(variable_column, reference_column, target_column) - if (! blocking_col %in% names(contrasts)){ - contrasts[[blocking_col]] <- '' + if (! blocking_column %in% names(contrasts)){ + contrasts[[blocking_column]] <- '' } # Check contrast headers are as expected @@ -930,8 +930,8 @@ read_contrasts <- success <- checkListIsSubset(contrasts$variable, colnames(samples), "contrast variables", "sample metadata") - if (! blocking_col %in% names(contrasts)){ - blocking <- unlist(lapply(contrasts[[blocking_col]], function(x) simpleSplit(x, ";"))) + if (! blocking_column %in% names(contrasts)){ + blocking <- unlist(lapply(contrasts[[blocking_column]], function(x) simpleSplit(x, ";"))) blocking <- blocking[!is.na(blocking)] if (length(blocking > 0)) { success <- checkListIsSubset(blocking, colnames(samples), "blocking variables", "sample metadata") From 94c68b38f14c42aa034b29231592130d56e02ce6 Mon Sep 17 00:00:00 2001 From: Jonathan Manning Date: Tue, 17 Oct 2023 15:55:20 +0100 Subject: [PATCH 6/6] Fix blocking conditionality --- R/accessory.R | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/R/accessory.R b/R/accessory.R index 82f1731..c3c2c13 100644 --- a/R/accessory.R +++ b/R/accessory.R @@ -915,7 +915,7 @@ read_contrasts <- contrasts <- read_metadata(filename) contrast_cols <- c(variable_column, reference_column, target_column) if (! blocking_column %in% names(contrasts)){ - contrasts[[blocking_column]] <- '' + contrasts[[blocking_column]] <- NA } # Check contrast headers are as expected @@ -930,12 +930,12 @@ read_contrasts <- success <- checkListIsSubset(contrasts$variable, colnames(samples), "contrast variables", "sample metadata") - if (! blocking_column %in% names(contrasts)){ - blocking <- unlist(lapply(contrasts[[blocking_column]], function(x) simpleSplit(x, ";"))) - blocking <- blocking[!is.na(blocking)] - if (length(blocking > 0)) { - success <- checkListIsSubset(blocking, colnames(samples), "blocking variables", "sample metadata") - } + # Check blocking variables, where supplied + + blocking <- unlist(lapply(contrasts[[blocking_column]], function(x) simpleSplit(x, ";"))) + blocking <- blocking[!is.na(blocking)] + if (length(blocking > 0)) { + success <- checkListIsSubset(blocking, colnames(samples), "blocking variables", "sample metadata") } ## 'reference', 'target', and 'blocking' should be values of their variable