Java - Problems retrieving atoms/bonds via indices in a mapped subgroup

Hi all,

I’m having real trouble trying to perform two modifications to molecular structures via the Java molecular toolkit:

-         - Inserting atoms between a bond (e.g – C-C-C -> C-X-C-C, where X is a new atom );

-         - Forming bonds between non-neighbouring atoms at a MINIMUM distance of 5 atoms away (to create rings, SMILES example - CCCCCC -> C1CCCC1C ).

I am using the SGMapper class (the Sub-group mapper) to map query fragments onto molecules (e.g – I were to map

Say, an amide bond using a SMARTS query onto a molecule like glutathione).

If I submit a query like CC(=O)NC (amide between carbons), I want a guaranteed way of inserting atom only between the bond

In the middle of the query (in this case, the oxygen’s double bond if I choose the 2nd bond as the middle, or the oxygen atom).

However, to account for rings & branching atoms, the indices of atoms/bonds in any of these mapped queries are not linear in

A molecule object!

As of such, I have so far failed to understand how I can do this, short of extracting the SMILES string, looking at the string (via my query)

& mutating that instead, & then re-creating the modified molecule from this.

A similar issue exists with creating rings – If I supply a query (for example to find 2 carbons 5 atoms apart from each other), how do

I can I be guaranteed to retrieve the ‘end’ carbons (at the flanks of the query)?

Thanks in advance,

Edmund