Browse code

docs: bump version and export breaks_ppm

jorainer authored on 24/01/2024 14:34:35
Showing 6 changed files

... ...
@@ -1,6 +1,6 @@
1 1
 Package: MsCoreUtils
2 2
 Title: Core Utils for Mass Spectrometry Data
3
-Version: 1.15.2
3
+Version: 1.15.3
4 4
 Description: MsCoreUtils defines low-level functions for mass
5 5
     spectrometry data and is independent of any high-level data
6 6
     structures. These functions include mass spectra processing
... ...
@@ -76,4 +76,4 @@ BugReports: https://github.com/RforMassSpectrometry/MsCoreUtils/issues
76 76
 URL: https://github.com/RforMassSpectrometry/MsCoreUtils
77 77
 biocViews: Infrastructure, Proteomics, MassSpectrometry, Metabolomics
78 78
 Roxygen: list(markdown=TRUE)
79
-RoxygenNote: 7.2.3
79
+RoxygenNote: 7.3.1
... ...
@@ -6,6 +6,7 @@ export(aggregate_by_vector)
6 6
 export(asInteger)
7 7
 export(between)
8 8
 export(bin)
9
+export(breaks_ppm)
9 10
 export(closest)
10 11
 export(coefMA)
11 12
 export(coefSG)
... ...
@@ -1,8 +1,13 @@
1 1
 # MsCoreUtils 1.15
2 2
 
3
+## MsCoreUtils 1.15.3
4
+
5
+- Add function `breaks_ppm` to create a sequence of numbers with increasing
6
+  difference between elements (defined by parameter `ppm`).
7
+
3 8
 ## MsCoreUtils 1.15.2
4 9
 
5
-- Porting baseline baseline estimation function (see [issue
10
+- Porting baseline estimation function (see [issue
6 11
   119](https://github.com/rformassspectrometry/MsCoreUtils/issues/119)).
7 12
 
8 13
 ## MsCoreUtils 1.15.1
... ...
@@ -135,6 +135,8 @@ bin <- function(x, y, size = 1,
135 135
 #' @return `numeric` with the sequence of values with increasing differences.
136 136
 #'     The returned values include `from` and `to`.
137 137
 #'
138
+#' @export
139
+#'
138 140
 #' @author Johannes Rainer
139 141
 #'
140 142
 #' @examples
... ...
@@ -23,7 +23,8 @@ thrown.}
23 23
 
24 24
 \item{size}{\code{numeric(1)} with the size of a bin.}
25 25
 
26
-\item{breaks}{\code{numeric} defining the breaks (bins).}
26
+\item{breaks}{\code{numeric} defining the breaks (bins). See \code{\link[=breaks_ppm]{breaks_ppm()}} to
27
+define breaks with increasing size (depending on ppm).}
27 28
 
28 29
 \item{FUN}{\code{function} to be used to aggregate values of \code{x} falling into the
29 30
 bins defined by \code{breaks}. \code{FUN} is expected to return a \code{numeric(1)}.}
30 31
new file mode 100644
... ...
@@ -0,0 +1,53 @@
1
+% Generated by roxygen2: do not edit by hand
2
+% Please edit documentation in R/binning.R
3
+\name{breaks_ppm}
4
+\alias{breaks_ppm}
5
+\title{Sequence with increasing difference between elements}
6
+\usage{
7
+breaks_ppm(from = 1, to = 1, by = 1, ppm = 0)
8
+}
9
+\arguments{
10
+\item{from}{\code{numeric(1)} with the value from which the sequence should start.}
11
+
12
+\item{to}{\code{numeric(1)} defining the upper bound of the sequence. Note that
13
+the last value of the result will not be equal to \code{to} but equal to the
14
+first number in the sequence which is larger than this value.}
15
+
16
+\item{by}{\code{numeric(1)} defining the constant part of the difference by which
17
+numbers should increase.}
18
+
19
+\item{ppm}{\code{numeric(1)} defining the variable part of the difference by
20
+which numbers should increase (expressed in parts-per-million of the
21
+values).}
22
+}
23
+\value{
24
+\code{numeric} with the sequence of values with increasing differences.
25
+The returned values include \code{from} and \code{to}.
26
+}
27
+\description{
28
+\code{breaks_ppm} creates a sequence of numbers with increasing differences
29
+between them. Parameter \code{ppm} defines the amount by which the difference
30
+between values increases. The value for an element \code{i+1} is calculated by
31
+adding \code{size} to the value of element \code{i} and in addition also the
32
+\code{ppm(a, ppm)}, where \code{a} is the value of the element \code{i} plus \code{size}. This
33
+iterative calculation is stopped once the value of an element is larger
34
+than \code{to}. The last value in the result vector will thus not be equal to
35
+\code{to} (which is in contrast to the base \code{\link[=seq]{seq()}} function) but slightly
36
+higher.
37
+
38
+A typical use case of this function would be to calculate breaks for the
39
+binning of m/z values of mass spectra. This function allows to create
40
+m/z-relative bin sizes which better represents measurement errors observed
41
+on certain mass spectrometry instruments.
42
+}
43
+\examples{
44
+
45
+res <- breaks_ppm(20, 50, by = 1, ppm = 50)
46
+res
47
+
48
+## difference between the values increases (by ppm)
49
+diff(res)
50
+}
51
+\author{
52
+Johannes Rainer
53
+}