Skip to content

Commit

Permalink
refactor: import breaks_ppm from MsCoreUtils
Browse files Browse the repository at this point in the history
- Import `breaks_ppm` from `MsCoreUtils`.
- Update documentation.
  • Loading branch information
jorainer committed Jan 25, 2024
1 parent dad7171 commit 601f76a
Show file tree
Hide file tree
Showing 13 changed files with 20 additions and 39 deletions.
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ Imports:
robustbase,
IRanges,
SummarizedExperiment,
MsCoreUtils (>= 1.11.5),
MsCoreUtils (>= 1.15.3),
MsFeatures,
MsExperiment (>= 1.1.2),
MsExperiment (>= 1.5.3),
Spectra (>= 1.13.2),
progress,
multtest,
Expand Down Expand Up @@ -87,7 +87,7 @@ URL: https://github.com/sneumann/xcms
BugReports: https://github.com/sneumann/xcms/issues/new
VignetteBuilder: knitr
biocViews: ImmunoOncology, MassSpectrometry, Metabolomics
RoxygenNote: 7.3.0
RoxygenNote: 7.3.1
Collate:
'AllGenerics.R'
'functions-XChromatograms.R'
Expand Down
3 changes: 1 addition & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ importMethodsFrom("S4Vectors", "as.matrix", "mcols", "mcols<-",
"extractROWS", "findMatches")
importFrom("SummarizedExperiment", "SummarizedExperiment")
importFrom("MsCoreUtils", "rbindFill", "closest", "i2index", "sumi", "between",
"maxi")
"maxi", "breaks_ppm")

## Additional imports proposed by R CMD check:
importFrom("graphics", "abline", "barplot", "close.screen", "hist",
Expand Down Expand Up @@ -593,4 +593,3 @@ importFrom("jsonlite", "serializeJSON", "write_json", "unserializeJSON",
export("RDataParam")
export("PlainTextParam")
exportMethods("storeResults")

22 changes: 1 addition & 21 deletions R/do_groupChromPeaks-functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ do_groupChromPeaks_density <- function(peaks, sampleGroups,
## Define the mass slices and the index in the peaks matrix with an mz
## value >= mass[i]. If ppm != 0 the size of the individual bins will
## be dependend on the m/z value.
mass <- .breaks_ppm(peaks[1, "mz"], peaks[nrow(peaks), "mz"] + binSize,
mass <- breaks_ppm(peaks[1, "mz"], peaks[nrow(peaks), "mz"] + binSize,
by = binSize / 2, ppm = ppm / 2)
masspos <- findEqualGreaterM(peaks[, "mz"], mass)

Expand Down Expand Up @@ -562,23 +562,3 @@ do_groupChromPeaks_nearest <- function(peaks, sampleGroups, mzVsRtBalance = 10,
}
x
}

#' Generate a sequence of values with increasing difference between consecutive
#' values. The difference is increased using the `ppm`.
#'
#' Add that also to MsCoreUtils and eventually replace
#'
#' @noRd
.breaks_ppm <- function(from = 1, to = 1, by = 1, ppm = 0) {
l <- ceiling((to - from + 1) / by)
res <- rep(NA_real_, l)
res[1L] <- a <- from
i <- 2L
while(a < to) {
a <- a + by
a <- a + (a * ppm * 1e-6)
res[i] <- a
i <- i + 1L
}
res[!is.na(res)]
}
2 changes: 2 additions & 0 deletions inst/NEWS
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Changes in version 4.1.6
----------------------

- Import `filterSpectra` from `MsExperiment`.
- Import `breaks_ppm` from `MsCoreUtils`.
- Update `featureArea` function to consider all chromatographic peaks per
feature, not only the one with the highest intensity. As a consequence,
returned m/z and rt ranges might be higher which has an influence in
Expand Down
2 changes: 1 addition & 1 deletion man/do_findChromPeaks_massifquant.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/do_findChromPeaks_matchedFilter.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/do_findPeaks_MSW.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/findChromPeaks-centWave.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/findChromPeaks-centWaveWithPredIsoROIs.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/findChromPeaks-massifquant.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions man/findChromPeaks-matchedFilter.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/findChromPeaks.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions man/findPeaks-MSW.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 601f76a

Please sign in to comment.