Re: [Rdkit-discuss] GetSubstructMatches and unique match

2020-05-10 Thread Paolo Tosco
think? Is there something missing in the query? Thanks for your time, Best regards, QT Le 05/05/2020 à 14:52, Paolo Tosco a écrit : Dear Quoc-Tuan, this should do what you need: https://gist.github.com/ptosco/dc4d27153e6e8e45aed654761e4d7409 Che

Re: [Rdkit-discuss] write sdf properties without position number

2020-05-05 Thread Paolo Tosco
Hi Nicolas, quick and dirty solution: strip it with a regex, e.g. sed 's|^\(>  <.*>\) *([0-9]*)|\1|' HTH, p. On 05/05/2020 16:35, Nicolas Bosc wrote: Hi RDKit users, Writing molecules in a sdf with properties automatically add a number after the property name which is the position of the

Re: [Rdkit-discuss] GetSubstructMatches and unique match

2020-05-05 Thread Paolo Tosco
thought the default would be uniquify=False. Actually my problem is to find 2 distinct units of isoprene (pattern) in the borneol (smiles) as the latter is a monoterpene. Do you have any idea I can do this ? Thanks in advance for your time. Best regards, QT Le 04/05/2020 à 19:53, Paolo Tosco

Re: [Rdkit-discuss] GetSubstructMatches and unique match

2020-05-04 Thread Paolo Tosco
Dear Quoc-Tuan, On 04/05/2020 09:10, Greenpharma S.A.S. wrote: Dear All, Please could you help with the following problem (I could not find answers in discussion list) ? pattern='C~C~C(~C)~C' smiles='O[C@H]1C[C@H]2C([C@@]1(C)CC2)(C)C' pat = Chem.MolFromSmiles(pattern) mol =

Re: [Rdkit-discuss] [RDKit-discuss] rdchem.ResonanceMolSupplier cause segfault on some inputs

2020-04-29 Thread Paolo Tosco
Dear Victor, I have tested this on the latest RDKit trunk code and it does not segfault; I believe this is the same bug described here: https://github.com/rdkit/rdkit/issues/3048 and it is already fixed. Cheers, p. On 29/04/2020 17:24, victor viterbo via Rdkit-discuss wrote: RDKit   

Re: [Rdkit-discuss] Complications with ConstrainedEmbed

2020-04-18 Thread Paolo Tosco
. On 18/04/2020 16:55, Tim Dudgeon wrote: On 18/04/2020 11:56, Paolo Tosco wrote: Hi Tim, mol.GetSubstructMatch(query) will give you indices in mol that match query. Yes, I can re-calculate it, but the fact that it's getting highlighted in Jupyter suggests that the mol already has that info

Re: [Rdkit-discuss] Complications with ConstrainedEmbed

2020-04-18 Thread Paolo Tosco
and atom properties but can't find anything that suggests "highlight me". How is this encoded? Tim On 17/04/2020 19:02, Paolo Tosco wrote: Hi Tim, I’ll take a look later and get back to you. Cheers, p. On 17 Apr 2020, at 18:55, Tim Dudgeon wrote: I'm wanting to use AllChem.Constr

Re: [Rdkit-discuss] Complications with ConstrainedEmbed

2020-04-17 Thread Paolo Tosco
Hi Tim, I’ll take a look later and get back to you. Cheers, p. > On 17 Apr 2020, at 18:55, Tim Dudgeon wrote: > > I'm wanting to use AllChem.ConstrainedEmbed() to generate a conformer of a > molecule tethered to a molecule that should always have some MCS. I found > some code on the

Re: [Rdkit-discuss] Compilation problems on Linux

2020-04-15 Thread Paolo Tosco
and find a solution. Thank you again! Max Pinheiro Jr Em qua., 15 de abr. de 2020 às 18:25, Paolo Tosco mailto:paolo.tosco.m...@gmail.com>> escreveu: Hi Max, you mention you are using gcc-8.1 and Boost 1.67. Did you compile Boost with the same compiler or was it co

Re: [Rdkit-discuss] Compilation problems on Linux

2020-04-15 Thread Paolo Tosco
Hi Max, you mention you are using gcc-8.1 and Boost 1.67. Did you compile Boost with the same compiler or was it compiled with an earlier version of gcc/g++? If Boost was compiled with an earlier version of gcc/g++, you will need to add to /home/mpinheiro/codes/rdkit-2020.09/CMakeLists.txt

Re: [Rdkit-discuss] Help mapping atoms between two files

2020-04-04 Thread Paolo Tosco
Hi Gustavo, that's because a2.pdb has formal charges whereas a1.pdb has none. If you neutralize a2 then you'll find a match. You could use |Chem.MolStandardize.rdMolStandardize.||Uncharger| or something as below: from rdkit import Chem a1 = Chem.MolFromPDBFile("a1.pdb") a2 =

Re: [Rdkit-discuss] How to sort a list of mol objects

2020-04-03 Thread Paolo Tosco
Hi Zhenting, you mean sort by a property value? For example, this would sort your list by decreasing value of the ACTIVITY property (e.g., assuming it is a pIC50): mol_list.sort(key=lambda m: float(m.GetProp("ACTIVITY")), reverse=True) Cheers, p. On 03/04/2020 16:38, Zhenting Gao wrote:

Re: [Rdkit-discuss] problem building from source - ‘CT_CHIRALITY_PROP_PREFIX’ is not a member of ‘schrodinger::mae’

2020-03-30 Thread Paolo Tosco
Hi Tim, try rm -rf External/CoordGen/coordgen* External/CoordGen/maeparser* you might have some outdated coordgen libs. Deleting those and re-running cmake will download them afresh. Cheers, p. On 30/03/2020 14:51, Tim Dudgeon wrote: I'm finding an error building from source (on master

Re: [Rdkit-discuss] Closing a file opened by Chem.SDMolSupplier?

2020-03-29 Thread Paolo Tosco
Hi Jean-Marc, tempfn.close() should allow you to delete the file. A better alternative would be using using with temp file.TemporaryFile as tempfn ... As the file will be automatically closed and deleted for you as soon as it goes out of scope at the end of the context manager block.

Re: [Rdkit-discuss] Save clusters

2020-03-23 Thread Paolo Tosco
Hi Francesco, np.savetxt() expects an array of numbers, while you have an array of tuples (i.e., the individual clusters), hence the error. You don't actually need numpy to save an array in human-readable, text format. You might store your array in JSON format: import json with

Re: [Rdkit-discuss] MMFF Atoms type definitions

2020-03-16 Thread Paolo Tosco
Hi Omar, MMFF94 definitions are not encoded via SMARTS patterns. Definition are stored in Code/ForceField/MMFF/Params.cpp (defaultMMFFDef). You may find them here in a more human-readable form: https://github.com/openbabel/openbabel/blob/master/data/mmffdef.par Cheers, p. On 16/03/2020

Re: [Rdkit-discuss] Building RDKit from source under Ubuntu VM, ctest 87 tests failed out of 165. Any advice much appreciated.

2020-03-13 Thread Paolo Tosco
Test time (real) =   0.09 sec The following tests FAILED:       2 - pyCoordGen (Failed) Errors while running CTest *From:* Paolo Tosco Dear Earl, given that all Python tests are failing my guess is that you might be running the tests with a Python interpreter different from

Re: [Rdkit-discuss] Building RDKit from source under Ubuntu VM, ctest 87 tests failed out of 165. Any advice much appreciated.

2020-03-13 Thread Paolo Tosco
Dear Earl, given that all Python tests are failing my guess is that you might be running the tests with a Python interpreter different from the one you have built RDKit against. Re-run one of the failing tests with -V ctest -I 2,2 -V to get some more information. Cheers, p. On 13/03/2020

Re: [Rdkit-discuss] RDKit in C++

2020-02-26 Thread Paolo Tosco
Hi Leon, there is nice document produced by David Cosgrove and Greg Landrum: https://github.com/rdkit/rdkit/blob/master/Docs/Book/GettingStartedInC%2B%2B.md RDKit C++ unit tests, RDKit C++ API documentations and headers are also very helpful. Cheers, p. On 26/02/2020 15:51, topgunhaides .

Re: [Rdkit-discuss] Draw.MolsToGridImage error: got multiple values for keyword argument

2020-02-25 Thread Paolo Tosco
Hi Konrad, you should use the highlightAtomLists parameter rather than highlightAtoms, then your example will work. Cheers, p. On 25/02/2020 16:02, Konrad Koehler via Rdkit-discuss wrote: Hi everyone, I am having trouble using a mol property value to define highlighted atoms when

Re: [Rdkit-discuss] What is the meaning of the output of rdkit.Chem.rdMolAlign.O3A.Align()?

2020-02-24 Thread Paolo Tosco
source shape similarity tool? Best regards Zhenting Paolo Tosco <mailto:paolo.tosco.m...@gmail.com>> 于2020年2月24日周一 下午9:21写道: Hi Zhenting, O3A.Align() returns the RMSD between the atom pairs that the O3A algorithm was able to match across the two molecules. O3A.Score(

Re: [Rdkit-discuss] What is the meaning of the output of rdkit.Chem.rdMolAlign.O3A.Align()?

2020-02-24 Thread Paolo Tosco
Hi Zhenting, O3A.Align() returns the RMSD between the atom pairs that the O3A algorithm was able to match across the two molecules. O3A.Score() returns the score for an alignment. The score is directly proportional to: * the number of atom pairs that could be matched across the two

Re: [Rdkit-discuss] Pharmacophore Fingerprints

2020-02-21 Thread Paolo Tosco
Hi Antoine, |rdkit.Chem.Pharm2D.Generate.||Gen2DFingerprint()| expects a single molecule https://www.rdkit.org/docs/source/rdkit.Chem.Pharm2D.Generate.html?highlight=gen2dfingerprint#rdkit.Chem.Pharm2D.Generate.Gen2DFingerprint while you are passing a list of molecules: pharmacophorefps =

Re: [Rdkit-discuss] Markush Enumeration.

2020-02-21 Thread Paolo Tosco
Hi Jitender, you could do that quite easily using reaction SMARTS; see for example this thread: https://sourceforge.net/p/rdkit/mailman/message/35730514/ You could selectively replace a specific R attachment point by isotopically labeling it. Cheers, p. On 21/02/2020 09:55, Jitender

Re: [Rdkit-discuss] conformations for cycles with multiple stereocenters

2020-02-21 Thread Paolo Tosco
Hi Pavel, I believe you forgot to add hydrogen atoms to the molecule graph before generating 3D conformers: mol_h = Chem.AddHs(mol) AllChem.EmbedMultipleConfs(mol_h, 50, Chem.rdDistGeom.ETKDGv2()) mol_h.GetNumConformers() 50 HTH, cheers p. On 21/02/2020 12:57, Pavel Polishchuk wrote:

Re: [Rdkit-discuss] Inconsistent sanitization of fragments

2020-02-18 Thread Paolo Tosco
the SanitizeFrags option when getting individual fragments. Am I missing something? Kind regards Puck On Tue, 18 Feb 2020 at 11:17, Paolo Tosco <mailto:paolo.tosco.m...@gmail.com>> wrote: Hi Puck, I modified your previous example to use FragmentOnBonds(): from rdkit imp

Re: [Rdkit-discuss] Inconsistent sanitization of fragments

2020-02-18 Thread Paolo Tosco
h dummy atoms rather than hydrogen. Is it possible to quench with hydrogen using FragmentOnBonds()? Kind regards Puck On Mon, 17 Feb 2020 at 13:42, Paolo Tosco <mailto:paolo.tosco.m...@gmail.com>> wrote: Hi Puck, sorry dor the delay in replying. After removing the

Re: [Rdkit-discuss] Inconsistent sanitization of fragments

2020-02-17 Thread Paolo Tosco
Hi Puck, sorry dor the delay in replying. After removing the bond you will need to adjust the number of explicit Hs on both ends with SetNumExplicitHs(), and then add those Hs in the molecule graph as real atoms with Chem.AddHs(): rwmol = Chem.RWMol(mol) bonds = rwmol.GetBonds() b =

Re: [Rdkit-discuss] PDB file format and dummy atoms

2020-02-13 Thread Paolo Tosco
Hi Gabriele, this has come up previously: https://sourceforge.net/p/rdkit/mailman/message/36796385/ This gist https://gist.github.com/ptosco/ba11e577a8c616b958c49e23cc42a5e3 shows a possible solution, provided that your molecules do not contain Astatine, otherwise pick another unusual

Re: [Rdkit-discuss] Inconsistent sanitization of fragments

2020-02-12 Thread Paolo Tosco
Dear Puck, Sure; I'll get back to you later today. Cheers, p. On 12/02/2020 10:03, Puck van Gerwen wrote: Dear all, I am trying to read in SMILES to generate mol objects which I then break into fragments using rwmol.RemoveBond(). Thereafter I want to sanitize the fragments by saturating

Re: [Rdkit-discuss] RDKit upgrade issue

2020-01-23 Thread Paolo Tosco
these be the same? Thanks, Navid On Thu, Jan 23, 2020 at 12:07 PM Paolo Tosco mailto:paolo.tosco.m...@gmail.com>> wrote: Hi Navid, try adding import rdkit.Chem.Descriptors before attempting to use MolWt. Cheers, p. On 23/01/2020 17:02, Navid Shervani-Tabar

Re: [Rdkit-discuss] RDKit upgrade issue

2020-01-23 Thread Paolo Tosco
Hi Navid, try adding import rdkit.Chem.Descriptors before attempting to use MolWt. Cheers, p. On 23/01/2020 17:02, Navid Shervani-Tabar wrote: Update: I was able to go back to square one. Using RDKit-2019.09.3.0 I still get the error module 'rdkit.Chem' has no attribute 'Descriptors'

Re: [Rdkit-discuss] Alignment using GetO3A

2020-01-14 Thread Paolo Tosco
Hi Charmaine, can you provide a reproducible example of your workflow? Please reply to me directly. Thanks, cheers p. On 14/01/2020 11:40, Chu, Charmaine wrote: Dear Rdkit community, I’ve been trying to align some small molecules to a defined substructure using GetO3A but it doesn’t seem

Re: [Rdkit-discuss] Exhaustive fragmentation of molecules

2020-01-08 Thread Paolo Tosco
Dear Puck, You may break a bond by creating a Chem.RWMol out of your Chem.Mol, and then calling the RemoveBond() method on your Chem.RWMol, or you may use dedicated functions in the rdmolops module. Individual fragments can then be obtained by calling rdmolops.GetMolFrags(). I have put

Re: [Rdkit-discuss] bond order is lost in reaction transformation

2020-01-03 Thread Paolo Tosco
Hi Devendra, Your starting molecule is aromatic, as is your product; by default RDKit writes aromatic SMILES. If you wish to write your molecule as kekulized SMILES, do the following: In [1]: from rdkit import Chem In

Re: [Rdkit-discuss] passing options to javac when building from source

2020-01-03 Thread Paolo Tosco
./Code/JavaWrappers/gmwrapper/org.RDKit.jar -verbose org.RDKit.RDKFuncs | grep major and get:   major version: 55 55 is the class version for Java11. In fact if I set JAVA_COMPILE to complete nonsense everything still builds OK! Tim On 26/12/2019 15:39, Paolo Tosco wrote: Hi Tim, Try addin

Re: [Rdkit-discuss] passing options to javac when building from source

2019-12-26 Thread Paolo Tosco
Hi Tim, Try adding this to your CMake command: -DJAVA_COMPILE="/usr/bin/javac -source 8" Cheers, p. On 26/12/2019 15:22, Tim Dudgeon wrote: When building the Java wrappers from source (the -DRDK_BUILD_SWIG_WRAPPERS=ON option) is possible to specify options to pass on to javac.

Re: [Rdkit-discuss] Constructing a mol object from a PDB ligand

2019-12-16 Thread Paolo Tosco
nd Ph.D. candidate, Brenk-lab, Haug-lab Department of Biomedicine Department of Chemistry University of Bergen From: Illimar Hugo Rekand Sent: Monday, December 16, 2019 5:55:56 PM To: Paolo Tosco Subject: Re: [Rdkit-discuss] Constructing a mol object from

Re: [Rdkit-discuss] Constructing a mol object from a PDB ligand

2019-12-16 Thread Paolo Tosco
Hi Illimar, this gist: https://gist.github.com/ptosco/2ee199b219b27e01052a7a1433b3bd22 shows a way to achieve this. Cheers, p. On 16/12/2019 16:07, Illimar Hugo Rekand wrote: Hello, everyone Is there a simple way to create a mol object from just the HETATM/ligand lines from a pdb-file?

Re: [Rdkit-discuss] About RemoveHs and AddHs

2019-12-10 Thread Paolo Tosco
Hi Leon, check the documentation for Chem.AddHs(): http://rdkit.org/docs/source/rdkit.Chem.rdmolops.html?highlight=addhs#rdkit.Chem.rdmolops.AddHs ARGUMENTS: [...] addCoords: (optional) if this toggle is set, The Hs will have 3D coordinates set. Default value is 0 (no 3D coords). So if

Re: [Rdkit-discuss] Turn off warning in Huckel calculations.

2019-12-10 Thread Paolo Tosco
Dear Jan, That warning is printed straight to stderr by the YAeHMOP code, so disabling Boost logging won't help. If you are using the YAeHMOP code from Python, your best option is probably to catch stderr as I described here: https://sourceforge.net/p/rdkit/mailman/message/36781695/ f =

Re: [Rdkit-discuss] RD Kit PostgreSQL in a container

2019-12-04 Thread Paolo Tosco
Hi, you might want to take a look at this Docker image maintained by Matt Swain: https://github.com/mcs07/docker-postgres-rdkit Cheers, p. On 04/12/2019 18:36, Webster Homer wrote: I’m looking at running  RD Kit Postgresql cartridge in a docker container. Has anyone done this? There are

Re: [Rdkit-discuss] Perceived bond orders of RNA PDB-files

2019-12-04 Thread Paolo Tosco
Hi Illimar, that's because the StandardPDBDoubleBond() function in ProximityBonds.cpp only takes into account standard amino acids, but not nucleotides. I'll submit a PR later tonight to include standard DNA and RNA bases. Cheers, p. On 04/12/2019 08:28, Illimar Hugo Rekand wrote: Hello,

Re: [Rdkit-discuss] (no subject)

2019-12-03 Thread Paolo Tosco
Murphy, PhD On Tue, Dec 3, 2019 at 3:47 AM Paolo Tosco <mailto:paolo.tosco.m...@gmail.com>> wrote: Hi Eric, it looks like the GUID in rdkit/utils/chemdraw.py might be outdated. Unfortunately I don't have access to ChemDraw, so I can't test this myself, but you might be

Re: [Rdkit-discuss] handling of stereo information from mol files when not sanitizing

2019-12-03 Thread Paolo Tosco
Hi Rasmus, the problem is that, as stated in the |rdmolfiles.||MolFromMolFile|() docs, the removeHs option is only honored when sanitize is True. So to obtain sensible results without sanitizing you should rather do something like: m1 = Chem.MolFromMolFile('Ran1.sdf', sanitize=False) m1 =

Re: [Rdkit-discuss] Segmentation fault when using MMFFOptimizeMoleculeConfs

2019-12-03 Thread Paolo Tosco
Hi Kas, Thanks for reporting this bug - I have just submitted a PR to fix it. The reason why you got this bug in the first place is that you are creating an O-Na bond, then assigning a +1 charge to oxygen. MMFF94 will choke on this, as it does not have parameters for that beast. The

Re: [Rdkit-discuss] Segmentation fault when using MMFFOptimizeMoleculeConfs

2019-12-03 Thread Paolo Tosco
Hi Kas, I'll have a look into this and get back to you soon. Cheers, p. On 03/12/2019 10:37, Kas Houthuijs wrote: Hi all, I've been using RDKit to generate geometries for sodium adduct ions that I subsequently use in a workflow. I wrote the following procedure for adding a Na+ to a neutral

Re: [Rdkit-discuss] (no subject)

2019-12-03 Thread Paolo Tosco
Hi Eric, it looks like the GUID in rdkit/utils/chemdraw.py might be outdated. Unfortunately I don't have access to ChemDraw, so I can't test this myself, but you might be able to find the current ChemDraw GUID as follows. From a Python prompt, issue the following commands:

Re: [Rdkit-discuss] Open3DAlign scoring of existing alignment?

2019-11-26 Thread Paolo Tosco
Hi James, What you've done seems correct to me; I have prepared an example gist here: https://gist.github.com/ptosco/40c2530c67d9c0930b8efbc8c92da0be which indeed shows correct matches. One observation here is that Open3DALIGN was conceived to generate alignments for 3D-QSAR; it really

Re: [Rdkit-discuss] The "confID" for "MMFFOptimizeMoleculeConfs"

2019-11-19 Thread Paolo Tosco
Hi Leon, you are right, that's a documentation bug: The confId parameter is actually ignored, as you have already found out. Thanks for reporting this, cheers p. On 19/11/2019 20:56, topgunhaides . wrote: Hi guys, Does the "confID" argument actually work for "MMFFOptimizeMoleculeConfs"?

Re: [Rdkit-discuss] ff.Minimize vs MMFFOptimize

2019-11-18 Thread Paolo Tosco
Hi Leon, MMFFOptimizeMoleculeConfs() by default will distribute minimization tasks across all available CPU cores as it is multi-threaded at the C++ level, while ff.Minimize() will run single-threaded, unless you do the distribution of individual minimization tasks yourself in the Python

Re: [Rdkit-discuss] Questions about adding and removing hydrogen atoms

2019-11-18 Thread Paolo Tosco
Hi Omar, you may have a look at this thread for an explanation and an example: https://sourceforge.net/p/rdkit/mailman/message/36787480/ Cheers, p. On 18/11/2019 15:28, Omar H94 wrote: What does it mean to take symmetry into account ? On Mon, Nov 18, 2019 at 6:07 PM topgunhaides .

Re: [Rdkit-discuss] Fragmentation Help

2019-11-17 Thread Paolo Tosco
Hi Ben, you could use SMARTS queries to do that, e.g.: from rdkit import Chem from rdkit.Chem.Draw import IPythonConsole RDKit WARNING: [19:50:41] Enabling RDKit 2020.03.1dev1 jupyter extensions sucrose =

Re: [Rdkit-discuss] Somthing wrong with MolDraw2DSVG

2019-11-06 Thread Paolo Tosco
Hi Zhang, this looks like a bug triggered by molecules whose Y size is very small, such as all molecules which are constituted by a single, horizontal bond: https://github.com/rdkit/rdkit/issues/2762 Cheers, p. On 11/04/19 07:14, Shengde wrote: Hi, I try to draw molecules in a grid

Re: [Rdkit-discuss] Explicit H in substructure searches

2019-11-05 Thread Paolo Tosco
Hi Markus, I tried to put together a comprehensible explanation in his gist: https://gist.github.com/ptosco/1088937ce332bd66c999a2a5fbc855b3 Please also refer to the following threads on the mailing list: https://sourceforge.net/p/rdkit/mailman/message/29679834/

Re: [Rdkit-discuss] Building RDKit Java Wrappers

2019-11-05 Thread Paolo Tosco
Hi Jenny, -- Could NOT find Boost (missing: serialization) (found suitable version "1.65.1", minimum required is "1.56.0") it looks like CMake found your Boost installation but either the serialization library was not built or possibly was not built for the same architecture (32-bit vs

Re: [Rdkit-discuss] fingerprint a molecule with pseudoatoms denoted by 'Du'

2019-10-30 Thread Paolo Tosco
Hi Jenke, I have put together a small gist showing a slightly hacky way to round-trip a molecule containing dummy atoms through a PDB block (assuming that your molecules do not contain astatine). If your dummy atoms are called "DU" rather than " *", you may just change the replace()

Re: [Rdkit-discuss] AlignMol and GetBestRMS

2019-10-17 Thread Paolo Tosco
Hi Stamatia, the difference between GetBestRMS and AlignMol is that GeBestRMS will yield the lowest RMSD across all symmetry-equivalent supeirmpositions, whereas AlignMol will yield the RMS from a single superimposition, by default obtained overlaying atoms with the same index across the two

Re: [Rdkit-discuss] Setting atom type

2019-10-16 Thread Paolo Tosco
Hi Luan, as mentioned in the e-mail thread that you have found, it is not currently possible to change atom type definitions from Python. Could you give me a few more details regarding your use case? What are you trying to achieve? Feel free to reply to me off-list. Thanks, cheers p. On

Re: [Rdkit-discuss] identify and setformal charge of carboxylic acid

2019-10-16 Thread Paolo Tosco
Hi Jorgen, you can use a reaction SMARTS for that purpose; see below for an example and the docs https://www.rdkit.org/docs/GettingStartedInPython.html#chemical-reactions for more information. from cresset import flare from rdkit import Chem from rdkit.Chem import AllChem

Re: [Rdkit-discuss] SDMolSupplier, next()

2019-10-15 Thread Paolo Tosco
Dear Jean-Marc, in Python 3 you need to use next(suppl) or suppl.__next__(). Cheers, p. On 10/15/19 21:34, Jean-Marc Nuzillard wrote: Dear all, The code: from rdkit import Chem sdfnamein = "simple.sdf" suppl = Chem.SDMolSupplier(sdfnamein) m = suppl.next() print(m.GetNumAtoms()) prints:

Re: [Rdkit-discuss] Compatibility with pylint in vscode

2019-10-12 Thread Paolo Tosco
Hi Hongbin, Try configuring extension-pkg-whitelist=rdkit Then pylint should recognise RDKit methods. Cheers, p. > On 12 Oct 2019, at 08:12, Hongbin Yang wrote: > > Dear RDKit users, > > Does any one use vscode with pylint support? > In my IDE, it hints me that "Module 'rdkit.Chem' has

Re: [Rdkit-discuss] Inchi which flavour??

2019-10-09 Thread Paolo Tosco
Hi Mike, please find here a solution which I have just tested and works well on both Unix and Windows. You need to redirect the C++ stderr stream with ctypes around the call whose output you wish to grab. This can be done defining a context manager that uses ctypes: import os import sys

Re: [Rdkit-discuss] Inchi which flavour??

2019-10-09 Thread Paolo Tosco
Hi Mike, as I promised I'll put together something for you to capture warnings; I'll try to get it done tonight. p. On 10/09/19 18:10, Mike Mazanetz wrote: Hi, Many thanks this, it is very helpful to see some code. Yes, as it stands, I am yet to get warnings which are seen in stdout

Re: [Rdkit-discuss] regarding hydrogens from SMILES

2019-10-08 Thread Paolo Tosco
9 at 10:10 AM Paolo Tosco mailto:paolo.tosco.m...@gmail.com>> wrote: Hi Jorgen, optimizing your molecule geometry with UFF or MMFF should fix the problem: AllChem.UFFOptimizeMolecule(m2) or AllChem.MMOptimizeMolec

Re: [Rdkit-discuss] regarding hydrogens from SMILES

2019-10-08 Thread Paolo Tosco
Hi Jorgen, optimizing your molecule geometry with UFF or MMFF should fix the problem: AllChem.UFFOptimizeMolecule(m2) or AllChem.MMOptimizeMolecule(m2) see rdkit.Chem.rdForceFieldHelpers.UFFOptimizeMolecule

Re: [Rdkit-discuss] Saving chains from PDB file

2019-10-05 Thread Paolo Tosco
Hi Chris, The following, though quite inefficient, will work: from rdkit import Chem mol = Chem.MolFromPDBFile("1CX2.pdb") chains = {a.GetPDBResidueInfo().GetChainId() for a in mol.GetAtoms()} chain_mols = {c: Chem.RWMol(mol) for c in chains} for c, m in chain_mols.items(): bonds_to_remove =

Re: [Rdkit-discuss] Bug in Chem.SetDihedralDeg ?

2019-09-26 Thread Paolo Tosco
Dear Thomas, That sounds very much like a bug. I’ll have a look and see what’s going wrong there; I’ll be in touch soon. Cheers, p. > On 26 Sep 2019, at 18:13, > wrote: > > Hi, > > I came across a weird behavior of Chem.SetDihedralDeg: > > In the attached python script I try to

Re: [Rdkit-discuss] problem when drawing a murcko scaffold

2019-08-28 Thread Paolo Tosco
Hi Jose Manuel, the problem is just that the scaffold returned by MurckoScaffold.GetScaffoldForMol() has no explicit hydrogens on the imino N: for atom in ms.GetAtoms():     print(atom.GetIdx(), atom.GetAtomicNum(), atom.GetNumExplicitHs(),   atom.GetNumImplicitHs(),

Re: [Rdkit-discuss] Setting custom coordinates for new atoms

2019-08-28 Thread Paolo Tosco
r.cpp Failed Expression: dp_mol->getNumAtoms() == d_positions.size() RDKIT: 2019.09.1dev1 BOOST: 1_67 Hoping to hear from you soon! Illimar Rekand Ph.D. candidate, Brenk-lab, Haug-lab Department of Biomedicine Department of Chemistry University of Bergen _

Re: [Rdkit-discuss] Setting custom coordinates for new atoms

2019-08-22 Thread Paolo Tosco
Hi Illimar, AddAtom() will return the index i of the added atom, then you can call SetAtomPosition on that index on the molecule conformer and pass a Point3D with the desired coordinates: conf.SetAtomPosition(i, Point3D(x, y, z)) Cheers, p. On 08/22/19 09:24, Illimar Hugo Rekand wrote:

Re: [Rdkit-discuss] Get distances between two atoms in different molecules

2019-08-16 Thread Paolo Tosco
Hi Illimar, You may use Point3D.Distance: conf_a.GetAtomPosition(i).Distance(conf_b.GetAtomPosition(j)) Cheers, p. > On 16 Aug 2019, at 16:01, Illimar Hugo Rekand wrote: > > Hello everyone, > > > I see that GetBondDistance() is a useful tool for calculating the distances > between atoms,

Re: [Rdkit-discuss] GetSubstructMatches() as smiles

2019-08-07 Thread Paolo Tosco
Hi Mel, You can use Chem.MolFragmentToSmiles(mol, match) where match is a tuple of atom indices returned by GetSubstructMatch(). Cheers, p. > On 7 Aug 2019, at 11:36, Melissa Adasme wrote: > > Dear rdkitters, > > I'm trying to find substructures (query molecules built from SMARTS) matching

Re: [Rdkit-discuss] Protonation site

2019-08-05 Thread Paolo Tosco
Hi Nitzan, you should try to modify the molecule conformation as little as possible between the two calculations; see the example below. rom rdkit import Chem from rdkit.Chem import AllChem test_ion1 = Chem.MolFromSmiles('COC(=O)C(c1c1)C1[NH2+]1') test_ion1 =

Re: [Rdkit-discuss] How to make non-planar rings have a consistent conformation?

2019-08-05 Thread Paolo Tosco
Dear Masgils, you might look into using AllChem.ConstrainedEmbed() and supplying pre-generated 3D coordinates for your 6-membered chair (or boat) ring conformations; see the example below where I constrain the piperidine ring in bilastine to have a chair conformation. You might need

Re: [Rdkit-discuss] How to get substructure matches with different atoms?

2019-07-25 Thread Paolo Tosco
Dear Masgils, you may try something along these lines, i.e. make atoms and/or bonds generic on one of the molecules withrdmolops.AdjustQueryProperties() in order to get subtructures to match, and then use rdMolAlign.GetBestRMS(): piperidine = Chem.AddHs(Chem.MolFromSmiles("C1CC(C)CCN1"))

Re: [Rdkit-discuss] Problem with Installation Conda Miniconda Azure Linux

2019-07-09 Thread Paolo Tosco
18.04.2 glibc/2.27     UID:GID : 1002:1003 netrc file : None    offline mode : False " (I replaced my Username with "User".) Best, Jasmin Am 09.07.2019 13:30 schrieb Paolo Tosco: Hi Jasmin, after you have activated your environment it should be suffic

Re: [Rdkit-discuss] Problem with Installation Conda Miniconda Azure Linux

2019-07-09 Thread Paolo Tosco
hing. Best, Jasmin Am 09.07.2019 10:03 schrieb Paolo Tosco: Hi Jasmin, as it looks like you are attempting to build RDKit in a conda environment, you should be building against the Boost version supplied by conda, while this line Boost include path: /usr/include shows that cmake has picked up

Re: [Rdkit-discuss] Problem with Installation Conda Miniconda Azure Linux

2019-07-09 Thread Paolo Tosco
Hi Jasmin, as it looks like you are attempting to build RDKit in a conda environment, you should be building against the Boost version supplied by conda, while this line Boost include path: /usr/include shows that cmake has picked up the system-installed Boost from libboost-all-dev.This

Re: [Rdkit-discuss] How to calculate Lennard-Jones potential by using RDkit?

2019-07-08 Thread Paolo Tosco
Hi, a similar question has come up recently on the RDKit mailing list: https://www.mail-archive.com/rdkit-discuss@lists.sourceforge.net/msg08995.html the GetUFFVdWParams() and GetMMFFVdWParams() functions will return the vdW parameters for UFF and MMFF94 force fields, respectively. For UFF

Re: [Rdkit-discuss] Error from qed

2019-07-04 Thread Paolo Tosco
Hi Navid, based on the adjacency matrix that you reported the first molecule has the following topology: i.e., it features an oxygen atom with 3 valences, plus a disconnected oxygen (the last one in the node). That molecule makes little chemical sense to me - it looks like some sort of

Re: [Rdkit-discuss] What is returned by GetMMFFVdWParams?

2019-07-03 Thread Paolo Tosco
Hi Lewis, The reason why it takes two particle indices as input is that MMFF94 uses rather complex combination rules for the van der Waals term. In particular, EvdW between two particles /i/ and /j/ is given by the following equation: where /R/_/ij/ is the distance between particles /i/

Re: [Rdkit-discuss] support for Postgres 11 ?

2019-07-01 Thread Paolo Tosco
Hi John, yes, it is, I have myself compiled the RDKit PostgreSQL cartridge against Postgres 11. It should just be a matter of adding the following flags to the cmake command:   -DPostgreSQL_ROOT=/usr/pgsql-11 \   -DPostgreSQL_INCLUDE_DIR=/usr/pgsql-11/include \

Re: [Rdkit-discuss] Query about Substructure match by RDKit

2019-06-28 Thread Paolo Tosco
Hi Goutam, I assume you are typing the first example interactively in the Python interpreter or in a ipython shell or Jupyter notebook. In that case you only need to enter the same commands in a text editor, save the script with a name (e.g., substructure.py) and run it from a shell; python

Re: [Rdkit-discuss] Chem.RemoveHs does not remove explicit hydrogens

2019-06-22 Thread Paolo Tosco
Dear Steven, yes, it is the expected behaviour. Molecule mol encodes acetone with all hydrogens made explicit, such that the RDKit does not need to use its valence model to compute the number of implicit Hs each heavy atom is connected to. However, as you can see in your mol.GetAtoms()

Re: [Rdkit-discuss] Shape alignment in wrong 3D reference frame - how to fix?

2019-06-18 Thread Paolo Tosco
]], constraintWeights=contraint_weights, prbCid=cid) Cheers /.Joerg On Sun, Jun 16, 2019 at 8:51 PM Paolo Tosco mailto:paolo.tosco.m...@gmail.com>> wrote: Dear Jörg, I have just tried this and it seems to work for me. I have created a gist here which shows an example usage on mu

Re: [Rdkit-discuss] Shape alignment in wrong 3D reference frame - how to fix?

2019-06-16 Thread Paolo Tosco
Dear Jörg, I have just tried this and it seems to work for me. I have created a gist here which shows an example usage on multiple conformations: https://gist.github.com/ptosco/b9b7341251457fe26441dc17609ae34a As the notebook contains 3Dmol.js renderings that won't show up in the gist, I

Re: [Rdkit-discuss] Catching errors in SMILES files

2019-06-04 Thread Paolo Tosco
for now.  Do you want me to file an issue on github, or even, maybe, see if I can fix it myself? Cheers, Dave On Mon, Jun 3, 2019 at 5:32 PM Paolo Tosco <mailto:paolo.tosco.m...@gmail.com>> wrote: Hi David, a workaround could be adding a final check after the for loop: #

Re: [Rdkit-discuss] Catching errors in SMILES files

2019-06-03 Thread Paolo Tosco
Hi David, a workaround could be adding a final check after the for loop: #!/usr/bin/env python from rdkit import Chem suppl1 = Chem.SmilesMolSupplier('test1.smi', titleLine=False, nameColumn=1) rec_num = 0 print("len(suppl1) = {0:d}".format(len(suppl1))) for mol in suppl1:     rec_num += 1    

Re: [Rdkit-discuss] Unable to build RDKit C# wrapper due to boost libraries

2019-05-03 Thread Paolo Tosco
ry with a non-Anaconda Boost, but I've now switched back to the conda boost version. Unfortunately it still does not work. Esther *From:* Paolo Tosco *Sent:* 03 May 2019 10:43 *To:* Esther Barlow-Smith *Subject:* Re: [Rdkit-discu

Re: [Rdkit-discuss] Unable to build RDKit C# wrapper due to boost libraries

2019-05-03 Thread Paolo Tosco
Dear Esther, you should not set BOOST_INCLUDEDIR, BOOST_ROOT, BOOST_LIBRARYDIR as environment variables, but as CMake parameters, i.e. something like: cmake -S %RDBASE% -B "%RDBASE%\build" -DRDK_BUILD_SWIG_CSHARP_WRAPPER=ON

Re: [Rdkit-discuss] Get num of heavy atoms returns incorrect value

2019-05-01 Thread Paolo Tosco
Hi Lukas, in the RDKit notation all atoms are explicit if they are present in the molecule graph, including hydrogens. You mention that hydrogens are explicitly present in your input structure, so that's the expected behaviour. If you wish to retrieve the number of heavy atoms you can use

Re: [Rdkit-discuss] molecular dynamics using RDkit only

2019-04-13 Thread Paolo Tosco
Dear Jim, I have indeed written some preliminary code to: 1) Implement MMFF94/MMFF94s into OpenMM 2) Integrate OpenMM within the RDKit Even though it needs polishing and adding unit tests, this code is functional and usable. I will make sure that it builds and integrates correctly with the

Re: [Rdkit-discuss] Beta of the 2019.03 release available

2019-04-06 Thread Paolo Tosco
iguez Schmidt, Matt Swain, Paolo Tosco, Ricardo Vianello, 'John-Videogames', 'magattaca', 'msteijaert', 'paconius', 'sirbiscuit' ## Bug Fixes: - PgSQL: fix boolean definitions for Postgresql 11 (github pull #2129 from pkubatrh) - update fingerprint tutorial notebook

Re: [Rdkit-discuss] multiThreads OptimizeMoleculeConf with constraint?

2019-03-29 Thread Paolo Tosco
Hi Rafal, There is no C++-level function to do that, but you can use Python multiprocessing to achieve the same result with only a small efficiency loss, due to the larger overhead of starting multiple processes as compared to multiple threads: from multiprocessing import Pool from

Re: [Rdkit-discuss] Get list of dihedrals using atom names/numbers from PDB

2019-03-27 Thread Paolo Tosco
Hi Angelica, if torsion_lists is the tuple of of (non_ring, ring) torsion lists in mol: torsion_lists = TorsionFingerprints.CalculateTorsionLists(mol) you can get the same list where the atom index is replaced by a (PDB_atom_serial, PDB_atom_name) tuple as follows: torsion_lists_sn =

Re: [Rdkit-discuss] ForwardSDMolSupplier, stdin, and python 3.7

2019-03-27 Thread Paolo Tosco
Hi Andy, for that to work with Python 3 you will need to replace sys.stdin with sys.stdin.buffer. HTH, cheers Paolo On 03/27/19 18:32, Andy wrote: Hi, I have used the git version of rdkit for years (local build with python 2.7). The last update pushed me to use python3, and, in addition

Re: [Rdkit-discuss] add hydrogen after its removal

2019-03-22 Thread Paolo Tosco
Hi Pavel, After you have first called AddHs(), all hydrogens in your molecule are now in the molecule graph as real atoms, and there are no more implicit/explicit Hs . Therefore, when you call RemoveAtom(), you are removing a real atom from the molecule graph, and the implicit/explicit H

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

Re: [Rdkit-discuss] Why this doesn't work? HasStructMatch function

2019-02-20 Thread Paolo Tosco
*From:* Paolo Tosco *Sent:* 19 February 2019 23:15 *To:* Li, Xiaobo [xiaoboli] *Subject:* Re: [Rdkit-discuss] Why this doesn't work? HasStructMatch function Hi Xiaobo, it will work if you use as SMARTS query one of the following expressions, not if you specify an explicit

<    1   2   3   4   >