-
Notifications
You must be signed in to change notification settings - Fork 26
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
Support chunk-wise processing in containsMz #341
Conversation
- Add support for chunk-wise processing to `containsMz()`. Related to issue #340.
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 don't have any changes to suggest but I'm a bit confused by the different functions.
See my comment
if (length(object)) { | ||
cond_fun <- match.fun(match.arg(which)) | ||
if (all(is.na(mz))) | ||
return(rep(NA, length(object))) |
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'm a bit confused, when do you use this function containsMz() exactly ? I saw the definition in the documentation but i've never had to use it before I think, so i'm not sure of the context where its usefull.
About this line of code above: Why would the variable mz
be full of NA ?
Also the .has_mz_each()
is not used here ? i'm a bit confused by the difference between .has_mz_each()
and .peaks_contains_mz()
, don't they both compare the mz()
of a Spectra
object to a numeric vector made of m/z values ?
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, in fact both do. I need to replace/remove also the .has_mz_each()
function, but that will involve some bigger changes.
The .has_mz_each()
and .has_mz()
are old functions that simply run the code on all m/z values, without the possibility of chunk-wise processing or similar. This PR removes/replaces the .has_mz()
function. I will then later also remove the other one. The difference between the two was: .has_mz()
checks for presence of the same provided mz
values in the m/z values of all spectra, while .has_mz_each()
allowed to specify an individual (single!) mz
value to check in a spectrum. Example: .has_mz(sps, mz = c(123.3, 234.12))
would check if any of the spectra have either an m/z value of 123.3
or 234.12
. .has_mz_each(sps, mz = c(1, 2, 3, 4, 5))
checks if the first spectrum contains a 1
, the second a 2
and so on - with the requirement length(sps) == length(mz)
.
Refactor
containsMz()
to support chunk-wise processing.