Open In Colab

In [1]:
!wget -c https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
!chmod +x Miniconda3-latest-Linux-x86_64.sh
!time bash ./Miniconda3-latest-Linux-x86_64.sh -b -f -p /usr/local
!time conda install -q -y -c conda-forge rdkit
--2018-11-15 12:31:27--  https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
Resolving repo.continuum.io (repo.continuum.io)... 104.16.19.10, 104.16.18.10, 2606:4700::6810:120a, ...
Connecting to repo.continuum.io (repo.continuum.io)|104.16.19.10|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 62574861 (60M) [application/x-sh]
Saving to: ‘Miniconda3-latest-Linux-x86_64.sh’

Miniconda3-latest-L 100%[===================>]  59.68M  90.2MB/s    in 0.7s    

2018-11-15 12:31:33 (90.2 MB/s) - ‘Miniconda3-latest-Linux-x86_64.sh’ saved [62574861/62574861]

PREFIX=/usr/local
reinstalling: python-3.7.0-hc3d631a_0 ...
Python 3.7.0
reinstalling: ca-certificates-2018.03.07-0 ...
reinstalling: conda-env-2.6.0-1 ...
reinstalling: libgcc-ng-8.2.0-hdf63c60_1 ...
reinstalling: libstdcxx-ng-8.2.0-hdf63c60_1 ...
reinstalling: libffi-3.2.1-hd88cf55_4 ...
reinstalling: ncurses-6.1-hf484d3e_0 ...
reinstalling: openssl-1.0.2p-h14c3975_0 ...
reinstalling: xz-5.2.4-h14c3975_4 ...
reinstalling: yaml-0.1.7-had09818_2 ...
reinstalling: zlib-1.2.11-ha838bed_2 ...
reinstalling: libedit-3.1.20170329-h6b74fdf_2 ...
reinstalling: readline-7.0-h7b6447c_5 ...
reinstalling: tk-8.6.8-hbc83047_0 ...
reinstalling: sqlite-3.24.0-h84994c4_0 ...
reinstalling: asn1crypto-0.24.0-py37_0 ...
reinstalling: certifi-2018.8.24-py37_1 ...
reinstalling: chardet-3.0.4-py37_1 ...
reinstalling: idna-2.7-py37_0 ...
reinstalling: pycosat-0.6.3-py37h14c3975_0 ...
reinstalling: pycparser-2.18-py37_1 ...
reinstalling: pysocks-1.6.8-py37_0 ...
reinstalling: ruamel_yaml-0.15.46-py37h14c3975_0 ...
reinstalling: six-1.11.0-py37_1 ...
reinstalling: cffi-1.11.5-py37he75722e_1 ...
reinstalling: setuptools-40.2.0-py37_0 ...
reinstalling: cryptography-2.3.1-py37hc365091_0 ...
reinstalling: wheel-0.31.1-py37_0 ...
reinstalling: pip-10.0.1-py37_0 ...
reinstalling: pyopenssl-18.0.0-py37_0 ...
reinstalling: urllib3-1.23-py37_0 ...
reinstalling: requests-2.19.1-py37_0 ...
reinstalling: conda-4.5.11-py37_0 ...
installation finished.
WARNING:
    You currently have a PYTHONPATH environment variable set. This may cause
    unexpected behavior when running the Python interpreter in Miniconda3.
    For best results, please verify that your PYTHONPATH only points to
    directories of packages that are compatible with the Python interpreter
    in Miniconda3: /usr/local

real	0m16.146s
user	0m14.483s
sys	0m3.101s
Solving environment: ...working... done

## Package Plan ##

  environment location: /usr/local

  added / updated specs: 
    - rdkit


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    ca-certificates-2018.10.15 |       ha4d7672_0         135 KB  conda-forge
    blas-1.0                   |              mkl           6 KB
    xorg-libsm-1.2.3           |       h8c8a85c_0          24 KB  conda-forge
    xorg-kbproto-1.0.7         |       h470a237_2          25 KB  conda-forge
    xorg-xextproto-7.3.0       |       h470a237_2          26 KB  conda-forge
    pillow-5.3.0               |   py37hc736899_0         552 KB  conda-forge
    certifi-2018.10.15         |        py37_1000         138 KB  conda-forge
    intel-openmp-2019.0        |              118         721 KB
    boost-cpp-1.68.0           |       h3a22d5f_0        20.1 MB  conda-forge
    gettext-0.19.8.1           |       h5e8e0c9_1         3.5 MB  conda-forge
    xorg-libxau-1.0.8          |       h470a237_6          12 KB  conda-forge
    libiconv-1.15              |       h470a237_3         2.0 MB  conda-forge
    libxcb-1.13                |       h470a237_2         393 KB  conda-forge
    glib-2.56.2                |       h464dc38_1         4.6 MB  conda-forge
    cairo-1.14.12              |       h276e583_5         1.3 MB  conda-forge
    xorg-libice-1.0.9          |       h470a237_4          55 KB  conda-forge
    xorg-xproto-7.0.31         |       h470a237_7          72 KB  conda-forge
    libpng-1.6.35              |       ha92aebf_2         305 KB  conda-forge
    xorg-libxrender-0.9.10     |       h470a237_2          28 KB  conda-forge
    pcre-8.41                  |       hfc679d8_3         243 KB  conda-forge
    mkl-2019.0                 |              118       204.4 MB
    xorg-libxext-1.3.3         |       h470a237_4          45 KB  conda-forge
    olefile-0.46               |             py_0          31 KB  conda-forge
    python-dateutil-2.7.5      |             py_0         218 KB  conda-forge
    libxml2-2.9.8              |       h422b904_5         1.8 MB  conda-forge
    pytz-2018.7                |             py_0         226 KB  conda-forge
    pandas-0.23.4              |   py37hf8a1672_0        27.5 MB  conda-forge
    freetype-2.9.1             |       h6debe1e_4         800 KB  conda-forge
    numpy-1.11.3               |  py37h1d66e8a_10          11 KB
    xorg-libxdmcp-1.1.2        |       h470a237_7          17 KB  conda-forge
    fontconfig-2.13.1          |       h65d0f4c_0         320 KB  conda-forge
    boost-1.68.0               |   py37h3e44d54_1         357 KB  conda-forge
    pthread-stubs-0.4          |       h470a237_1           5 KB  conda-forge
    xorg-renderproto-0.11.1    |       h470a237_2           8 KB  conda-forge
    bzip2-1.0.6                |       h470a237_2         310 KB  conda-forge
    libgfortran-ng-7.2.0       |       hdf63c60_3         1.2 MB  conda-forge
    rdkit-2018.09.1            |   py37h0c1dfbd_0        19.7 MB  conda-forge
    conda-4.5.11               |        py37_1000         651 KB  conda-forge
    icu-58.2                   |       hfc679d8_0        22.8 MB  conda-forge
    xorg-libx11-1.6.6          |       h470a237_0         890 KB  conda-forge
    pycairo-1.18.0             |   py37h4d1f301_0          76 KB  conda-forge
    jpeg-9c                    |       h470a237_1         229 KB  conda-forge
    openssl-1.0.2p             |       h470a237_1         3.1 MB  conda-forge
    libuuid-2.32.1             |       h470a237_2          24 KB  conda-forge
    libtiff-4.0.9              |       he6b73bb_2         521 KB  conda-forge
    pixman-0.34.0              |       h470a237_3         1.2 MB  conda-forge
    numpy-base-1.11.3          |  py37h81de0dd_10         3.5 MB
    ------------------------------------------------------------
                                           Total:       324.2 MB

The following NEW packages will be INSTALLED:

    blas:             1.0-mkl                             
    boost:            1.68.0-py37h3e44d54_1    conda-forge
    boost-cpp:        1.68.0-h3a22d5f_0        conda-forge
    bzip2:            1.0.6-h470a237_2         conda-forge
    cairo:            1.14.12-h276e583_5       conda-forge
    fontconfig:       2.13.1-h65d0f4c_0        conda-forge
    freetype:         2.9.1-h6debe1e_4         conda-forge
    gettext:          0.19.8.1-h5e8e0c9_1      conda-forge
    glib:             2.56.2-h464dc38_1        conda-forge
    icu:              58.2-hfc679d8_0          conda-forge
    intel-openmp:     2019.0-118                          
    jpeg:             9c-h470a237_1            conda-forge
    libgfortran-ng:   7.2.0-hdf63c60_3         conda-forge
    libiconv:         1.15-h470a237_3          conda-forge
    libpng:           1.6.35-ha92aebf_2        conda-forge
    libtiff:          4.0.9-he6b73bb_2         conda-forge
    libuuid:          2.32.1-h470a237_2        conda-forge
    libxcb:           1.13-h470a237_2          conda-forge
    libxml2:          2.9.8-h422b904_5         conda-forge
    mkl:              2019.0-118                          
    numpy:            1.11.3-py37h1d66e8a_10              
    numpy-base:       1.11.3-py37h81de0dd_10              
    olefile:          0.46-py_0                conda-forge
    pandas:           0.23.4-py37hf8a1672_0    conda-forge
    pcre:             8.41-hfc679d8_3          conda-forge
    pillow:           5.3.0-py37hc736899_0     conda-forge
    pixman:           0.34.0-h470a237_3        conda-forge
    pthread-stubs:    0.4-h470a237_1           conda-forge
    pycairo:          1.18.0-py37h4d1f301_0    conda-forge
    python-dateutil:  2.7.5-py_0               conda-forge
    pytz:             2018.7-py_0              conda-forge
    rdkit:            2018.09.1-py37h0c1dfbd_0 conda-forge
    xorg-kbproto:     1.0.7-h470a237_2         conda-forge
    xorg-libice:      1.0.9-h470a237_4         conda-forge
    xorg-libsm:       1.2.3-h8c8a85c_0         conda-forge
    xorg-libx11:      1.6.6-h470a237_0         conda-forge
    xorg-libxau:      1.0.8-h470a237_6         conda-forge
    xorg-libxdmcp:    1.1.2-h470a237_7         conda-forge
    xorg-libxext:     1.3.3-h470a237_4         conda-forge
    xorg-libxrender:  0.9.10-h470a237_2        conda-forge
    xorg-renderproto: 0.11.1-h470a237_2        conda-forge
    xorg-xextproto:   7.3.0-h470a237_2         conda-forge
    xorg-xproto:      7.0.31-h470a237_7        conda-forge

The following packages will be UPDATED:

    ca-certificates:  2018.03.07-0                         --> 2018.10.15-ha4d7672_0 conda-forge
    certifi:          2018.8.24-py37_1                     --> 2018.10.15-py37_1000  conda-forge
    conda:            4.5.11-py37_0                        --> 4.5.11-py37_1000      conda-forge
    openssl:          1.0.2p-h14c3975_0                    --> 1.0.2p-h470a237_1     conda-forge

Preparing transaction: ...working... done
Verifying transaction: ...working... done
Executing transaction: ...working... done

real	2m53.156s
user	2m32.482s
sys	0m9.606s
In [0]:
%matplotlib inline
import matplotlib.pyplot as plt
import sys
import os
sys.path.append('/usr/local/lib/python3.7/site-packages/')
In [0]:
from rdkit import Chem
from rdkit.Chem import Draw
from rdkit.Chem.Draw import IPythonConsole
from rdkit import rdBase
In [5]:
print(rdBase.rdkitVersion)
2018.09.1
In [6]:
testsmi = 'CC(C1=C(C=CC(=C1Cl)F)Cl)OC2=C(N=CC(=C2)C3=CN(N=C3)C4CCNCC4)N'
mol = Chem.MolFromSmiles(testsmi)
mol
Out[6]:
In [7]:
print(Chem.MolToSmiles(mol))
CC(Oc1cc(-c2cnn(C3CCNCC3)c2)cnc1N)c1c(Cl)ccc(F)c1Cl
In [8]:
mols = []
for _ in range(50):
  smi = Chem.MolToSmiles(mol, doRandom=True)
  print(smi)
  m = Chem.MolFromSmiles(smi)
  mols.append(m)
Fc1c(Cl)c(C(Oc2cc(-c3cn(nc3)C3CCNCC3)cnc2N)C)c(cc1)Cl
O(c1cc(-c2cnn(c2)C2CCNCC2)cnc1N)C(c1c(Cl)c(ccc1Cl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