Suppose we have 2 fragments, A and B, with free valences marked as
some dummy atoms. For example, A=CH3* and B=HO*. We want a general
method to combine A and B, in this example the result should be CH3OH.
There are at least 3 ways to do it.
1. Use the trick from SMILIB: replace dummies with %11, and then parse
A+"."+B. The problem is that although this is how SMILIB is
implemented, this approach is, in general, incorrect: it works if and
only if the dummy is preceded by the atom connected to it. It does
work for certain cases, though, at least when implemented with
OpenBabel (I never managed to make it work with RDKit).
2. Use Reaction SMARTS. Not so easy to implement properly, and quite
slow for large molecules (but unlike the above, will always work
correctly).
In this example, Cl and Br are used as dummy atoms.
>>> from rdkit.Chem import AllChem
>>> ps=rxnJoin.RunReactants((Chem.MolFromSmiles('C[Cl]'),Chem.MolFromSmiles('CC[Br]')))
>>> Chem.MolToSmiles(ps[0][0],True)
'CCC'
3. Use AllChem.ReplaceSubstructs.
joined=AllChem.ReplaceSubstructs(A,dummy_in_A,processed_B)[0]
where processed_B is obtained from B by: removing the dummy atom and
renumbering the atoms so the linking atom (which was connected to the
dummy) has index 0. Renumbering could be obviated if ReplaceSubstructs
had an additional argument specifying the linking atom (looking at the
C sources, it seems quite easy to add this parameter).
Best wishes,
Michal
On 29 Nov 2013 16:27, "Nicholas Firth" <[email protected]> wrote:
>
> Hi RDKitters,
>
> This may be a silly question, but I'm wondering if there's any functionality
> in RDKit to add two molecules together? I've been writing to SMILES and
> joining with a '.' and then reading back in. This feels very cludgy.
>
> Basically I have two fragments of molecules and I want to add them into one
> EditableMol and join these fragments to construct a single molecule.
>
> Thanks in advance.
>
> Best,
> Nick
>
> Nicholas C. Firth | PhD Student | Cancer Therapeutics
> The Institute of Cancer Research | 15 Cotswold Road | Belmont | Sutton |
> Surrey | SM2 5NG
> T 020 8722 4033 | E [email protected] | W www.icr.ac.uk | Twitter
> @ICRnews
>
> The Institute of Cancer Research: Royal Cancer Hospital, a charitable Company
> Limited by Guarantee, Registered in England under Company No. 534147 with its
> Registered Office at 123 Old Brompton Road, London SW7 3RP.
>
> This e-mail message is confidential and for use by the addressee only. If
> the message is received by anyone other than the addressee, please return the
> message to the sender by replying to it and then delete the message from your
> computer and network.
>
> ------------------------------------------------------------------------------
> Rapidly troubleshoot problems before they affect your business. Most IT
> organizations don't have a clear picture of how application performance
> affects their revenue. With AppDynamics, you get 100% visibility into your
> Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
> http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk
> _______________________________________________
> Rdkit-discuss mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss