--jupyter-I'm using notebook --I managed to get rid of the image not being displayed in ROMol when loading SDF data containing multiple compounds with RDKit with PandasTools.LoadSDF. ――My environment is as follows - MacOSX 10.15.2 Catalina --The RDKit environment was built with Anaconda by referring to the following. -How to install — RDKit_unofficial_translation_JP 1.00 Document --Using Python 3.7.5 from anaconda 3-5.3.1 - rdkit version: 2019.09.2 - pandas version: 0.25.3
I was practicing RDKit with reference to the following site
Introduction to Cheminformatics with RDKit | New Shapes of Chemistry
When I read the SDF file in the DataFrame format of pandas in Reading multiple molecules and then display it, the image is displayed in ROMol. Instead, it was a column like <img data-content =" rdkit / molecule "src =" data: i ...
) (image below)
According to the issue below, it seems that it is happening with versions above pandas 0.25.0
Sure, in my case the version of pandas was 0.25.3
import pandas as pd
print('pandas version: ', pd.__version__)
#=> pandas version: 0.25.3
The solution was to revert the pandas version to 0.25.0, It was annoying so I searched for another way
There are some parts that are more convenient to be displayed as an image, so if you follow the issue or search for it I was told to use an HTML library
https://github.com/rdkit/rdkit/issues/2673#issuecomment-570898398
Molecules not rendered in Pandas DF in Jupyter Lab · Issue #2825 · rdkit/rdkit
I tried it as follows (assuming that the sdf file has been downloaded and the library has been imported)
df = PandasTools.LoadSDF('./sdf/somesdffile.sdf')
from IPython.display import HTML
HTML(df.to_html())
Success if the image comes out properly
For the time being, when it is easier to understand if there is an image, it will come out properly if you do this
Recommended Posts