Re: [Rdkit-discuss] Categorising reactions using SMARTS

2016-11-09 Thread Greg Landrum
Ah, ok, that's what I suspected you were doing.
You probably want to construct the input reaction (not the categorization
filter) from SMILES:

In [18]: rxn =
rdChemReactions.ReactionFromSmarts('Nc1nc(Cl)c2[nH]cnc2n1.OCC1C1>>Nc1nc(OCC2C2)c2[nH]cnc2n1',useSmiles=True)

And you definitely want to sanitize (or at least call UpdatePropertyCache()
on) each reactant and product:

In [19]: for r in rxn.GetReactants(): Chem.SanitizeMol(r)

In [20]: for p in rxn.GetProducts(): Chem.SanitizeMol(p)


Now there's no error:

In [21]: rdChemReactions.HasReactionSubstructMatch(rxn,qrxn)
Out[21]: False

Best,
-greg


On Wed, Nov 9, 2016 at 10:27 AM, James Wallace  wrote:

> I think something went missing in my log, the next step after Input 6
> should be rdChemReactions.HasReactionSubstructMatch(rxn,qrxn)
>
> And I'm trying to do substructure queries between the reactions as a
> whole, rather than each individual molecule, effectively using the query
> reaction as a filter.
>
> On 9 November 2016 at 09:24, Greg Landrum  wrote:
>
>> Hi James,
>>
>> Sorry for the slow reply, this one got lost in the rush around the UGM.
>> I'm not able to reproduce the error you show below with the commands you
>> sent. Did you do something else in between or is that the error really
>> coming after input [6]?
>>
>> As for the larger question: are you looking to do a substructure query
>> between each reactant/product of rxn and each reactant/product of qrxn?
>>
>> -greg
>>
>> On Thu, Oct 27, 2016 at 2:17 PM, James Wallace 
>> wrote:
>>
>>> Looking into this further, I've decided to use the Python option again,
>>> as this seems to have more functions.
>>>
>>> I run the current example, where rxn is the original example, and qrxn
>>> is the 'query' for categorisation:
>>>
>>> In [2]: import rdkit
>>>
>>> In [3]: from rdkit import Chem
>>>
>>> In [4]: from rdkit.Chem import rdChemReactions
>>>
>>> In [5]: rxn = rdChemReactions.ReactionFromSm
>>> arts('Nc1nc(Cl)c2[nH]cnc2n1.OCC1CCC
>>>...: CC1>>Nc1nc(OCC2C2)c2[nH]cnc2n1')
>>>
>>> In [6]: qrxn = rdChemReactions.ReactionFromSm
>>> arts('[cH1:1]1:[c:2](-[CH2:7]-[CH2
>>>...: :8]-[NH2:9]):[c:3]:[c:4]:[c:5]:[c:6]:1.[#6:11]-[CH1;R0:10]=[
>>> OD1]>>[c:1]
>>>...: 12:[c:2](-[CH2:7]-[CH2:8]-[NH1:9]-[C:10]-2(-[#6:11])):[c:3]:
>>> [c:4]:[c:5]
>>>...: :[c:6]:1')
>>>
>>> 
>>> Pre-condition Violation
>>> getNumImplicitHs() called without preceding call to calcImplicitValence()
>>> Violation occurred on line 165 in file C:\Users\riccardo\Anaconda\con
>>> da-bld\work
>>> \Code\GraphMol\Atom.cpp
>>> Failed Expression: d_implicitValence > -1
>>> 
>>>
>>> 
>>> ---
>>> RuntimeError  Traceback (most recent call
>>> last)
>>>  in ()
>>> > 1 rdChemReactions.HasReactionSubstructMatch(rxn,qrxn)
>>>
>>> RuntimeError: Pre-condition Violation
>>> getNumImplicitHs() called without preceding call to
>>> calcImplicitValence(
>>> )
>>> Violation occurred on line 165 in file Code\GraphMol\Atom.cpp
>>> Failed Expression: d_implicitValence > -1
>>> RDKIT: 2016.03.1
>>> BOOST: 1_59
>>>
>>>
>>> Is the code working as designed (ultimately I want to feed lists of
>>> these together, but I'm trying one at a time for now)?
>>>
>>>
>>> On 27 October 2016 at 12:02, James Wallace  wrote:
>>>
 Hi,
 I'm trying to replicate the Schneider categorisations with a local set
 of reactions that I have stored in SMILES. I currently have the
 categorisation filters as Reaction SMARTS, and I was hoping to do a
 standard substructure comparison between the SMARTS and the SMILES, but
 can't seem to do that.

 I'm using the Java wrapped version, and I can see how to import a
 ChemicalReaction as SMILES or SMARTS, I can't see how to compose such a
 query. Can anyone offer me any help or pointers?

 Thanks in advance,
 James

>>>
>>>
>>> 
>>> --
>>> The Command Line: Reinvented for Modern Developers
>>> Did the resurgence of CLI tooling catch you by surprise?
>>> Reconnect with the command line and become more productive.
>>> Learn the new .NET and ASP.NET CLI. Get your free copy!
>>> http://sdm.link/telerik
>>> ___
>>> Rdkit-discuss mailing list
>>> Rdkit-discuss@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>>>
>>>
>>
>
--
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. 

Re: [Rdkit-discuss] Categorising reactions using SMARTS

2016-11-09 Thread Greg Landrum
Hi James,

Sorry for the slow reply, this one got lost in the rush around the UGM.
I'm not able to reproduce the error you show below with the commands you
sent. Did you do something else in between or is that the error really
coming after input [6]?

As for the larger question: are you looking to do a substructure query
between each reactant/product of rxn and each reactant/product of qrxn?

-greg

On Thu, Oct 27, 2016 at 2:17 PM, James Wallace  wrote:

> Looking into this further, I've decided to use the Python option again, as
> this seems to have more functions.
>
> I run the current example, where rxn is the original example, and qrxn is
> the 'query' for categorisation:
>
> In [2]: import rdkit
>
> In [3]: from rdkit import Chem
>
> In [4]: from rdkit.Chem import rdChemReactions
>
> In [5]: rxn = rdChemReactions.ReactionFromSmarts('Nc1nc(Cl)
> c2[nH]cnc2n1.OCC1CCC
>...: CC1>>Nc1nc(OCC2C2)c2[nH]cnc2n1')
>
> In [6]: qrxn = rdChemReactions.ReactionFromSmarts('[cH1:1]1:[
> c:2](-[CH2:7]-[CH2
>...: :8]-[NH2:9]):[c:3]:[c:4]:[c:5]:[c:6]:1.[#6:11]-[CH1;R0:10]=[
> OD1]>>[c:1]
>...: 12:[c:2](-[CH2:7]-[CH2:8]-[NH1:9]-[C:10]-2(-[#6:11])):[c:
> 3]:[c:4]:[c:5]
>...: :[c:6]:1')
>
> 
> Pre-condition Violation
> getNumImplicitHs() called without preceding call to calcImplicitValence()
> Violation occurred on line 165 in file C:\Users\riccardo\Anaconda\
> conda-bld\work
> \Code\GraphMol\Atom.cpp
> Failed Expression: d_implicitValence > -1
> 
>
> 
> ---
> RuntimeError  Traceback (most recent call last)
>  in ()
> > 1 rdChemReactions.HasReactionSubstructMatch(rxn,qrxn)
>
> RuntimeError: Pre-condition Violation
> getNumImplicitHs() called without preceding call to
> calcImplicitValence(
> )
> Violation occurred on line 165 in file Code\GraphMol\Atom.cpp
> Failed Expression: d_implicitValence > -1
> RDKIT: 2016.03.1
> BOOST: 1_59
>
>
> Is the code working as designed (ultimately I want to feed lists of these
> together, but I'm trying one at a time for now)?
>
>
> On 27 October 2016 at 12:02, James Wallace  wrote:
>
>> Hi,
>> I'm trying to replicate the Schneider categorisations with a local set of
>> reactions that I have stored in SMILES. I currently have the categorisation
>> filters as Reaction SMARTS, and I was hoping to do a standard substructure
>> comparison between the SMARTS and the SMILES, but can't seem to do that.
>>
>> I'm using the Java wrapped version, and I can see how to import a
>> ChemicalReaction as SMILES or SMARTS, I can't see how to compose such a
>> query. Can anyone offer me any help or pointers?
>>
>> Thanks in advance,
>> James
>>
>
>
> 
> --
> The Command Line: Reinvented for Modern Developers
> Did the resurgence of CLI tooling catch you by surprise?
> Reconnect with the command line and become more productive.
> Learn the new .NET and ASP.NET CLI. Get your free copy!
> http://sdm.link/telerik
> ___
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
>
--
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] Categorising reactions using SMARTS

2016-10-27 Thread James Wallace
Looking into this further, I've decided to use the Python option again, as
this seems to have more functions.

I run the current example, where rxn is the original example, and qrxn is
the 'query' for categorisation:

In [2]: import rdkit

In [3]: from rdkit import Chem

In [4]: from rdkit.Chem import rdChemReactions

In [5]: rxn =
rdChemReactions.ReactionFromSmarts('Nc1nc(Cl)c2[nH]cnc2n1.OCC1CCC
   ...: CC1>>Nc1nc(OCC2C2)c2[nH]cnc2n1')

In [6]: qrxn =
rdChemReactions.ReactionFromSmarts('[cH1:1]1:[c:2](-[CH2:7]-[CH2
   ...:
:8]-[NH2:9]):[c:3]:[c:4]:[c:5]:[c:6]:1.[#6:11]-[CH1;R0:10]=[OD1]>>[c:1]
   ...:
12:[c:2](-[CH2:7]-[CH2:8]-[NH1:9]-[C:10]-2(-[#6:11])):[c:3]:[c:4]:[c:5]
   ...: :[c:6]:1')


Pre-condition Violation
getNumImplicitHs() called without preceding call to calcImplicitValence()
Violation occurred on line 165 in file
C:\Users\riccardo\Anaconda\conda-bld\work
\Code\GraphMol\Atom.cpp
Failed Expression: d_implicitValence > -1


---
RuntimeError  Traceback (most recent call last)
 in ()
> 1 rdChemReactions.HasReactionSubstructMatch(rxn,qrxn)

RuntimeError: Pre-condition Violation
getNumImplicitHs() called without preceding call to
calcImplicitValence(
)
Violation occurred on line 165 in file Code\GraphMol\Atom.cpp
Failed Expression: d_implicitValence > -1
RDKIT: 2016.03.1
BOOST: 1_59


Is the code working as designed (ultimately I want to feed lists of these
together, but I'm trying one at a time for now)?


On 27 October 2016 at 12:02, James Wallace  wrote:

> Hi,
> I'm trying to replicate the Schneider categorisations with a local set of
> reactions that I have stored in SMILES. I currently have the categorisation
> filters as Reaction SMARTS, and I was hoping to do a standard substructure
> comparison between the SMARTS and the SMILES, but can't seem to do that.
>
> I'm using the Java wrapped version, and I can see how to import a
> ChemicalReaction as SMILES or SMARTS, I can't see how to compose such a
> query. Can anyone offer me any help or pointers?
>
> Thanks in advance,
> James
>
--
The Command Line: Reinvented for Modern Developers
Did the resurgence of CLI tooling catch you by surprise?
Reconnect with the command line and become more productive. 
Learn the new .NET and ASP.NET CLI. Get your free copy!
http://sdm.link/telerik___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


[Rdkit-discuss] Categorising reactions using SMARTS

2016-10-27 Thread James Wallace
Hi,
I'm trying to replicate the Schneider categorisations with a local set of
reactions that I have stored in SMILES. I currently have the categorisation
filters as Reaction SMARTS, and I was hoping to do a standard substructure
comparison between the SMARTS and the SMILES, but can't seem to do that.

I'm using the Java wrapped version, and I can see how to import a
ChemicalReaction as SMILES or SMARTS, I can't see how to compose such a
query. Can anyone offer me any help or pointers?

Thanks in advance,
James
--
The Command Line: Reinvented for Modern Developers
Did the resurgence of CLI tooling catch you by surprise?
Reconnect with the command line and become more productive. 
Learn the new .NET and ASP.NET CLI. Get your free copy!
http://sdm.link/telerik___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss