New feature: group and summarised Spectra
Opened this issue · 2 comments
The filterPrecursorMaxIntensity()
(see #290) conceptually works as follows:
- Group spectra based on a given criterion, here those that have the same precursor MZ,
- Group these or filter one of them, here the one with the highest precursor intensity.
This could be generalised with groupSpectra()
and summarizedSpectra()
functions. But before embarking on something like this, we should rework the documentation (see #288) to clarify which functions would fall under this paradigm.
If I understood correctly, the idea of the grouping function would that it adds a special spectra variable to the input object with the spectra groups (e.g. a factor
). The summarize spectra will then use that grouping to summarize the spectra in each group to a single spectrum.
So, summarizeSpectra
could thus be defined as
summarizeSpectra <- function(x, f = spectraGroups(x), ...)
which would allow to either use predefined spectra groups or allow the user to define their own factor
.
Yes. The typical usage/paradigm would be
sp |>
groupSpectraByPrecursorMz(...) |>
summarizeSpectraByMaxPrecursorInt(...)
or
sp |>
groupSpectra(fun = groupByPrecursorMz, ...) |>
summarizeSpectra(fun = summarizeByMaxPrecursotIn, ...)