Skip to content

Commit 2077a13

Browse files
committed
fix: manualChromPeaks to support integrating a single peak
1 parent 55d39de commit 2077a13

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Package: xcms
2-
Version: 4.5.3
2+
Version: 4.5.4
33
Title: LC-MS and GC-MS Data Analysis
44
Description: Framework for processing and visualization of chromatographically
55
separated and single-spectra mass spectral data. Imports from AIA/ANDI NetCDF,

NEWS.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# xcms 4.5
22

3+
## Changes in version 4.5.4
4+
5+
- Fix a bug in `manualChromPeaks()` that caused an error when only a single
6+
chrom peak was added.
7+
38
## Changes in version 4.5.3
49

510
- Address issue #765: peak detection on chromatographic data: report a

R/XcmsExperiment.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1192,7 +1192,8 @@ setMethod(
11921192
colnames(chromPeaks)))
11931193
stop("'chromPeaks' lacks one or more of the required colums ",
11941194
"\"mzmin\", \"mzmax\", \"rtmin\" and \"rtmax\".")
1195-
chromPeaks <- chromPeaks[, c("mzmin", "mzmax", "rtmin", "rtmax")]
1195+
chromPeaks <- chromPeaks[, c("mzmin", "mzmax", "rtmin", "rtmax"),
1196+
drop = FALSE]
11961197
if (!all(samples %in% seq_along(object)))
11971198
stop("'samples' out of bounds")
11981199
if (hasFeatures(object))

tests/testthat/test_XcmsExperiment.R

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1029,7 +1029,11 @@ test_that("manualChromPeaks,XcmsExperiment works", {
10291029
res2 <- manualChromPeaks(tmp, pks, samples = 2)
10301030
expect_equal(unname(chromPeaks(res2)), unname(pks_2))
10311031

1032-
1032+
## Add single chrom peak
1033+
tmp <- as(mse, "XcmsExperiment")
1034+
res <- manualChromPeaks(tmp, pks[1L, , drop = FALSE])
1035+
expect_true(nrow(chromPeaks(res)) == 3L)
1036+
expect_equal(chromPeaks(res)[2, "maxo"], pks[1, "maxo"])
10331037
})
10341038

10351039
test_that("filterChromPeaks,XcmsExperiment works", {

0 commit comments

Comments
 (0)