mobiusklein / brainpy

A Python implementation of Baffling Recursive Algorithm for Isotopic distributioN calculations
http://mobiusklein.github.io/brainpy
Apache License 2.0
19 stars 10 forks source link

Isotopically-labeled compounds #3

Closed im281 closed 4 years ago

im281 commented 4 years ago

Is there support for isotopically labeled compounds? (e.g. C13 or C13N15 od Deuterated)

mobiusklein commented 4 years ago

Yes. I realize the documentation on this library is pretty sparse.

If you have a fixed isotope e.g. C13 which is 100% 6 protons and 7 neutrons, you can specify that as "C[13]" as a key in the Mapping you give to isotopic_variants or in a formula.

An example with a plain six carbon monosaccharide:

>>>brainpy.isotopic_variants({"C": 6, "H": 12, "O": 6})
[Peak(mz=180.063388, intensity=0.922712, charge=0),
 Peak(mz=181.066831, intensity=0.063261, charge=0),
 Peak(mz=182.068007, intensity=0.013221, charge=0),
 Peak(mz=183.071174, intensity=0.000805, charge=0)]
# One heavy oxygen, note how the m/z is shifted and how a greater proportion
# of signal is in the first peak.
>>> brainpy.isotopic_variants({"C": 6, "H": 12, "O": 5, "O[18]": 1})
[Peak(mz=182.067634, intensity=0.924937, charge=0),
 Peak(mz=183.071073, intensity=0.063061, charge=0),
 Peak(mz=184.072309, intensity=0.011328, charge=0),
 Peak(mz=185.075433, intensity=0.000673, charge=0)]
mobiusklein commented 4 years ago

Improved error handling and documentation were added in af2b730

I'll close this, but if you have further questions feel free to open it again.