Comments (14)
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.
Thanks! I'm now importing the definitions directly from your commonMZ
package with the MZ_CAMERA
function
from compounddb.
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.
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.
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.
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.
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.
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.
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.
Thanks @stanstrup! I knew there was something like that, but couldn't remember. I've added commonMZ
now as a remote.
from compounddb.
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.
Don't you have mz/mass exchanged? I assume by mass you mean the neutral mass.
from compounddb.
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.
Yes now I have the same as you :-)
from compounddb.
Related Issues (20)
- Create an IonDb with all theoretical adducts for a CompoundDb
- Function to combine/concatenate CompDb databases
- Add an insertCompound function HOT 1
- Availability of functions to create empty CompDB and insert and delete compounds HOT 2
- Seeking suggestions for database development (HMDB version 5) HOT 2
- Pass skipErrors to read.SDFset through compound_tbl_sdf? HOT 4
- Replace mass2mz and mz2mass with the ones from MetaboCoreUtils
- Rename table "compound" into "ms_compound"
- Implement a StandardsDb that extends CompoundDb HOT 11
- Update the MsBackendCompDb HOT 1
- insertIon method HOT 4
- non integer msLevel values HOT 3
- Add possibility to delete (inserted or existing) ions or MS/MS spectra
- Prepare for Bioconductor submission HOT 3
- Arbitrary columns in insertIon
- Transfer of CompoundDb
- Support import from MoNa MSP files HOT 1
- custom Db - spectra and ion Db questions HOT 2
- Issue with GitHub install of CompoundDb HOT 3
- mass2mz method for CompDb HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from compounddb.