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

Monoisotopic masses can be calculated correctly. #32

Closed
wants to merge 3 commits into from

Conversation

janlisec
Copy link
Contributor

Suggested Version: 1.65.4
Changes:
* Rdisop-1.65.4
* !changed getIsotope function to return a list of matrices to be consistent with the other getter functions
* new exported function getMono() which will return the mono-isotopic mass for a molecule object (also when a list of molecules as for decomposeMass) or alternatively for a vector of chemical formulas
* modified documentation to clarify the difference of exactmass and mono-isotopic mass
* testthat test for getMono were set up
* new internal function to count chemical elements (imported/copied from the CorMID package) to be utilized in getMono
* two data sets included in package and appropriately documented:
* isotopes (a data.frame version of the PSE info)
* mono_masses (a named vector containing only the most abundant isotope per element)

@janlisec
Copy link
Contributor Author

@sneumann I managed to amend the PR by the missing LazyData statement. Now all checks are passed. If you are fine with the changes, please accept, so I can take care of the next issue from the repository's list.

Copy link
Owner

@sneumann sneumann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thanks for the PR. I just have tiny suggestions. Yours, Steffen

NAMESPACE Outdated
@@ -8,6 +8,7 @@ export(getFormula)
export(getIsotope)
export(getMass)
export(getMolecule)
export(getMono)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can I have getMonoisotopic ? The abbreviation looses meaning without context

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure.

#' @param ele Character vector of elements to count particularly or counting all contained in string if NULL.
#' @return A named numeric with counts for all contained or specified elements.
#' @references This function is a copy from the `CorMID` package by Jan Lisec.
#' It is not (and should bot be) exported in Rdisop but only used internally.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about starting internal function with a dot, .CountChemicalElements()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine with me.

R/getMolecule.R Outdated
@@ -3,25 +3,29 @@
#' @aliases getMass
#'
#' @description Parse the sum formula and calculate the theoretical exact mass
#' and the isotope distribution.
#' and the isotope distribution for an approximate MS resolution of 20,000.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the 20.000 come from the Boecker paper ? For sure there is no isotope fine structure.
Maybe mention that instead ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In enviPat it is possible to adjust the resolution. By comparing the results with Rdisop I estimated what is probably internally used. I feel it is important for the user to get an approximate idea of the resolution he can expect. However, if you feel uncomfortable to provide this number, feel free to change to 'no isotope fine structure' instead.

R/getMolecule.R Outdated
#' exact mass and the isotope distribution.
#' The exact mass is the mass of the most abundant isotope and is not
#' identical with the monoisotopic mass. The latter can be extracted using
#' the function `getMono()`. This function can also be supplied with a
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if getMono() is changed, then here as well.

Copy link
Contributor Author

@janlisec janlisec Oct 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. There are more instances (e.g. the Changes-document and probably a testthat file). Please Search and replace the whole package.

@janlisec
Copy link
Contributor Author

janlisec commented Nov 4, 2024

@sneumann I am not sure about how we proceed. :/ Will you make the changes while accepting the PR or shall I open another PR where the modifications are incorporated? Bests, Jan

@sneumann
Copy link
Owner

sneumann commented Nov 5, 2024

Hi, no need for a separate PR. You can go ahead and fix/rename things, push to your janlisec:devel and these changed automagically go into this PR here. Worst case ping me again, and I can merge all in one go. Yours, Steffen

@janlisec
Copy link
Contributor Author

janlisec commented Nov 5, 2024

@sneumann Worked as suggested. :) I smuggled an additional modification in which adresses issue #3. Basically I use .CountChemicalElements to pre-check a sum formula submitted to getMolecule to avoid C++ crashes occuring in case of syntactically incorrect formulas. Bests, Jan

@sneumann
Copy link
Owner

sneumann commented Nov 5, 2024

Merged & Pushed as 1.67.1 to https://bioconductor.org/checkResults/devel/bioc-LATEST/Rdisop/
Thanks Jan ! Yours, Steffen

@sneumann
Copy link
Owner

sneumann commented Nov 5, 2024

Hm, maybe my manual changes prevented GitHub from seeing it was merged in e70ef18

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

Successfully merging this pull request may close these issues.

2 participants