Thank you for both of your suggestions, Craig, both are informative
and will do the job. I'm in a hurry to get a result quickly now, so I
think I'll go with your suggestion to modify the appropriate line to
make babel print out the Z coordinate for now, and will work on your
other suggestion when I will be generating a clean and efficient
version of my code (soon).

But in any case, all of this solves my problem really well.

Thank you very much for your help!

On Sun, Feb 21, 2010 at 10:19 AM, Craig A. James <cja...@emolecules.com> wrote:
> 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&#174; 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
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to