Re: [Rdkit-discuss] Two nitrogens in a 5 membered ring

2014-03-03 Thread Bob Funchess
Hi Toby,



I'd say it's more of a limitation inherent in Kekule representations than
an actual bug in RDKit.  Trying to get too clever in figuring out what
the user meant usually causes more harm than good.



I'm not sure what version of RDKit you're using, but the aromatic
specification with an explicit hydrogen on one of the nitrogen atoms works
for me:



 Chem.MolFromSmiles('n1[nH]ccc1').Debug();

Atoms:

0 7 N chg: 0  deg: 2 exp: 3 imp: 0 hyb: 3 arom?: 1 chi: 0

1 7 N chg: 0  deg: 2 exp: 3 imp: 0 hyb: 3 arom?: 1 chi: 0

2 6 C chg: 0  deg: 2 exp: 3 imp: 1 hyb: 3 arom?: 1 chi: 0

3 6 C chg: 0  deg: 2 exp: 3 imp: 1 hyb: 3 arom?: 1 chi: 0

4 6 C chg: 0  deg: 2 exp: 3 imp: 1 hyb: 3 arom?: 1 chi: 0

Bonds:

0 0-1 order: 12 conj?: 1 aromatic?: 1

1 1-2 order: 12 conj?: 1 aromatic?: 1

2 2-3 order: 12 conj?: 1 aromatic?: 1

3 3-4 order: 12 conj?: 1 aromatic?: 1

4 4-0 order: 12 conj?: 1 aromatic?: 1



The double bonds in the Kekule representations here can be between atom
pairs 1,2 and 3,4 or between atom pairs 2,3 and 4,0.  Putting one between
pair 0,1 leaves atom 4 with two single bonds to it (and therefore, to
satisfy valence requirements, two implicit hydrogens); I'm not horribly
surprised that RDKit perceives that as aliphatic.  You can see that's
what's happening in your second example where the hybridization of atom 4
is 4 (sp3) instead of 3 (sp2).



Regards,

Bob



--

Bob Funchess, Ph.D.Kelaroo,
Inc

Senior Scientist
www.kelaroo.com

bfunch...@kelaroo.com (858)
259-7561 x3







*From:* Toby Wright [mailto:toby.wri...@inhibox.com]
*Sent:* Monday, March 03, 2014 7:42 AM
*To:* RDKit Discuss
*Subject:* [Rdkit-discuss] Two nitrogens in a 5 membered ring



Hi,

If I have a five membered ring with 2 consecutive Ns and alternating single
and double bonds expressed by the smiles: N1N=CC=C1 RDKit gives me a
molecule in which every atom is aromatic. If I give it: N1=NC=CC1 it gives
me a molecule in which every atom is aliphatic. If I give it: n1nccc1 it
gives me a kekulization error. I, possibly naively, thought the forms would
be all aromatic or all aliphatic. Am I missing something or is this a bug?

 Chem.MolFromSmiles('N1N=CC=C1').Debug()
Atoms:
0 7 N chg: 0  deg: 2 exp: 3 imp: 0 hyb: 3 arom?: 1 chi: 0
1 7 N chg: 0  deg: 2 exp: 3 imp: 0 hyb: 3 arom?: 1 chi: 0
2 6 C chg: 0  deg: 2 exp: 3 imp: 1 hyb: 3 arom?: 1 chi: 0
3 6 C chg: 0  deg: 2 exp: 3 imp: 1 hyb: 3 arom?: 1 chi: 0
4 6 C chg: 0  deg: 2 exp: 3 imp: 1 hyb: 3 arom?: 1 chi: 0
Bonds:
0 0-1 order: 12 conj?: 1 aromatic?: 1
1 1-2 order: 12 conj?: 1 aromatic?: 1
2 2-3 order: 12 conj?: 1 aromatic?: 1
3 3-4 order: 12 conj?: 1 aromatic?: 1
4 4-0 order: 12 conj?: 1 aromatic?: 1

 Chem.MolFromSmiles('N1=NC=CC1').Debug()
Atoms:
0 7 N chg: 0  deg: 2 exp: 3 imp: 0 hyb: 3 arom?: 0 chi: 0
1 7 N chg: 0  deg: 2 exp: 3 imp: 0 hyb: 3 arom?: 0 chi: 0
2 6 C chg: 0  deg: 2 exp: 3 imp: 1 hyb: 3 arom?: 0 chi: 0
3 6 C chg: 0  deg: 2 exp: 3 imp: 1 hyb: 3 arom?: 0 chi: 0
4 6 C chg: 0  deg: 2 exp: 2 imp: 2 hyb: 4 arom?: 0 chi: 0
Bonds:
0 0-1 order: 2 conj?: 1 aromatic?: 0
1 1-2 order: 1 conj?: 1 aromatic?: 0
2 2-3 order: 2 conj?: 1 aromatic?: 0
3 3-4 order: 1 conj?: 0 aromatic?: 0
4 4-0 order: 1 conj?: 0 aromatic?: 0

 Chem.MolFromSmiles('n1nccc1').Debug()
[15:31:44] Can't kekulize mol

Yours,

Toby Wright

--

InhibOx Ltd
--

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2014.0.4335 / Virus Database: 3697/7090 - Release Date: 02/13/14
Internal Virus Database is out of date.
--
Subversion Kills Productivity. Get off Subversion  Make the Move to Perforce.
With Perforce, you get hassle-free workflows. Merge that actually works. 
Faster operations. Version large binaries.  Built-in WAN optimization and the
freedom to use Git, Perforce or both. Make the move to Perforce.
http://pubads.g.doubleclick.net/gampad/clk?id=122218951iu=/4140/ostg.clktrk___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


[Rdkit-discuss] Difference in Python / C# wrapper versions

2014-12-30 Thread Bob Funchess
Hi all,



We’re using the C# wrappers to RDKit for an enumeration engine and we have
run into an issue with stereochemistry in RDKit.



The basic problem is that when we use a reaction which adds a stereocenter
to a molecule, chirality at carbons that were present in the reactants is
kept, but chirality at carbons introduced by the reaction itself is lost.


In the course of trying to figure this out, I created a Python script that
goes through the steps performed by the enumeration engine for a sample
illustrating the issue so that I could try to debug the problem more
easily, only to find that in Python the chirality is retained throughout
the molecule. I then translated that Python script back into a standalone
C# program … and the problem reappears.



The output molecule should have two chiral centers (the carbon attached to
the fluorine and the carbon attached to the chlorine). The Python version
shows both of these as chiral; the C# version has only the fluorine carbon
as chiral.



I’ve attached the Python script and the C# source file. The C# version has
the Python commands included as comments for easy comparison.



Does anyone know what’s going on here?  The only significant difference
between the two that I can see is that Python has rxn.Initialize() while C#
has rxn.initReactantMatchers(). Could this be the cause, and if so what C#
method should I be using instead?



Thanks in Advance,



Bob



--

Bob Funchess, Ph.D.Kelaroo,
Inc

Senior Scientist
www.kelaroo.com

bfunch...@kelaroo.com (858)
259-7561 x3
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using GraphMolWrap;

namespace StereoTest
{
class StereoTest
{
static void Main(string[] args)
{
string molblock_r = @
  Mrv0541 12291411382D  

  6  5  0  0  1  0999 V2000
   -2.88750.71450. Br  0  0  0  0  0  0  0  0  0  6  0  0
   -2.06250.71450. C   0  0  0  0  0  0  0  0  0  5  0  0
   -1.65000.0. C   0  0  0  0  0  0  0  0  0  4  0  0
   -2.0625   -0.71450. C   0  0  1  0  0  0  0  0  0  1  0  0
   -1.6500   -1.42890. C   0  0  0  0  0  0  0  0  0  3  0  0
   -2.8875   -0.71450. F   0  0  0  0  0  0  0  0  0  2  0  0
  1  2  1  0  0  0  0
  2  3  1  0  0  0  0
  3  4  1  0  0  0  0
  4  5  1  0  0  0  0
  4  6  1  1  0  0  0
M  END
;  
// molblock_r =  same heredoc? 

string molblock_p = @
  Mrv0541 12291411382D  

  9  8  0  0  1  0999 V2000
3.18210.61880. C   0  0  0  0  0  0  0  0  0  3  0  0
3.89660.20630. C   0  0  2  0  0  0  0  0  0  1  0  0
3.8966   -0.61870. F   0  0  0  0  0  0  0  0  0  2  0  0
4.61110.61880. C   0  0  0  0  0  0  0  0  0  4  0  0
5.32560.20620. C   0  0  0  0  0  0  0  0  0  5  0  0
6.04000.61870. C   0  0  0  0  0  0  0  0  0  7  0  0
6.75450.20620. C   0  0  1  0  0  0  0  0  0  8  0  0
7.46900.61870. C   0  0  0  0  0  0  0  0  0  9  0  0
6.7545   -0.61880. Cl  0  0  0  0  0  0  0  0  0 10  0  0
  1  2  1  0  0  0  0
  2  3  1  1  0  0  0
  2  4  1  0  0  0  0
  4  5  1  0  0  0  0
  5  6  1  0  0  0  0
  7  6  1  0  0  0  0
  7  8  1  0  0  0  0
  7  9  1  1  0  0  0
M  END
;  
// molblock_p =  same heredoc 

ChemicalReaction rxn = new ChemicalReaction();  
// rxn = Chem.rdChemReactions.ChemicalReaction()

ROMol template_r = RWMol.MolFromMolBlock(molblock_r, true, false);  
// template_r = Chem.MolFromMolBlock(molblock_r,True,False)
ROMol reactant_H = template_r.addHs(true);  
// reactant_H = Chem.AddHs(template_r,True)
rxn.addReactantTemplate(reactant_H);
// rxn.AddReactantTemplate(reactant_H)

ROMol template_p = RWMol.MolFromMolBlock(molblock_p, true, false);  
// template_p = Chem.MolFromMolBlock(molblock_p,True,False)
ROMol product_H = template_p.addHs(true);   
// product_H = Chem.AddHs(template_p,True)
rxn.addProductTemplate(product_H);  
// product_H = Chem.AddHs(template_p,True)

rxn.initReactantMatchers(); 
// rxn.Initialize()

string molblock_r0 = @
  Mrv0541 12291411372D  

  6  5  0  0  1  0999 V2000
   -2.88750.71450. Br  0  0  0  0  0  0  0  0  0  6  0  0
   -2.06250.71450. C   0  0  0  0  0  0  0  0  0  5  0  0
   -1.65000.0. C   0  0  0  0  0  0  0  0

Re: [Rdkit-discuss] Difference in Python / C# wrapper versions

2015-01-02 Thread Bob Funchess
Hi Greg,



Thanks for your response.  The RDKit version I was using was an older one
(2012_06_1).  Since we’re not using Python in production, I checked the
current version of the C# wrapper code to see if the problem was still
there, but didn’t bother to check the latest Python wrappers.



It’s good to know that I’m not actually doing something wrong.  I’ll look
into the workaround you suggest for now.



Thanks again,

Bob



*From:* Greg Landrum [mailto:greg.land...@gmail.com]
*Sent:* Thursday, January 01, 2015 11:52 PM
*To:* Bob Funchess
*Cc:* RDKit Discuss
*Subject:* Re: [Rdkit-discuss] Difference in Python / C# wrapper versions



Hi Bob,



On Tue, Dec 30, 2014 at 8:42 PM, Bob Funchess bfunch...@kelaroo.com wrote:



We’re using the C# wrappers to RDKit for an enumeration engine and we have
run into an issue with stereochemistry in RDKit.



The basic problem is that when we use a reaction which adds a stereocenter
to a molecule, chirality at carbons that were present in the reactants is
kept, but chirality at carbons introduced by the reaction itself is lost.


In the course of trying to figure this out, I created a Python script that
goes through the steps performed by the enumeration engine for a sample
illustrating the issue so that I could try to debug the problem more
easily, only to find that in Python the chirality is retained throughout
the molecule. I then translated that Python script back into a standalone
C# program … and the problem reappears.



The output molecule should have two chiral centers (the carbon attached to
the fluorine and the carbon attached to the chlorine). The Python version
shows both of these as chiral; the C# version has only the fluorine carbon
as chiral.



Hmm, when I run stereo.py with the 2014.09.2 release of the RDKit I also
only get one stereo-center:

(py34)~/Downloads  python stereo.py

[07:03:18] product atom-mapping number 7 not found in reactants.

[07:03:18] product atom-mapping number 8 not found in reactants.

[07:03:18] product atom-mapping number 9 not found in reactants.

[07:03:18] product atom-mapping number 10 not found in reactants.

[07:03:18] mapped atoms in the reactants were not mapped in the products.

  unmapped numbers are: 6



 RDKit  2D



  9  8  0  0  0  0  0  0  0  0999 V2000

   -3.8971   -0.75000. C   0  0  0  0  0  0  0  0  0  0  0  0

   -2.59810.0. C   0  0  0  0  0  0  0  0  0  0  0  0

   -2.59811.50000. F   0  0  0  0  0  0  0  0  0  0  0  0

   -1.2990   -0.75000. C   0  0  0  0  0  0  0  0  0  0  0  0

0.0.0. C   0  0  0  0  0  0  0  0  0  0  0  0

1.2990   -0.75000. C   0  0  0  0  0  0  0  0  0  0  0  0

2.5981   -0.0. C   0  0  0  0  0  0  0  0  0  0  0  0

3.8971   -0.75000. C   0  0  0  0  0  0  0  0  0  0  0  0

2.59811.50000. Cl  0  0  0  0  0  0  0  0  0  0  0  0

  2  1  1  1

  2  3  1  0

  2  4  1  0

  4  5  1  0

  5  6  1  0

  7  6  1  0

  7  8  1  0

  7  9  1  0

M  END



CC(Cl)CCC[C@@H](C)F





This is, I think, more or less what I expect to happen based on the current
state of the code. You need to tell the reaction engine that you want
stereochemistry the stereochemistry you provide in the products to be
maintained. There's an atom property for this, molInversionFlag. Here's an
example of how to set it:



  template_p.GetAtomWithIdx(6).SetProp('molInversionFlag','4')



The attached stereo2.py does this and produces the expected results (I
think).



The current behavior seems like a bug, but I'm going to need to think for a
bit about how to fix it. But at least this may be a workaround for now?





I’ve attached the Python script and the C# source file. The C# version has
the Python commands included as comments for easy comparison.



Does anyone know what’s going on here?  The only significant difference
between the two that I can see is that Python has rxn.Initialize() while C#
has rxn.initReactantMatchers(). Could this be the cause, and if so what C#
method should I be using instead?



ChemicalReaction.Initialize() from Python is just calling
initReactantMatchers(). I guess you were using different versions of the
underlying C++ code.



-greg




--

No virus found in this message.
Checked by AVG - www.avg.com
Version: 2015.0.5577 / Virus Database: 4257/8854 - Release Date: 01/02/15
--
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net___
Rdkit-discuss mailing list
Rdkit-discuss

Re: [Rdkit-discuss] Check for Heavy Isotopes using RdKit

2017-01-18 Thread Bob Funchess
Hi Milinda,



As an aside, most of the isotopes you listed are stable.  The only nuclides
in the list that are actually unstable are 14C, 3H, 24P and 46P.



If your goal is to exclude isotopically enriched structures rather than
radioactive ones, it might be better to just look for ANY isotopic
specification, rather than for a specific list.



Kind Regards,

Bob



--

Bob Funchess, Ph.D.Kelaroo,
Inc

Director of Software Support & Development
www.kelaroo.com

bfunch...@kelaroo.com (858)
259-7561 x3







*From:* Milinda Samaraweera [mailto:milindaatw...@gmail.com]
*Sent:* Wednesday, January 18, 2017 11:48 AM
*To:* Greg Landrum <greg.land...@gmail.com>
*Cc:* RDKit Discuss <rdkit-discuss@lists.sourceforge.net>
*Subject:* Re: [Rdkit-discuss] Check for Heavy Isotopes using RdKit



Greg,

I am looking to remove entries that contain un-stable isotopes of elements
CHNOPS (e.g. heavy_isotopes =['13C', '14C', '2H', '3H', '15N', '24P',
'46P', '33S', '34S', '36S'] ). Is there a way to modify the above code to
achieve that?

Thanks,

Milinda





On Wed, Jan 18, 2017 at 11:16 AM, Greg Landrum <greg.land...@gmail.com>
wrote:

Hi Milinda,



Here's an approach that finds all the atoms that have an isotope specified:



In [1]: from rdkit import Chem



In [2]: from rdkit.Chem import rdqueries



In [3]: q = rdqueries.IsotopeGreaterQueryAtom(1)



In [7]: list(x.GetIdx() for x in
Chem.MolFromSmiles('CC[13CH3]').GetAtomsMatchingQuery(q))

Out[7]: [2]



In [8]: list(x.GetIdx() for x in
Chem.MolFromSmiles('[12CH3]CC[13CH3]').GetAtomsMatchingQuery(q))

Out[8]: [0, 3]



Does that do what you want it to do?



-greg







On Wed, Jan 18, 2017 at 3:56 PM, Milinda Samaraweera <
milindaatw...@gmail.com> wrote:

Dear Experts,

I am trying to figure out a way to exclude entries which contain heavy
atoms (13C, 2H, 3H, etc), from a SD file (which has close to two thousand
entries) and write an updated file with the remaining entries.

I do understand how to read/write SD files using rdkit.

What I do understand is how to detect entries with heavy isotopes: Is there
an efficient and correct way of achieving this using rdkit?



thanks,

-- 

Milinda Samaraweera



--
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






-- 

Milinda Samaraweera, Ph.D.

Postdoctoral Fellow, Department of Pharmacy

University of Connecticut

69 North Eagleville road

Storrs, CT, 06269

milindaatw...@gmail.com
860-617-8046
--
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


[Rdkit-discuss] Windows 10 conda build fails

2017-03-06 Thread Bob Funchess
Hi All,



I am trying to build the latest version of RDKit with Anaconda3-2.5.0 and
it’s failing with the following error:



   Creating library pyAvalonTools.lib and object pyAvalonTools.exp

pyAvalonTools.cpp.obj : error LNK2019: unresolved external symbol "class
ExplicitBitVect const volatile * __cdecl boost::get_pointer(class ExplicitBitVect const volatile *)"
(??$get_pointer@$$CDVExplicitBitVect@@@boost@@YAPEDVExplicitBitVect@@PEDV1@@Z)
referenced in function "public: static struct _object * __cdecl
boost::python::objects::make_instance_impl,class ExplicitBitVect>,struct
boost::python::objects::make_ptr_instance,class ExplicitBitVect> > >::execute >(class std::auto_ptr &)" (??$execute@V?$auto_ptr@VExplicitBitVect@@@std@
@@?$make_instance_impl@VExplicitBitVect@@U?$pointer_holder@V
?$auto_ptr@VExplicitBitVect@@@std@@VExplicitBitVect@@@objects@python@boost@
@U?$make_ptr_instance@VExplicitBitVect@@U?$pointer_holder@V
?$auto_ptr@VExplicitBitVect@@@std@@VExplicitBitVect@@@objects@python@boost@
@@345@@objects@python@boost@@SAPEAU_object@@AEAV?$auto_ptr@VExplicitBitVect
@@@std@@@Z)

..\..\..\rdkit\Avalon\pyAvalonTools.pyd : fatal error LNK1120: 1 unresolved
externals

LINK failed. with 1120

NMAKE : fatal error U1077:
'K:\Anaconda3\conda-bld\rdkit_1488846410627\_b_env\Library\bin\cmake.exe' :
return code '0x'

Stop.

NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio
14.0\VC\BIN\amd64\nmake.exe"' : return code '0x2'

Stop.

NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio
14.0\VC\BIN\amd64\nmake.exe"' : return code '0x2'

Stop.



Has anyone else seen this? It looks like the problem is with boost, but
“conda build boost” APPEARED to work okay.



Thanks,

Bob



PS the latest version of Anaconda has an more recent version of Python,
which causes the boost build to fail utterly.





--

Bob Funchess, Ph.D.Kelaroo,
Inc

Director of Software Support & Development
www.kelaroo.com

bfunch...@kelaroo.com (858)
259-7561 x3
--
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] conda build errors on Windows 10

2017-05-12 Thread Bob Funchess
Hi Greg,



A tutorial would be greatly appreciated.



Kind Regards,

Bob



*From:* Greg Landrum [mailto:greg.land...@gmail.com]
*Sent:* Friday, May 12, 2017 4:54 AM
*To:* Bob Funchess <bfunch...@kelaroo.com>
*Cc:* RDKit Discuss <rdkit-discuss@lists.sourceforge.net>
*Subject:* Re: [Rdkit-discuss] conda build errors on Windows 10



Hi Bob,



On Thu, May 11, 2017 at 10:31 PM, Bob Funchess <bfunch...@kelaroo.com>
wrote:



I’m curious as to whether anyone is able to get RDKit to build on Windows
10 with Visual Studio 2015; I’ve been trying off and on to get this to work
for some time now with no discernable success.



Yeah, I was able to do so both while doing the conda builds and during the
testing phase (where I do the build manually).



PS My ultimate goal is to build the RDKit DLL and the C# wrappers and
that’s all I fundamentally care about; Java, Python, Postgres et al. are
irrelevant to me except insofar as they help me get the C# wrappers… the
Python version would be NICE (for testing), but I don’t actually NEED it.
If anyone has actually successfully built RDKFuncs.DLL and RDKit2DotNet.DLL
using the current version of RDKit, I would greatly appreciate any pointers.



Yeah, for this I think you really don't need/want to be using the conda
stuff.



How about this: I'll put together a short tutorial/walk-through on doing a
build of the C# wrappers with VS2015 under Win10 and we can see if that
helps. I can try a first pass over the weekend.





-greg
--
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