Skip to content

Commit

Permalink
Merge branch 'devel' into large_scale
Browse files Browse the repository at this point in the history
  • Loading branch information
jorainer committed Oct 30, 2024
2 parents e72e1c2 + d3e8acf commit eafadff
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check-bioc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ jobs:
rcmdcheck::rcmdcheck(
args = c("--no-build-vignettes", "--no-manual", "--timings"),
build_args = c("--no-manual", "--no-resave-data"),
error_on = "warning",
error_on = "error",
check_dir = "check"
)
shell: Rscript {0}
Expand Down
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: xcms
Version: 4.3.4
Version: 4.5.1
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,
Expand Down Expand Up @@ -162,4 +162,4 @@ Collate:
'writemzdata.R'
'writemztab.R'
'xcmsSource.R'
'zzz.R'
'zzz.R'
14 changes: 11 additions & 3 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# xcms 4.3
# xcms 4.5

## Changes in version XXX

Expand All @@ -7,7 +7,7 @@
in MS level 1 or `"CP2001"` instead of `"CP001"` for a chromatographic peak
in MS level 2.

## Changes in version 4.3.4
## Changes in version 4.5.1

- Address issue #765: peak detection on chromatographic data: report a
chromatogram's `"mz"`, `"mzmin"` and `"mzmax"` as the mean m/z and lower and
Expand All @@ -18,6 +18,14 @@
- Add `chromPeakSummary` generic (issue #705).
- Add `chromPeakSummary()` method to calculate the *beta* quality metrics.

# xcms 4.3

## Changes in version 4.3.4

- Small update to the `matchLamaChromPeaks()` function to get the chromPeaksId
of the chromPeaks matched with Lamas.
- Small fix to the .yml file for the github actions, so they do not crash on
warnings.

## Changes in version 4.3.3

Expand Down Expand Up @@ -1325,4 +1333,4 @@ Other Changes since Version 1.14:

- xcmsRaw can now filter for positive/negative spectra,
if the file includes both polarities. xcmsSet() can pass
the polarity to contain positive/negative peaks only.
the polarity to contain positive/negative peaks only.
1 change: 0 additions & 1 deletion R/AllGenerics.R
Original file line number Diff line number Diff line change
Expand Up @@ -2114,7 +2114,6 @@ setGeneric("stitch", function(object, lockMass, ...) standardGeneric("stitch"))
setGeneric("stitch.xml", function(object, lockMass) standardGeneric("stitch.xml"))
setGeneric("stitch.netCDF", function(object, lockMass) standardGeneric("stitch.netCDF"))
setGeneric("stitch.netCDF.new", function(object, lockMass) standardGeneric("stitch.netCDF.new"))

setGeneric("subset<-", function(object, value) standardGeneric("subset<-"))
setGeneric("subsetAdjust", function(object, ...) standardGeneric("subsetAdjust"))
setGeneric("subsetAdjust<-", function(object, value) standardGeneric("subsetAdjust<-"))
Expand Down
2 changes: 1 addition & 1 deletion R/XcmsExperiment.R
Original file line number Diff line number Diff line change
Expand Up @@ -1414,7 +1414,7 @@ setMethod(
rt_adj <- bpmapply(rtMap, rt_raw, idx, FUN = function(x, y, i, param) {
if (nrow(x) >= 10) { # too strict ? Gam always throws error when less than that and loess does not work that well either.
.adjust_rt_model(y, method = param@method,
rt_map = x, span = param@span,
rt_map = x[, c("ref","obs")], span = param@span,
resid_ratio = param@outlierTolerance,
zero_weight = param@zeroWeight,
bs = param@bs)
Expand Down
7 changes: 5 additions & 2 deletions R/do_adjustRtime-functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,9 @@ NULL
#'
#' @return a `data.frame` with columns `"ref"` and `"obs"` with the retention
#' times of the pairs of matched peaks. This `data.frame` can be used
#' in `.adjust_rt_model`'s parameter `rt_raw`.
#' in `.adjust_rt_model`'s parameter `rt_raw`. The column `chromPeaksId`
#' contains the rownames of the `obs_peaks` matrix. This can be used to
#' identify the peaks that were matched.
#'
#' @author Johannes Rainer, Philippine Louail
#'
Expand All @@ -804,7 +806,8 @@ NULL
dups <- idx[duplicated(idx[, 2L]), 2L]
idx <- idx[!idx[, 2L] %in% dups, , drop = FALSE]
data.frame(ref = ref_anchors[idx[, 2L], 2L],
obs = obs_peaks[idx[, 1L], 2L])
obs = obs_peaks[idx[, 1L], 2L],
chromPeaksId = rownames(obs_peaks[idx[, 1L], ,drop = FALSE]))
}

#' @description
Expand Down
11 changes: 7 additions & 4 deletions tests/testthat/test_do_adjustRtime-functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -293,13 +293,16 @@ test_that(".match_reference_anchors works", {
rt = c(100, 150.1, 190, 190, 190, 192))
b <- cbind(mz = c(200.2, 232, 233.1, 234),
rt = c(150, 190.4, 193, 240))
rownames(a) <- rep("a", nrow(a))
rownames(b) <- rep("b", nrow(b))

res <- .match_reference_anchors(a, b)
expect_true(is.data.frame(res))
expect_equal(colnames(res), c("ref", "obs"))
expect_equal(colnames(res), c("ref", "obs", "chromPeaksId"))
expect_true(nrow(res) == 1L)
expect_equal(res$ref, 193.0)
expect_equal(res$obs, 190.0)
expect_equal(res$chromPeaksId, "a")

## no matches:
res <- .match_reference_anchors(a, b, tolerance = 0, toleranceRt = 0)
Expand All @@ -311,7 +314,7 @@ test_that(".match_reference_anchors works", {
## rows 5 and 6 from `a` match row 3 from `b`
res <- .match_reference_anchors(a, b, tolerance = 0.1, toleranceRt = 52)
expect_true(is.data.frame(res))
expect_equal(colnames(res), c("ref", "obs"))
expect_equal(colnames(res),c("ref", "obs", "chromPeaksId"))
expect_equal(res$ref, 190.4)
expect_equal(res$obs, 190.0)

Expand All @@ -320,15 +323,15 @@ test_that(".match_reference_anchors works", {
## `b` and should thus not be reported.
res <- .match_reference_anchors(a, b, tolerance = 0.1, toleranceRt = 5)
expect_true(is.data.frame(res))
expect_equal(colnames(res), c("ref", "obs"))
expect_equal(colnames(res), c("ref", "obs", "chromPeaksId"))
expect_equal(res$ref, c(150, 190.4))
expect_equal(res$obs, c(150.1, 190.0))

## Same but reducing toleranceRt to have also a match between row 6 in `a`
## with row 3 in `b`.
res <- .match_reference_anchors(a, b, tolerance = 0.1, toleranceRt = 2)
expect_true(is.data.frame(res))
expect_equal(colnames(res), c("ref", "obs"))
expect_equal(colnames(res), c("ref", "obs", "chromPeaksId"))
expect_equal(res$ref, c(150, 190.4, 193.0))
expect_equal(res$obs, c(150.1, 190.0, 192.0))
})
Expand Down

0 comments on commit eafadff

Please sign in to comment.