Skip to content

Commit

Permalink
Add unit test for parsePeakAbundanceMatrixQF()
Browse files Browse the repository at this point in the history
  • Loading branch information
sneumann committed Aug 22, 2024
1 parent b47dad7 commit 06638e5
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/testthat/test-readMSDial.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
filePeakMatrix <- system.file("extdata/showcase/Metabolite_profile_showcase.txt", package = "MetFamily")
qf <- readMSDial(filePeakMatrix)

test_that("exampledata", {
data <- parsePeakAbundanceMatrixQF(qf, doPrecursorDeisotoping=TRUE,
mzDeviationInPPM_precursorDeisotoping=10, mzDeviationAbsolute_precursorDeisotoping=0.01,
maximumRtDifference=0.05,
progress=FALSE)

## Test dimensions
expect_equal(nrow(data$dataFrame1), 5403)
expect_equal(ncol(data$dataFrame1), 20)

## Test some values
expect_true(all(summary(t(data$dataFrame1[1,c("TRI03", "TRI02", "TRI01", "LVS03", "LVS02", "LVS01")])) == c("Min. : 236.0 ", "1st Qu.: 306.2 ", "Median : 357.5 ", "Mean : 501.0 ", "3rd Qu.: 554.2 ", "Max. :1146.0 ")))
expect_true(all(round(summary(data$dataFrame1[, "TRI01"])) == c(0, 809, 1537, 9818, 3207, 4407926)))
})


test_that("Sum of Intensities is correct", {

sumQf <- sum(colSums(assay(qf)))
Expand Down

0 comments on commit 06638e5

Please sign in to comment.