Skip to main content

SmileSherlock

SmileSherlock logo

A high-performance, production-grade tool for SMILES validation, PubChem lookup, and chemical structure retrieval.

DOI PyPI Python 3.10+ License: MIT

Features

  • SMILES Validation & Canonicalization - Validate and standardize SMILES strings using RDKit
  • Multi-format Input - Support for CSV, TSV, XLSX, SMI, SDF, and TXT files
  • Smart Auto-detection - Automatically identify SMILES columns
  • PubChem Lookup - Search by SMILES, CID, Name, InChI, and InChIKey
  • Rich Metadata - Retrieve IUPAC name, molecular formula, mass, descriptors
  • Structure Downloads - Get 2D/3D SDF, MOL, PDB, and PNG formats from PubChem
  • Offline Molecule Generation (--gen) - Generate 2D and 3D conformations (SDF, MOL, PDB) offline from SMILES via RDKit with forcefield optimization
  • Molecular Fingerprints - ECFP4, ECFP6, FCFP4, MACCS, RDKit, AtomPair, Torsion fingerprints offline (fingerprint command)
  • Similarity Search - Tanimoto-based library search with threshold and top-N ranking (similar command)
  • Drug-Likeness Filtering - Lipinski Ro5, Veber, Ghose, Egan, Ro3, PAINS alerts, and QED scoring (filter command)
  • Batch Processing - Process hundreds of compounds with progress tracking
  • Async/Multithreading - Fast parallel downloads with retry logic
  • Caching - SQLite database for storing results locally
  • Multiple Exports - Save results as CSV, Excel, or JSON
  • Python API - Use directly in your scripts via smilesherlock module
  • CLI Tool - Full-featured command-line interface with smilesherlock command

Installation

From PyPI

pip install smilesherlock

Development Installation

Clone the repository and install in editable mode:

git clone https://github.com/AtharvaTilewale/SmileSherlock.git
cd SmileSherlock
pip install -e ".[dev]"

Quick Start

CLI Usage

# Show configuration and status
smilesherlock status

# Initialize directories and database
smilesherlock init

# Lookup a single compound (by SMILES, CID, or Chemical Name)
smilesherlock lookup "c1ccccc1"  # Benzene
smilesherlock lookup "aspirin"
smilesherlock lookup 5282253 --type cid

# Batch process a file to retrieve metadata
smilesherlock batch compounds.csv --output results.xlsx --format xlsx

# Download structure from PubChem
smilesherlock download 5282253 --format sdf --3d

# Generate 3D structure offline from SMILES using RDKit (--gen all)
smilesherlock download "CC(=O)OC1=CC=CC=C1C(=O)O" --gen all --3d --format sdf

# Generate 2D MOL structure locally from SMILES
smilesherlock download "c1ccccc1" --gen all --2d --format mol

# Batch download with offline fallback for missing structures (--gen missing)
smilesherlock download --file compounds.csv --gen missing --3d --format sdf --output-dir ./structures/

# Batch generate all structures offline from a SMILES file (--gen all)
smilesherlock download --file compounds.smi --gen all --3d --format pdb --output-dir ./3d_models/

Molecular Fingerprints

# Generate ECFP4 fingerprint (single compound)
smilesherlock fingerprint "CC(=O)OC1=CC=CC=C1C(=O)O" --type ecfp4

# All 7 fingerprint types at once
smilesherlock fingerprint "CC(=O)OC1=CC=CC=C1C(=O)O" --type all

# Batch - save to CSV
smilesherlock fingerprint --file compounds.smi --type maccs --output fingerprints.csv
# Top-10 most similar compounds (Tanimoto >= 0.5)
smilesherlock similar "CC(=O)OC1=CC=CC=C1C(=O)O" --file library.smi --threshold 0.5 --top 10

# Save hits to CSV
smilesherlock similar "CCO" --file compounds.csv --fp-type ecfp6 --output hits.csv

Drug-Likeness Filtering

# Single compound - all rules
smilesherlock filter "CC(=O)OC1=CC=CC=C1C(=O)O"

# Batch - keep only Lipinski-compliant, PAINS-free compounds
smilesherlock filter --file compounds.csv --rules lipinski,veber,pains --output drug_like.csv

# Remove PAINS compounds from a library
smilesherlock filter --file library.csv --rules pains --output no_pains.csv

# Lead-like compounds with minimum QED 0.5
smilesherlock filter --file library.csv --rules ro3 --qed-min 0.5 --output leads.csv

Python API

from smilesherlock import lookup, lookup_file, download_structure, generate_structure, validate_smiles

# Lookup single compound
result = lookup("c1ccccc1")
print(result.cid, result.iupac_name)

# Process batch file
results = lookup_file("compounds.csv", output_format="xlsx")

# Download structure from PubChem
download_structure(5282253, format="sdf", dimension="3d")

# Generate 2D or 3D structure offline from SMILES
generate_structure(
    smiles="CC(=O)OC1=CC=CC=C1C(=O)O",
    output_path="aspirin_3d.sdf",
    format="sdf",
    dimension="3d",
    title="Aspirin"
)

For more detailed API documentation, see the API Reference page.

Documentation

For complete tutorials and advanced usage examples, see the Practical Guide or visit the official documentation on Read the Docs.

Requirements

  • Python 3.10+
  • RDKit (cheminformatics library)
  • pandas (data handling)
  • requests/aiohttp (HTTP)
  • typer (CLI framework)
  • rich/tqdm (UI/progress)

Configuration

For configuration and architecture details, see the Configuration & Architecture page.

Standardization Pipeline

Clean up "dirty" SMILES: strip salts, neutralize charges, canonicalize tautomers. Fully offline — powered by RDKit MolStandardize.

# Strip salt, neutralize, and canonicalize in one go
smilesherlock standardize "[Na+].[OH-].CC(=O)[O-]"
# Output: CC(=O)O

# Show step-by-step diff
smilesherlock standardize "[Na+].[OH-].CC(=O)[O-]" --show-diff

# Custom steps
smilesherlock standardize "O=C([O-])c1ccccc1" --steps neutralize,canonical

# Batch from CSV
smilesherlock standardize --file dirty.csv --output clean.csv

Python API

from smilesherlock import standardize_smiles

result = standardize_smiles("[Na+].[OH-].CC(=O)[O-]")
print(result.output_smiles)    # CC(=O)O
print(result.changed)          # True

# Inspect what changed per step
for s in result.step_results:
    if s.changed:
        print(f"{s.step}: {s.input_smiles} -> {s.output_smiles}")

Tautomer Enumeration

Enumerate all plausible tautomers for a given SMILES string. Critical for protein-ligand docking preparation where different tautomeric states have different binding affinities.

# Single compound
smilesherlock tautomers "Oc1nc(O)c2nc[nH]c2n1"

# Batch from CSV (outputs one row per tautomer)
smilesherlock tautomers --file ligands.csv --output tautomers.csv

Python API

from smilesherlock import enumerate_tautomers

result = enumerate_tautomers("Oc1nc(O)c2nc[nH]c2n1", max_tautomers=1000)
print(result.num_tautomers)        # e.g., 15
print(result.canonical_tautomer)   # O=c1[nH]c(=O)c2[nH]cnc2[nH]1

for t in result.tautomers:
    print(t)

IUPAC Identifier Generation

Generate InChI, InChIKey, formula, MW offline. Fetch IUPAC systematic name via PubChem with local caching.

# Offline: InChI, InChIKey, formula, MW
smilesherlock iupacname "CC(=O)OC1=CC=CC=C1C(=O)O"

# With IUPAC name from PubChem (cached after first fetch)
smilesherlock iupacname "CCO" --online

# Batch
smilesherlock iupacname --file compounds.smi --online --output identifiers.csv

Python API

from smilesherlock import get_iupac_name

result = get_iupac_name("CCO", use_online=True)
print(result.inchi)              # InChI=1S/C2H6O/c1-2-3/h3H,2H2,1H3
print(result.inchikey)           # LFQSCWFLJHTTHZ-UHFFFAOYSA-N
print(result.molecular_formula)  # C2H6O
print(result.iupac_name)         # ethanol
print(result.iupac_name_source)  # pubchem (or 'cache' on repeat calls)

Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

For more details, see the Contributing Guide.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Citation

If you use SmileSherlock in your research, please cite:

@software{smilesherlock2026,
  author={Atharva Tilewale},
  doi={10.5281/zenodo.22078775},
  month={8},
  title={SmileSherlock: A High-Performance SMILES Validation and PubChem Lookup Tool},
  version={1.7.0},
  year={2026},
  url={https://github.com/AtharvaTilewale/SmileSherlock}
}

Support

Changelog

See CHANGELOG.md for version history.


Made with ❤️ for the cheminformatics community

Metadata

Release files for SmileSherlock 1.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for SmileSherlock 1.7.0
File Size Uploaded
smilesherlock-1.7.0.tar.gz 52.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for SmileSherlock 1.7.0
File Interpreter ABI Platform
smilesherlock-1.7.0-py3-none-any.whl Python 3 none any Details

Total release size: 104.7 kB

Release files / smilesherlock-1.7.0.tar.gz

Download URL smilesherlock-1.7.0.tar.gz
Size 52.3 kB
Tags Source
SHA-256 checksum
How to use checksums
a116c4a55800229950faba663a26a56738fc17b195a178a8aa555d5d85b48608
BLAKE2b-256 checksum
How to use checksums
0cec8bfe25aad132478dbfac38c75dcc105bdca50abee31f87a083e20492f6d0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 27, 2026.

Transparency log

Release files / smilesherlock-1.7.0-py3-none-any.whl

Download URL smilesherlock-1.7.0-py3-none-any.whl
Size 52.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9354ae6e2edc837d6d45b0da3ffdf9bc6a67565e578737e34945d18277dcec59
BLAKE2b-256 checksum
How to use checksums
0d84a95a0033d85ab6f512a085da99d81556871451c2f9be751d93346b534734
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 27, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.7.0 This release

2 release files

1.6.0

2 release files

1.5.0

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page