Hi,

There is AtomContainerAtomPermutor, which has a method
containerFromPermutation - although note that this clones the original
atom container first. However, note that the method does nothing to
the bonds as the atom references in the bonds are not indexes in the
atom array but object references.

On the other hand, I find this stuff surprisingly hard to think about
- especially getting permutations the right way round (new_atom[p[i]]
= old_atom[i], for example). So I might have it wrong of course.
Corrections welcome!

gilleain

On 9/11/13, Nick Vandewiele <[email protected]> wrote:
> Hi,
>
> Another question:
> Once I find the new, canonical atom number of a particular atom: how do I
> set this atom number in the original atom container?
> If I just do this:
>
> for(IAtom at : mol.atoms()) mol.setAtom(newNumber, at);
>
> It messes up the references to the bonds, etc. It's too intrusive, because
> it doesn't acknowledge the fact that a new atom has taken that place in the
> array with that specific atom number.
>
> Is there a helper class that does all this "blue collar" work and resets
> references to this newly added atom?
> What do you suggest?
>
> Regards,
> Nick
>
>
> -----Original Message-----
> From: Nick Vandewiele [mailto:[email protected]]
> Sent: Wednesday, September 11, 2013 10:09 AM
> To: 'gilleain torrance'
> Cc: [email protected]
> Subject: Re: [Cdk-user] renumbering of atoms according to inchi
> canonicalization scheme?
>
> Hi Gilleain,
> Thanks for the answer.
> Looks like a nice alternative. However, I can't seem to figure out where
> certain things are located. I'm using CDK-1.5.3.
> CDKInChI is a missing class, InchiReader.getPermutationFromAuxInfo(String)
> is missing too. I changed InchiReader to
> org.openscience.cdk.io.INChIReader.
>
> Should I revert to another version of CDK, or is this functionality sitting
> somewhere in a side project? Or 3rd: is this supposed to be pseudo code and
> do I need to fill in the gaps? :)
>
> Regards,
> Nick
> -----Original Message-----
> From: gilleain torrance [mailto:[email protected]]
> Sent: Tuesday, September 10, 2013 4:59 PM
> To: Nick Vandewiele
> Cc: [email protected]
> Subject: Re: [Cdk-user] renumbering of atoms according to inchi
> canonicalization scheme?
>
> Hi Nick,
>
> Sorry, no - there is no implementation of the InChI canonicalization
> routine
> in the CDK (that I know of!) that doesn't involve actually generating the
> InChI using the c-libraries.
>
> The best you can get is to do something like:
>
>     public int[] getCanonicalPermutation(IAtomContainer container) {
>         int atomCount = container.getAtomCount();
>         try {
>             CDKInChI cdkInchi = new CDKInChI();
>             List<INCHI_OPTION> options = new ArrayList<INCHI_OPTION>();
>             options.add(INCHI_OPTION.DoNotAddH);
>             cdkInchi.getInChI(container, options);   // do nothing with it!
>             String auxInfo = cdkInchi.getAuxinfo();
>             int[] permutation =
> InchiReader.getPermutationFromAuxInfo(auxInfo);
>             int[] invP = new int[atomCount];
>             for (int i = 0; i < atomCount; i++) {
>                 invP[permutation[i]] = i;
>             }
>             return invP;
>         } catch (CDKException c) {
>             int[] permutation = new int[atomCount];
>             for (int index = 0; index < atomCount; index++) {
>                 permutation[index] = index;
>             }
>             return permutation;
>         }
>     }
>
> which will give you a permutation of the atoms according to the inchi.
> Of course, it generates an inchi at the same time...
>
> gilleain
>
> On 9/10/13, Nick Vandewiele <[email protected]> wrote:
>> Hi,
>>
>>
>>
>> Imagine I created an IAtomContainer by adding atom after atom. Now I
>> want to reorder the atoms so that their atom numbers comply to the
>> rules of the canonicalization scheme of inchi. I want to do that
>> without actually generating the inchi of the atom container and
>> re-using the inchi to create a new atom container. Just reshuffling
>> the atom numbers so that they are canonical.
>>
>>
>>
>> Does CDK have something that does this?
>>
>>
>>
>>
>>
>> regards
>>
>> Nick
>>
>>
>>
>>
>
>
> ----------------------------------------------------------------------------
> --
> How ServiceNow helps IT people transform IT departments:
> 1. Consolidate legacy IT systems to a single system of record for IT 2.
> Standardize and globalize service processes across IT 3. Implement
> zero-touch automation to replace manual, redundant tasks
> http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk
> _______________________________________________
> Cdk-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/cdk-user
>
>

------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. Consolidate legacy IT systems to a single system of record for IT
2. Standardize and globalize service processes across IT
3. Implement zero-touch automation to replace manual, redundant tasks
http://pubads.g.doubleclick.net/gampad/clk?id=51271111&iu=/4140/ostg.clktrk
_______________________________________________
Cdk-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cdk-user

Reply via email to