From 4d9fc84e3012d43c963b9759615984238380d64e Mon Sep 17 00:00:00 2001 From: raivo-otus Date: Thu, 10 Jul 2025 09:38:23 +0300 Subject: [PATCH 01/13] Test transformAssay(method = clr) against vegan::decostand --- tests/testthat/test-5transformCounts.R | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/testthat/test-5transformCounts.R b/tests/testthat/test-5transformCounts.R index 34ecc3b5f..e7b94b1b8 100644 --- a/tests/testthat/test-5transformCounts.R +++ b/tests/testthat/test-5transformCounts.R @@ -157,10 +157,9 @@ test_that("transformAssay", { # Tests clr # Calc CLRs mat <- assays(mia::transformAssay(tse, assay.type = "relabundance", - method = "clr", pseudocount = pseudonumber))$clr - mat_comp <- apply(as.matrix(relative), 2, FUN=function(x){ - log(x) - mean(log(x)) - }) + method = "clr", pseudocount = pseudonumber))$clr + mat_comp <- vegan::decostand(assay(tse, "relabundance"), method = "clr", + MARGIN = 2, pseudocount = pseudonumber) # Remove attributes since vegan adds additional ones attributes(mat) <- NULL attributes(mat_comp) <- NULL From 264225b880f5afaecbfd989cbc9a773c1bb745f2 Mon Sep 17 00:00:00 2001 From: raivo-otus Date: Thu, 10 Jul 2025 09:54:14 +0300 Subject: [PATCH 02/13] Remove reduntant expect_error() --- tests/testthat/test-5transformCounts.R | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/testthat/test-5transformCounts.R b/tests/testthat/test-5transformCounts.R index e7b94b1b8..a53415fd8 100644 --- a/tests/testthat/test-5transformCounts.R +++ b/tests/testthat/test-5transformCounts.R @@ -166,9 +166,6 @@ test_that("transformAssay", { # Compare expect_equal(mat, mat_comp) - # Expect that error occurs - expect_error(mia::transformAssay(tse, method = "clr")) - # Expect that error does not occur tse <- mia::transformAssay(tse, method = "rclr") From 5d7c0fc4ab6a2f2a86c1a63ed115751198589338 Mon Sep 17 00:00:00 2001 From: raivo-otus Date: Thu, 10 Jul 2025 10:15:45 +0300 Subject: [PATCH 03/13] Remove unnecessary lines --- tests/testthat/test-5transformCounts.R | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/testthat/test-5transformCounts.R b/tests/testthat/test-5transformCounts.R index a53415fd8..f14096196 100644 --- a/tests/testthat/test-5transformCounts.R +++ b/tests/testthat/test-5transformCounts.R @@ -151,9 +151,6 @@ test_that("transformAssay", { pseudonumber <- runif(1, 1, 100) tse <- transformAssay(tse, method = "relabundance") - # Calculates relative abundance table - relative <- assay(tse, "relabundance") - relative <- relative + pseudonumber # Tests clr # Calc CLRs mat <- assays(mia::transformAssay(tse, assay.type = "relabundance", @@ -171,6 +168,9 @@ test_that("transformAssay", { # Tests transformAssay, tries to calculate clr. Should be an error, because of zeros. expect_error(mia::transformAssay(tse, method = "clr")) + + # Test robust CLR + # Tests that clr robust gives values that are approximately same if only # one value per sample are changed to zero @@ -184,6 +184,8 @@ test_that("transformAssay", { assay(tse, "test2")[1, ] <- 0 # One missing value assay(tse, "na_values")[4, 5] <- NA + + tse <- transformAssay(tse, method = "relabundance") # Expect error when counts and zeroes From 28ca441cbf067900226eb7262e2ddd9365c2ac56 Mon Sep 17 00:00:00 2001 From: raivo-otus Date: Thu, 10 Jul 2025 10:29:04 +0300 Subject: [PATCH 04/13] Simplify Hellinger transformation test --- tests/testthat/test-5transformCounts.R | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/tests/testthat/test-5transformCounts.R b/tests/testthat/test-5transformCounts.R index f14096196..e04019b32 100644 --- a/tests/testthat/test-5transformCounts.R +++ b/tests/testthat/test-5transformCounts.R @@ -136,13 +136,11 @@ test_that("transformAssay", { ######################## HELLINGER ##################################### # Calculates Hellinger transformation. Should be equal. - # Calculates relative abundance table - relative <- assays(mia::transformAssay(tse, method = "relabundance", name = "relative"))$relative - - expect_equal(as.matrix(assays(mia::transformAssay(tse, method = "hellinger", name = "test_123"))$test_123), - apply(as.matrix(relative), 2, FUN=function(x){ - sqrt(x) - }), check.attributes = FALSE) + expect_equal(as.matrix(assays(mia::transformAssay(tse, method = "hellinger", + name = "test_123"))$test_123), + as.matrix(vegan::decostand(assay(tse, "counts"), method = "hellinger", + MARGIN = 2)), + check.attributes = FALSE) ############################### CLR #################################### # Calculates clr-transformation. Should be equal. From ec52a7513319454bdcac3307f8a321875069d924 Mon Sep 17 00:00:00 2001 From: raivo-otus Date: Thu, 10 Jul 2025 10:38:58 +0300 Subject: [PATCH 05/13] Add test for rCLR transformation --- tests/testthat/test-5transformCounts.R | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/testthat/test-5transformCounts.R b/tests/testthat/test-5transformCounts.R index e04019b32..4f2bb2e94 100644 --- a/tests/testthat/test-5transformCounts.R +++ b/tests/testthat/test-5transformCounts.R @@ -167,8 +167,16 @@ test_that("transformAssay", { # Tests transformAssay, tries to calculate clr. Should be an error, because of zeros. expect_error(mia::transformAssay(tse, method = "clr")) - # Test robust CLR - + # Test robust clr + rmat <- assays(mia::transformAssay(tse, assay.type = "relabundance", + method = "rclr"))$rclr + rmat_comp <- vegan::decostand(assay(tse, "relabundance"), method = "rclr", + MARGIN = 2) + # Remove attributes added by vegan + attributes(rmat) <- NULL + attributes(rmat_comp) <- NULL + # Compare + expect_equal(rmat, rmat_comp) # Tests that clr robust gives values that are approximately same if only # one value per sample are changed to zero From 236dc6109f5f3f815f1c9901e37f79e0b614f79d Mon Sep 17 00:00:00 2001 From: raivo-otus Date: Thu, 10 Jul 2025 11:01:29 +0300 Subject: [PATCH 06/13] Add missing test for rCLR equivalence when zero added to samples --- tests/testthat/test-5transformCounts.R | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/testthat/test-5transformCounts.R b/tests/testthat/test-5transformCounts.R index 4f2bb2e94..edcb91fe8 100644 --- a/tests/testthat/test-5transformCounts.R +++ b/tests/testthat/test-5transformCounts.R @@ -178,8 +178,6 @@ test_that("transformAssay", { # Compare expect_equal(rmat, rmat_comp) - # Tests that clr robust gives values that are approximately same if only - # one value per sample are changed to zero tse <- transformAssay(tse, method = "relabundance") # Adds pseudocount assay(tse, "test") <- assay(tse, "relabundance") + 1 @@ -191,6 +189,13 @@ test_that("transformAssay", { # One missing value assay(tse, "na_values")[4, 5] <- NA + # Tests that clr robust gives values that are approximately same if only + # one value per sample are changed to zero + expect_equal(assays(mia::transformAssay(tse, assay.type = "test", + method = "rclr")), + assays(mia::transformAssay(tse, assay.type = "test2", + method = "rclr")), + check.attributes = FALSE) tse <- transformAssay(tse, method = "relabundance") From 9d5a422bc1319c417a6748e64667a0b477548769 Mon Sep 17 00:00:00 2001 From: raivo-otus Date: Thu, 10 Jul 2025 11:42:07 +0300 Subject: [PATCH 07/13] Remove some unnecessary calculations, test only against vegan --- tests/testthat/test-5transformCounts.R | 37 +++----------------------- 1 file changed, 3 insertions(+), 34 deletions(-) diff --git a/tests/testthat/test-5transformCounts.R b/tests/testthat/test-5transformCounts.R index edcb91fe8..ca6945126 100644 --- a/tests/testthat/test-5transformCounts.R +++ b/tests/testthat/test-5transformCounts.R @@ -134,49 +134,17 @@ test_that("transformAssay", { expect_equal(typeof(actual),"double") expect_true(all(actual == 1 | actual == 0)) - ######################## HELLINGER ##################################### - # Calculates Hellinger transformation. Should be equal. - expect_equal(as.matrix(assays(mia::transformAssay(tse, method = "hellinger", - name = "test_123"))$test_123), - as.matrix(vegan::decostand(assay(tse, "counts"), method = "hellinger", - MARGIN = 2)), - check.attributes = FALSE) - ############################### CLR #################################### - # Calculates clr-transformation. Should be equal. - # Random pseudocount pseudonumber <- runif(1, 1, 100) tse <- transformAssay(tse, method = "relabundance") - # Tests clr - # Calc CLRs - mat <- assays(mia::transformAssay(tse, assay.type = "relabundance", - method = "clr", pseudocount = pseudonumber))$clr - mat_comp <- vegan::decostand(assay(tse, "relabundance"), method = "clr", - MARGIN = 2, pseudocount = pseudonumber) - # Remove attributes since vegan adds additional ones - attributes(mat) <- NULL - attributes(mat_comp) <- NULL - # Compare - expect_equal(mat, mat_comp) # Expect that error does not occur tse <- mia::transformAssay(tse, method = "rclr") # Tests transformAssay, tries to calculate clr. Should be an error, because of zeros. expect_error(mia::transformAssay(tse, method = "clr")) - - # Test robust clr - rmat <- assays(mia::transformAssay(tse, assay.type = "relabundance", - method = "rclr"))$rclr - rmat_comp <- vegan::decostand(assay(tse, "relabundance"), method = "rclr", - MARGIN = 2) - # Remove attributes added by vegan - attributes(rmat) <- NULL - attributes(rmat_comp) <- NULL - # Compare - expect_equal(rmat, rmat_comp) tse <- transformAssay(tse, method = "relabundance") # Adds pseudocount @@ -190,7 +158,7 @@ test_that("transformAssay", { assay(tse, "na_values")[4, 5] <- NA # Tests that clr robust gives values that are approximately same if only - # one value per sample are changed to zero + # one value per sample is changed to zero expect_equal(assays(mia::transformAssay(tse, assay.type = "test", method = "rclr")), assays(mia::transformAssay(tse, assay.type = "test2", @@ -313,6 +281,7 @@ test_that("transformAssay", { expect_equal(max(abs(z_assay - xx), na.rm=TRUE), 0, tolerance = 1e-14, check.attributes = FALSE) + ####################### Test equality to vegan########################## # Test that transformations are equal to ones directly from vegan # clr tse <- transformAssay(tse, method = "relabundance") @@ -322,9 +291,9 @@ test_that("transformAssay", { compare <- vegan::decostand(assay(tse, "relabundance"), method = "clr", pseudocount = 4, MARGIN = 2) expect_equal(actual, compare) + # rclr tse <- transformAssay(tse, assay.type = "relabundance", method = "rclr") - actual <- assay(tse, "rclr") # mia has additional pseudocount parameter for all methods attr(actual, "parameters")$pseudocount <- NULL From 87c0916a7e3199ddbdbd58c9af5239a5f1fe852c Mon Sep 17 00:00:00 2001 From: raivo-otus Date: Thu, 10 Jul 2025 11:59:03 +0300 Subject: [PATCH 08/13] Remove redundant rank calculation, and add rank test for vegan equivalence --- tests/testthat/test-5transformCounts.R | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/tests/testthat/test-5transformCounts.R b/tests/testthat/test-5transformCounts.R index ca6945126..a91df6bae 100644 --- a/tests/testthat/test-5transformCounts.R +++ b/tests/testthat/test-5transformCounts.R @@ -249,18 +249,6 @@ test_that("transformAssay", { # Expect that assay contains count and rank table expect_true(all(c("counts", "rank") %in% assayNames(tse_rank))) - for(i in c(1:10)){ - # Gets columns from 'rank' table - ranks <- assay(tse_rank, "rank")[,i] - # Gets columns from 'counts' table, and calculates ranks - counts_compare <- assay(tse_rank, "counts")[,i] - counts_compare[counts_compare == 0] <- NA - ranks_compare <- rank(counts_compare, na.last = "keep") - ranks_compare[is.na(ranks_compare)] <- 0 - # Expect that they are equal - expect_equal(ranks, ranks_compare, check.attributes = FALSE) - } - # Calculates rank with pseudocount tse_rank_pseudo <- transformAssay(tse, method = "rank", pseudocount = runif(1, 0, 1000)) # Pseudocount should not change the rank @@ -281,7 +269,7 @@ test_that("transformAssay", { expect_equal(max(abs(z_assay - xx), na.rm=TRUE), 0, tolerance = 1e-14, check.attributes = FALSE) - ####################### Test equality to vegan########################## + ####################### Test equality to vegan ######################### # Test that transformations are equal to ones directly from vegan # clr tse <- transformAssay(tse, method = "relabundance") @@ -329,6 +317,16 @@ test_that("transformAssay", { MARGIN = 2) compare <- t(compare) expect_equal(na.omit(actual), na.omit(compare)) + + # rank + tse <- transformAssay(tse, assay.type = "counts", method = "rank") + actual <- assay(tse, "rank") + attr(actual, "parameters")$pseudocount <- NULL + compare <- vegan::decostand(assay(tse, "counts"), method = "rank", + MARGIN = 2) + expect_equal(actual, compare) + + # Check that transformation is applied to altExps expect_error(transformAssay(tse, altexp = "Phylum")) @@ -350,7 +348,7 @@ test_that("transformAssay", { test <- altExp(test, "Genus") expect_equal(assay(test, "relabundance"), assay(ref, "relabundance")) - # Check that philt transformation works + # Check that philr transformation works skip_if_not_installed("philr") data("GlobalPatterns") tse <- GlobalPatterns From 7304601bd3cef4101cad589d8282829a356f80ac Mon Sep 17 00:00:00 2001 From: raivo-otus Date: Tue, 16 Dec 2025 12:35:43 +0200 Subject: [PATCH 09/13] relabundance vs decostand --- tests/testthat/test-5transformCounts.R | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/tests/testthat/test-5transformCounts.R b/tests/testthat/test-5transformCounts.R index 467066215..c017391cf 100644 --- a/tests/testthat/test-5transformCounts.R +++ b/tests/testthat/test-5transformCounts.R @@ -20,10 +20,11 @@ test_that("transformAssay", { ############################# RELATIVE ABUNDANCE ####################### # Calculates relative abundances. Should be equal. - expect_equal(as.matrix(assays(mia::transformAssay(tse, method = "relabundance"))$relabundance), - apply(as.matrix(assay(tse,"counts")), 2, FUN=function(x){ - x/sum(x) - }), check.attributes = FALSE) + expect_equal( + as.matrix(assays(mia::transformAssay(tse, method = "relabundance"))$relabundance), + as.matrix(vegan::decostand(assay(tse, "counts"), method = "total", MARGIN = 2)), + check.attributes = FALSE + ) mat <- matrix(1:60, nrow = 6) df <- DataFrame(n = c(1:6)) From e24586939bbae6350980b1d8ab45ee87571099b6 Mon Sep 17 00:00:00 2001 From: raivo-otus Date: Tue, 16 Dec 2025 12:53:28 +0200 Subject: [PATCH 10/13] pa vs decostand --- tests/testthat/test-5transformCounts.R | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/testthat/test-5transformCounts.R b/tests/testthat/test-5transformCounts.R index c017391cf..5d333a043 100644 --- a/tests/testthat/test-5transformCounts.R +++ b/tests/testthat/test-5transformCounts.R @@ -123,7 +123,7 @@ test_that("transformAssay", { # Calculates pa transformation. Should be equal. actual <- assay(mia::transformAssay(tse, method = "pa"),"pa") expect_equal(as.vector(actual), - as.integer(as.matrix(assay(tse, "counts")) > 0), + as.vector(vegan::decostand(assay(tse, "counts"), method = "pa", MARGIN = 2)), check.attributes = FALSE) expect_equal(typeof(actual),"double") expect_true(all(actual == 1 | actual == 0)) @@ -131,7 +131,8 @@ test_that("transformAssay", { # Tests transformAssay(MARGIN = "features"), calculates pa transformation. Should be equal. actual <- assay(mia::transformAssay(tse, MARGIN = "features", method = "pa"),"pa") expect_equal(as.vector(actual), - as.integer(t(as.matrix(t(assay(tse, "counts"))) > 0))) + as.vector(vegan::decostand(assay(tse, "counts"), method = "pa", MARGIN = 1)) + ) expect_equal(typeof(actual),"double") expect_true(all(actual == 1 | actual == 0)) From d46cd49311b6185702c798aa98146c955155ebde Mon Sep 17 00:00:00 2001 From: raivo-otus Date: Tue, 16 Dec 2025 13:04:52 +0200 Subject: [PATCH 11/13] remove redundant test --- tests/testthat/test-5transformCounts.R | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/tests/testthat/test-5transformCounts.R b/tests/testthat/test-5transformCounts.R index 5d333a043..7f06ffcef 100644 --- a/tests/testthat/test-5transformCounts.R +++ b/tests/testthat/test-5transformCounts.R @@ -149,24 +149,11 @@ test_that("transformAssay", { expect_error(mia::transformAssay(tse, method = "clr")) tse <- transformAssay(tse, method = "relabundance") - # Adds pseudocount - assay(tse, "test") <- assay(tse, "relabundance") + 1 - assay(tse, "test2") <- assay(tse, "test") + # Adds pos/neg pseudocount assay(tse, "neg_values") <- assay(tse, "counts") - 2 assay(tse, "na_values") <- assay(tse, "counts") + 2 - # First row is zeroes - assay(tse, "test2")[1, ] <- 0 # One missing value assay(tse, "na_values")[4, 5] <- NA - - # Tests that clr robust gives values that are approximately same if only - # one value per sample is changed to zero - expect_equal(assays(mia::transformAssay(tse, assay.type = "test", - method = "rclr")), - assays(mia::transformAssay(tse, assay.type = "test2", - method = "rclr")), - check.attributes = FALSE) - tse <- transformAssay(tse, method = "relabundance") # Expect error when counts and zeroes From 49ed631371ce0a19f7cb1996a2c88146516c0ed6 Mon Sep 17 00:00:00 2001 From: raivo-otus Date: Tue, 16 Dec 2025 13:24:42 +0200 Subject: [PATCH 12/13] refactor to appropriate section --- tests/testthat/test-5transformCounts.R | 35 ++++++++++++++------------ 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/tests/testthat/test-5transformCounts.R b/tests/testthat/test-5transformCounts.R index 7f06ffcef..8c7c19c86 100644 --- a/tests/testthat/test-5transformCounts.R +++ b/tests/testthat/test-5transformCounts.R @@ -19,13 +19,8 @@ test_that("transformAssay", { check.attributes = FALSE) ############################# RELATIVE ABUNDANCE ####################### - # Calculates relative abundances. Should be equal. - expect_equal( - as.matrix(assays(mia::transformAssay(tse, method = "relabundance"))$relabundance), - as.matrix(vegan::decostand(assay(tse, "counts"), method = "total", MARGIN = 2)), - check.attributes = FALSE - ) - + # Calculation tests against vegan at later section + # Tests validity of assay name mat <- matrix(1:60, nrow = 6) df <- DataFrame(n = c(1:6)) expect_error(transformAssay( @@ -120,19 +115,13 @@ test_that("transformAssay", { expect_true(all.equal(as.matrix(ass[19:20, 17:18]), normalized_counts, check.attributes = FALSE)) ########################## PA ########################################## - # Calculates pa transformation. Should be equal. + # Calculates pa transformation. Validate format. actual <- assay(mia::transformAssay(tse, method = "pa"),"pa") - expect_equal(as.vector(actual), - as.vector(vegan::decostand(assay(tse, "counts"), method = "pa", MARGIN = 2)), - check.attributes = FALSE) expect_equal(typeof(actual),"double") expect_true(all(actual == 1 | actual == 0)) - # Tests transformAssay(MARGIN = "features"), calculates pa transformation. Should be equal. + # .. feature wise actual <- assay(mia::transformAssay(tse, MARGIN = "features", method = "pa"),"pa") - expect_equal(as.vector(actual), - as.vector(vegan::decostand(assay(tse, "counts"), method = "pa", MARGIN = 1)) - ) expect_equal(typeof(actual),"double") expect_true(all(actual == 1 | actual == 0)) @@ -314,7 +303,21 @@ test_that("transformAssay", { compare <- vegan::decostand(assay(tse, "counts"), method = "rank", MARGIN = 2) expect_equal(actual, compare) - + + # pa + tse <- transformAssay(tse, assay.type = "counts", method = "pa") + actual <- assay(tse, "pa") + attr(actual, "parameters")$pseudocount <- NULL + compare <- vegan::decostand(assay(tse, "counts"), method = "pa", + MARGIN = 2) + expect_equal(actual, compare, check.attributes = FALSE) + # .. feature wise + tse <- transformAssay(tse, MARGIN = "features", method = "pa") + actual <- assay(tse, "pa") + attr(actual, "parameters")$pseudocount <- NULL + compare <- vegan::decostand(assay(tse, "counts"), method = "pa", + MARGIN = 1) + expect_equal(actual, compare, check.attributes = FALSE) # Check that transformation is applied to altExps From b90e71aa24e407b06c939931ce9914fa950b3e6e Mon Sep 17 00:00:00 2001 From: raivo-otus Date: Tue, 16 Dec 2025 14:08:39 +0200 Subject: [PATCH 13/13] standardize vs decostand --- tests/testthat/test-5transformCounts.R | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/tests/testthat/test-5transformCounts.R b/tests/testthat/test-5transformCounts.R index 8c7c19c86..83145d965 100644 --- a/tests/testthat/test-5transformCounts.R +++ b/tests/testthat/test-5transformCounts.R @@ -159,11 +159,11 @@ test_that("transformAssay", { assay.type = "neg_values", pseudocount = TRUE)) # Expect pseudocount to be half of min value when NA values present - test3 <- tmp - assay(test3, "na_values") <- assay(test3, "counts") - assay(test3, "na_values")[4, 5] <- NA + test2 <- tmp + assay(test2, "na_values") <- assay(test2, "counts") + assay(test2, "na_values")[4, 5] <- NA expect_warning( - actual <- transformAssay(test3, method = "relabundance", + actual <- transformAssay(test2, method = "relabundance", assay.type = "na_values", pseudocount = TRUE) ) value <- attr(assay(actual, "relabundance"), "parameters")[["pseudocount"]] @@ -238,14 +238,11 @@ test_that("transformAssay", { ############################## Z TRANSFORMATION ######################## # Calculates Z-transformation for features - xx <- t(scale(t(as.matrix(assay(tse, "counts"))))) expect_warning(z_assay <- assay( mia::transformAssay( tse, method = "standardize", MARGIN = "features", pseudocount = 1), "standardize")) - expect_equal(max(abs(z_assay - xx), na.rm=TRUE), 0, - tolerance = 1e-14, check.attributes = FALSE) ####################### Test equality to vegan ######################### # Test that transformations are equal to ones directly from vegan @@ -307,18 +304,23 @@ test_that("transformAssay", { # pa tse <- transformAssay(tse, assay.type = "counts", method = "pa") actual <- assay(tse, "pa") - attr(actual, "parameters")$pseudocount <- NULL compare <- vegan::decostand(assay(tse, "counts"), method = "pa", MARGIN = 2) expect_equal(actual, compare, check.attributes = FALSE) # .. feature wise tse <- transformAssay(tse, MARGIN = "features", method = "pa") actual <- assay(tse, "pa") - attr(actual, "parameters")$pseudocount <- NULL compare <- vegan::decostand(assay(tse, "counts"), method = "pa", MARGIN = 1) expect_equal(actual, compare, check.attributes = FALSE) + # Standardize + tse <- transformAssay(tse, method = "standardize") + actual <- assay(tse, "standardize") + compare <- vegan::decostand(assay(tse, "counts"), method = "standardize", + MARGIN = 2) + expect_equal(actual, compare, + check.attributes = FALSE) # Check that transformation is applied to altExps expect_error(transformAssay(tse, altexp = "Phylum"))