[Rdkit-discuss] Filtering Out Highly Strained Ring Systems

2017-04-15 Thread James Johnson
Dear All,

I'm generating analogs from a parent compound. An unfortunate side effect
is the generation of various highly strained rings among other compounds.
I'm developing filters to deal with any unwanted generated compounds, but
I'm having difficulty with strained ring systems.

Attached are some examples in mol2 format: https://ufile.io/bdmcp

For this problem I'm thinking of using an energy/bond approach:
ff = AllChem.UFFGetMoleculeForceField(mol)
energy_per_bond = ff.CalcEnergy()/len(mol.GetBonds())

If energy/bond is above a certain value it gets filtered out. Do you think
this is the best solution? Is there a way of viewing each bonds energy
(with increasing amount of bonds an unstable bond might not be filtered)?
Do you have any suggestions on alternate ways of doing this?

Thank you for the help, it is very much appreciated! :)

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


Re: [Rdkit-discuss] Generating all stereochem possibilities from smile

2016-12-11 Thread James Johnson
Thank you all again for the great responses! :)

There seems to be a consensus between Andrew and Pavel that the solution is
with SetBondDir(). I've tried Pavel's functions get_unspec_double_bonds()
and set_double_bond_stereo() in python 2 (couldn't figure out how to get
RDkit set up in python 3, but it seems like python 3 is only used for
read_input). In python 2 get_unspec_double_bonds() worked, but
set_double_bond_stereo() did not change the stereo of the bond. I've also
tried the SetBondDir() function myself with no avail.

However, Brian's answer makes the logical sense with setStereo(). I did not
find a function like that in python (It is in the C++ code however:
http://www.rdkit.org/C++_Docs/Bond_8h_source.html#l00278). Oddly enough
there is the GetStereo() function for python.

I'm wondering if maybe I could use SetProp() to do this? I couldn't find
how exactly GetStereo() works, if it is a property that is set or
calculated. But I would assume if it was a property I could do something
like the following: SetProp("d_stereo","STEREOE"). However, I did not find
the right property name to do this.

Again, thank you all for the help. It is very much appreciated!

- James



On Fri, Dec 9, 2016 at 11:46 PM, Pavel Polishchuk 
wrote:

> I just want to share my script, which I use for enumeration of
> stereoisomers. Enumeration of double bonds was added quite recently and
> thus I didn't test it extensively.
> I put it on github: 
> https://github.com/DrrDom/rdk
> It seems to work well on quite complex queries like
> CC1CCC(CC1)C1CC=C(C\C(=C/I)C(=CF)C1C1C[C@@H](C)CC=C1)C1CC[C@H](O)C(Br)C1
>
> to generate all possible stereoisomers:
> gen_stereo_rdkit3.py -i input.smi -o output.smi -t -d
>
> to discard compounds with more than 4 undefined centers/double bonds:
> gen_stereo_rdkit3.py -i input.smi -o output.smi -t -d -u 4
>
> Try it on your own risk :)
> If you will find mistakes let me know.
>
> Pavel.
>
>
> On 12/10/2016 03:44 AM, Brian Cole wrote:
>
> So I may need a little guidance on this one from someone with a little
> more historical knowledge of RDKit.
>
> I found the findPotentialStereoBonds function inside Chirality.cpp that
> appears to do what we want, detect double bonds with unspecified E/Z stereo
> chemistry. That's at least what the comment in the file leads me to
> believe:
>
> // Find bonds than can be cis/trans in a molecule and mark them as "any"
> ...
> void findPotentialStereoBonds(ROMol , bool cleanIt) {
>
>
> But when you look at the code, it's not setting bonds to Bond::STEREOANY,
> it's setting them to Bond::STEREONONE here:
>
> ...
> // proceed only if we either want to clean the stereocode on this
> bond
> // or if none is set on it yet
>
> if (cleanIt || dblBond->getStereo() == Bond::STEREONONE) {
>   dblBond->setStereo(Bond::STEREONONE);
> ...
>
> Seems odd to me check that the stereo is Bond::STEREONONE, and then set it
> to that value.
>
> While findPotentialStereoBonds isn't exposed in Python, there is some Java
> docs written for it in the Java wrappers:
> %javamethodmodifiers RDKit::MolOps::findPotentialStereoBonds(
> ROMol & mol,boolcleanIt = false )
> "
> /**
> 
> finds bonds that could be cis/trans in a molecule and mark them as
> Bond::STEREONONE
> 
>
>
> So that documentation is actually correct. It does find bonds that could
> be cis/trans and mark them as Bond::STEREONONE. That just isn't very useful
> since all bonds are marked Bond::STEREONONE by default.
>
> The only direct test case of findPotentialStereoBonds I can find is the
> following:
>
> MolOps::findPotentialStereoBonds(*m, false);
> TEST_ASSERT(m->getNumAtoms() == 15);
> TEST_ASSERT(m->getBondWithIdx(1)->getBondType() == Bond::DOUBLE);
> TEST_ASSERT(m->getBondWithIdx(1)->getStereoAtoms().size() == 2);
> TEST_ASSERT(m->getBondWithIdx(3)->getBondType() == Bond::DOUBLE);
> TEST_ASSERT(m->getBondWithIdx(3)->getStereoAtoms().size() == 2);
>
> That doesn't even test the getStereo() return value. Though it does test
> getStereoAtoms() return value. So it looks like the proper thing to do to
> detect unspecified bond stereo is to check for a non-empty getStereoAtoms()
> vector?
>
> So ideally, I would like to write an bond stereo enumerator that tests if
> a double bond has unspecified stereo (testing the size of getStereoAtoms()
> would work) and then sets the stereo, that is:
>
> bond.SetStereo(Bond::STEREOE);
> or
> bond.SetStereo(Bond::STEREOZ);
>
> And then hopefully the Chem.MolToSmiles will "do the right thing".
> However, this commented out code in the wrapper has given me pause:
>
> // this is no longer exposed because it requires that stereo atoms
> // be set. This is a task that is tricky and "dangerous".
> //.def("SetStereo",::setStereo,
> // "Set the CIP-classification of the bond as a
> 

Re: [Rdkit-discuss] Generating all stereochem possibilities from smile

2016-12-09 Thread James Johnson
Thank you all for your responses. I got R/S combos to work (awesome!), but
now I am working on E/Z. I am considering a similar approach (0 would be
interpreted as E, 1 as Z).

However to do this I would need two functions which I couldn't find
1.) Find double bonds that could be E/Z.
2.) Set the double bonds to have property E or Z

I actually only need #2 (just make any double bond E/Z as see what
happens), but #1 would make it more efficient.

How does RDKit handle E/Z stereochem in mol?

Thanks again for the help!

- James

On Fri, Dec 9, 2016 at 8:23 AM, Rafal Roszak <rmrmg.c...@gmail.com> wrote:

> On Thu, 8 Dec 2016 23:21:24 -0800
> James Johnson <totalboron...@gmail.com> wrote:
>
> > Hello all, I am trying to generate R and S from: CCC(C)(Cl)Br
> >
> > Below is the code for making the smi to mol file. Can someone give me
> some
> > guidance to generate all sterochem possibilities?
>
> There are two ways to address this problem:
> 1. generate all possible SMILESs and for each of them generate 3D
> structure using molecular modeling (or just embedMolecule) which is in
> my opinion better
>
> 2. generate many 3D structures and extract interesting stereoisomers
>
> Links below describe the 1st option:
> https://github.com/rdkit/rdkit/issues/626
> https://sourceforge.net/p/rdkit/mailman/message/34488969/
>
>
> Regards,
> RR
>
--
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


[Rdkit-discuss] Generating all stereochem possibilities from smile

2016-12-08 Thread James Johnson
Hello all, I am trying to generate R and S from: CCC(C)(Cl)Br

Below is the code for making the smi to mol file. Can someone give me some
guidance to generate all sterochem possibilities?

The code would also need to work for 2 stereocenters such as:
RR, RS, SR, SS
or
RE, RZ, SE, SZ
etc.

Thanks!

Python Code:

from rdkit import Chem
from rdkit.Chem import AllChem

smi = "CCC(C)(Cl)Br"
uncharged_mol_1D = Chem.MolFromSmiles(smi)
uncharged_mol_1D = Chem.MolFromSmiles(smi)
uncharged_mol_3D = Chem.AddHs(uncharged_mol_1D)
AllChem.EmbedMolecule(uncharged_mol_3D)
AllChem.UFFOptimizeMolecule(uncharged_mol_3D)
Chem.MolToMolFile(uncharged_mol_3D, "./test.mol")
--
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] Writing a Tripos MOL2 file with charges

2016-11-10 Thread James Johnson
Thank you everyone for all of your help.

I decided the best solution was Mr. Wójcikowsk's pull request. Thank you!

If it wasn't for this, I would have used a different program. Make that
pull request happen! :-D

Thanks once again.

-Jonathan

On Mon, Oct 31, 2016 at 11:16 AM, Paolo Tosco <paolo.to...@unito.it> wrote:

> Dear James,
>
> this is a small variation on Greg's reply (he was faster than me!):
>
> https://gist.github.com/ptosco/02af3456720d54c37ffc488056df02d4
>
> While Greg's reply showed how to set a molecule property as a list of
> per-atom partial charges, here I have set each partial charge as an atom
> property. When you read in the SDF file, the partial charge for each atom
> can be accessed with
>
> partialCharge = float(atom.GetProp('molFileAlias'))
>
> In the same way you may also associate to each a name or any other
> property.
> Cheers,
> p.
>
>
> On 31/10/2016 17:11, James Johnson wrote:
>
> Is there any supported format that outputs partial charges?
>
> The speed of RDKit is phenomenal (0.02 seconds) vs obabel's 2 seconds, but
> if I cannot output partial charges I'll be forced to use obabel.
>
> Thank you for your time.
>
> -James
>
> On Mon, Oct 31, 2016 at 1:00 AM, Greg Landrum <greg.land...@gmail.com>
> wrote:
>
>> Hi James,
>>
>> Due to problems with the general ambiguity of the format the RDKIt does
>> not have a mol2 writer.
>>
>> -greg
>>
>>
>>
>>
>>
>> On Mon, Oct 31, 2016 at 12:22 AM +0100, "James Johnson" <
>> totalboron...@gmail.com> wrote:
>>
>> Hello all,
>>>
>>> I've been trying to output my 3D mol object that has Gasteiger charges
>>> to mol2 file format. How would I go about that? I've only found it for mol
>>> and pdb.
>>>
>>> Here is the code I'be been using if that helps:
>>> ~~~
>>> from rdkit import Chem
>>> from rdkit.Chem import AllChem
>>>
>>> smile = 'Cc1c1'
>>>
>>> uncharged_mol_1D = Chem.MolFromSmiles(smile)
>>>
>>> uncharged_mol_3D = Chem.AddHs(uncharged_mol_1D)
>>> AllChem.EmbedMolecule(uncharged_mol_3D)
>>> AllChem.UFFOptimizeMolecule(uncharged_mol_3D)
>>>
>>> charged_mol_3D = uncharged_mol_3D
>>> AllChem.ComputeGasteigerCharges(charged_mol_3D)
>>>
>>> fout = Chem.SDWriter('./charged_test.mol')
>>> fout.write(charged_mol_3D)
>>> fout.close()
>>> ~~~
>>>
>>> Thank you!
>>>
>>
>
>
> --
> 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 
> listRdkit-discuss@lists.sourceforge.nethttps://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] Writing a Tripos MOL2 file with charges

2016-10-31 Thread James Johnson
Is there any supported format that outputs partial charges?

The speed of RDKit is phenomenal (0.02 seconds) vs obabel's 2 seconds, but
if I cannot output partial charges I'll be forced to use obabel.

Thank you for your time.

-James

On Mon, Oct 31, 2016 at 1:00 AM, Greg Landrum <greg.land...@gmail.com>
wrote:

> Hi James,
>
> Due to problems with the general ambiguity of the format the RDKIt does
> not have a mol2 writer.
>
> -greg
>
>
>
>
>
> On Mon, Oct 31, 2016 at 12:22 AM +0100, "James Johnson" <
> totalboron...@gmail.com> wrote:
>
> Hello all,
>>
>> I've been trying to output my 3D mol object that has Gasteiger charges to
>> mol2 file format. How would I go about that? I've only found it for mol and
>> pdb.
>>
>> Here is the code I'be been using if that helps:
>> ~~~
>> from rdkit import Chem
>> from rdkit.Chem import AllChem
>>
>> smile = 'Cc1c1'
>>
>> uncharged_mol_1D = Chem.MolFromSmiles(smile)
>>
>> uncharged_mol_3D = Chem.AddHs(uncharged_mol_1D)
>> AllChem.EmbedMolecule(uncharged_mol_3D)
>> AllChem.UFFOptimizeMolecule(uncharged_mol_3D)
>>
>> charged_mol_3D = uncharged_mol_3D
>> AllChem.ComputeGasteigerCharges(charged_mol_3D)
>>
>> fout = Chem.SDWriter('./charged_test.mol')
>> fout.write(charged_mol_3D)
>> fout.close()
>> ~~~
>>
>> Thank you!
>>
>
--
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


[Rdkit-discuss] Writing a Tripos MOL2 file with charges

2016-10-30 Thread James Johnson
Hello all,

I've been trying to output my 3D mol object that has Gasteiger charges to
mol2 file format. How would I go about that? I've only found it for mol and
pdb.

Here is the code I'be been using if that helps:
~~~
from rdkit import Chem
from rdkit.Chem import AllChem

smile = 'Cc1c1'

uncharged_mol_1D = Chem.MolFromSmiles(smile)

uncharged_mol_3D = Chem.AddHs(uncharged_mol_1D)
AllChem.EmbedMolecule(uncharged_mol_3D)
AllChem.UFFOptimizeMolecule(uncharged_mol_3D)

charged_mol_3D = uncharged_mol_3D
AllChem.ComputeGasteigerCharges(charged_mol_3D)

fout = Chem.SDWriter('./charged_test.mol')
fout.write(charged_mol_3D)
fout.close()
~~~

Thank you!
--
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