Skip to main content

A python library to explains molecular patterns (SMARTS)

Project description

👀 smarts-explainer

SMARTS explainer is a small wrapper around the [SMARTSview](https://smarts.plus/) tool developped at ZBH U. Hamburg for creating an easy to comprehend visualization for SMARTS expression. The concept was developed K. Schomburg and M. Rarey.

Installation


smarts-explainer requires datamol and requests-toolbelt. You can install it as follows

pip install smarts-explainer

Alternatively, download, install the dependency then install it with:

git clone git@github.com:maclandrol/smexplainer.git
cd smexplainer
mamba env create -f env.yml -n "smexplainer" && conda activate smexplainer
pip install -e . 

Usage


import smexplainer

my_smarts = "c12c(n(C)c(=O)[nH,$(nC)]c(=O)1)ncn2C"
smexplainer.explain(my_smarts, filetype="png")

output.svg

For a batch of smarts, you can use the smexplainer.batch_explain function instead

Input parameters:

  • smarts: a smarts string (valid) to visualize
  • comparesmarts: optional smarts to compare agains
  • vmode: visualization Mode:
    • 0 = Complete visualization (default)
    • 1 = ID-Mapping
    • 2 = Element symbols
    • 3 = Structure Diagram-Like
  • vbonds: Visualization of Default Bonds
    • 0 = "Single bonds"
    • 1 = "Single or Aromatic Bonds" (default)
  • textdesc: Legend Option 1: Textual desciption
    • False = No
    • True = Yes (default)
  • depsymbols: Legend Option 2: Depiction of SMARTS symbols
    • False = No
    • True = Yes (default)
  • smartsheading: Legend Option 3: Write SMARTS as picture heading
    • False = No
    • True = Yes (default)
  • trim: SMARTS trim active:
    • False = No
    • True = Yes (default)
  • labels: Show Atom Labels
    • False = No
    • True = Yes (default)
  • cmode: Compare Mode: This only affects compare images
    • 1 = Search for Identical Patterns
    • 2 = Subset search from smarts
    • 3 = subset search from comparesmarts
    • 4 = Similarity Search (default)
  • detectarom: Detect Aromatic Bonds
    • False = No
    • True = Yes (default)
  • smileslikearom: SMILES-Like Aromaticity Detection
    • False = No
    • True = Yes (default)
  • filetype: Output File Type
    • png (default)
    • svg
    • pdf
  • outfile: Optional Output file where to save the output image

Reference


For more information about the explainer, see the corresponding paper:

@article{schomburg2010structure,
  title={From structure diagrams to visual chemical patterns},
  author={Schomburg, Karen and Ehrlich, Hans-Christian and Stierand, Katrin and Rarey, Matthias},
  journal={Journal of chemical information and modeling},
  volume={50},
  number={9},
  pages={1529--1535},
  year={2010},
  publisher={ACS Publications}
}

Changelogs


See the latest changelogs at CHANGELOG.rst.

License


The smexplainer is under the Apache-2.0 license. See LICENSE. But the original work is copyrighted by "SMARTSviewer smartsview.zbh.uni-hamburg.de, ZBH Center for Bioinformatics, University of Hamburg"

Authors

See AUTHORS.rst.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

smexplainer-0.0.2.tar.gz (9.4 kB view details)

Uploaded Source

File details

Details for the file smexplainer-0.0.2.tar.gz.

File metadata

  • Download URL: smexplainer-0.0.2.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/0.0.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for smexplainer-0.0.2.tar.gz
Algorithm Hash digest
SHA256 5cf551e3a2fe3c70b1fe071358cf9157f4b09eb4d6114daeb585a250111e2447
MD5 efe96b0c83716aed1dbfb68176927106
BLAKE2b-256 a425b430419c17d340cd90b68bab529c135657fac68cf63a654b773487317f05

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page