Thank you Francois, I took a look at your code and borrowed parts of it to
rejoin two molecules. It seems like my problem is solved. I eventually
arrived at something like example 4 in
https://www.programcreek.com/python/example/123334/rdkit.Chem.CombineMols
(which I discovered a bit late).

Still, I am not sure if the code is safe. In particular, I wonder if the
following conditions are always valid.

   1. Chem.CombineMols simply concatenates the atomic indices from the
   input molecules.
   2. The Chem.EditableMol constructor preserves atom ordering from the
   input.
   3. RemoveAtom in EditableMol results in all indices above the deleted to
   decrease by one, i.e. atom ordering is preserved.

Thank you!

Ling


Francois Berenger <mli...@ligand.eu> 於 2021年3月31日週三 下午5:27寫道:

> On 01/04/2021 04:55, Ling Chan wrote:
> > Dear Colleagues,
> >
> > I am trying to do something that I think is quite simple, but I have
> > not figured out a simple way. Don't know if I am missing something. I
> > am sure that ultimately I can figure it out, but I wonder if there is
> > a good way.
> >
> > I fragmented a molecule with some rules, using FragmentOnBonds. I did
> > get a list of primary fragments.
>
> I have an ad hoc fragmenting scheme and fragment assembly
> implemented in there:
>
> https://github.com/UnixJunkie/molenc/blob/master/bin/molenc_smisur.py
>
> Sorry, but this is non trivial code.
>
> Look for the function bind_molecules to connect two fragments.
>
> The rdkit python doc might have some simpler examples, using
> well-known/published fragmenting schemes
> (BRICS or Recap):
> http://www.rdkit.org/docs/GettingStartedInPython.html
>
> Regards,
> F.
>
> > I wish to recombine pairs (and triplets, but no bigger) of these
> > primary fragments, but only if the resulting fragment is part of the
> > original molecule. I.e. I want to undo some of the cuttings.
> > (FragmentOnSomeBonds does not help, since you cannot ensure that the
> > resulting fragments consist only of pairs of primary fragments.)
> >
> > What is the best way to do this? The following is what I am trying.
> >
> > I see that you can mark the original cut points using the dummyLabels
> > argument in FragmentOnBonds. So I converted the primary fragments to
> > smiles. I looked for the two sides of the original cut point and
> > substituted the two dummyLables to [2H] and [3H]. I then tried to
> > rejoin the fragments using a reaction string
> > "[*:1][2H].[*:2][3H]>>[*:1][*:2]". Unfortunately the
> > ReactionFromSmarts function does not accept this string. So I'll have
> > to use Smarts search to look for [2H] and [3H], then create an
> > editable molecule from the two primary fragments, look for neighbours
> > of [2H] and [3H], add a bond, then delete the atoms [2H] and [3H],
> > then sanitize.
> >
> > Thank you for your ideas.
> >
> > Ling
> > _______________________________________________
> > Rdkit-discuss mailing list
> > Rdkit-discuss@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to