Skip to content
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

Function to find/visualise contaminants #260

Open
lgatto opened this issue Dec 26, 2022 · 2 comments
Open

Function to find/visualise contaminants #260

lgatto opened this issue Dec 26, 2022 · 2 comments

Comments

@lgatto
Copy link
Member

lgatto commented Dec 26, 2022

In PR #259, I included a message about mz being sorted. As pointed by @sgibb, we haven't done so in other instances, and I suppose it doesn't bring much anyway given that a vector logical is always returned, irrespective of the number of contained mz values.

I thought it would be useful to have another function (or update that one) to check for one or multiple contaminants in a Spectra object, something like this

Rplot

I imagine a function contaminantMz(x, mz = c(...)) that returns a logical matrix of dimensions length(x) by length(mz).

Referring back to this comment, in this case, I thought it would be worth mentioning that mz would be sorted if they weren't. But even here, if we name our colnames, it might not even be needed.

@lgatto
Copy link
Member Author

lgatto commented Jan 3, 2023

Here's a two suggestions to implement what is needed for the above feature using containsMz():

Add a simplity argument

The (default) would be simplify = TRUE that would retain the current behaviour while simplify = FALSE would return a matrix of logicals of dimensions length(object) by length(mz) with colnames equal to the (sorted) as.character(mz) indicating whether the given mz is contained in the respective spectra.

Add a what argument

This new argument could take one of "any", "all" value returning respectively the default vector and the matrix of logicals described above. It could possible also take a "which" value to return the index of the contained (sorted) mz.

This would actually be very confusing with the current which argument, so I suggest to ignore this suggestion. Or we repurpuse which.

@sgibb @jorainer, what do you think?

@jorainer
Copy link
Member

jorainer commented Jan 4, 2023

I would opt for adding a parameter simplify = FALSE to containsMz that does exactly what you propose.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants