On 11/13/2013 05:08 PM, Geoffrey Hutchison wrote:

... I mean, do you want
> something which says carbon-11 is basically nonexistent? If so, no you
> can't use Open Babel for that since we don't store or tabulate the
> abundance of isotopes, only the isotopic masses and the mass for the most
> common form.

What I want is to not have to copy-paste for the millionth time the
table that lists the isotopes of H, C, N, O, P, and S, into yet another
script. Especially if that script is already using the library that
already has that information.

I was looking at share/openbabel/2.3.2/isotope.txt, it has the "list of
isotopes as int, float pairs corresponding to masses". It should be
possible to access that list and specifically its int elements --
assuming that's the source for isotope table (I guess it probably isn't).

How about this: do you think the last bit of output below is reasonable?

>>> mol = pybel.readstring("smi","C(=O)=O")
>>> mol.molwt
44.009500000000003
>>> mol.OBMol.BeginModify()
>>> for atom in mol.atoms :
...     if atom.OBAtom.IsCarbon() : atom.OBAtom.SetIsotope( 7 )
...
>>> mol.OBMol.EndModify()
>>> mol.molwt
31.998799999999999
>>>
>>> mol.OBMol.BeginModify()
>>> for atom in mol.atoms :
...     if atom.OBAtom.IsCarbon() : atom.OBAtom.SetIsotope( 5 )
...
>>> mol.OBMol.EndModify()
>>> mol.molwt
31.998799999999999
>>>


-- 
Dimitri Maziuk
Programmer/sysadmin
BioMagResBank, UW-Madison -- http://www.bmrb.wisc.edu

Attachment: signature.asc
Description: OpenPGP digital signature

------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to