Thread: [Rdkit-discuss] depiction of molecules with PandasTools AddMoleculeColumnToFrame
Open-Source Cheminformatics and Machine Learning
Brought to you by:
glandrum
From: Ines S. <ia...@ca...> - 2017-10-24 16:19:08
|
Hello RDKitters/pandaskitters, I'm trying to use the 'AddMoleculeColumnToFrame' in the Jupyter notebook but the depiction of the molecule in dataframe isn't great, the lines are jagged/low resolution. Displaying molecules inline in the notebook (outside of the dataframe) works fine. I've tried changing the PandasTools.molSize but it didn't help. Here is my code: from rdkit import Chem from rdkit.Chem.Draw import IPythonConsole from rdkit.Chem import PandasTools import pandas as pd from IPython.core.display import display, HTML # Normal inline display of molecule is fine Chem.MolFromSmiles('COC1=C(OC)C(=O)C(C)=CC1=O') # Add molecule to dataframe my_df = pd.DataFrame(['COC1=C(OC)C(=O)C(C)=CC1=O'], columns = ['Smiles']) PandasTools.AddMoleculeColumnToFrame(my_df,'Smiles','Molecule picture') # Depiction of molecule within dataframe is not so great display(my_df) # Using HTML I get the same jagged depiction. HTML(PandasTools.PrintAsBase64PNGString(Chem.MolFromSmiles('COC1=C(OC)C(=O)C(C)=CC1=O'))) I have these packages in my conda environment: cairo 1.14.8 cffi 1.7.0 pandas 0.20.1 pillow 3.3.1 rdkit 2017.03.3 Am I missing something else? Any suggestions for what I could try? Many thanks! Ines -- PhD student at the University of Cambridge |
From: Greg L. <gre...@gm...> - 2017-10-25 06:09:46
|
Hi Ines, This problem should go away if you update to the most recent version of the RDKit. -greg On Tue, Oct 24, 2017 at 4:19 PM, Ines Smit <ia...@ca...> wrote: > Hello RDKitters/pandaskitters, > > I'm trying to use the 'AddMoleculeColumnToFrame' in the Jupyter notebook > but the depiction of the molecule in dataframe isn't great, the lines are > jagged/low resolution. Displaying molecules inline in the notebook (outside > of the dataframe) works fine. > > I've tried changing the PandasTools.molSize but it didn't help. > > Here is my code: > > from rdkit import Chem > from rdkit.Chem.Draw import IPythonConsole > from rdkit.Chem import PandasTools > import pandas as pd > from IPython.core.display import display, HTML > > # Normal inline display of molecule is fine > Chem.MolFromSmiles('COC1=C(OC)C(=O)C(C)=CC1=O') > > # Add molecule to dataframe > my_df = pd.DataFrame(['COC1=C(OC)C(=O)C(C)=CC1=O'], columns = ['Smiles']) > PandasTools.AddMoleculeColumnToFrame(my_df,'Smiles','Molecule picture') > > # Depiction of molecule within dataframe is not so great > display(my_df) > > # Using HTML I get the same jagged depiction. > HTML(PandasTools.PrintAsBase64PNGString(Chem.MolFromSmiles(' > COC1=C(OC)C(=O)C(C)=CC1=O'))) > > I have these packages in my conda environment: > cairo 1.14.8 > cffi 1.7.0 > pandas 0.20.1 > pillow 3.3.1 > rdkit 2017.03.3 > > Am I missing something else? Any suggestions for what I could try? > > Many thanks! > Ines > -- PhD student at the University of Cambridge > > ------------------------------------------------------------ > ------------------ > 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 > Rdk...@li... > https://lists.sourceforge.net/lists/listinfo/rdkit-discuss > |
From: Ines S. <ia...@ca...> - 2017-10-25 12:50:06
|
That worked! Thanks Greg and everyone who worked on that, brilliant! Ines On 2017-10-25 07:09, Greg Landrum wrote: > Hi Ines, > > This problem should go away if you update to the most recent version > of the RDKit. > > -greg > > On Tue, Oct 24, 2017 at 4:19 PM, Ines Smit <ia...@ca...> wrote: > >> Hello RDKitters/pandaskitters, >> >> I'm trying to use the 'AddMoleculeColumnToFrame' in the Jupyter >> notebook but the depiction of the molecule in dataframe isn't great, >> the lines are jagged/low resolution. Displaying molecules inline in >> the notebook (outside of the dataframe) works fine. >> >> I've tried changing the PandasTools.molSize but it didn't help. >> >> Here is my code: >> >> from rdkit import Chem >> from rdkit.Chem.Draw import IPythonConsole >> from rdkit.Chem import PandasTools >> import pandas as pd >> from IPython.core.display import display, HTML >> >> # Normal inline display of molecule is fine >> Chem.MolFromSmiles('COC1=C(OC)C(=O)C(C)=CC1=O') >> >> # Add molecule to dataframe >> my_df = pd.DataFrame(['COC1=C(OC)C(=O)C(C)=CC1=O'], columns = >> ['Smiles']) >> PandasTools.AddMoleculeColumnToFrame(my_df,'Smiles','Molecule >> picture') >> >> # Depiction of molecule within dataframe is not so great >> display(my_df) >> >> # Using HTML I get the same jagged depiction. >> > HTML(PandasTools.PrintAsBase64PNGString(Chem.MolFromSmiles('COC1=C(OC)C(=O)C(C)=CC1=O'))) >> >> I have these packages in my conda environment: >> cairo 1.14.8 >> cffi 1.7.0 >> pandas 0.20.1 >> pillow 3.3.1 >> rdkit 2017.03.3 >> >> Am I missing something else? Any suggestions for what I could try? >> >> Many thanks! >> Ines >> -- PhD student at the University of Cambridge >> >> > ------------------------------------------------------------------------------ >> Check out the vibrant tech community on one of the world's most >> engaging tech sites, Slashdot.org! http://sdm.link/slashdot [1] >> _______________________________________________ >> Rdkit-discuss mailing list >> Rdk...@li... >> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss [2] > > > > Links: > ------ > [1] http://sdm.link/slashdot > [2] https://lists.sourceforge.net/lists/listinfo/rdkit-discuss |