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

decomposeIsotopes it doesnt seem to apply element min/max #12

Open
Rennepink opened this issue Dec 13, 2018 · 1 comment
Open

decomposeIsotopes it doesnt seem to apply element min/max #12

Rennepink opened this issue Dec 13, 2018 · 1 comment

Comments

@Rennepink
Copy link

Hi,

Thank you for the great package!
I'm trying to test it to generate possible molecules based on isotopic score.
min <- c("C3","H0","N0", "S0", "Cl0", "O0", "Br")
I have two questions:
1- It doesn't seem like that the function decomposesiotope is applying the minimum number of 3 carbon, when it generates formulas? There are few formulas with no carbon at all!
cbind(getFormula(molecules), getScore(molecules), getValid(molecules))

2- what is the order of the generated formulas, and how are they generated? Is it based on matching isotopic pattern?

I try to use isotopScore function to calculate isotopic score for my formulas that are generated using above:
molecule <- c("C8F17SO3")
masses <- c(498.9328, 500.9350, 499.9372)
intensities <- c(102, 10, 5)
isotopeScore(molecule, masses, intensities, elements = NULL, filter = NULL, z = -1)
This gives me error "$ operator is invalid for atomic vectors"

Thank you in advance for your time!

@janlisec
Copy link
Contributor

janlisec commented Nov 8, 2024

Hi @Rennepink,
I am currently trying to solve issues which did arise over the last years. Si, in case you are still using Rdisop:

Regarding the first part of your issue, the functions decomposeMass and decomposeIsotopes do respect minimum and maximum allowed values for elements when specified as a moledular formula. For the next release of Rdisop I updated the help section with appropriate examples:

> # use m/z=48 as an example
> getMolecule("CHOF")$exact
[1] 48.00114
> ele <- initializeElements(c("C","H","N","O","P","S","F"))
> getFormula(decomposeMass(48, mzabs = 0.003, elements = ele))
[1] "C4"   "H3NP" "CHOF"
> # works
> getFormula(decomposeMass(48, mzabs = 0.003, elements = ele, minElements = "H"))
[1] "H3NP" "CHOF"
> getFormula(decomposeMass(48, mzabs = 0.003, elements = ele, maxElements = "H2"))
[1] "C4"   "CHOF"
> getFormula(decomposeMass(48, mzabs = 0.003, elements = ele, maxElements = "H2", minElements = "CHF"))
[1] "CHOF"

Regarding the second part of your issue, the function isotopeScore does allow to calculate what you intended. However, you need to provide it with a molecule as a parameter and not a formula. Also, the masses parameter should be ordered. So, to write your example corretly:

> molecule <- getMolecule("C8F17SO3")
> masses <- c(498.9328, 499.9372, 500.9350)
> intensities <- c(102, 10, 5)
> Rdisop::isotopeScore(molecule, masses, intensities)
    C8F17O3S 
2.435789e-13 

Here, I also did amend the help section with appropriate examples for the next release.

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