[Rdkit-discuss] Getting chemical reactions from BRICS or RECAP fragmentation

2019-03-11 Thread Peyrat Gautier

Hello,

recently I tried to find retrosynthetic routes for some molecules.
I thought that using BRICS or RECAP fragmentation would give me 
fragments of the molecules and chemical reactions to build the molecule 
back.
But it seems that the chemical reactions used to fragments the molecules 
aren't stored anywhere in both modules.


I followed RECAP and BRICS implementations from 
https://www.rdkit.org/docs/GettingStartedInPython.html.
I also checked in the documentation 
https://www.rdkit.org/docs/source/rdkit.Chem.Recap.html and 
https://www.rdkit.org/docs/source/rdkit.Chem.BRICS.html.


Could you please tell me how can I get chemical reactions when I 
fragment a molecule with BRICS or RECAP ?


Regards

Gautier Peyrat,
PhD student

--
Signature
*PEYRAT Gautier *   


/Chemoinformatics PhD Student
/
* Institute of Organic and Analytical Chemistry
 ICOA UMR7311*
 Université d'Orléans - Pôle de Chimie
 Rue de Chartres - BP 6759
 45067 Orléans Cedex 2 - France
   +33 (0)2 38 
49 45 77 
SBC Tool Platform  - SBC Team 


 
 


 
 






___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


[Rdkit-discuss] Partial join of molecular fragments

2019-03-11 Thread Marco Podda
Hello,
first of all, many thanks for this awesome library.

I have little to none knowledge of chemistry, so I hope you'll excuse me if
I say some chemical nonsense below.

I have a fragmented molecule (fragmentation being done with the BRICS
implementation in rdkit) which (for example) looks like this:

frags = ['[8*]C(C)(C)C',  '[16*]c1ccc2occ([16*])c2c1']

Say I want to join the two fragments in the list. Then, I would write:

from rdkit import Chem
from rdkit.Chem import BRICS
frags = ['[8*]C(C)(C)C',  '[16*]c1ccc2occ([16*])c2c1']
molfrags = [Chem.MolFromSmiles(f) for f in frags]
combined = list(BRICS.BRICSBuild(molfrags, maxDepth=1))[0] # maxDepth=1
gives me 1 result in this case
print(Chem.MolToSmiles(combined, True)) # 'CC(C)(C)c1ccc2occ(C(C)(C)C)c2c1'

If I understood this code correctly, BRICSBuild has reacted both dummy
spots in the second fragment with the dummy spot in the first fragment.
However, I would like to perform a partial join, meaning joining the first
fragment only with one of the two dummy spots in the second fragment. In
practice, I'm looking for a result like this:

'CC(C)(C)c1ccc2occ([16*])c2c1'
or
[16*]c1ccc2occ(C(C)(C)C)c2c1'

Is there a way in rdkit to achieve this?
Again, sorry for the poor chemical jargon and if I make not much sense from
a chemical point of view.

Thank you.
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] Partial join of molecular fragments

2019-03-11 Thread Greg Landrum
Hi Marco,

Welcome to the mailing list!

The trick in this particular case is that you want to do a maxDepth of 0
(that means a single iteration) and to tell BRICSBuild that you're willing
to see incomplete molecules (i.e. molecules that still contain a dummy
atom):

In [22]: from rdkit import Chem
...: from rdkit.Chem import BRICS
...: frags = ['[8*]C(C)(C)C',  '[16*]c1ccc2occ([16*])c2c1']
...: molfrags = [Chem.MolFromSmiles(f) for f in frags]
...: print(list(Chem.MolToSmiles(x) for x in BRICS.BRICSBuild(molfrags,
onlyCompleteMols=False, maxDepth=0)))
['[16*]c1coc2ccc(-c3ccc4occ([16*])c4c3)cc12',
'[16*]c1ccc2occ(-c3ccc4occ([16*])c4c3)c2c1',
'[16*]c1ccc2occ(-c3coc4ccc([16*])cc34)c2c1',
'[16*]c1coc2ccc(C(C)(C)C)cc12', '[16*]c1ccc2occ(C(C)(C)C)c2c1']


The results with two [16*] attachment points happen because there's a rule
that allows [16*] - [[16*] bonds to be formed. This wasn't in the original
BRICS paper but it is consistent with the rest of the rules, so we added it.

I hope this helps,
-greg





On Mon, Mar 11, 2019 at 3:37 PM Marco Podda 
wrote:

> Hello,
> first of all, many thanks for this awesome library.
>
> I have little to none knowledge of chemistry, so I hope you'll excuse me
> if I say some chemical nonsense below.
>
> I have a fragmented molecule (fragmentation being done with the BRICS
> implementation in rdkit) which (for example) looks like this:
>
> frags = ['[8*]C(C)(C)C',  '[16*]c1ccc2occ([16*])c2c1']
>
> Say I want to join the two fragments in the list. Then, I would write:
>
> from rdkit import Chem
> from rdkit.Chem import BRICS
> frags = ['[8*]C(C)(C)C',  '[16*]c1ccc2occ([16*])c2c1']
> molfrags = [Chem.MolFromSmiles(f) for f in frags]
> combined = list(BRICS.BRICSBuild(molfrags, maxDepth=1))[0] # maxDepth=1
> gives me 1 result in this case
> print(Chem.MolToSmiles(combined, True)) # 'CC(C)(C)c1ccc2occ(C(C)(C)C)c2c1'
>
> If I understood this code correctly, BRICSBuild has reacted both dummy
> spots in the second fragment with the dummy spot in the first fragment.
> However, I would like to perform a partial join, meaning joining the first
> fragment only with one of the two dummy spots in the second fragment. In
> practice, I'm looking for a result like this:
>
> 'CC(C)(C)c1ccc2occ([16*])c2c1'
> or
> [16*]c1ccc2occ(C(C)(C)C)c2c1'
>
> Is there a way in rdkit to achieve this?
> Again, sorry for the poor chemical jargon and if I make not much sense
> from a chemical point of view.
>
> Thank you.
> ___
> 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


[Rdkit-discuss] AM1-BCC charges for small molecules

2019-03-11 Thread James T. Metz via Rdkit-discuss
RDkit Discussion Group,
    I am interested in generating and assigning AM1-BCC charges to small 
molecules,
preferably in batch mode.  I understand this topic has been discussed 
previously, buthas there been RDkit code written to do this?  Since this relies 
on the results of AM1 calculations, has anyone perhaps written RDkit code to 
calculate and assign the charges if I have already generated a MOPAC output 
file by some other means? 
    I greatly appreciate all the capabilities of RDkit, and not to be 
off-topic, but if someone is aware of a non-RDkit way to generate AM1-BCC 
charges, that might workfor me.  Hence, please let me know.  Thank you. 
    Regards,
    Jim Metz


___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] AM1-BCC charges for small molecules

2019-03-11 Thread Paolo Tosco

Dear Jim,

you can do that quite conveniently using antechamber from the AmberTools 
 package.


antechamber takes as input formats PDB, MOL2 and MOL, so it should be 
pretty straightforward for you to interface it with the RDKit.


Please feel free to get back to me off-list if you get into trouble.

Cheers,
p.

On 03/11/19 18:55, James T. Metz via Rdkit-discuss wrote:

RDkit Discussion Group,

    I am interested in generating and assigning AM1-BCC charges to 
small molecules,
preferably in batch mode.  I understand this topic has been discussed 
previously, but
has there been RDkit code written to do this?  Since this relies on 
the results of AM1
calculations, has anyone perhaps written RDkit code to calculate and 
assign the
charges if I have already generated a MOPAC output file by some other 
means?


    I greatly appreciate all the capabilities of RDkit, and not to be 
off-topic, but if
someone is aware of a non-RDkit way to generate AM1-BCC charges, that 
might work

for me.  Hence, please let me know. Thank you.

    Regards,
    Jim Metz






___
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


Re: [Rdkit-discuss] AM1-BCC charges for small molecules

2019-03-11 Thread kz fm
Dear Jim,

You can assign RESP charge to small molcules using psikit, and if psi4
implemented AM1-BCC charge you can also assign them to molecules.
But I don't know whether it implements AM1-BCC charge.

https://github.com/Mishima-syk/psikit
http://forum.psicode.org/t/calculate-the-resp-and-am1-bcc-charges-of-a-molecule/1276

Regards,
Kazufumi

On Tue, Mar 12, 2019 at 4:23 AM Paolo Tosco 
wrote:

> Dear Jim,
>
> you can do that quite conveniently using antechamber from the AmberTools
>  package.
>
> antechamber takes as input formats PDB, MOL2 and MOL, so it should be
> pretty straightforward for you to interface it with the RDKit.
>
> Please feel free to get back to me off-list if you get into trouble.
>
> Cheers,
> p.
> On 03/11/19 18:55, James T. Metz via Rdkit-discuss wrote:
>
> RDkit Discussion Group,
>
> I am interested in generating and assigning AM1-BCC charges to small
> molecules,
> preferably in batch mode.  I understand this topic has been discussed
> previously, but
> has there been RDkit code written to do this?  Since this relies on the
> results of AM1
> calculations, has anyone perhaps written RDkit code to calculate and
> assign the
> charges if I have already generated a MOPAC output file by some other
> means?
>
> I greatly appreciate all the capabilities of RDkit, and not to be
> off-topic, but if
> someone is aware of a non-RDkit way to generate AM1-BCC charges, that
> might work
> for me.  Hence, please let me know.  Thank you.
>
> Regards,
> Jim Metz
>
>
>
>
>
>
> ___
> Rdkit-discuss mailing 
> listRdkit-discuss@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
>
> ___
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>


-- 
# -*- coding: kzfm -*-
http://www.kzfmix.com
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] AM1-BCC charges for small molecules

2019-03-11 Thread Francois Berenger

On 12/03/2019 03:55, James T. Metz via Rdkit-discuss wrote:

RDkit Discussion Group,

I am interested in generating and assigning AM1-BCC charges to
small molecules,


You can do it with Chimera.

Cf. 
http://www.cgl.ucsf.edu/chimera/current/docs/ContributedSoftware/addcharge/addcharge.html


Though you would have to create a script to do it efficiently for 
several molecules.


---
#!/usr/bin/python2

# convert a single molecule 3D .sdf with hydrogens to a .mol2 with 
AM1-BCC partial charges


from chimera import runCommand, openModels
from AddCharge import estimateNetCharge
import os, sys

# I need an env. var to pass the input file name, so that chimera 
doesn't

# try to read that file
sdf = os.environ['INPUT_FILE']

runCommand("open " + sdf)
molecule = openModels.list()[0]
net_charge = estimateNetCharge(molecule.atoms)
runCommand("addcharge nonstd #0 " + str(net_charge) + " method am1")
runCommand("write format mol2 #0 " + sdf[:-4] + ".mol2")
runCommand("close all")
---

I also had a shell script on top of that, to process a single molecule.

---
#!/bin/bash

# convert a .sdf to a .mol2 with partial charges assigned by chimera's 
AM1-BCC FF


# trick to pass an input_file to the python script and not having 
chimera

# try to interprete that file
export INPUT_FILE=$1

chimera --nogui --script ~/bin/chimeraAM1-BCC.py
---

Please ask the chimera ML if you need more help.

I don't guarantee those scripts still work.

Regards,
F.


preferably in batch mode.  I understand this topic has been discussed
previously, but
has there been RDkit code written to do this?  Since this relies on
the results of AM1
calculations, has anyone perhaps written RDkit code to calculate and
assign the
charges if I have already generated a MOPAC output file by some other
means?

I greatly appreciate all the capabilities of RDkit, and not to be
off-topic, but if
someone is aware of a non-RDkit way to generate AM1-BCC charges, that
might work
for me.  Hence, please let me know.  Thank you.

Regards,

Jim Metz
___
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


Re: [Rdkit-discuss] Getting chemical reactions from BRICS or RECAP fragmentation

2019-03-11 Thread Greg Landrum
Hi Gautier,

An obligatory disclaimer: I assume you know this already, but for anyone
else who doesn't... neither BRICS nor RECAP are really intended for
retrosynthesis. They identify bond types that tend to be possible to make
synthetically, and they encode the transformations for forming the bonds,
but they don't directly tell you which real-world chemical reaction would
form that bond (or even if such a thing exists).

The RDKit doesn't have anything directly builtin that does what you want,
but you can use what is there to approximate it.

BRICS and RECAP are implemented differently for historical reasons, so you
need a slightly different approach for each. I'll demonstrate for BRICS,
because I prefer it to RECAP.

This gist shows has the complete code I used:
https://gist.github.com/greglandrum/45bc872f81f36f4ac0d378166708eb9e
Here I'll just explain the key steps

The BRICS module does have a list of the BRICS reactions and the SMARTS
that defines them. You can start by getting those into a flat list using
the function chain from Python's itertools module):
   all_rxns = list(chain.from_iterable(BRICS.reactions))

Now the key is to loop over the reactions and keep track of which ones can
apply to the molecule you're interested in. Rather than saving those, I
save the SMARTS that defines them:

applicable = []

for i,(rxn,rxnD) in enumerate(zip(rxns,rxnDefs)):
if rxn.IsMoleculeReactant(mol):
applicable.append((i,rxnD))


at that point you have the list of all BRICS reactions that apply to your
molecule which is, I think, what you're looking for.

Best,
-greg



On Mon, Mar 11, 2019 at 10:05 AM Peyrat Gautier <
gautier.pey...@univ-orleans.fr> wrote:

> Hello,
>
> recently I tried to find retrosynthetic routes for some molecules.
> I thought that using BRICS or RECAP fragmentation would give me fragments
> of the molecules and chemical reactions to build the molecule back.
> But it seems that the chemical reactions used to fragments the molecules
> aren't stored anywhere in both modules.
>
> I followed RECAP and BRICS implementations from
> https://www.rdkit.org/docs/GettingStartedInPython.html.
> I also checked in the documentation
> https://www.rdkit.org/docs/source/rdkit.Chem.Recap.html and
> https://www.rdkit.org/docs/source/rdkit.Chem.BRICS.html.
>
> Could you please tell me how can I get chemical reactions when I fragment
> a molecule with BRICS or RECAP ?
>
> Regards
>
> Gautier Peyrat,
> PhD student
> --
> *PEYRAT Gautier *  
> 
>
> *Chemoinformatics PhD Student *
>
> * Institute of Organic and Analytical Chemistry  ICOA UMR7311*
>  Université d'Orléans - Pôle de Chimie
>  Rue de Chartres - BP 6759
>  45067 Orléans Cedex 2 - France
>    +33 (0)2 38 49
> 45 77 <+33%202%2038%2049%2045%2077>
>  SBC Tool Platform  - SBC Team
> 
>  
>
> 
>  
>
> 
>
>
> ___
> 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