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

2016-10-31 Thread Paolo Tosco

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 > 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"
mailto: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


--
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 Greg Landrum
About the best I can think of is to set a property on the molecule and
generate an SDF. This contains the information, but is somewhat ugly:


In [19]: m = Chem.MolFromSmiles('c1cccnc1OC')

In [20]: AllChem.ComputeGasteigerCharges(m)

In [21]: chgs = [x.GetDoubleProp('_GasteigerCharge') for x in m.GetAtoms()]

In [22]: m.SetProp('GasteigerCharges','\n'.join(['%.3f'%x for x in chgs]))

In [23]: from io import StringIO

In [24]: sio = StringIO()

In [25]: w = Chem.SDWriter(sio)

In [26]: w.write(m)

In [27]: w.flush()

In [28]: print(sio.getvalue())

 RDKit

  8  8  0  0  0  0  0  0  0  0999 V2000
0.0.0. 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
0.0.0. 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
0.0.0. N   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
0.0.0. O   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  2  2  0
  2  3  1  0
  3  4  2  0
  4  5  1  0
  5  6  2  0
  6  7  1  0
  7  8  1  0
  6  1  1  0
M  END
>(1)
0.000
-0.055
-0.044
0.031
-0.222
0.212
-0.481
0.079



Maybe there's a better solution. What are you trying to do with the partial
charge data?

-greg


On Mon, Oct 31, 2016 at 6:11 PM, 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 
> 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


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

2016-10-31 Thread Maciek Wójcikowski
Hi,

If you really desperately need it, there is a mockup of MolToMol2Block()
and MolToMol2File() by Jan and myself [see
https://github.com/rdkit/rdkit/pull/415], but it's still rough around the
eadges at best.


Pozdrawiam,  |  Best regards,
Maciek Wójcikowski
mac...@wojcikowski.pl

2016-10-31 18:11 GMT+01:00 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 
> 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
>
>
--
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 
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


Re: [Rdkit-discuss] Problems Installing RDKit for Python Under Ubuntu

2016-10-31 Thread Greg Landrum
The last time this came up (
http://www.mail-archive.com/rdkit-discuss@lists.sourceforge.net/msg06118.html)
it was a problem with the PYTHONPATH being set improperly.

We should update the docs for this.

On Sun, Oct 30, 2016 at 9:30 PM, Jonathan Saboury  wrote:

> Hello all,
>
> I've been having problems installing RDKit for python in Ubuntu.
>
> The installation guide simply states to run: "sudo apt-get install 
> python-rdkit librdkit1 rdkit-data".
>
> I've done this but when I run a python with "from rdkit import Chem" it says 
> that "ImportError: No module named rdkit".
>
> What else am I missing? 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
>
>
--
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


Re: [Rdkit-discuss] reading multiple conformers from file

2016-10-31 Thread Greg Landrum
Ok, let's start talking about this here:
https://github.com/rdkit/rdkit/issues/1137

-greg


On Mon, Oct 31, 2016 at 1:11 PM, Markus Sitzmann 
wrote:

> +1 for a json format ... hmm, how about a general json-based molecular
> structure format ... let us call it "cson" (that is an homage to Google
> gson and Chemical Markup Language CML :-)
>
> Markus
>
> On Mon, Oct 31, 2016 at 11:18 AM, Brian Cole  wrote:
>
>> I would 2nd the suggestion of continuing to push a JSON format forward
>> that natively supports multiple conformers.
>>
>> I've never seen automatic recombination of an SDF work %100 of the time,
>> it's fraught with corner cases. It's also abysmally slow and takes a huge
>> amount of disk space.
>>
>> -Bruce
>>
>> On Oct 30, 2016, at 5:21 PM, Brian Kelley  wrote:
>>
>> Rdkit already has a way to serialize conformers, the binary pickle format!
>>
>> Perhaps we should make a file extension for multiple molecules.  Say
>> ".rdk" and call it a day.   Like inchi the source code is the reference  :)
>>
>> 
>> Brian Kelley
>>
>> On Oct 27, 2016, at 2:05 AM, Greg Landrum  wrote:
>>
>> The RDKit has support for the TPL format, an old BioCad/MSI/Accelrys
>> format.
>> It's easy to imagine something better, but this is at least already there
>> and there could be other software that speaks it:
>> https://github.com/rdkit/rdkit/blob/master/Code/GraphMol/
>> FileParsers/test_data/cmpd2.tpl
>>
>> I'd still like to do a decent JSON format and adding multi-confs to that
>> would be logical
>>
>> On Thu, Oct 27, 2016 at 6:58 AM, David Cosgrove <
>> davidacosgrov...@gmail.com> wrote:
>>
>>> I've been wondering if, now that you can get decent conformations from
>>> RDKit, it would be worth devising a multi-conformation file format to make
>>> reading multi-conf molecules faster for vs purposes. In my experience,
>>> pulling all the conformers out of an ascii file such as an sdf can become
>>> the RDS for pharmacophore searchimg. Something to think about at the
>>> hackathon maybe and certainly something that deserves a new email
>>> thread.
>>>
>>> Dave
>>>
>>>
>>> On Thursday, 27 October 2016, Greg Landrum 
>>> wrote:
>>>
 Hi Thomas,

 You're right, reading multiple conformations out of an SDF does seem
 like one of those common operations. Unfortunately the RDKit does not
 currently support it in an easy way.

 A python implementation of this would be a good topic for Friday's UGM
 hackathon, we can see if anyone finds it interesting enough to work on.

 -greg


 On Tue, Oct 25, 2016 at 2:16 AM, Thomas Evangelidis 
 wrote:

> Hello everyone,
>
> I am a new user of RDkit and I was looking in the documentation for an
> easy way to load multiple conformers from a structure file like .sdf. The
> code must 1) distinguish between different protonation states of the same
> molecule,  2) create a new Mol() object for each protonation state and 
> load
> into it the respective conformers.
>
> Apparently I can work out a solution for 1)
> using mol.GetProp('_Name'), mol.GetNumAtoms, mol.GetNumBonds and
> other properties, but I was wondering if there is any more straight 
> forward
> way to do it.
> For 2) I guess I must iterate over all molecules in the input file,
> create new Mol() objects (one for each protonation state of each ligand)
> and add conformers to these new Mol() objects. Again this sounds easily
> programmable, but sounds like a very common operation, thus I was 
> wondering
> if it has been implemented in a function.
>
> thanks in advance
> Thomas
>
>
> --
>
> ==
>
> Thomas Evangelidis
>
> Research Specialist
> CEITEC - Central European Institute of Technology
> Masaryk University
> Kamenice 5/A35/1S081,
> 62500 Brno, Czech Republic
>
> email: tev...@pharm.uoa.gr
>
>   teva...@gmail.com
>
>
> website: https://sites.google.com/site/thomasevangelidishomepage/
>
>
> 
> --
> 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
>
>

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

Re: [Rdkit-discuss] reading multiple conformers from file

2016-10-31 Thread Markus Sitzmann
+1 for a json format ... hmm, how about a general json-based molecular
structure format ... let us call it "cson" (that is an homage to Google
gson and Chemical Markup Language CML :-)

Markus

On Mon, Oct 31, 2016 at 11:18 AM, Brian Cole  wrote:

> I would 2nd the suggestion of continuing to push a JSON format forward
> that natively supports multiple conformers.
>
> I've never seen automatic recombination of an SDF work %100 of the time,
> it's fraught with corner cases. It's also abysmally slow and takes a huge
> amount of disk space.
>
> -Bruce
>
> On Oct 30, 2016, at 5:21 PM, Brian Kelley  wrote:
>
> Rdkit already has a way to serialize conformers, the binary pickle format!
>
> Perhaps we should make a file extension for multiple molecules.  Say
> ".rdk" and call it a day.   Like inchi the source code is the reference  :)
>
> 
> Brian Kelley
>
> On Oct 27, 2016, at 2:05 AM, Greg Landrum  wrote:
>
> The RDKit has support for the TPL format, an old BioCad/MSI/Accelrys
> format.
> It's easy to imagine something better, but this is at least already there
> and there could be other software that speaks it:
> https://github.com/rdkit/rdkit/blob/master/Code/GraphMol/FileParsers/test_
> data/cmpd2.tpl
>
> I'd still like to do a decent JSON format and adding multi-confs to that
> would be logical
>
> On Thu, Oct 27, 2016 at 6:58 AM, David Cosgrove <
> davidacosgrov...@gmail.com> wrote:
>
>> I've been wondering if, now that you can get decent conformations from
>> RDKit, it would be worth devising a multi-conformation file format to make
>> reading multi-conf molecules faster for vs purposes. In my experience,
>> pulling all the conformers out of an ascii file such as an sdf can become
>> the RDS for pharmacophore searchimg. Something to think about at the
>> hackathon maybe and certainly something that deserves a new email
>> thread.
>>
>> Dave
>>
>>
>> On Thursday, 27 October 2016, Greg Landrum 
>> wrote:
>>
>>> Hi Thomas,
>>>
>>> You're right, reading multiple conformations out of an SDF does seem
>>> like one of those common operations. Unfortunately the RDKit does not
>>> currently support it in an easy way.
>>>
>>> A python implementation of this would be a good topic for Friday's UGM
>>> hackathon, we can see if anyone finds it interesting enough to work on.
>>>
>>> -greg
>>>
>>>
>>> On Tue, Oct 25, 2016 at 2:16 AM, Thomas Evangelidis 
>>> wrote:
>>>
 Hello everyone,

 I am a new user of RDkit and I was looking in the documentation for an
 easy way to load multiple conformers from a structure file like .sdf. The
 code must 1) distinguish between different protonation states of the same
 molecule,  2) create a new Mol() object for each protonation state and load
 into it the respective conformers.

 Apparently I can work out a solution for 1)
 using mol.GetProp('_Name'), mol.GetNumAtoms, mol.GetNumBonds and other
 properties, but I was wondering if there is any more straight forward way
 to do it.
 For 2) I guess I must iterate over all molecules in the input file,
 create new Mol() objects (one for each protonation state of each ligand)
 and add conformers to these new Mol() objects. Again this sounds easily
 programmable, but sounds like a very common operation, thus I was wondering
 if it has been implemented in a function.

 thanks in advance
 Thomas


 --

 ==

 Thomas Evangelidis

 Research Specialist
 CEITEC - Central European Institute of Technology
 Masaryk University
 Kamenice 5/A35/1S081,
 62500 Brno, Czech Republic

 email: tev...@pharm.uoa.gr

   teva...@gmail.com


 website: https://sites.google.com/site/thomasevangelidishomepage/


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


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

Re: [Rdkit-discuss] reading multiple conformers from file

2016-10-31 Thread Brian Cole
I would 2nd the suggestion of continuing to push a JSON format forward that 
natively supports multiple conformers.

I've never seen automatic recombination of an SDF work %100 of the time, it's 
fraught with corner cases. It's also abysmally slow and takes a huge amount of 
disk space. 

-Bruce

> On Oct 30, 2016, at 5:21 PM, Brian Kelley  wrote:
> 
> Rdkit already has a way to serialize conformers, the binary pickle format!
> 
> Perhaps we should make a file extension for multiple molecules.  Say ".rdk" 
> and call it a day.   Like inchi the source code is the reference  :) 
> 
> 
> Brian Kelley
> 
>> On Oct 27, 2016, at 2:05 AM, Greg Landrum  wrote:
>> 
>> The RDKit has support for the TPL format, an old BioCad/MSI/Accelrys format.
>> It's easy to imagine something better, but this is at least already there 
>> and there could be other software that speaks it:
>> https://github.com/rdkit/rdkit/blob/master/Code/GraphMol/FileParsers/test_data/cmpd2.tpl
>> 
>> I'd still like to do a decent JSON format and adding multi-confs to that 
>> would be logical
>> 
>>> On Thu, Oct 27, 2016 at 6:58 AM, David Cosgrove 
>>>  wrote:
>>> I've been wondering if, now that you can get decent conformations from 
>>> RDKit, it would be worth devising a multi-conformation file format to make 
>>> reading multi-conf molecules faster for vs purposes. In my experience, 
>>> pulling all the conformers out of an ascii file such as an sdf can become 
>>> the RDS for pharmacophore searchimg. Something to think about at the 
>>> hackathon maybe and certainly something that deserves a new email thread. 
>>> 
>>> Dave
>>> 
>>> 
 On Thursday, 27 October 2016, Greg Landrum  wrote:
 Hi Thomas,
 
 You're right, reading multiple conformations out of an SDF does seem like 
 one of those common operations. Unfortunately the RDKit does not currently 
 support it in an easy way.
 
 A python implementation of this would be a good topic for Friday's UGM 
 hackathon, we can see if anyone finds it interesting enough to work on.
 
 -greg
 
 
> On Tue, Oct 25, 2016 at 2:16 AM, Thomas Evangelidis  
> wrote:
> Hello everyone,
> 
> I am a new user of RDkit and I was looking in the documentation for an 
> easy way to load multiple conformers from a structure file like .sdf. The 
> code must 1) distinguish between different protonation states of the same 
> molecule,  2) create a new Mol() object for each protonation state and 
> load into it the respective conformers. 
> 
> Apparently I can work out a solution for 1) using mol.GetProp('_Name'), 
> mol.GetNumAtoms, mol.GetNumBonds and other properties, but I was 
> wondering if there is any more straight forward way to do it. 
> For 2) I guess I must iterate over all molecules in the input file, 
> create new Mol() objects (one for each protonation state of each ligand) 
> and add conformers to these new Mol() objects. Again this sounds easily 
> programmable, but sounds like a very common operation, thus I was 
> wondering if it has been implemented in a function.
> 
> thanks in advance
> Thomas
> 
> 
> -- 
> ==
> Thomas Evangelidis
> Research Specialist
> CEITEC - Central European Institute of Technology
> Masaryk University
> Kamenice 5/A35/1S081, 
> 62500 Brno, Czech Republic 
> 
> email: tev...@pharm.uoa.gr
>   teva...@gmail.com
> 
> website: https://sites.google.com/site/thomasevangelidishomepage/
> 
> 
> --
> 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
>> 
>> --
>> 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
> --
> 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.

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

2016-10-31 Thread Greg Landrum
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" 
 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!






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