From 84b3cd669d135f7b0b7d17b107bbd6217d870e88 Mon Sep 17 00:00:00 2001 From: maxkarlsson <40792056+maxkarlsson@users.noreply.github.com> Date: Fri, 31 May 2024 11:23:46 +0200 Subject: [PATCH 1/2] fix: logical in ModelNegativeADTnorm.r --- R/ModelNegativeADTnorm.r | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/ModelNegativeADTnorm.r b/R/ModelNegativeADTnorm.r index 8b42c98..332cc26 100644 --- a/R/ModelNegativeADTnorm.r +++ b/R/ModelNegativeADTnorm.r @@ -137,7 +137,7 @@ ModelNegativeADTnorm = function(cell_protein_matrix, mclust::Mclust(data = x, G = 2, verbose = FALSE, warn = FALSE) }) mu1 = unlist(lapply(p.model, function(x) x$parameters$mean[[1]])) - if (isFALSE(all.equal(length(mu1), length(rownames(adt_log))))) { + if (isFALSE(length(mu1) == length(rownames(adt_log)))) { ad_name = setdiff(rownames(adt_log), names(mu1)) warning( paste0('empirical background cound not be fit for: ', From 73d58b1d51efc9fafe7336bc39abbf1c9527ca74 Mon Sep 17 00:00:00 2001 From: maxkarlsson <40792056+maxkarlsson@users.noreply.github.com> Date: Fri, 31 May 2024 11:55:44 +0200 Subject: [PATCH 2/2] fix: error in warning message --- R/ModelNegativeADTnorm.r | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/R/ModelNegativeADTnorm.r b/R/ModelNegativeADTnorm.r index 332cc26..79df5c9 100644 --- a/R/ModelNegativeADTnorm.r +++ b/R/ModelNegativeADTnorm.r @@ -140,14 +140,15 @@ ModelNegativeADTnorm = function(cell_protein_matrix, if (isFALSE(length(mu1) == length(rownames(adt_log)))) { ad_name = setdiff(rownames(adt_log), names(mu1)) warning( - paste0('empirical background cound not be fit for: ', - ad_name, - ' value returned will be log transformed without background correction'), + paste0('empirical background cound not be fit for ', + length(ad_name), ' proteins: ', + paste(ad_name, collapse = ', '), + '. Value returned will be log transformed without background correction.') ) ad = as.numeric(rep(x = 0, length(ad_name))) names(ad) = ad_name mu1 = c(mu1 , ad) - mu1 = mu1[match(rownames(norm_adt) , names(mu1) )] + mu1 = mu1[match(rownames(adt_log) , names(mu1) )] } norm_adt = apply( adt_log, 2, function(x) (x - mu1) )