diff --git a/DESCRIPTION b/DESCRIPTION index 005b55868..96445f886 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: xcms -Version: 4.1.7 +Version: 4.1.9 Title: LC-MS and GC-MS Data Analysis Description: Framework for processing and visualization of chromatographically separated and single-spectra mass spectral data. Imports from AIA/ANDI NetCDF, @@ -35,7 +35,11 @@ Authors@R: c( person(given = "Philippine", family = "Louail", email = "philippine.louail@eurac.edu", role = "aut", - comment = c(ORCID = "0009-0007-5429-6846")) + comment = c(ORCID = "0009-0007-5429-6846")), + person(given = "Pablo", family = "Vangeenderhuysen", + email = "pablo.vangeenderhuysen@ugent.be", + role = "ctb", + comment = c(ORCID = "0000-0002-5492-6904")) ) Depends: R (>= 4.0.0), diff --git a/R/XcmsExperiment.R b/R/XcmsExperiment.R index fdb94eddc..7b3672046 100644 --- a/R/XcmsExperiment.R +++ b/R/XcmsExperiment.R @@ -702,7 +702,7 @@ NULL .empty_chrom_peaks <- function(sample = TRUE) { - cols <- c(.REQ_PEAKS_COLS, "maxo") + cols <- c(.REQ_PEAKS_COLS, "maxo","sn") if (!sample) cols <- cols[cols != "sample"] matrix(numeric(), ncol = length(cols), nrow = 0, diff --git a/R/method-filterFeatures.R b/R/method-filterFeatures.R index 8c708680b..9ef97ac0e 100644 --- a/R/method-filterFeatures.R +++ b/R/method-filterFeatures.R @@ -455,7 +455,7 @@ setMethod("filterFeatures", vals <- rowPercentMissing(featureValues(object, ...)[, spl_idx]) fts_idx <- c(fts_idx, which(vals <= filter@threshold)) } - fts_idx <- order(unique(fts_idx)) + fts_idx <- sort(unique(fts_idx)) message(length(vals) - length(fts_idx), " features were removed") ph <- XProcessHistory(param = filter, date. = date(), @@ -479,7 +479,7 @@ setMethod("filterFeatures", vals <- rowPercentMissing(assay(object, assay)[, spl_idx]) fts_idx <- c(fts_idx, which(vals <= filter@threshold)) } - fts_idx <- order(unique(fts_idx)) + fts_idx <- sort(unique(fts_idx)) message(length(vals) - length(fts_idx), " features were removed") object[fts_idx] } diff --git a/inst/NEWS b/inst/NEWS index 5fc15922b..b61d17766 100644 --- a/inst/NEWS +++ b/inst/NEWS @@ -1,3 +1,14 @@ +Changes in version 4.1.9 +---------------------- + +- Fix bug in `filterFeatures,PercentMissingFilter`. + +Changes in version 4.1.8 +---------------------- + +- Fixing issue #716: edit of `.empty_chrom_peaks` function so an `sn` column is + returned. Fixes extracting and plotting of peaks after using `manualChromPeaks` + Changes in version 4.1.7 ---------------------- diff --git a/tests/testthat/test_XcmsExperiment.R b/tests/testthat/test_XcmsExperiment.R index 4aa26f58e..f2b0e6303 100644 --- a/tests/testthat/test_XcmsExperiment.R +++ b/tests/testthat/test_XcmsExperiment.R @@ -4,7 +4,7 @@ mse_dia <- readMsExperiment(fl) test_that(".empty_chrom_peaks works", { res <- .empty_chrom_peaks() expect_true(nrow(res) == 0) - expect_equal(colnames(res), c(.REQ_PEAKS_COLS, "maxo")) + expect_equal(colnames(res), c(.REQ_PEAKS_COLS, "maxo","sn")) res <- .empty_chrom_peaks(sample = FALSE) expect_true(nrow(res) == 0) @@ -995,8 +995,13 @@ test_that("manualChromPeaks,XcmsExperiment works", { expect_equal(unname(pks[, c("mz", "into", "maxo")]), unname(pks_2[, c("mz", "into", "maxo")])) + chr_pks <- chromPeaks(res) + expect_true("sn" %in% colnames(chr_pks)) + res2 <- manualChromPeaks(tmp, pks, samples = 2) expect_equal(unname(chromPeaks(res2)), unname(pks_2)) + + }) test_that("filterChromPeaks,XcmsExperiment works", {