[Rdkit-discuss] RDKit Pandas iterate through all Descriptors for compounds in dataframe

2018-07-11 Thread Vasileios Tatsis via Rdkit-discuss
Hi RDKit community,I would like to ask if it is possible to calculate (iterate 
over) all the available descriptors for a set of compounds loaded in a pandas 
dataframe.I have found a few examples doing the same with a "mols" 
list.Thanks,Bill
--
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] Error if run Draw in Python

2018-07-11 Thread Chris Earnshaw
Hi

I'm no Python expert, but I think the problem is that Python doesn't (by
default) do filename globbing. As a result it doesn't understand the
significance of the ~ character in your directory path and tries to
interpret it literally. The simple solution is to just give a path that can
be interpreted directly (e.g.
/home/your_username/Desktop/rest_of_the_path), alternatively install the
Python glob module to parse your current path. The former seems to be a
much simpler solution!

Best regards,
Chris

On 11 July 2018 at 00:28, Phuong Chau  wrote:

> Thank you so much!
>
> On Tue, Jul 10, 2018 at 4:33 PM, Malitha Kabir 
> wrote:
>
>> Hi,
>>
>> Probably the designated folder is missing. So, rdkit cannot create the
>> file in specified path. Thanks.
>>
>> - malitha
>>
>> On Wed, Jul 11, 2018, 5:46 AM Phuong Chau  wrote:
>>
>>> Hello,
>>>
>>> I was trying to draw the 2D structure of a molecule inside a python
>>> script (.py). It works with other functions such as MolToSmiles,
>>> FingerPrintMol(),... but somehow the Draw.MolToSmile() function does not
>>> work. It kept throw errors of:
>>>  File "PairsFinder.py", line 53, in 
>>> Draw.MolToFile(chem,'~/Desktop/work/2018/July/10/500_v2/
>>> Chem1_avg7.png')
>>>   File "/usr/lib/python2.7/dist-packages/rdkit/Chem/Draw/__init__.py",
>>> line 182, in MolToFile
>>> canvas.save()
>>>   File "/usr/lib/python2.7/dist-packages/rdkit/Chem/Draw/spingCanvas.py",
>>> line 111, in save
>>> self.canvas.save()
>>>   File "/usr/lib/python2.7/dist-packages/rdkit/sping/PIL/pidPIL.py",
>>> line 166, in save
>>> self._image.save(filename, format=format)
>>>   File "/usr/lib/python2.7/dist-packages/PIL/Image.py", line 1672, in
>>> save
>>> fp = builtins.open(filename, "wb")
>>> IOError: [Errno 2] No such file or directory:
>>> '~/Desktop/work/2018/July/10/500_v2/Chem1_avg7.png'
>>> My script is :
>>> chem = Chem.MolFromSmiles('Nc1c1F')
>>> Draw.MolToFile(chem,'~/Desktop/work/2018/July/10/500_v2/Chem1_avg7.png')
>>>
>>> Would anyone help me please? How do I run Draw in python script?
>>>
>>> Thank you so much for your help
>>> --
>>> Phuong Chau
>>> Smith College '20
>>> Engineering Major
>>> 
>>> --
>>> 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
>>>
>>
>
>
> --
> Phuong Chau
> Smith College '20
> Engineering Major
>
> 
> --
> 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
>
>
--
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] Naming files in a loop

2018-07-11 Thread Shojiro Shibayama
Hi,

I don't know the version of python you use, but the following code must be
effective in python 3.5 or so:

for i in chemicals:
Draw.MolToFile(i, 'Desktop/{}.png'.format(i) )

Or you should use zip() for the for-loop to insert corresponding compounds'
names.

Best,
Shojiro

On Wed, Jul 11, 2018 at 9:04 AM Phuong Chau  wrote:

> Hello,
> I have a list of chemicals such as chemicals=["Cc1c1",
> "C=Cc1c1","CCCc1c1"] and I want to use Draw.MolToFile to draw 2D
> structure image of each of them. However, I am not sure how to name it
> differently in the for loop. Like for example:
> for i in chemicals:
> Draw.MolToFile(i, 'Desktop/i.png')
>
> I want the image file name has the name of the SMILES string of that
> chemcal such as Cc1c1.png. Is it possible for me to do that in the
> Python Script? or do I have to do it one by one?
>
> Thank you so much for your help!
>
> --
> Phuong Chau
> Smith College '20
> Engineering Major
>
> --
> 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
>
--
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