Code Monkey home page Code Monkey logo

Comments (14)

stanstrup avatar stanstrup commented on August 16, 2024 1

The function you need is MZ_CAMERA. A tibble is returned. I understand the desire the keep dependencies limited. I kept it this way just because it is easier to work with. The adducts are color coded by type so you can easier get an overview when actually working with the table. Also you avoid that if people add things to the table excel has a nasty desire to change the delimiter in csv files (based on the machine locale).

from compounddb.

jorainer avatar jorainer commented on August 16, 2024 1

Thanks! I'm now importing the definitions directly from your commonMZ package with the MZ_CAMERA function 👍

from compounddb.

jorainer avatar jorainer commented on August 16, 2024 1

Aaaah! Yes! You're right! I used res and z as variable names and got mislead by the R function names! It should be:

mass -> m/z

mz <- (adduct$nmol * mass + adduct$massdiff) / adduct$charge

m/z -> mass

mass <- (adduct$charge * mz - adduct$massdiff) / adduct$nmol

from compounddb.

jorainer avatar jorainer commented on August 16, 2024

Eventually we should add an optional ifNotFound parameter to choose what to do if the adduct definition was not found with options NA, "error".

from compounddb.

stanstrup avatar stanstrup commented on August 16, 2024

Maybe these are useful: https://github.com/stanstrup/commonMZ/tree/master/inst/extdata

I don't remember if the inchi is in there but if so you can also check if the compound is in neutral state. For example Anthocyanins have a persistent charge. If you don't account for that you will get the wrong m/z.

from compounddb.

jorainer avatar jorainer commented on August 16, 2024

Awesome! Nice ressource indeed! I did take the definitions from the camera rules. I'll also check the other files. Once the code is in place I'd really appreciate if you look through to see if all is correct.

from compounddb.

stanstrup avatar stanstrup commented on August 16, 2024

Great.
Would it not make sense to take the data directly from the commonMZ package? There are function to get the data so you don't need to read the excel file on your side. It is a dedicated package now.

from compounddb.

jorainer avatar jorainer commented on August 16, 2024

That would make sense indeed. I would just need a data.frame with the content of the xls files - what functions would I need to get these?

Other question: is it needed to have these files as xls files? If they were tab delimited text files I could simply load them with read.table ... and we could reduce the number of dependencies.

from compounddb.

stanstrup avatar stanstrup commented on August 16, 2024

Btw. I saw that you add instructions to install dependencies. Those should work automatically when you install the package I assume.
Even github packages can be automatically handled with devtools if you define them as remote in the description file. e.g. Remotes: stanstrup/commonMZ

from compounddb.

jorainer avatar jorainer commented on August 16, 2024

Thanks @stanstrup! I knew there was something like that, but couldn't remember. I've added commonMZ now as a remote.

from compounddb.

jorainer avatar jorainer commented on August 16, 2024

BTW, just to be on the safe side: @stanstrup can you just check that I'm converting correctly?

To calculate masses from m/z (adduct below is the adduct data.frame from commonMZ:

mass <- (adduct$nmol * mz + adduct$massdiff) / adduct$charge

and other way round:

mzr <- (adduct$charge * mass - adduct$massdiff) / adduct$nmol

I cross-checked with some compounds/adducts in HMDB, but it's never bad to have a second look at it.

from compounddb.

stanstrup avatar stanstrup commented on August 16, 2024

Don't you have mz/mass exchanged? I assume by mass you mean the neutral mass.

from compounddb.

jorainer avatar jorainer commented on August 16, 2024

yes, mass is the neutral (monoisotopic) mass.

Could be that I mixed it up - am quite confused at present. How would you then calculate the adduct m/z if you have the mass and vice versa?

from compounddb.

stanstrup avatar stanstrup commented on August 16, 2024

Yes now I have the same as you :-)

from compounddb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.