Closed michaelwitting closed 3 years ago
Firstly, the function is now called filterIntensity
and yes, it's only possible to specify a hard cut-off in that function. What relative threshold would you need?
I would like to filter peaks that are lower than let's say 1% of the base peak intensity.
The filter call which is applied to each spectrum has its msLevel
, centroiding
, intensity
and mz
available. So, filtering based on the intensity values of a spectrum should be doable. We would have to support passing a function to filterIntensity
.
What would not be possible right now is to filter peaks in a spectrum based on the e.g. precursor intensity of that spectrum.
PR #136 adds this functionality. With it you can then add a function to filterIntensity
that takes the intensity values of a spectrum as input and filters the spectrum based on that. Example:
my_filter <- function(x) {
x > max(x, na.rm = TRUE) / 10
}
sps <- filterIntensity(sps, intenity = my_filter)
This will remove all peaks from each spectrum that have an intensity smaller than 10% of the maximum intensity in that spectrum (BPI).
Awesome, seems to work correct!
Hi,
as far as I understand
removePeaks
is working with an absolute intensity treshold. Is it possible to also have a relative treshold? Best without the need to first convertintensity
to relative scale and filter, because then the absolute intensities are lost.Best regards,
Michael