Create, browse, and search your team's compounds library.
911
Chemsearch is web application used to create, browse, and search a chemical
compounds library. Powered by the cheminformatics toolkit rdkit, Chemsearch
extracts molecular structure from a collection of MOL files, gathers metadata,
and provides an interface for exploring the library of compounds. To search
within the library, Chemsearch offers 'search by similarity' and 'search by
substructure', taking queries in the form of molecular structure drawings
(using a molecule editor from Kekule.js) or as SMILES or SMARTS strings. Each
compound has a dedicated page which shows molecular structure, summary data, a
file listing for the corresponding data folder, and custom information (provided
as a Google Doc, markdown file or other text file).
Chemsearch can work with a Google Workspace / G Suite account for extended functionality. The app can work with libraries stored in a Google Shared Drive (in DRIVE mode) or with a local folder (default mode). Optional access control is provided in AUTH mode, with a Google OAuth login page that restricts access to members of a specified Google Group.

The quickest way to try out Chemsearch is to use the Docker container image on Docker Hub, which has all code and dependencies bundled in. With Docker installed and running on your machine, run the following command in the terminal to download the image and browse the demo library with default settings:
docker run --rm -p 5000:5000 cgemcci/chemsearch
The app will be accessible in your browser at http://localhost:5000/.
Customizing the app requires additional command arguments that bind two local folders:
docker run -p 5000:5000 --rm \
-v /path/to/config/dir:/app/config \
-v /path/to/archive/dir:/app/demo_db cgemcci/chemsearch
chemsearch executableChemsearch requires Python 3.6 and above, plus a number of third-party Python packages, and rdkit. The easiest way to install everything is with Conda. Conda can set up a suitable Python virtual environment for use with Chemsearch and install rdkit, all with a single command.
conda on your system, install Miniconda.conda env create -n chemsearch -f environment.yaml
environment.lock.yaml instead of environment.yaml above.conda activate chemsearch. (This environment
will need to be activated each time you want to run Chemsearch.)python setup.py develop. This
will add a chemsearch CLI executable to your PATH that you can use to
configure and run your Chemsearch server.chemsearch build. This demo library will be available for browsing when you
start the server.The WSGI server executables gunicorn and flask are available after installing
the package and dependencies as above and activating the chemsearch virtual environment.
Either executable can be used to serve the application. gunicorn is the recommended,
more production-ready option, while flask is a 'development' server, best suited
to testing code changes.
GUNICORN:
To serve using gunicorn, run the following :
gunicorn -w 1 -k gevent chemsearch.chemsearch:app
FLASK:
To serve using flask, run the following:
chemsearch flask run
flask run if you set FLASK_APP in the configuration
file config/.env.Chemsearch has a command-line interface (CLI) that will help you configure the
app. Get started by running chemsearch setup prompt in your terminal. This will
walk you through the creation of the 'env' file that stores the configuration settings.
Run chemsearch setup to see a complete list of setup subcommands, including:
creds Copy Google JSON credentials to config folder.
edit Open configuration .env file in an editor.
import Load variables from specified .env path.
prompt Create configuration .env file via command prompt.
revert Revert to previous .env file.
show Print configuration path and contents.
The env file is used to specify non-default options via environment variables:
flask application server (FLASK_ENV, default 'production').To use Shared Drive and/or Authentication modes, you will need to set up a Google Workspace and provide some additional env variables. In the Google-specific variable list below, a tick below means the variable is required:
| variable | DRIVE mode | AUTH mode | example | notes |
|---|---|---|---|---|
| CREDENTIALS_AS_USER | ✅ | ✅ | [email protected] | (1) |
| SHARED_DRIVE_ID | ✅ | 0AbCdEfG_abc123 | (2) | |
| GOOGLE_CLIENT_ID | ✅ | 123456789.apps.googleusercontent.com | (3) | |
| GOOGLE_SECRET | ✅ | 98765_abcde | (3) | |
| GROUP_KEY | ✅ | 012345abcde | (4) |
Notes
The search page can be customized with shortcut buttons that run a specific
substructure search. These buttons are created automatically (at app launch time)
when a custom_queries.yaml file is added to the config folder. The chemsearch
CLI can walk you through the creation of this file with the command:
chemsearch shortcuts prompt
An example specification:
# FORMAT EACH SHORTCUT AS <Name for button>: '<SMARTS STRING>'
Aliphatic amines: '[$([NH2][CX4]),$([NH]([CX4])[CX4]),$([NX3]([CX4])([CX4])[CX4])]'
Bicyclic: '[$([*R2]([*R])([*R])([*R]))].[$([*R2]([*R])([*R])([*R]))]'
Chemsearch can display 'custom data' on a compound page, extracting text from (in decreasing order of priority) a Google Doc (in DRIVE mode), markdown, or other text file in the compound folder. Rich formatting in Google Docs and Markdown files are preserved by conversion to HTML.
Markdown filenames should end in .md (e.g. custom.md), while plain text files
should end in .txt.
An example Markdown file, showing syntax for lists, tables, and blockquotes,
is provided in demo_db/base/CHEMBL1195529/custom.md, and replicated below:
<h4>Hello!</h4>
This is some custom information for the molecule page.
1. first item in enumerated list
2. second item
3. final list item.
- bullet point.
- another bullet point.
First Header | Second Header
------------- | -------------
Content Cell with a long long LONG value | Content Cell
Content Cell | Content Cell
> Blockquote
>
> Here's a second paragraph.
See our team website at http://gem-net.net.
To use Shared Drive and/or Authentication modes, you will need a Google Workspace / G Suite account. The 'G Suite for Education' edition is free for academic institutions, otherwise a Business Standard plan (or higher) will be required to create Shared Drives (for DRIVE mode). The premium plans (which offer a free trial period) charge based on the number of users, but for Chemsearch only one official user is required: a user to create a Google Group (for AUTH mode) and a Shared Drive (for DRIVE mode). The members of the Google Group and Shared Drive can all use free Google accounts.
To sign up for a Workspace account, you'll need to register a domain (e.g. example.com) and verify your ownership of the domain with Google. The remaining steps are as follows:
https://www.googleapis.com/auth/drive.readonly
https://www.googleapis.com/auth/drive.metadata.readonly
https://www.googleapis.com/auth/admin.directory.user.readonly
https://www.googleapis.com/auth/admin.directory.group.member.readonly
http://localhost:5000/callback/google (for testing from localhost)https://<yourdomainname>/callback/google (if you're serving the app at a
custom domain)You should now be able to use the Workspace account with Chemsearch. Just place
the JSON file in the app config directory (renaming it creds.json), and update
the env file as described above.
Chemsearch is minimally prescriptive in how you structure your library, with only the following requirements (which apply to both the 'local' and 'DRIVE' versions:
Additional files and folders associated with compounds can be nested within compound folders as desired.
Content type
Image
Digest
Size
574.2 MB
Last updated
over 5 years ago
docker pull cgemcci/chemsearch