Skip to content

Commit

Permalink
Merge branch 'devel' into import_methods
Browse files Browse the repository at this point in the history
  • Loading branch information
philouail committed Apr 30, 2024
2 parents e5bd282 + 811b863 commit 35521d0
Show file tree
Hide file tree
Showing 16 changed files with 300 additions and 229 deletions.
45 changes: 24 additions & 21 deletions .github/workflows/check-bioc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ jobs:
matrix:
config:
- { os: ubuntu-latest, r: 'devel', bioc: 'devel', cont: "bioconductor/bioconductor_docker:devel", rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest" }
- { os: macOS-latest, r: 'devel', bioc: '3.19'}
- { os: windows-latest, r: 'devel', bioc: '3.19'}
- { os: macOS-latest, r: 'next', bioc: '3.19'}
- { os: windows-latest, r: 'next', bioc: '3.19'}
env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
RSPM: ${{ matrix.config.rspm }}
Expand Down Expand Up @@ -160,12 +160,12 @@ jobs:
- name: Install BiocManager
run: |
message(paste('****', Sys.time(), 'installing BiocManager ****'))
remotes::install_cran("BiocManager")
remotes::install_cran("BiocManager", type = "source")
shell: Rscript {0}

- name: Set BiocVersion
run: |
BiocManager::install(version = "${{ matrix.config.bioc }}", ask = FALSE)
BiocManager::install(version = "${{ matrix.config.bioc }}", ask = FALSE, type = "source")
shell: Rscript {0}

- name: Install dependencies pass 1
Expand All @@ -177,45 +177,48 @@ jobs:
## https://github.com/r-lib/remotes/issues/296
## Ideally, all dependencies should get installed in the first pass.
## Workaround for problems with cached S4objects in binary packages
BiocManager::install("GenomeInfoDb", force = TRUE, type = "source")
BiocManager::install("BiocParallel", force = TRUE, type = "source")
BiocManager::install("S4Vectors", force = TRUE, type = "source")
BiocManager::install("SummarizedExperiment", force = TRUE, type = "source")
## install xcms with dependencies - to ensure dependencies are installed from source;
## somehow install_local installs binary packages instead.
BiocManager::install("mzR", force = TRUE)
BiocManager::install("MSnbase", force = TRUE, type = "source")
BiocManager::install("xcms", force = TRUE, type = "source", dependencies = TRUE)
BiocManager::install("faahKO", type = "source")
## Pass #1 at installing dependencies
BiocManager::install(c("ncdf4", "mzR"))
message(paste('****', Sys.time(), 'pass number 1 at installing dependencies: local dependencies ****'))
remotes::install_local(dependencies = TRUE, repos =
BiocManager::repositories(), build_vignettes = FALSE, upgrade = TRUE)
remotes::install_local(dependencies = TRUE, repos = BiocManager::repositories(), build_vignettes = FALSE, build_manual = FALSE, type = "source")
BiocManager::install(c("rmarkdown", "BiocStyle"))
BiocManager::install(c("rmarkdown", "BiocStyle"), type = "source")
continue-on-error: true
shell: Rscript {0}

- name: Install dependencies pass 2
run: |
## Pass #2 at installing dependencies
message(paste('****', Sys.time(), 'pass number 2 at installing dependencies: any remaining dependencies ****'))
remotes::install_local(dependencies = TRUE, repos = BiocManager::repositories(), build_vignettes = FALSE, upgrade = TRUE)
remotes::install_local(dependencies = TRUE, repos = BiocManager::repositories(), build_vignettes = FALSE, type = "source")
## Manually install packages that seem to be skipped.
message(paste('****', Sys.time(), 'force installation of selected packages ****'))
BiocManager::install(c("faahKO"))
BiocManager::install("ProtGenerics")
BiocManager::install("MSnbase")
BiocManager::install("mzR", type = "source", force = TRUE)
BiocManager::install("Spectra")
BiocManager::install("MsBackendMgf")
BiocManager::install("MetaboCoreUtils")
BiocManager::install("magick")
BiocManager::install("RforMassSpectrometry/MsExperiment")
BiocManager::install("RforMassSpectrometry/MsCoreUtils", force = TRUE)
BiocManager::install("magick", type = "source")
## For running the checks
message(paste('****', Sys.time(), 'installing rcmdcheck and BiocCheck ****'))
remotes::install_cran("rcmdcheck")
BiocManager::install(c("BiocCheck", "DBI"))
remotes::install_cran("rcmdcheck", type = "source")
BiocManager::install("BiocCheck", type = "source")
shell: Rscript {0}

- name: Install BiocGenerics
if: env.has_RUnit == 'true'
run: |
## Install BiocGenerics
BiocManager::install("BiocGenerics")
BiocManager::install("BiocGenerics", type = "source")
shell: Rscript {0}

- name: Install covr
Expand Down
8 changes: 4 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: xcms
Version: 4.1.12
Version: 4.1.14
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 @@ -41,8 +41,8 @@ Authors@R: c(
role = "ctb",
comment = c(ORCID = "0000-0002-5492-6904")),
person(given = "Carl", family = "Brunius",
email = "carl.brunius@chalmers.se",
role = "ctb",
email = "carl.brunius@chalmers.se",
role = "ctb",
comment = c(ORCID = "0000-0003-3957-870X"))
)
Depends:
Expand Down Expand Up @@ -104,11 +104,11 @@ Collate:
'MPI.R'
'MsExperiment-functions.R'
'MsExperiment.R'
'XcmsExperiment.R'
'PlainTextParam.R'
'RDataParam.R'
'XcmsExperiment-functions.R'
'XcmsExperiment-plotting.R'
'XcmsExperiment.R'
'c.R'
'cwTools.R'
'databases.R'
Expand Down
12 changes: 12 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# xcms 4.1

## Changes in version 4.1.13

- Fix for issue #734. XIC plot is is now working with MS2 Data.


## Changes in version 4.1.13

- Add parameter `rtimeDifferenceThreshold` to `ObiwarpParam` allowing to
customize the threshold used by obiwarp to determine whether *gaps* are
present in the sequence of retention times of a sample. This addresses/fixes
issue #739.

## Changes in version 4.1.12

- Implementation of the `LamaParama` class and method for the `adjustRtime()`
Expand Down
12 changes: 12 additions & 0 deletions R/AllGenerics.R
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,18 @@ setGeneric("addProcessHistory", function(object, ...)
#' start and end points and `response = 100` warping using all bijective
#' anchors.
#'
#' @param rtimeDifferenceThreshold For `ObiwarpParam`: `numeric(1)` defining
#' the threshold to identify a *gap* in the sequence of retention times of
#' (MS1) spectra of a sample/file. A gap is defined if the difference in
#' retention times between consecutive spectra is
#' `> rtimeDifferenceThreshold` of the median observed difference or
#' retenion times of that data sample/file. Spectra with an retention time
#' after such a *gap* will not be adjusted. The default for this parameter
#' is `rtimeDifferenceThreshold = 5`. For Waters data with lockmass scans
#' or LC-MS/MS data this might however be a too low threshold and it should
#' be increased. See also
#' [issue #739](https://github.com/sneumann/xcms/issues/739).
#'
#' @param smooth For `PeakGroupsParam`: `character(1)` defining the function to
#' be used to interpolate corrected retention times for all peak groups.
#' Can be either `"loess"` or `"linear"`.
Expand Down
6 changes: 4 additions & 2 deletions R/DataClasses.R
Original file line number Diff line number Diff line change
Expand Up @@ -1522,7 +1522,8 @@ setClass("ObiwarpParam",
localAlignment = "logical",
initPenalty = "numeric",
subset = "integer",
subsetAdjust = "character"),
subsetAdjust = "character",
rtimeDifferenceThreshold = "numeric"),
contains = "Param",
prototype = prototype(
binSize = 1,
Expand All @@ -1536,7 +1537,8 @@ setClass("ObiwarpParam",
localAlignment = FALSE,
initPenalty = 0,
subset = integer(),
subsetAdjust = "average"),
subsetAdjust = "average",
rtimeDifferenceThreshold = 5),
validity = function(object) {
msg <- character()
if (length(object@binSize) > 1 |
Expand Down
1 change: 1 addition & 0 deletions R/MsExperiment-functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@

.mse_obiwarp_chunks <- function(x, param, msLevel = 1L, chunkSize = 1L,
BPPARAM = bpparam()) {
message("value ", param@rtimeDifferenceThreshold)
rt_raw <- split(rtime(x), fromFile(x))
subset_idx <- subset(param)
if (length(subset_idx))
Expand Down
5 changes: 3 additions & 2 deletions R/PlainTextParam.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#' @title Store/load contents of `MsExperiment` and `XcmsExperiment` objects
#' as/from plain text files
#' @include XcmsExperiment.R
#' @title Store contents of `MsExperiment` and `XcmsExperiment` objects as
#' plain text files
#'
#' @name PlainTextParam
#'
Expand Down
5 changes: 3 additions & 2 deletions R/XcmsExperiment-plotting.R
Original file line number Diff line number Diff line change
Expand Up @@ -380,12 +380,13 @@ setMethod(
fns <- basename(fileNames(x))
for (i in seq_along(x)) {
z <- x[i]
lst <- as(filterMsLevel(spectra(z), msLevel = msLevel), "list")
flt <- filterMsLevel(spectra(z), msLevel = msLevel)
lst <- as(flt, "list")
lns <- lengths(lst) / 2
lst <- do.call(rbind, lst)
if (!length(lst))
next
df <- data.frame(rt = rep(rtime(z), lns), lst)
df <- data.frame(rt = rep(rtime(flt), lns), lst)
colnames(df)[colnames(df) == "intensity"] <- "i"
do.call(MSnbase:::.plotXIC,
c(list(x = df, main = fns[i], layout = NULL), dots))
Expand Down
8 changes: 4 additions & 4 deletions R/functions-OnDiskMSnExp.R
Original file line number Diff line number Diff line change
Expand Up @@ -448,15 +448,15 @@ findPeaks_MSW_Spectrum_list <- function(x, method = "MSW", param) {
## median difference between spectras' scan time.
mstdiff <- median(c(scantime1_diff, scantime2_diff), na.rm = TRUE)

mst1 <- which(scantime1_diff > 5 * mstdiff)[1]
mst1 <- which(scantime1_diff > param@rtimeDifferenceThreshold * mstdiff)[1]
if (!is.na(mst1)) {
message("Found gaps in scan times of the center sample: cut ",
warning("Found gaps in scan times of the center sample: cut ",
"scantime-vector at ", scantime1[mst1]," seconds.")
scantime1 <- scantime1[seq_len(max(2, (mst1 - 1)))]
}
mst2 <- which(scantime2_diff > 5 * mstdiff)[1]
mst2 <- which(scantime2_diff > param@rtimeDifferenceThreshold * mstdiff)[1]
if (!is.na(mst2)) {
message("Found gaps in scan time. Cutting scantime-vector at ",
warning("Found gaps in scan time. Cutting scantime-vector at ",
scantime2[mst2]," seconds.")
scantime2 <- scantime2[seq_len(max(2, (mst2 - 1)))]
}
Expand Down
6 changes: 4 additions & 2 deletions R/functions-Params.R
Original file line number Diff line number Diff line change
Expand Up @@ -311,15 +311,17 @@ ObiwarpParam <- function(binSize = 1, centerSample = integer(), response = 1L,
gapExtend = numeric(), factorDiag = 2, factorGap = 1,
localAlignment = FALSE, initPenalty = 0,
subset = integer(),
subsetAdjust = c("average", "previous")) {
subsetAdjust = c("average", "previous"),
rtimeDifferenceThreshold = 5) {
subsetAdjust <- match.arg(subsetAdjust)
new("ObiwarpParam", binSize = binSize,
centerSample = as.integer(centerSample),
response = as.integer(response), distFun = distFun,
gapInit = gapInit, gapExtend = gapExtend, factorDiag = factorDiag,
factorGap = factorGap, localAlignment = localAlignment,
initPenalty = initPenalty, subset = as.integer(subset),
subsetAdjust = subsetAdjust)
subsetAdjust = subsetAdjust,
rtimeDifferenceThreshold = rtimeDifferenceThreshold[1L])
}

#' @return The \code{FillChromPeaksParam} function returns a
Expand Down
3 changes: 2 additions & 1 deletion R/methods-Params.R
Original file line number Diff line number Diff line change
Expand Up @@ -1265,7 +1265,8 @@ setMethod("plot", signature(x = "LamaParama"),
zero_weight = x@zeroWeight,
bs = x@bs)
datap <- x@rtMap[[index]]
plot(datap, type = "p", xlab = xlab, ylab = ylab, col = colPoints, ...)
plot(datap[, 2L], datap[, 1L], type = "p", xlab = xlab, ylab = ylab,
col = colPoints, ...)
points(model, type = "l", col = colFit)
})

Expand Down
Loading

0 comments on commit 35521d0

Please sign in to comment.