-
Notifications
You must be signed in to change notification settings - Fork 27
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
Introducing filterRanges
Function and Discussion on a possible filterSimilarities
#312
Conversation
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.
Thank you @philouail ! Great PR! Some change requests and questions.
Also, something strange happened with the roxygen documentation.
To me this function is great and also the We have already a use case in which we want to extract/filter spectra with their precursor m/z and retention time within respective ranges (from MS1 data). |
Thanks @jorainer ! I have adapted the code to your suggestions. |
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.
Thanks Phili! This function makes a lot of sense to me!
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.
Very nice, thank you Phili.
I would like to discuss the name of this and equivalent similarities functions. At first, the name was very confusing to me, as it reminded me of existing function that filter ranges, filterMzRange()
and filterPrecursorMzRange()
[1]. So I would suggest to use a name that refers to spectraData
explicitly. And then use that name to inform the one focusing on similar values.
[1] grep("ange", grep("filter", ls("package:Spectra"), value = TRUE), value = TRUE)
Thanks for the review @lgatto ! Regarding the name, if I understand you you would like to name the function to something like I would not use To me We also thought of a generic |
OK for |
Thanks @lgatto for the feedback ! I will adjust the documentation and the code accordingly. As well as adding the |
So here is everything updated. I moved the main code to the MsBackend.R to have a similar implementation as the other filtering functions. Some things i am not 100% sure about:
Also curiosity question but what is the different between I will write the vignette now while i wait for feedback :) Thanks again for the help ! |
Regarding your last question: |
For the default 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.
Looks good @philouail ! Thanks! I have some change requests - mostly related to documentation - and one suggestion to maybe add an additional parameter to both functions that allows to combine the multiple filters/conditions either with a logical and (the default) or a logical or.
Thanks @jorainer for the idea, I'll update the code for the comments you made and implement the extra parameter ! |
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.
Really great contribution Phili! Thanks!
I'm totally fine with the implementations, but have some suggestions to improve/fix the documentation.
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.
Thanks Phili! All good from my side!
R/MsBackend.R
Outdated
@@ -121,6 +126,11 @@ | |||
#' @param ppm For `filterPrecursorMzValues`: `numeric(1)` with the m/z-relative | |||
#' maximal acceptable difference for a m/z to be considered matching. See | |||
#' [closest()] for details. | |||
#' For `filterValues`: `numeric` of any length allowing to define |
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 see this is also missing for the other functions, but I find it useful to use () for functions, to explicitly differentiate them form variables. So here, filterValues()
. If @jorainer agrees and if you have time, this could be changed everywhere. Otherwise, leave it.
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.
Yes I can do that in the next push !
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.
yes, that makes sense - can you then please do that for all functions - so that we have everything consistent.
Thank you @philouail for the great contribution! |
Hi, I wanted to suggest the implementation of this function
filterRanges
, which allows the user to filter aspectra
object based on any variables of itsspectraData
suing a range of values that the user inputs . I believe this would be great for multiple reasons:Welcoming any feedback on the code and PR :)
On the other hand, I would also like to suggest implementing a similar function such as
filterSimilarities
(not sure about the name), which would be implemented in a similar way for filtering based on similarity to specific values for variables within thespectraData
of the object rather than within a range. Thus, it would have the same advantages as thefilterRanges
function. It would prevent variable-specific functions and make the code easier to combine multiple filters.I can however see the counter argument that this might not be as user-friendly as variable-specific functions. I would love to get your opinion @jorainer and @lgatto on this. If you are interested i can come up with a more detailed proposition of implementation.