-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add new filterPeaksRanges
function
#326
Conversation
- Add a new `filterPeaksRanges` function that allows to filter mass peaks in a `Spectra` by any (combination of) numeric spectra and peaks variables. - Re-organize documentation of filter and subset operations (related to issue #288).
A nice use case for this function would be to filter a LC-MS data set keeping (or removing) all mass peaks that were considered a chromatographic peak by xcms-based preprocessing. This allows e.g. to evaluate the foreground (i.e. all quantified ion signal) and background signal (i.e. background noise, or signal that was not considered a valid chromatographic peak by xcms) of a full data set. I will later add such a use case to the xcmsTutorials tutorial/workshop. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The codes looks all good to me.
Thanks for reorganizing the documentation I believe it is much more clear now. I put some comments to signals typos and maybe some suggestions. But i think it's great !
R/Spectra-functions.R
Outdated
#' has to be an available spectra or peaks variable. `<range>` can be a | ||
#' `numeric` of length 2 defining the lower and upper boundary, or a `numeric` | ||
#' two-column matrix (multi-row matrices are also supported, see further | ||
#' below). `filterPeaksRanges(s, mz = c(200, 300))` woudl for example reduce |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would*
R/Spectra-functions.R
Outdated
#' the peaks matrices of the `Spectra` object `s` to mass peaks with an m/z | ||
#' value between 200 and 300. `filterPeaksRanges()` returns the original | ||
#' `Spectra` object with the filter operation added to the processing queue. | ||
#' Thus, the filter gets only applied when the peaks data gets extracted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe "only" in bold to highlight it
R/Spectra-functions.R
Outdated
#' or peaks variables) have to match. | ||
#' | ||
#' **Missing value handling**: any comparison which involves a missing value | ||
#' (beingvit a spectra variable value, a peaks variable value or a value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
being*
R/Spectra-functions.R
Outdated
#' | ||
#' **Missing value handling**: any comparison which involves a missing value | ||
#' (beingvit a spectra variable value, a peaks variable value or a value | ||
#' in one of thevprovided ranges) is treated as a logical `FALSE`. For |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*the provided
R/Spectra-functions.R
Outdated
#' @note | ||
#' | ||
#' In contrast to other *filter* functions, this function does not provide a | ||
#' `msLevel.` parameter to apply the filter only on spectra of the specified |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra point at msLevel
R/Spectra-functions.R
Outdated
#' | ||
#' In contrast to other *filter* functions, this function does not provide a | ||
#' `msLevel.` parameter to apply the filter only on spectra of the specified | ||
#' MS levels. In contrast, to apply no, or different, filters to spectra from |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mmm i'm confused by this sentence
R/Spectra.R
Outdated
#' operations that reduce the number of spectra in the object as well as filters | ||
#' that reduce the *content* of the `Spectra` object. See section | ||
#' *Filter peaks data* below for functions that filter the peaks data of a | ||
#' `Spectra`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe to make it extremely clear, we can say the number of spectra in the Spectra object will not change with filters until applyProcessing() is run ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess here or at the beginning of the filter section
|
||
### Filter spectra data | ||
|
||
These functions comprise subset operations that reduce the total number of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add "directly" or immediately" ?
### Filter or aggregate mass peak data | ||
|
||
These function filter or aggregate the mass peak data (`peaksData()`) of each | ||
spectrum in a `Spectra` without changing the total number of spectra. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as before I would precise "until the applyProcessing() function in run"
Thanks @philouail ! I addressed all of your points! Hope documentation is now a bit clearer. Happy for additional/extra feedback, otherwise I proceed and merge tomorrow. |
filterPeaksRanges
function that allows to filter mass peaks in aSpectra
by any (combination of) numeric spectra and peaks variables.