当前位置:网站首页>Rdkit installation

Rdkit installation

2022-06-11 16:30:00 Dazed flounder

RDKit file

RDKit summary

What is it ?
Chemical informatics Open Source Toolkit

  • Business friendly BSD license
  • C++ The core data structure and algorithm in
  • Use Boost.Python Generated Python 3.x Wrappers
  • Use SWIG Generated Java and C# Wrappers
  • 2D and 3D Molecular manipulation
  • Machine learning descriptor generation
  • be used for PostgreSQL Molecular database box
  • KNIME Chemical informatics node ( come from KNIME Community site :https://www.knime.com/rdkit)

operation :

  • http://www.rdkit.org
  • Support Mac/Windows/Linux

install

anaconda python Lower cross platform ( The fastest installation )

anaconda brief introduction

Conda It's open source 、 Cross platform package manager . It supports the packaging and distribution of software components , And manage their installation in an isolated execution environment . It is associated with pip and virtualenv There are several analogies , But it was designed to be more “ And python irrelevant ” And it is more suitable for the distribution of binary packages and their dependencies .

How to get conda

obtain Conda The easiest way to do this is to install it as Anaconda Python Distribution version Part of . smaller 、 More independent Miniconda Provides a possibility ( But it is more complicated to use ) alternatives .conda The source code repository is in github Available on the , Other documents are provided by the project website .

How to use Conda install RDKit

Create an installation of RDKit The new conda The environment needs a command similar to the following :

conda create -c conda-forge -n my-rdkit-env rdkit

Last , The new environment must be activated , So that the corresponding python The interpreter is in the same shell Available in the :

conda activate my-rdkit-env

If for some reason this doesn't work , Please try :

cd [anaconda folder]/bin
source activate my-rdkit-env

Windows The user will use slightly different commands :

C:\> activate my-rdkit-env

How to use Conda Build from source

About using Conda More details on building from source code , see also conda-rdkit The repository .
macOS 10.12 (Sierra):Python 3 Environmental Science
The following command will be macOS Sierra and Python 3 Create a development environment . from Conda download Miniconda3-latest-MacOSX-x86_64.sh And run the following command :

bash Miniconda3-latest-MacOSX-x86_64.sh
conda install numpy matplotlib
conda install cmake cairo pillow eigen pkg-config
conda install boost-cpp boost py-boost

perhaps , Add the following package to your environment as a useful development tool .

pip install yapf==0.11.1
pip install coverage==3.7.1

Then follow the usual build instructions .PYTHON_INCLUDE_DIR Must be in cmake Set... In the command .

PYROOT=<path to miniconda3>
cmake -DPYTHON_INCLUDE_DIR=$PYROOT/include/python3.6m  \
  -DRDK_BUILD_AVALON_SUPPORT=ON \
  -DRDK_BUILD_CAIRO_SUPPORT=ON \
  -DRDK_BUILD_INCHI_SUPPORT=ON \
  ..

After successful completion make, Run the test using the following command :make install

RDBASE=$RDBASE DYLD_FALLBACK_LIBRARY_PATH="$RDBASE/lib:$PYROOT/lib" PYTHONPATH=$RDBASE ctest

This is necessary , because Recent macOS The version introduces System integrity protection SIP .

Linux x86_64:Python 3 Environmental Science

The following command will be Linux x86_64 and Python 3 Create a development environment .
First of all, from the Anaconda Download the latest anaconda Install the program and install it . then , Install required packages :

bash Anaconda3-5.2.0-x86_64.sh
conda install -y cmake cairo pillow eigen pkg-config
conda install -y boost-cpp boost py-boost

Numpy and matplotlib It's already anaconda Part of foundation installation . Because the current build is up to date boost Library GLIBC Version higher than anaconda Default version in , We need to update to a newer version :

conda install -y gxx_linux-64

here , You should be able to put RDKit Clone the repository to the desired build location , Then start building . Please note that , It is necessary to point out numpy The path to the header , In order to RDKit Find them , because anaconda Hide them in numpy In bag :

git clone https://github.com/rdkit/rdkit.git
cd rdkit
mkdir build && cd build
cmake -DPy_ENABLE_SHARED=1 \
  -DRDK_INSTALL_INTREE=ON \
  -DRDK_INSTALL_STATIC_LIBS=OFF \
  -DRDK_BUILD_CPP_TESTS=ON \
  -DPYTHON_NUMPY_INCLUDE_PATH="$(python -c 'import numpy ; print(numpy.get_include())')" \
  -DBOOST_ROOT="$CONDA_PREFIX" \
  ..

Last make, and make installctest

from conda Environment installation and use PostgreSQL and RDKit PostgreSQL box

because conda python Distribution and system python Different versions , So by conda install PostgreSQL and PostgreSQL python The client is the easiest .
After activating your environment , Just do it by :

conda install -c rdkit rdkit-postgresql

conda package PostgreSQL Version needs to be run initdb Command to initialize [conda folder]/envs/my-rdkit-env/bin

[conda folder]/envs/my-rdkit-env/bin/initdb -D /folder/where/data/should/be/stored

You can then run... From the terminal using the following command PostgreSQL:

[conda folder]/envs/my-rdkit-env/bin/postgres -D /folder/where/data/should/be/stored

For most use cases , You need to PostgreSQL Run as a daemons , One way is to use supervisor. You can... Here Learn more and how to install supervisor . The required configuration files will be as follows :

[program:postgresql]
command=[conda folder]/envs/my-rdkit-env/bin/postgres -D /folder/where/data/should/be/stored
user=[your username]
autorestart=true

once PostgreSQL Start and run , All normal PostgreSQL Commands are available in your conda Run when the environment is activated . therefore , To create a database , You can run :

createdb my_rdkit_db
psql my_rdkit_db
# create extension rdkit;

If you try to use multiple... In different environments PostgreSQL install , You have to go through edit PostgreSQL The configuration file To set up different pid file 、unix Sockets and ports . Through the above configuration , These files can be found in /folder/where/data/should/be/stored Find .

Linux and OS X

Install from the repository
Ubuntu 12.04 And higher

thank Debichem Team effort ,RDKit Can pass Ubuntu The repository gets . install :

sudo apt-get install python-rdkit librdkit1 rdkit-data

Fedora、CentOS and RHEL
thank Gianluca Sforna The job of ,RDKit Binary system RPM Now it is Fedora Part of the official Repository :https://admin.fedoraproject.org/pkgdb/package/rpms/rdkit/

Build from source

from 2018_03 Publish start ,RDKit The core C++ The code is modern C++ Compiling ; For this version , It means C++11. This means that the compiler used to build it cannot be completely old . The following is the minimum test version :

  • g++ v4.8: But please pay attention to ,SLN Parser code cannot use v4.8 structure . When using this old compiler , It will automatically disable .
  • clang v3.9: Maybe an older version of the compiler can also work , But we haven't tested yet .
  • Visual Studio 2015: Maybe an older version of the compiler can also work , But we haven't tested it yet .

structure RDKit

Get source code , Here is tar.gz, But you can also use git:

wget https://github.com/rdkit/rdkit/archive/Release_XXXX_XX_X.tar.gz

senior
Specify the installation location
You need to RDK_INSTALL_INTRE close :

cmake -DRDK_INSTALL_INTREE=OFF -DCMAKE_INSTALL_PREFIX=/path/as/you/like ..

Designated spare Boost install
You need to tell cmake Where can I find boost Library and header files :
If you are in Added in boost /opt/local, be cmake The call will look like this :

cmake -DBOOST_ROOT=/opt/local ..

Please note that , If you use your own... On a system with a system installation boost install , Usually it's best to do it in your cmake The command contains parameters .-D Boost_NO_SYSTEM_PATHS=ON
Designated spare Python install
If you do not use the default for your computer python install , You need to tell cmake Where can I find what it should link to python Kuhe python The header file .
This is an example command line :

cmake -D PYTHON_LIBRARY=/usr/lib/python3.6/config/libpython3.6.a -D PYTHON_INCLUDE_DIR=/usr/include/python3.6/ -D PYTHON_EXECUTABLE=/usr/bin/python3 ..

If correct PYTHON_EXECUTABLEpython It's yours PATH.

Ban Python Wrappers
You can disable... Completely python The construction of the wrapper :

cmake -DRDK_BUILD_PYTHON_WRAPPERS=OFF ..

Recommended additional features

  • -DRDK_BUILD_INCHI_SUPPORT=ON You can add parameters to cmake Command line to enable the generation of InChI String and InChI Key support .
  • -DRDK_BUILD_AVALON_SUPPORT=ON You can add parameters to your cmake Command line to enable Avalon Toolkit support .
  • If you want to be able to generate high-quality PNG, You should install... On your system cairo And build enable cairo Supported by RDKit:-DRDK_BUILD_CAIRO_SUPPORT=ON
  • If you want to be able to use 3D The descriptor , You need to install eigen3 Copy of . Most operating systems have corresponding software packages .

structure Java Wrappers

build

  • When you call cmake When adding parameters . for example :-D RDK_BUILD_SWIG_WRAPPERS=ONcmake -D RDK_BUILD_SWIG_WRAPPERS=ON …
  • Use make Build and install normally . This directory $RDBASE/Code/JavaWrappers/gmwrapper Will contain three required files :(libGraphMolWrap.so stay libGraphMolWrap.jnilibOS X On )org.RDKit.jar、 and org.RDKitDoc.jar.
$ CLASSPATH=$CLASSPATH:$RDBASE/Code/JavaWrappers/gmwrapper/org.RDKit.jar jython -Djava.library.path=$RDBASE/Code/JavaWrappers/gmwrapper
Jython 2.2.1 on java1.6.0_20
Type "copyright", "credits" or "license" for more information.
>>> from org.RDKit import *
>>> from java import lang
>>> lang.System.loadLibrary('GraphMolWrap')
>>> m = RWMol.MolFromSmiles('c1ccccc1')
>>> m.getNumAtoms()
6L

Reference resources

https://www.rdkit.org/docs/Install.html

原网站

版权声明
本文为[Dazed flounder]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/162/202206111609385146.html