Skip to content

Streamlit app for visualization SMARTS patterns of individual compounds and chemical reactions

License

Notifications You must be signed in to change notification settings

Ananikov-Lab/SMARTSViewer

Repository files navigation

SMARTSViewer

Streamlit application for visualizing SMARTS patterns of individual compounds and chemical reactions.

Features

  • Interactive molecule drawing with Ketcher editor
  • SMARTS pattern matching and highlighting in molecular structures
  • Chemical reaction analysis using reaction SMARTS
  • Product generation and visualization
  • Pre-configured examples for common patterns and reactions

Quickstart

Prerequisites

  • Python 3.13 or higher
  • uv package manager (recommended) or pip

Installation

  1. Clone the repository:
git clone <repository-url>
cd SMARTSViewer
  1. Install dependencies:
# Using uv (recommended)
uv sync

# Or using pip
pip install -e .
  1. Run the application:
# Using uv
uv run streamlit run app.py

# Or using pip
streamlit run app.py

The application will open in your browser at http://localhost:8501.

How to Use

Compound Page

  1. Draw or edit molecules: Use the interactive Ketcher molecular editor to draw your compound
  2. Enter SMARTS pattern: Input a SMARTS pattern in the text field to search for specific substructures
  3. View results: The molecule will be highlighted showing all matching fragments

Example SMARTS patterns:

  • Aromatic ring: c1ccccc1
  • Hydroxyl group: [OH]
  • Carbonyl: [#6]=[#8]
  • Amine: [NH2]
  • Carboxylic acid: [CX3](=O)[OX2H1]

Reaction Page

  1. Define reactants: Draw all reactant molecules in the editor (separate multiple reactants with dots)
  2. Apply changes: Click "Apply Changes" to parse the reactants
  3. Enter reaction SMARTS: Input a reaction SMARTS pattern defining the transformation
  4. View products: All generated products will be displayed

Example reaction SMARTS:

  • Alcohol oxidation: [C:1][OH:2]>>[C:1][O:2]
  • Ester hydrolysis: [C:1](=[O:2])[O:3][C:4]>>[C:1](=[O:2])[OH:3].[C:4][O:5]
  • Esterification: [C:1][OH:2].[C:3](=[O:4])[OH:5]>>[C:1][O:2][C:3](=[O:4]).[O:5]

Tips for reactions:

  • Separate multiple reactants with dots: CCO.CC(=O)O
  • Use atom mapping in reactions: [C:1][OH:2]>>[C:1][O:2]
  • Ensure proper SMARTS syntax for reliable product generation

Dependencies

  • RDKit: Chemical informatics toolkit
  • Streamlit: Web application framework
  • Streamlit-Ketcher: Interactive molecule editor
  • NumPy: Numerical computing
  • Plotly: Interactive plotting
  • PyYAML: Configuration file parsing

Configuration

The application behavior can be customized through config.yaml:

  • Default molecules and reaction patterns
  • UI settings and styling
  • Example patterns for quick testing
  • Error messages and validation settings

License

See LICENSE file for details.

About

Streamlit app for visualization SMARTS patterns of individual compounds and chemical reactions

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published