Streamlit application for visualizing SMARTS patterns of individual compounds and chemical reactions.
- 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
- Python 3.13 or higher
- uv package manager (recommended) or pip
- Clone the repository:
git clone <repository-url>
cd SMARTSViewer- Install dependencies:
# Using uv (recommended)
uv sync
# Or using pip
pip install -e .- Run the application:
# Using uv
uv run streamlit run app.py
# Or using pip
streamlit run app.pyThe application will open in your browser at http://localhost:8501.
- Draw or edit molecules: Use the interactive Ketcher molecular editor to draw your compound
- Enter SMARTS pattern: Input a SMARTS pattern in the text field to search for specific substructures
- 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]
- Define reactants: Draw all reactant molecules in the editor (separate multiple reactants with dots)
- Apply changes: Click "Apply Changes" to parse the reactants
- Enter reaction SMARTS: Input a reaction SMARTS pattern defining the transformation
- 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
- RDKit: Chemical informatics toolkit
- Streamlit: Web application framework
- Streamlit-Ketcher: Interactive molecule editor
- NumPy: Numerical computing
- Plotly: Interactive plotting
- PyYAML: Configuration file parsing
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
See LICENSE file for details.