Leonid,
> I was converting SDF molecules into canonical SMILES, but in my case,
> I would like to keep the correspondence between the (order of
> appearance) index of the SDF file atoms and the (order of appearance)
> index of the atoms in the newly created SMILES string.
>
> Would you say this is possible without first making the conversion and
> then doing graph isomorphism? Since I am doing large numbers of
> conversions, efficiency is of great importance and this proposition is
> not efficient at all, it would seem.
>
> I know this is probably very simple, but I have not gone too much into
> detail of the inner workings of OpenBabel, so it's difficult for me to
> solve currently. I appreciate any advice anyone here may offer.
As Chris said, it is not practical to write SMILES with the atoms in a specific
order.
I suggest you use the more "traditional" way. You write out the canonical
SMILES, and you also write out an atom-mapping string that correlates the
canonical order to the original order. For example:
CCO ==> OCC 2,1,0
c1c(O)cccc1 ==> Oc1ccccc1 2,1,0,6,5,4,3
The canonical atom order is already stored as a sting. I haven't compiled this
example, but it shows the idea:
if (mol.HasData("Canonical Atom Order")) {
vector<string> vs;
string canorder = mol.GetData("Canonical Atom Order")->GetValue();
ofs << " " << canorder << endl;
}
}
Once you have this string, you can use it to build a simple array that maps the
canonical order back to the original order, or vice versa.
Craig
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
OpenBabel-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss