Skip to content

Commit 95ee8b1

Browse files
authored
Fix unit tests (#747)
1 parent 954e2a7 commit 95ee8b1

2 files changed

Lines changed: 2 additions & 37 deletions

File tree

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: mia
22
Type: Package
3-
Version: 1.17.4
3+
Version: 1.17.5
44
Authors@R:
55
c(person(given = "Tuomas", family = "Borman", role = c("aut", "cre"),
66
email = "tuomas.v.borman@utu.fi",

tests/testthat/test-5transformCounts.R

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -167,30 +167,6 @@ test_that("transformAssay", {
167167
# Compare
168168
expect_equal(mat, mat_comp)
169169

170-
# Tests rclr
171-
# Calc RCLRs
172-
assay <- assay(tse, "counts")
173-
suppressWarnings(
174-
mat <- assays(mia::transformAssay(tse, assay.type = "counts", method = "rclr"))$rclr
175-
)
176-
177-
suppressWarnings(
178-
mat_comp <- apply(as.matrix(assay), 2, FUN=function(x){
179-
temp <- log(x)
180-
temp[is.infinite(temp)] <- NA
181-
temp <- log(x) - mean(temp, na.rm = TRUE)
182-
temp[is.infinite(temp)] <- 0
183-
return(temp)
184-
})
185-
)
186-
187-
# Round
188-
mat <- round(mat, 4)
189-
mat_comp <- round(mat_comp, 4)
190-
191-
# Compare
192-
expect_equal(mat, mat_comp, check.attributes = FALSE)
193-
194170
# Expect that error occurs
195171
expect_error(mia::transformAssay(tse, method = "clr"))
196172

@@ -213,17 +189,6 @@ test_that("transformAssay", {
213189
# One missing value
214190
assay(tse, "na_values")[4, 5] <- NA
215191

216-
# clr robust transformations
217-
test <- assay(transformAssay(tse, method = "rclr", assay.type = "test"), "rclr")
218-
test2 <- assay(transformAssay(tse, method = "rclr", assay.type = "test2"), "rclr")
219-
220-
# Removes first rows
221-
test <- test[-1, ]
222-
test2 <- test2[-1, ]
223-
224-
# Expect that under 10 values are unequal. Values have only one decimal.
225-
expect_true(sum(round(test, 1) != round(test2, 1), na.rm = TRUE) < 10)
226-
227192
tse <- transformAssay(tse, method = "relabundance")
228193
# Expect error when counts and zeroes
229194
expect_error(
@@ -356,7 +321,7 @@ test_that("transformAssay", {
356321
attr(actual, "parameters")$pseudocount <- NULL
357322
compare <- vegan::decostand(assay(tse, "relabundance"), method = "rclr",
358323
MARGIN = 2)
359-
expect_equal(actual, compare)
324+
expect_equal(actual, compare, check.attributes = FALSE)
360325

361326
# alr
362327
tse <- transformAssay(tse, assay.type = "relabundance", method = "alr",

0 commit comments

Comments
 (0)