Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upoptimize function names (removePeaks, clean) #89
Comments
Related to discussions here at the RFMF workshop (see rformassspectrometry#89 ) Yours, Steffen
Indeed, very confusing, and I take the blame for this many years ago. I am not convinced about renaming I would suggest the following changes, including in the signature of
These names are a bit longer but avoid any ambiguity. |
Do we need both functions? What are the use cases for them? I used them only in combinations, i.e. first |
filterIntensities(object,
threshold = minIntensity(),
all = TRUE,
msLevel. = unique(msLevel(object))) that filters (i.e. completely remove) peaks and setIntsToZero(object,
threshold = minIntensity(),
msLevel. = unique(msLevel(object))) that sets them to zero. |
I like the For replaceIntensityBelow(object,
threshold = min,
value = 0,
msLevel. = unique(msLevel(object)) with In addition (don't know if that's too much then) we could also have a filterIntensity(object,
intensity = c(min, Inf),
msLevel. = unique(msLevel(object))) This function would then match the |
|
the And yes, |
|
I could see plausible use cases for filtering max I as well (e.g. signal suppression / saturation was encountered, or you already analysed the Top X peaks and want to look at the middle ground) and would be pro leaving this in for enhanced flexibility. One could always design the function so that if only one value is given it is implicitly |
Hmm can you do it so that it asks for both parameters officially, but provides the implicit shortcut of setting max=Inf if only one value is provided, for those that don't want to type? |
I am in favour of the second option. |
+1 for the latter |
OK, summarizing: we agreed on:
|
schymane commentedJan 21, 2020
Discussion at metaRbolomics, these two functions are a bit of a misnoma:
https://github.com/rformassspectrometry/Spectra/blob/master/R/Spectra.R#L401
"removePeaks" is rather "markPeaks" or something (it doesn't actually remove peaks)
Whereas "clean" is not really clean but more analogous to trim
https://github.com/rformassspectrometry/Spectra/blob/master/R/Spectra.R#L412