Re: [Rdkit-discuss] Aligning in 3D

2016-04-22 Thread Greg Landrum
Hi Kirk,

Paolo has already pointed out the tools to use if you want to have control
over the process. There's also a convenience function available,
AllChem.ConstrainedEmbed(), that makes the process a bit easier:
http://www.rdkit.org/docs/api/rdkit.Chem.AllChem-module.html#ConstrainedEmbed

Best,
-greg



On Fri, Apr 22, 2016 at 10:14 PM, Robert DeLisle 
wrote:

> In working with RDKit I've been able to align 2D structures based upon a
> common core of MCS using
>
> AllChem.GenerateDepictionMatching2DStructure(m,p)
>
> The next step for me is to generate 3D structures and align them based
> upon that same common core.  Obviously this leads to multiple steps, not
> the least of which is generating conformations that are consistent across
> the common core for the various molecules.  I seem to recall the ability to
> generate a conformation and minimize it (either UFF or MMFF) and apply
> constraints based upon an input substructure, but I cannot find the details.
>
> Any tips to accomplish this one?
>
> -Kirk
>
>
>
>
> --
> Find and fix application performance issues faster with Applications
> Manager
> Applications Manager provides deep performance insights into multiple
> tiers of
> your business applications. It resolves application problems quickly and
> reduces your MTTR. Get your free trial!
> https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
> ___
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
>
--
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] Aligning in 3D

2016-04-22 Thread Paolo Tosco

Dear Kirk,

in $RDBASE/Code/ForceField/Wrap/testConstraints.py you'll find examples 
how to set constraints on internal coordinates
with {MM,U}FFAddDistanceConstraint(), {MM,U}FFAddAngleConstraint(), 
{MM,U}FFAddTorsionConstraint. You may also set harmonic positional 
constraints on Cartesian coordinates with 
{MM,U}FFAddPositionConstraint() and fix atoms by setting their gradient 
to 0 during minimization with AddFixedPoint().


The relevant Python API documentation is here:

http://www.rdkit.org/docs/api/rdkit.ForceField.rdForceField.ForceField-class.html

Cheers,
p.


On 04/22/2016 09:14 PM, Robert DeLisle wrote:
In working with RDKit I've been able to align 2D structures based upon 
a common core of MCS using


AllChem.GenerateDepictionMatching2DStructure(m,p)

The next step for me is to generate 3D structures and align them based 
upon that same common core.  Obviously this leads to multiple steps, 
not the least of which is generating conformations that are consistent 
across the common core for the various molecules.  I seem to recall 
the ability to generate a conformation and minimize it (either UFF or 
MMFF) and apply constraints based upon an input substructure, but I 
cannot find the details.


Any tips to accomplish this one?

-Kirk




--
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z


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


--
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] PyMOL from RDKit? (Resurrection)

2016-04-22 Thread Paolo Tosco

Dear Robert,

I have just built the latest PyMOL 1.8.2.0 on CentOS 7, I started it:

pymol -R

and then I ran the following Python script:

#!/usr/bin/env python

import os
import rdkit
from rdkit import Chem
from rdkit.Chem import PyMol
from rdkit.Chem import AllChem

s = PyMol.MolViewer()
mol = Chem.MolFromSmiles \
  ('CCOCCn1c(C2CC[NH+](CCc3ccc(C(C)(C)C(=O)[O-])cc3)CC2)nc2c21')
mol = AllChem.AddHs(mol)
AllChem.EmbedMolecule(mol)
AllChem.MMFFOptimizeMolecule(mol)
s.ShowMol(mol, name = 'bilastine', showOnly = False)
s.Zoom('bilastine')
s.SetDisplayStyle('bilastine', 'sticks')

I obtained the expected display:



Cheers,
p.

On 04/22/2016 09:09 PM, Robert DeLisle wrote:

Back again!

I apologize for resurrecting an old topic, but I'm once again trying 
to work with PyMOL through RDKit.  I've been following the approach in 
this thread 
(http://www.mail-archive.com/rdkit-discuss%40lists.sourceforge.net/msg00325.html) 
but it seems not to work any longer.  I'm using PyMOL 1.8 on Fedora 
and I see that the xml-rpc file is current, so that's no longer a 
problem.  When I step through the process and hit this step:


s.ShowMol(m,name='ligand',showOnly=False)

nothing happens in the PyMOL viewer. It just remains blank.  
Any updates on operating with PyMOL?


-Kirk



--
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z


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


--
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


[Rdkit-discuss] Aligning in 3D

2016-04-22 Thread Robert DeLisle
In working with RDKit I've been able to align 2D structures based upon a
common core of MCS using

AllChem.GenerateDepictionMatching2DStructure(m,p)

The next step for me is to generate 3D structures and align them based upon
that same common core.  Obviously this leads to multiple steps, not the
least of which is generating conformations that are consistent across the
common core for the various molecules.  I seem to recall the ability to
generate a conformation and minimize it (either UFF or MMFF) and apply
constraints based upon an input substructure, but I cannot find the details.

Any tips to accomplish this one?

-Kirk
--
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


[Rdkit-discuss] PyMOL from RDKit? (Resurrection)

2016-04-22 Thread Robert DeLisle
Back again!

I apologize for resurrecting an old topic, but I'm once again trying to
work with PyMOL through RDKit.  I've been following the approach in this
thread (
http://www.mail-archive.com/rdkit-discuss%40lists.sourceforge.net/msg00325.html)
but it seems not to work any longer.  I'm using PyMOL 1.8 on Fedora and I
see that the xml-rpc file is current, so that's no longer a problem.  When
I step through the process and hit this step:

s.ShowMol(m,name='ligand',showOnly=False)

nothing happens in the PyMOL viewer.  It just remains blank.

Any updates on operating with PyMOL?

-Kirk
--
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] conformation search and constraints

2016-04-22 Thread Paolo Tosco
Dear Rafal,


On 22/04/2016 17:15, Rafal Roszak wrote:
> Hello,
>
> I want to find:
> A) "global minimum" [*] for given compound(s) and
> B) (for the same compound) minimum with constraint(s) (e.g. frozen
> angle)
>
> For problem A) I tried folowing code:
>
> self.MOLEC=Chem.MolFromSmiles(SMILES)
> self.MOLEC=Chem.AddHs(self.MOLEC)
> allconf=Chem.rdDistGeom.EmbedMultipleConfs(self.MOLEC,
> numConfs=HowMany, enforceChirality=True, pruneRmsThresh=limitRMS) for
> confId in range(len(allconf)): AllChem.UFFOptimizeMolecule(self.MOLEC,
> maxIters=12540, confId=confId) self.ff =
> AllChem.UFFGetMoleculeForceField(self.MOLEC) energy_value = str
> (self.ff.CalcEnergy()) print (energy_value)
>
Here you do generate and optimize many conformations, but then you 
retrieve the force-field with UFFGetMoleculeForceField() always for 
conformation -1 (the default), hence you get the same energy.
I slightly modified your script (see below) to actually generate a few 
dozens of diverse conformations:

#!/usr/bin/env python

import sys
import rdkit
from rdkit import Chem
from rdkit.Chem import AllChem

SMILES = 'CCOCCn1c(C2CC[NH+](CCc3ccc(C(C)(C)C(=O)[O-])cc3)CC2)nc2c21'
HowMany = 100
limitRMS = 2.0

mol = Chem.MolFromSmiles(SMILES)
mol = AllChem.AddHs(mol)
allconf = AllChem.EmbedMultipleConfs(mol,
   numConfs = HowMany, enforceChirality=True, pruneRmsThresh = limitRMS)
w = Chem.SDWriter(sys.stdout)
for confId in allconf:
   ff = AllChem.UFFGetMoleculeForceField(mol, confId = confId)
   ff.Minimize()
   energy_value = ff.CalcEnergy()
   mol.SetProp('ENERGY', '{0:.2f}'.format(energy_value))
   w.write(mol, confId = confId)
w.close()


> No matter what values are used for the numConfs or pruneRmsThresh after
> optimization I end up in conformer(s) with the same energy. The energy
> value vary from one run to another. In other words EmbedMultipleConfs()
> generate random structure (that make sense to me) but all conformation
> are very similar - after optimization all fall into one structure. Is
> it bug or feature? :) How effectively generate set of _different_
> conformation? I found two solution: a) execute presented above code
> multiple times b) set dihedral angle to unnatural value (using
> Chem.rdMolTransforms.SetDihedralDeg() function) for selected dihedral
> angle and then minimize structure Both works but seems to me that both
> are not optimal.
>
>
> For problem B:
>
> I want to minimize structure with frozen dihedral angle. I set the
> angle value using Chem.rdMolTransforms.SetDihedralDeg I could not find
> any possibility to freeze angle so I used
> rdForceField.ForceField.MMFFAddTorsionConstraint function. with very
> high forceConstant (relative=True minDihedralDeg=-5, maxDihedralDeg=5,
> forceConstant=999.9). The code is as follow:
>
>
> conformers=Chem.rdDistGeom.EmbedMultipleConfs(self.MOLEC,numConfs=confNum, 
> enforceChirality=enforceChirality,numThreads=numThreads, 
> pruneRmsThresh=RMSThreshold)
> for confId in range(len(conformers)):
>   ff = AllChem.UFFGetMoleculeForceField(self.MOLEC, confId=confId)
>  rdForceField.ForceField.MMFFAddTorsionConstraint( ff, idx0, idx1, 
> idx2, idx3, True, minDihedralDeg=-5, maxDihedralDeg=5, 
> forceConstant=999.9)
>   Chem.rdMolTransforms.SetDihedralDeg(self.MOLEC.GetConformer(confId), 
> idx0, idx1, idx2, idx3, 0.0 )
>   AllChem.UFFOptimizeMolecule(self.MOLEC, maxIters=12540, confId=confId)
>
> but it does not work - i end up in structure with dihedral value far from 
> this which was set. How can I force optimization with defined value (or some 
> range of values)? In other words what I am doing wrong?
The problem here is that you are setting the constraint in MMFF and then 
use UFF for minimization; furthermore MMFFAddTorsionConstraint() and 
UFFAddTorsionConstraint() are member functions of the respective 
force-fields. Please find below a sample script which should do what you 
describe; here I read the value of the dihedral before and after 
minimization, to verify that it is actually frozen.

#!/usr/bin/env python

import sys
import rdkit
from rdkit import Chem
from rdkit.Chem import AllChem

SMILES = 'CCOCCn1c(C2CC[NH+](CCc3ccc(C(C)(C)C(=O)[O-])cc3)CC2)nc2c21'
HowMany = 100
limitRMS = 2.0

mol = Chem.MolFromSmiles(SMILES)
mol = AllChem.AddHs(mol)
tors = mol.GetSubstructMatch(Chem.MolFromSmarts('cCC[NH+]'))
allconf = AllChem.EmbedMultipleConfs(mol,
   numConfs = HowMany, enforceChirality=True, pruneRmsThresh = limitRMS)
w = Chem.SDWriter(sys.stdout)
for confId in allconf:
   ff = AllChem.UFFGetMoleculeForceField(mol, confId = confId)
   before = AllChem.GetDihedralDeg(mol.GetConformer(confId),
   tors[0], tors[1], tors[2], tors[3])
   ff.UFFAddTorsionConstraint(tors[0], tors[1], tors[2], tors[3],
 True, -5, 5, )
   ff.Minimize()
   energy_value = ff.CalcEnergy()
   after = AllChem.GetDihedralDeg(mol.GetConformer(confId),
   tors[0], tors[1], tors[2], tors[3])
   mol.SetProp('DIHEDRAL', '{0:.2f},{1:.2f}'.format \

[Rdkit-discuss] conformation search and constraints

2016-04-22 Thread Rafal Roszak
Hello,

I want to find: 
A) "global minimum" [*] for given compound(s) and 
B) (for the same compound) minimum with constraint(s) (e.g. frozen
angle)

For problem A) I tried folowing code:

self.MOLEC=Chem.MolFromSmiles(SMILES)
self.MOLEC=Chem.AddHs(self.MOLEC)
allconf=Chem.rdDistGeom.EmbedMultipleConfs(self.MOLEC,
numConfs=HowMany, enforceChirality=True, pruneRmsThresh=limitRMS) for
confId in range(len(allconf)): AllChem.UFFOptimizeMolecule(self.MOLEC,
maxIters=12540, confId=confId) self.ff =
AllChem.UFFGetMoleculeForceField(self.MOLEC) energy_value = str
(self.ff.CalcEnergy()) print (energy_value)


No matter what values are used for the numConfs or pruneRmsThresh after
optimization I end up in conformer(s) with the same energy. The energy
value vary from one run to another. In other words EmbedMultipleConfs()
generate random structure (that make sense to me) but all conformation
are very similar - after optimization all fall into one structure. Is
it bug or feature? :) How effectively generate set of _different_
conformation? I found two solution: a) execute presented above code
multiple times b) set dihedral angle to unnatural value (using
Chem.rdMolTransforms.SetDihedralDeg() function) for selected dihedral
angle and then minimize structure Both works but seems to me that both
are not optimal.


For problem B:

I want to minimize structure with frozen dihedral angle. I set the
angle value using Chem.rdMolTransforms.SetDihedralDeg I could not find
any possibility to freeze angle so I used
rdForceField.ForceField.MMFFAddTorsionConstraint function. with very
high forceConstant (relative=True minDihedralDeg=-5, maxDihedralDeg=5,
forceConstant=999.9). The code is as follow:


conformers=Chem.rdDistGeom.EmbedMultipleConfs(self.MOLEC,numConfs=confNum, 
enforceChirality=enforceChirality,numThreads=numThreads, 
pruneRmsThresh=RMSThreshold)
for confId in range(len(conformers)):
ff = AllChem.UFFGetMoleculeForceField(self.MOLEC, confId=confId)
rdForceField.ForceField.MMFFAddTorsionConstraint( ff, idx0, idx1, idx2, 
idx3, True, minDihedralDeg=-5, maxDihedralDeg=5, forceConstant=999.9)
Chem.rdMolTransforms.SetDihedralDeg(self.MOLEC.GetConformer(confId), 
idx0, idx1, idx2, idx3, 0.0 )
AllChem.UFFOptimizeMolecule(self.MOLEC, maxIters=12540, confId=confId)

but it does not work - i end up in structure with dihedral value far from this 
which was set. How can I force optimization with defined value (or some range 
of values)? In other words what I am doing wrong?

Regards,

Rafal




[*] Yes I aware that it is very complex task to find a true global
minima but I only want to find reasonably good/stable conformer, that
why I wrote "global minimum"

--
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] ReactionFromSmarts and RunReactants

2016-04-22 Thread 吴玲
Now I think I know and I very much look forward to  a more detailed 
documentation.

many thanks,

-Monica




At 2016-04-22 17:48:39, "Greg Landrum"  wrote:

There isn't great documentation for this, but the way the current code works is 
reasonably simple.
If your reaction has two products (i.e. two molecules separated by a dot), you 
will get two products (i.e. two separate molecules) when you call 
RunReactants(); that's what you asked for.


Here's a very simple illustration of that with some silly isotope labels to 
make it easier to see what's happening:

In [33]: rxn = AllChem.ReactionFromSmarts("[CH:1][O:2]>>[C:1].[O:2]")

In [34]: ps = 
rxn.RunReactants((Chem.MolFromSmiles('[13CH2]1[12CH2][14CH2]O[15CH]1N'),))

In [35]: len(ps)

Out[35]: 1

In [36]: len(ps[0])

Out[36]: 2

In [37]: Chem.MolToSmiles(ps[0][0],True)

Out[37]: '[14CH2][12CH2][13CH2][15CH2]N'

In [39]: Chem.MolToSmiles(ps[0][1],True)

Out[39]: '[13CH2][12CH2][14CH2]O'

If you draw the molecule and the products, I think you'll see what's going on.





If you are just interested in breaking a bond, you need to use "component level 
grouping", like this:

In [40]: rxn = AllChem.ReactionFromSmarts("[CH:1][O:2]>>([C:1].[O:2])")

In [41]: ps = 
rxn.RunReactants((Chem.MolFromSmiles('[13CH2]1[12CH2][14CH2]O[15CH]1N'),))

In [42]: len(ps)

Out[42]: 1

In [43]: len(ps[0])

Out[43]: 1

In [44]: Chem.MolToSmiles(ps[0][0],True)

Out[44]: 'N[15CH2][13CH2][12CH2][14CH2]O'

That formulation says, in effect, "[C:1] and [O:2] should be in the same 
product molecule, but there should be no bond between them".




I should probably do a blog post on this and then incorporate it into the 
documentation.





I hope this helps clear things up,

-greg






On Fri, Apr 22, 2016 at 11:31 AM, 吴玲  wrote:

Hi  Grégori,

Maybe I don't have a clear understanding of this function, I know the dot 
represent disconncction of two fragments ,and I suppose  changes  just occurs 
in mapped molecular fragment, the remaining part of reactant is invariable, in 
other words, if  mapped molecular fragment  breaks based on input pattern, the 
rest of the reactant is maintained.
So I still expect one site breaks, both ends would be connected by in-between 
atons .Maybe I shoud deep study the documentation of rdkit and  SMARTS 
definition.
Thank for your helps!

Monica








At 2016-04-22 16:32:39, greg...@gerebtzoff.com wrote:
>Hi Monica,
>
>As Greg stated, why do you expect your product not to be fragmented?
>I suggest you to have a careful look at the SMARTS definition (for 
>instance from Daylight: 
>http://www.daylight.com/dayhtml/doc/theory/theory.smarts.html)
>In SMARTS patterns, the dot indicates disconnected fragments. Thus you 
>obtain in your product... disconnected fragments.
>
>Best,
>
>Grégori
>
>
>Le 2016-04-22 10:13, 吴玲 a écrit :
>> Greg,
>> 
>> After changing the pattern into
>> "[C:1][C:2](=[O:3])[N+0:4][C:5]=[C:6][C:7]([O-:8])=[O:9].[OH2:10].[OH2:11]>>[C:1][C:2]([O-:10])=[O:3].[O:8]=[C:7]=[O:9].[N+:4].[C:6][C:5]=[O:11]
>> , I get the same result .A ring structure just like you said is broken
>> into pieces.
>> pattern:[C:1][C:2](=[O:3])[N+0:4][C:5]=[C:6][C:7]([O-:8])=[O:9].[OH2:10].[OH2:11]>>[C:1][C:2]([O-:10])=[O:3].[O:8]=[C:7]=[O:9].[N+:4].[C:6][C:5]=[O:11]
>> 
>> output:[O-]C(=O)C1=CNC(=O)CC1.O.O>>CCC(=O)[O-].O=C=[O-].[NH4+].CCC=O
>> 
>> The input reactant ([O-]C(=O)C1=CNC(=O)CC1) if mapped with
>> pattern'reactants ,it should be "
>> [O-:8][C:7](=[O:9])[C:6]1=[C:5][N:4][C:2](=[O:3])[C:1][C:*]1,
>> 
>> what I mean is that the input reactant with a ring that CARBON6
>> connect with CARBON1 by CARBON* ,why the CARBON6  AND  CARBON1 IN THE
>> product is not connected by the CARBON* ?
>> 
>> Thanks a lot,
>> 
>> -Monica
>> 
>> At 2016-04-20 12:43:36, "Greg Landrum"  wrote:
>> 
>>> Monica,
>>> 
>>> Why do you think you should get a single chain from the ring
>>> structure?
>>> If you look at the atom mapping in your input reaction:
>>> 
>>> 
>> [C:1][C:2](=[O:3])[N+0:4][C:5]=[C:6][C:7]([O-:8])=[O:9].[OH2:10].[OH2:11]>>[C:1][C:2]([O-:10])=[O:3].[O:7]=[C:8]=[O:9].[N+:4].[C:6][C:5]=[O:11]
>>> 
>>> You've told it to put:
>>> - carbons 1 and 2 from the reactant into product 1
>>> - carbon 8 into product 2, carbon 7 into product 2 but converted
>>> into an oxygen first.
>>> - carbon 5 and 6 into product 4. In other words: you requested that
>>> the input molecule be broken into pieces.
>>> 
>>> The atom mapping tells you which atoms in the reactants correspond
>>> to which atoms in the products.
>>> 
>>> I would suggest that you look carefully at your reaction
>>> definitions, in particular the atom mapping numbers, in Marvin and
>>> make sure that you think that what you're asking for makes sense.
>>> 
>>> -greg
>>> 
>>> On Wed, Apr 20, 2016 at 6:04 AM, 吴玲 
>>> wrote:
>>> 
 Hi Greg,
 
 Thanks a lot for previous help! There is another question in
 RunReactants I want to ask for some help.
 
 when I input the pattern as
 
>>> 
>> “[C:1][

Re: [Rdkit-discuss] ReactionFromSmarts and RunReactants

2016-04-22 Thread Greg Landrum
There isn't great documentation for this, but the way the current code
works is reasonably simple.
If your reaction has two products (i.e. two molecules separated by a dot),
you will get two products (i.e. two separate molecules) when you call
RunReactants(); that's what you asked for.

Here's a very simple illustration of that with some silly isotope labels to
make it easier to see what's happening:

In [33]: rxn = AllChem.ReactionFromSmarts("[CH:1][O:2]>>[C:1].[O:2]")

In [34]: ps =
rxn.RunReactants((Chem.MolFromSmiles('[13CH2]1[12CH2][14CH2]O[15CH]1N'),))

In [35]: len(ps)

Out[35]: 1

In [36]: len(ps[0])

Out[36]: 2

In [37]: Chem.MolToSmiles(ps[0][0],True)

Out[37]: '[14CH2][12CH2][13CH2][15CH2]N'

In [39]: Chem.MolToSmiles(ps[0][1],True)

Out[39]: '[13CH2][12CH2][14CH2]O'

If you draw the molecule and the products, I think you'll see what's going
on.


If you are just interested in breaking a bond, you need to use "component
level grouping", like this:

In [40]: rxn = AllChem.ReactionFromSmarts("[CH:1][O:2]>>([C:1].[O:2])")

In [41]: ps =
rxn.RunReactants((Chem.MolFromSmiles('[13CH2]1[12CH2][14CH2]O[15CH]1N'),))

In [42]: len(ps)

Out[42]: 1

In [43]: len(ps[0])

Out[43]: 1

In [44]: Chem.MolToSmiles(ps[0][0],True)

Out[44]: 'N[15CH2][13CH2][12CH2][14CH2]O'

That formulation says, in effect, "[C:1] and [O:2] should be in the same
product molecule, but there should be no bond between them".


I should probably do a blog post on this and then incorporate it into the
documentation.


I hope this helps clear things up,

-greg



On Fri, Apr 22, 2016 at 11:31 AM, 吴玲  wrote:

> Hi  Grégori,
>
> Maybe I don't have a clear understanding of this function, I know the dot
> represent disconncction of two fragments ,and I suppose  changes  just
> occurs in mapped molecular fragment, the remaining part of reactant is
> invariable, in other words, if  mapped molecular fragment  breaks based on
> input pattern, the rest of the reactant is maintained.
> So I still expect one site breaks, both ends would be connected by
> in-between atons .Maybe I shoud deep study the documentation of rdkit and
> SMARTS definition.
> Thank for your helps!
>
> Monica
>
>
>
>
>
> At 2016-04-22 16:32:39, greg...@gerebtzoff.com wrote:
> >Hi Monica,
> >
> >As Greg stated, why do you expect your product not to be fragmented?
> >I suggest you to have a careful look at the SMARTS definition (for
> >instance from Daylight:
> >http://www.daylight.com/dayhtml/doc/theory/theory.smarts.html)
> >In SMARTS patterns, the dot indicates disconnected fragments. Thus you
> >obtain in your product... disconnected fragments.
> >
> >Best,
> >
> >Grégori
> >
> >
> >Le 2016-04-22 10:13, 吴玲 a écrit :
> >> Greg,
> >>
> >> After changing the pattern into
> >> "[C:1][C:2](=[O:3])[N+0:4][C:5]=[C:6][C:7]([O-:8])=[O:9].[OH2:10].[OH2:11]>>[C:1][C:2]([O-:10])=[O:3].[O:8]=[C:7]=[O:9].[N+:4].[C:6][C:5]=[O:11]
> >> , I get the same result .A ring structure just like you said is broken
> >> into pieces.
> >> pattern:[C:1][C:2](=[O:3])[N+0:4][C:5]=[C:6][C:7]([O-:8])=[O:9].[OH2:10].[OH2:11]>>[C:1][C:2]([O-:10])=[O:3].[O:8]=[C:7]=[O:9].[N+:4].[C:6][C:5]=[O:11]
> >>
> >> output:[O-]C(=O)C1=CNC(=O)CC1.O.O>>CCC(=O)[O-].O=C=[O-].[NH4+].CCC=O
> >>
> >> The input reactant ([O-]C(=O)C1=CNC(=O)CC1) if mapped with
> >> pattern'reactants ,it should be "
> >> [O-:8][C:7](=[O:9])[C:6]1=[C:5][N:4][C:2](=[O:3])[C:1][C:*]1,
> >>
> >> what I mean is that the input reactant with a ring that CARBON6
> >> connect with CARBON1 by CARBON* ,why the CARBON6  AND  CARBON1 IN THE
> >> product is not connected by the CARBON* ?
> >>
> >> Thanks a lot,
> >>
> >> -Monica
> >>
> >> At 2016-04-20 12:43:36, "Greg Landrum"  wrote:
> >>
> >>> Monica,
> >>>
> >>> Why do you think you should get a single chain from the ring
> >>> structure?
> >>> If you look at the atom mapping in your input reaction:
> >>>
> >>>
> >> [C:1][C:2](=[O:3])[N+0:4][C:5]=[C:6][C:7]([O-:8])=[O:9].[OH2:10].[OH2:11]>>[C:1][C:2]([O-:10])=[O:3].[O:7]=[C:8]=[O:9].[N+:4].[C:6][C:5]=[O:11]
> >>>
> >>> You've told it to put:
> >>> - carbons 1 and 2 from the reactant into product 1
> >>> - carbon 8 into product 2, carbon 7 into product 2 but converted
> >>> into an oxygen first.
> >>> - carbon 5 and 6 into product 4. In other words: you requested that
> >>> the input molecule be broken into pieces.
> >>>
> >>> The atom mapping tells you which atoms in the reactants correspond
> >>> to which atoms in the products.
> >>>
> >>> I would suggest that you look carefully at your reaction
> >>> definitions, in particular the atom mapping numbers, in Marvin and
> >>> make sure that you think that what you're asking for makes sense.
> >>>
> >>> -greg
> >>>
> >>> On Wed, Apr 20, 2016 at 6:04 AM, 吴玲 
> >>> wrote:
> >>>
>  Hi Greg,
> 
>  Thanks a lot for previous help! There is another question in
>  RunReactants I want to ask for some help.
> 
>  when I input the pattern as
> 
> >>>
> >> “[C:1][C:2](=[O:3])[N+0:4][C:5]=[C:6][

Re: [Rdkit-discuss] ReactionFromSmarts and RunReactants

2016-04-22 Thread 吴玲
Hi  Grégori,

Maybe I don't have a clear understanding of this function, I know the dot 
represent disconncction of two fragments ,and I suppose  changes  just occurs 
in mapped molecular fragment, the remaining part of reactant is invariable, in 
other words, if  mapped molecular fragment  breaks based on input pattern, the 
rest of the reactant is maintained.
So I still expect one site breaks, both ends would be connected by in-between 
atons .Maybe I shoud deep study the documentation of rdkit and  SMARTS 
definition.
Thank for your helps!

Monica








At 2016-04-22 16:32:39, greg...@gerebtzoff.com wrote:
>Hi Monica,
>
>As Greg stated, why do you expect your product not to be fragmented?
>I suggest you to have a careful look at the SMARTS definition (for 
>instance from Daylight: 
>http://www.daylight.com/dayhtml/doc/theory/theory.smarts.html)
>In SMARTS patterns, the dot indicates disconnected fragments. Thus you 
>obtain in your product... disconnected fragments.
>
>Best,
>
>Grégori
>
>
>Le 2016-04-22 10:13, 吴玲 a écrit :
>> Greg,
>> 
>> After changing the pattern into
>> "[C:1][C:2](=[O:3])[N+0:4][C:5]=[C:6][C:7]([O-:8])=[O:9].[OH2:10].[OH2:11]>>[C:1][C:2]([O-:10])=[O:3].[O:8]=[C:7]=[O:9].[N+:4].[C:6][C:5]=[O:11]
>> , I get the same result .A ring structure just like you said is broken
>> into pieces.
>> pattern:[C:1][C:2](=[O:3])[N+0:4][C:5]=[C:6][C:7]([O-:8])=[O:9].[OH2:10].[OH2:11]>>[C:1][C:2]([O-:10])=[O:3].[O:8]=[C:7]=[O:9].[N+:4].[C:6][C:5]=[O:11]
>> 
>> output:[O-]C(=O)C1=CNC(=O)CC1.O.O>>CCC(=O)[O-].O=C=[O-].[NH4+].CCC=O
>> 
>> The input reactant ([O-]C(=O)C1=CNC(=O)CC1) if mapped with
>> pattern'reactants ,it should be "
>> [O-:8][C:7](=[O:9])[C:6]1=[C:5][N:4][C:2](=[O:3])[C:1][C:*]1,
>> 
>> what I mean is that the input reactant with a ring that CARBON6
>> connect with CARBON1 by CARBON* ,why the CARBON6  AND  CARBON1 IN THE
>> product is not connected by the CARBON* ?
>> 
>> Thanks a lot,
>> 
>> -Monica
>> 
>> At 2016-04-20 12:43:36, "Greg Landrum"  wrote:
>> 
>>> Monica,
>>> 
>>> Why do you think you should get a single chain from the ring
>>> structure?
>>> If you look at the atom mapping in your input reaction:
>>> 
>>> 
>> [C:1][C:2](=[O:3])[N+0:4][C:5]=[C:6][C:7]([O-:8])=[O:9].[OH2:10].[OH2:11]>>[C:1][C:2]([O-:10])=[O:3].[O:7]=[C:8]=[O:9].[N+:4].[C:6][C:5]=[O:11]
>>> 
>>> You've told it to put:
>>> - carbons 1 and 2 from the reactant into product 1
>>> - carbon 8 into product 2, carbon 7 into product 2 but converted
>>> into an oxygen first.
>>> - carbon 5 and 6 into product 4. In other words: you requested that
>>> the input molecule be broken into pieces.
>>> 
>>> The atom mapping tells you which atoms in the reactants correspond
>>> to which atoms in the products.
>>> 
>>> I would suggest that you look carefully at your reaction
>>> definitions, in particular the atom mapping numbers, in Marvin and
>>> make sure that you think that what you're asking for makes sense.
>>> 
>>> -greg
>>> 
>>> On Wed, Apr 20, 2016 at 6:04 AM, 吴玲 
>>> wrote:
>>> 
 Hi Greg,
 
 Thanks a lot for previous help! There is another question in
 RunReactants I want to ask for some help.
 
 when I input the pattern as
 
>>> 
>> “[C:1][C:2](=[O:3])[N+0:4][C:5]=[C:6][C:7]([O-:8])=[O:9].[OH2:10].[OH2:11]>>[C:1][C:2]([O-:10])=[O:3].[O:7]=[C:8]=[O:9].[N+:4].[C:6][C:5]=[O:11]”
 and give the reactants rs1 =
 
>>> 
>> ["[O-]C(=O)C1=CNC(=O)CC1","CC(=O)NC=C(CC([O-])=O)C([O-])=O","CC(=O)NC=C(C(CO)C([O-])=O)C([O-])=O"]
 ,rs2 = ['O'] , rs3 = ['O'],
 when I check the output product, I find that the first reactants
 with a ring structure divided into four sections instead of three
 parts containing a NH4+,a CO2,and a long chain composed by the
 remained two fragments.In other words , I think that the product
 should be like this:
 
 what's the matter with this pattern? why this reaction predicted
 is wrong and the other is correct?(output result attached below).
 
 pattern:
 
 1 [O-]C(=O)C1=CNC(=O)CC1.O.O>>CCC(=O)[O-].O=C=O.[NH4+].CCC=O
 
 2
 
>>> 
>> CC(=O)NC=C(CC([O-])=O)C([O-])=O.O.O>>CC(=O)[O-].O=C=O.[NH4+].O=(=O)[O-]
 
 3
 
>>> 
>> CC(=O)NC=C(C(CO)C([O-])=O)C([O-])=O.O.O>>CC(=O)[O-].O=C=O.[NH4+].O=CCC(CO)C(=O)[O-]
 
 best wishes,
 
 monica
 
 
>>> 
>> --
 Find and fix application performance issues faster with
 Applications Manager
 Applications Manager provides deep performance insights into
 multiple tiers of
 your business applications. It resolves application problems
 quickly and
 reduces your MTTR. Get your free trial!
 https://ad.doubleclick.net/ddm/clk/302982198;130105516;z [1]
 ___
 Rdkit-discuss mailing list
 Rdkit-discuss@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/rdkit-discuss [2]
>

Re: [Rdkit-discuss] ReactionFromSmarts and RunReactants

2016-04-22 Thread gregori
Hi Monica,

As Greg stated, why do you expect your product not to be fragmented?
I suggest you to have a careful look at the SMARTS definition (for 
instance from Daylight: 
http://www.daylight.com/dayhtml/doc/theory/theory.smarts.html)
In SMARTS patterns, the dot indicates disconnected fragments. Thus you 
obtain in your product... disconnected fragments.

Best,

Grégori


Le 2016-04-22 10:13, 吴玲 a écrit :
> Greg,
> 
> After changing the pattern into
> "[C:1][C:2](=[O:3])[N+0:4][C:5]=[C:6][C:7]([O-:8])=[O:9].[OH2:10].[OH2:11]>>[C:1][C:2]([O-:10])=[O:3].[O:8]=[C:7]=[O:9].[N+:4].[C:6][C:5]=[O:11]
> , I get the same result .A ring structure just like you said is broken
> into pieces.
> pattern:[C:1][C:2](=[O:3])[N+0:4][C:5]=[C:6][C:7]([O-:8])=[O:9].[OH2:10].[OH2:11]>>[C:1][C:2]([O-:10])=[O:3].[O:8]=[C:7]=[O:9].[N+:4].[C:6][C:5]=[O:11]
> 
> output:[O-]C(=O)C1=CNC(=O)CC1.O.O>>CCC(=O)[O-].O=C=[O-].[NH4+].CCC=O
> 
> The input reactant ([O-]C(=O)C1=CNC(=O)CC1) if mapped with
> pattern'reactants ,it should be "
> [O-:8][C:7](=[O:9])[C:6]1=[C:5][N:4][C:2](=[O:3])[C:1][C:*]1,
> 
> what I mean is that the input reactant with a ring that CARBON6
> connect with CARBON1 by CARBON* ,why the CARBON6  AND  CARBON1 IN THE
> product is not connected by the CARBON* ?
> 
> Thanks a lot,
> 
> -Monica
> 
> At 2016-04-20 12:43:36, "Greg Landrum"  wrote:
> 
>> Monica,
>> 
>> Why do you think you should get a single chain from the ring
>> structure?
>> If you look at the atom mapping in your input reaction:
>> 
>> 
> [C:1][C:2](=[O:3])[N+0:4][C:5]=[C:6][C:7]([O-:8])=[O:9].[OH2:10].[OH2:11]>>[C:1][C:2]([O-:10])=[O:3].[O:7]=[C:8]=[O:9].[N+:4].[C:6][C:5]=[O:11]
>> 
>> You've told it to put:
>> - carbons 1 and 2 from the reactant into product 1
>> - carbon 8 into product 2, carbon 7 into product 2 but converted
>> into an oxygen first.
>> - carbon 5 and 6 into product 4. In other words: you requested that
>> the input molecule be broken into pieces.
>> 
>> The atom mapping tells you which atoms in the reactants correspond
>> to which atoms in the products.
>> 
>> I would suggest that you look carefully at your reaction
>> definitions, in particular the atom mapping numbers, in Marvin and
>> make sure that you think that what you're asking for makes sense.
>> 
>> -greg
>> 
>> On Wed, Apr 20, 2016 at 6:04 AM, 吴玲 
>> wrote:
>> 
>>> Hi Greg,
>>> 
>>> Thanks a lot for previous help! There is another question in
>>> RunReactants I want to ask for some help.
>>> 
>>> when I input the pattern as
>>> 
>> 
> “[C:1][C:2](=[O:3])[N+0:4][C:5]=[C:6][C:7]([O-:8])=[O:9].[OH2:10].[OH2:11]>>[C:1][C:2]([O-:10])=[O:3].[O:7]=[C:8]=[O:9].[N+:4].[C:6][C:5]=[O:11]”
>>> and give the reactants rs1 =
>>> 
>> 
> ["[O-]C(=O)C1=CNC(=O)CC1","CC(=O)NC=C(CC([O-])=O)C([O-])=O","CC(=O)NC=C(C(CO)C([O-])=O)C([O-])=O"]
>>> ,rs2 = ['O'] , rs3 = ['O'],
>>> when I check the output product, I find that the first reactants
>>> with a ring structure divided into four sections instead of three
>>> parts containing a NH4+,a CO2,and a long chain composed by the
>>> remained two fragments.In other words , I think that the product
>>> should be like this:
>>> 
>>> what's the matter with this pattern? why this reaction predicted
>>> is wrong and the other is correct?(output result attached below).
>>> 
>>> pattern:
>>> 
>>> 1 [O-]C(=O)C1=CNC(=O)CC1.O.O>>CCC(=O)[O-].O=C=O.[NH4+].CCC=O
>>> 
>>> 2
>>> 
>> 
> CC(=O)NC=C(CC([O-])=O)C([O-])=O.O.O>>CC(=O)[O-].O=C=O.[NH4+].O=(=O)[O-]
>>> 
>>> 3
>>> 
>> 
> CC(=O)NC=C(C(CO)C([O-])=O)C([O-])=O.O.O>>CC(=O)[O-].O=C=O.[NH4+].O=CCC(CO)C(=O)[O-]
>>> 
>>> best wishes,
>>> 
>>> monica
>>> 
>>> 
>> 
> --
>>> Find and fix application performance issues faster with
>>> Applications Manager
>>> Applications Manager provides deep performance insights into
>>> multiple tiers of
>>> your business applications. It resolves application problems
>>> quickly and
>>> reduces your MTTR. Get your free trial!
>>> https://ad.doubleclick.net/ddm/clk/302982198;130105516;z [1]
>>> ___
>>> Rdkit-discuss mailing list
>>> Rdkit-discuss@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss [2]
> 
> 
> 
> Links:
> --
> [1] https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
> [2] https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
> 
> --
> Find and fix application performance issues faster with Applications 
> Manager
> Applications Manager provides deep performance insights into multiple 
> tiers of
> your business applications. It resolves application problems quickly 
> and
> reduces your MTTR. Get your free trial!
> https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
> ___
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/list

[Rdkit-discuss] ReactionFromSmarts and RunReactants

2016-04-22 Thread 吴玲
Greg,

After  changing the pattern into 
"[C:1][C:2](=[O:3])[N+0:4][C:5]=[C:6][C:7]([O-:8])=[O:9].[OH2:10].[OH2:11]>>[C:1][C:2]([O-:10])=[O:3].[O:8]=[C:7]=[O:9].[N+:4].[C:6][C:5]=[O:11]
 , I get the same result .A ring structure just like you said  is broken into 
pieces.
pattern:[C:1][C:2](=[O:3])[N+0:4][C:5]=[C:6][C:7]([O-:8])=[O:9].[OH2:10].[OH2:11]>>[C:1][C:2]([O-:10])=[O:3].[O:8]=[C:7]=[O:9].[N+:4].[C:6][C:5]=[O:11]

output:[O-]C(=O)C1=CNC(=O)CC1.O.O>>CCC(=O)[O-].O=C=[O-].[NH4+].CCC=O

The input  reactant  ([O-]C(=O)C1=CNC(=O)CC1)   if mapped with  
pattern'reactants ,it  should be " 
[O-:8][C:7](=[O:9])[C:6]1=[C:5][N:4][C:2](=[O:3])[C:1][C:*]1,

what I mean is that the input reactant with a ring  that carbon6  connect with 
carbon1 by carbon* ,why the carbon6  and carbon1 in the product is not 
connected by the carbon* ?

Thanks a lot,

-Monica







At 2016-04-20 12:43:36, "Greg Landrum"  wrote:

Monica,


Why do you think you should get a single chain from the ring structure?
If you look at the atom mapping in your input reaction:

[C:1][C:2](=[O:3])[N+0:4][C:5]=[C:6][C:7]([O-:8])=[O:9].[OH2:10].[OH2:11]>>[C:1][C:2]([O-:10])=[O:3].[O:7]=[C:8]=[O:9].[N+:4].[C:6][C:5]=[O:11]


You've told it to put:
 - carbons 1 and 2 from the reactant into product 1
 - carbon 8 into product 2, carbon 7 into product 2 but converted into an 
oxygen first.
 - carbon 5 and 6 into product 4. In other words: you requested that the input 
molecule be broken into pieces.

The atom mapping tells you which atoms in the reactants correspond to which 
atoms in the products.

I would suggest that you look carefully at your reaction definitions, in 
particular the atom mapping numbers, in Marvin and make sure that you think 
that what you're asking for makes sense.


-greg






On Wed, Apr 20, 2016 at 6:04 AM, 吴玲  wrote:

Hi Greg,

Thanks a lot for previous help! There is another question in RunReactants I 
want to ask for some help.

when I input the pattern as 
“[C:1][C:2](=[O:3])[N+0:4][C:5]=[C:6][C:7]([O-:8])=[O:9].[OH2:10].[OH2:11]>>[C:1][C:2]([O-:10])=[O:3].[O:7]=[C:8]=[O:9].[N+:4].[C:6][C:5]=[O:11]”
 and give the reactants  rs1 = 
["[O-]C(=O)C1=CNC(=O)CC1","CC(=O)NC=C(CC([O-])=O)C([O-])=O","CC(=O)NC=C(C(CO)C([O-])=O)C([O-])=O"]
 ,rs2 = ['O'] , rs3 = ['O'],
when I check the output product, I find that the first reactants with a ring 
structure divided into four  sections instead of three parts containing a 
NH4+,a CO2,and a long chain composed by the remained two fragments.In other 
words , I think that the product should be like this:

what's the matter with this pattern? why this reaction predicted is wrong and 
the other is correct?(output result attached below).

pattern:

1 [O-]C(=O)C1=CNC(=O)CC1.O.O>>CCC(=O)[O-].O=C=O.[NH4+].CCC=O

2 CC(=O)NC=C(CC([O-])=O)C([O-])=O.O.O>>CC(=O)[O-].O=C=O.[NH4+].O=(=O)[O-]


3 
CC(=O)NC=C(C(CO)C([O-])=O)C([O-])=O.O.O>>CC(=O)[O-].O=C=O.[NH4+].O=CCC(CO)C(=O)[O-]


best wishes,

monica






 


--
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss








 --
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss