Thanks Maciek, that's exactly what I need.
Best,
Antonio
El 19/01/2018 a las 10:38, Maciek Wójcikowski escribió:
Hi Antionio,
OpenBabel generates new labels, unless there are already OBResiude
info on that. You can set it to whatever you want with
OBResiude.SetAtomID(). Checkout the script below:
import pybel
ob = pybel.ob
mol = pybel.readstring('smi', 'c1ccccc1')
res = ob.OBResidue()
for atom in ob.OBMolAtomIter(mol.OBMol):
res.AddAtom(atom)
res.SetAtomID(atom, '%s%i' %
(ob.OBElementTable().GetSymbol(atom.GetAtomicNum()), atom.GetIdx()))
print(mol.write('mol2'))
Note that if you use the -xl option the residue will be ignored, but
you can name the residue to whatever you want via res.SetName('BLAH')
----
Pozdrawiam, | Best regards,
Maciek Wójcikowski
mac...@wojcikowski.pl <mailto:mac...@wojcikowski.pl>
2018-01-18 23:57 GMT+01:00 Antonio Jesus Banegas Luna
<ajbane...@alu.ucam.edu <mailto:ajbane...@alu.ucam.edu>>:
Hello all,
I'm a newby in obabel and I need a bit of help.
I use obabel to convert a file from sdf to mol2 format because
another program requires such conversion.
The conversion is fine, and I get something like this (I only show
the ATOM block):
@<TRIPOS>ATOM
1 C 0.5825 -1.4943 0.8613 C.ar 1
LIG1 0.0063
2 C -0.4113 -2.1197 1.6364 C.ar 1
LIG1 0.0421
3 C -1.7701 -1.8708 1.3728 C.ar 1
LIG1 0.1957
4 O -2.7253 -2.4643 2.1262 O.3 1
LIG1 -0.2866
5 C -2.1325 -1.0044 0.3248 C.ar 1
LIG1 0.0421
However, the third-party software requires something like this:
@<TRIPOS>ATOM
1 C*1* 0.5825 -1.4943 0.8613 C.ar 1
LIG1 0.0063
2 C*2* -0.4113 -2.1197 1.6364 C.ar 1
LIG1 0.0421
3 C*3* -1.7701 -1.8708 1.3728 C.ar 1
LIG1 0.1957
4 O*1* -2.7253 -2.4643 2.1262 O.3 1
LIG1 -0.2866
5 C*4* -2.1325 -1.0044 0.3248 C.ar 1
LIG1 0.0421
Now, my question is: is there any way of forcing obabel to
generate atom names in the required format?
Maybe someone has some experience with this.
Thanks in advance,
Antonio
--
Antonio J. Banegas Luna
Bioinformatics and High Performance Computing Research Group
ajbane...@alu.ucam.edu <mailto:ajbane...@alu.ucam.edu>
http://orcid.org/0000-0003-1158-8877
<http://orcid.org/0000-0003-1158-8877>
http://www.researcherid.com/rid/O-7331-2016
<http://www.researcherid.com/rid/O-7331-2016>
https://scholar.google.es/citations?user=EWtHIUMAAAAJ
<https://scholar.google.es/citations?user=EWtHIUMAAAAJ>
https://www.researchgate.net/profile/Antonio_Jesus_Banegas_Luna
<https://www.researchgate.net/profile/Antonio_Jesus_Banegas_Luna>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
<mailto:OpenBabel-discuss@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
<https://lists.sourceforge.net/lists/listinfo/openbabel-discuss>
--
Antonio J. Banegas Luna
Bioinformatics and High Performance Computing Research Group
ajbane...@alu.ucam.edu
http://orcid.org/0000-0003-1158-8877
http://www.researcherid.com/rid/O-7331-2016
https://scholar.google.es/citations?user=EWtHIUMAAAAJ
https://www.researchgate.net/profile/Antonio_Jesus_Banegas_Luna
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss