Hi Per,

I can think of 2 approaches to solve this.

The 1st is to have fragments of molecules that have an explicit connection
point, i.e. OH[*] and CCCCC[*], and use RDKit's functionality of combining
fragments.
The 2nd is to use define a reaction for this using SMIRKS or Reaction
SMILES, i.e. [OH-].CCCCC>>CCCCCOH, and use RDKit's reaction functionality
to perform the reaction on your molecules.

Hope this was a bit helpful.

Regards,

Christos

Christos Kannas

Chem[o]informatics Researcher & Software Developer

[image: View Christos Kannas's profile on LinkedIn]
<http://cy.linkedin.com/in/christoskannas>

On 7 August 2017 at 18:46, Per Jr. Greisen <pgrei...@gmail.com> wrote:

> Hi Nikolaus and Ling,
>
> Thanks for your help (the atom numbe shouldnt be 43 but it still gives the
> error I will clarify)- yes Nikolaus you are right it is a sanitization
> issue and in this case I am trying to use it as a molecular editor to build
> a model molecule (a transition state model to be exact) - I would normally
> do this calling some other script but it would be very nice to do all of it
> in the framework of RDkit - can this be done? Thanks
>
> On Mon, Aug 7, 2017 at 12:05 PM, Stiefl, Nikolaus <
> nikolaus.sti...@novartis.com> wrote:
>
>> Hi Per
>>
>> Just by looking at your code I would assume you have a sanitization
>> issue. You create your pentane molecule and then add H’s. This will
>> saturate each single carbon. When you then add a bond between the two
>> fragments your atom 3 will have a valence of 5 and this causes issues.
>>
>> Maybe do the fragment combination first and then add the H’s? Or do an
>> explicit handling of the correct carbon you link to upfront.
>>
>> Hope this helps
>>
>> Nik
>>
>>
>>
>>
>>
>> *From: *"Per Jr. Greisen" <pgrei...@gmail.com>
>> *Date: *Sunday 6 August 2017 at 19:55
>> *To: *RDKit <rdkit-discuss@lists.sourceforge.net>
>> *Subject: *[Rdkit-discuss] adding fragment to existing molecule
>>
>>
>>
>> Hi all,
>>
>>
>>
>> I am trying to add a fragment to an existing molecule using RDkit - I
>> start by generating the desired molecules I would like to combine:
>>
>>
>>
>> oh = '[OH-]'
>>
>> ohh = Chem.MolFromSmiles(oh)
>>
>> oh = Chem.AddHs(ohh)
>>
>> oh.SetProp("_Name","OH-")
>>
>> AllChem.EmbedMolecule(oh, AllChem.ETKDG())
>>
>>
>>
>> smiles_ = 'CCCCC'
>>
>> m = Chem.MolFromSmiles(smiles_)
>>
>> m_h = Chem.AddHs(vxm)
>>
>> m_h.SetProp("_Name","XP")
>>
>> AllChem.EmbedMolecule(m_h, AllChem.ETKDG())
>>
>>
>>
>> I combine them which works fine:
>>
>>
>>
>> combo = Chem.CombineMols(m_h,oh)
>>
>>
>>
>> and I can add the bond between the desired atoms:
>>
>>
>>
>>
>>
>> edcombo = Chem.EditableMol(combo)
>>
>>
>>
>> edcombo.AddBond(3,1,order=Chem.rdchem.BondType.SINGLE)
>>
>> back = edcombo.GetMol()
>>
>>
>>
>> The problems arises when I want to edit the geometry between the two :
>>
>>
>>
>> from rdkit.Chem import rdMolTransforms as rdmt
>>
>> conf = back.GetConformer(0)
>>
>>
>>
>> rdmt.SetBondLength(conf,3,43,10)
>>
>>
>>
>> writer3 = Chem.SDWriter('out_long.sdf')
>>
>> writer3.write(back,confId=0)
>>
>>
>>
>>
>>
>>
>>
>> RuntimeError                              Traceback (most recent call last)
>>
>> <ipython-input-193-36d3c0480a45> in <module>()
>>
>> *      2* conf = back.GetConformer(0)
>>
>> *      3*
>>
>> ----> 4 rdmt.SetBondLength(conf,3,43,10)
>>
>> *      5*
>>
>> *      6* writer3 = Chem.SDWriter('out_long.sdf')
>>
>>
>>
>> RuntimeError: Pre-condition Violation
>>
>>         RingInfo not initialized
>>
>>         Violation occurred on line 66 in file Code/GraphMol/RingInfo.cpp
>>
>>         Failed Expression: df_init
>>
>>         RDKIT: 2017.03.3
>>
>>         BOOST: 1_56
>>
>>
>>
>> So I am not sure how fix - thanks in advance
>>
>>
>>
>>
>>
>> --
>>
>> With kind regards
>>
>>
>> Per
>>
>
>
>
> --
> With kind regards
>
> Per
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to