Solved the problem that the image was not displayed in ROMol when loaded with PandasTools.LoadSDF.

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

Screen Shot 2020-02-05 at 18.35.42.png

According to the issue below, it seems that it is happening with versions above pandas 0.25.0

Mol rendering within DataFrames in a Jupyter Notebook is broken with Pandas 0.25.1 · Issue #2673 · rdkit/rdkit

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())
Screen Shot 2020-02-06 at 8.56.43.png

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

Solved the problem that the image was not displayed in ROMol when loaded with PandasTools.LoadSDF.
Note that one problem was solved when jupyter-notebook was introduced.
Solution when the image cannot be displayed with tkinter [python]
When reading an image with SimpleITK, there is a problem if there is Japanese in the path
[VLC] How to deal with the problem that it is not in the foreground during playback
A solution to the problem that files containing [and] are not listed in glob.glob ()
Bugs that static files are not displayed on the App Engine development server
[Django] css in the project cannot be read
[Jinja2] Solution to the problem that variables added in the for statement are not inherited
Solve the problem that CSS is not reflected during web application development in Flask
Solved the problem that the image was not displayed in ROMol when loaded with PandasTools.LoadSDF.
Solved the problem that sqlite3 got undefined error when cross-compiling Golang
Workaround for the problem that sys.argv is not passed when executing a Python script with only the file name in Python2.7 on Windows
Workaround for the problem that? Is displayed when checking the version when using non-standard perl | python with pkg version
Results that did not get caught in the search with this word
The 16th offline real-time how to write problem was solved with Python
The 15th offline real-time how to write problem was solved with python
Behavior when returning in the with block
How to display in the entire window when setting the background image with tkinter
Determine the numbers in the image taken with the webcam
Detect folders with the same image in ImageHash
The story that fits in with pip installation
[Jinja2] Solution to the problem that variables added in the for statement are not inherited
Note that I was addicted to npm script not passing in the verification environment
[systemd] How to deal with the problem that fancontrol does not work after suspending
When I crawl the webapi that appears during rendering, it was played with CORS
Solve the problem that CSS is not reflected during web application development in Flask
Here is one of the apps with "artificial intelligence" that I was interested in.
What I did when I was angry to put it in with the enable-shared option
I investigated the problem that I could not get more than 101 images with google images download
The story that sendmail that can be executed in the terminal did not work with cron
A solution to the problem that files containing [and] are not listed in glob.glob ()
When the selected object in bpy.context.selected_objects is not returned
[Python] Get the numbers in the graph image with OCR
Convert the image in .zip to PDF with Python
Check when the version does not switch with pyenv
Note that there was a version problem with networkx
The story that Japanese output was confused with Django
When "ERROR: HTTP is not supported." Is displayed in mpsyt
The story that yapf did not work in vscode
About the matter that nosetests does not pass when __init__.py is created in the project directory
What to do if the image is not displayed using matplotlib etc. in the Docker container
The image is displayed in the local development environment, but the image is not displayed on the remote server of VPS