Jim,
I don't know which language you are using, but in Python I do it by iterating 
the atoms in 
a given residue, then using them as argument for the GetAtomID() method of the 
residue.
=================
import pybel
ob = pybel.ob
import sys

mol = pybel.readfile('mol2', sys.argv[1]).next()
obmol = mol.OBMol

for res in ob.OBResidueIter(obmol):
     for atom in ob.OBResidueAtomIter(res):
         atName = res.GetAtomID(atom)
         print "Atom name:", atName
=================
Not exactly the most straightforward way, but I couldn't find any better, and 
it works for me.

Hope this helps,

S

On 07/17/2014 02:40 PM, Jim Parker wrote:
> Hello,
>    I would like to read and modify the atom names from a .mol2 file.
>
> I have been working through the tutorials and documentation for the API, and
> I can read in the file, and write a file, and I see that the names are parsed 
> correctly in
> the output file, so I'm confident that the OBMol object has the information, 
> but I'm
> confused as to where I can find it.
>
> I assumed it would be in each OBAtom object, but the only string value is 
> .GetTtitle() and
> .SetTitle() but those are blank.
> I've tried Google and searches on this mailing list.
> There is an old post
> http://sourceforge.net/p/openbabel/mailman/openbabel-devel/thread/caokanmena-r1f+n_ggvn00lj_cegtvydmxzcxaado1d+spg...@mail.gmail.com/
>
> for .cif formats involving OBPairData, but there is no "_atom_site_label" 
> found for my
> molecule.
>
> Just trying to find out where that information is stored.
> Any help would be appreciated.
>
> Cheers,
> --Jim
>

-- 
  Stefano Forli, PhD

  Staff Scientist
  Molecular Graphics Laboratory
  Dept. of Integrative Structural
   and Computational Biology, MB-112F
  The Scripps Research Institute
  10550  North Torrey Pines Road
  La Jolla,  CA 92037-1000,  USA.

     tel: (858) 784-2055
     fax: (858) 784-2860
     email: fo...@scripps.edu
     http://www.scripps.edu/~forli/

------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to