Skip to main content

icon

Overview | mol_eval

mol_eval is a tool for evaluating SMILES data, particularly for distinguishing between real and fake SMILES sequences. It uses configurable thresholds and molecular descriptors to assess similarity and other properties such as solubility.

Coverage PyPI Latest Release Unit Tests
Powered by TaccLab License


Features

  • Real vs Fake SMILES Evaluation: Compare real and synthetic SMILES sequences based on various similarity thresholds.
  • Similarity Metrics: Uses Levenshtein distance, Tanimoto coefficient, and molecular descriptors for comparison.
  • Configurable Analysis: Easily tweak similarity thresholds, solubility labels, and molecular descriptors through a configuration file.
  • Reports: Generate detailed evaluation reports based on the results.

Installation

To install mol_eval, you can use pip:

pip install mol_eval

Configuration

Before running the tool, you'll need to prepare your dataset and configuration file.

Step 1: Prepare Your Dataset Files

real_data.csv

This file should contain two columns:

  • cmpd_name: The name of the compound.
  • smile: The SMILES string representing the molecule.

fake_data.csv

This file should contain one column:

  • smile: The SMILES string of synthetic molecules.

Step 2: Configuration File (config.json)

The configuration file allows you to set various thresholds and other parameters used in the evaluation. Here's an example configuration file:

{
    "LEVENSHTEIN_THRESHOLD": 0.5,
    "VERY_HIGH_SIMILARITY_THRESHOLD": 0.9,
    "HIGH_SIMILARITY_THRESHOLD": 0.88,
    "LOW_SIMILARITY_THRESHOLD": 0.3,
    "SOLUBILITY_THRESHOLDS": {
        "VERY_HIGH": -1,
        "HIGH": 0,
        "MODERATE": 2,
        "LOW": 4,
        "VERY_LOW": "Infinity"
    },
    "RELEVANT_DESCRIPTORS": [
        "fr_Al_COO", "fr_NH1", "fr_ketone", "fr_halogen",
        "MaxEStateIndex", "MinEStateIndex", "MinPartialCharge", "MaxPartialCharge",
        "fr_COO", "fr_Ar_N", "fr_Ar_OH",
        "MolWt", "ExactMolWt", "HeavyAtomCount", "NumRotatableBonds",
        "FractionCSP3", "LabuteASA", "RingCount",
        "MolLogP", "TPSA",
        "SlogP_VSA1", "SlogP_VSA2", "SlogP_VSA3", "SlogP_VSA4",
        "SlogP_VSA5", "SlogP_VSA6", "SlogP_VSA7", "SlogP_VSA8", "SlogP_VSA9", "SlogP_VSA10",
        "PEOE_VSA1", "PEOE_VSA2", "PEOE_VSA3", "PEOE_VSA4", "PEOE_VSA5", "PEOE_VSA6",
        "PEOE_VSA7", "PEOE_VSA8", "PEOE_VSA9", "PEOE_VSA10", "PEOE_VSA11", "PEOE_VSA12",
        "PEOE_VSA13", "PEOE_VSA14",
        "NumAromaticRings", "NumSaturatedRings", "fr_benzene", "fr_bicyclic",
        "Chi0", "Chi0n", "Chi0v", "Chi1", "Chi1n", "Chi1v",
        "Chi2n", "Chi2v", "Chi3n", "Chi3v", "Chi4n", "Chi4v", "HallKierAlpha"
    ],
    "TANIMOTO_THRESHOLDS": {
        "VERY_HIGH": 0.9,
        "HIGH": 0.88,
        "MODERATE": 0.3
    },
    "VALID_SOLUBILITY_LABELS": ["VERY_HIGH", "HIGH", "MODERATE"],
    "VALID_TANIMOTO_LABELS": ["HIGH", "MODERATE", "LOW"],
    "MAX_SUBSTRUCTURES_MATCHES": 0,
    "REPORT_FOLDER": "./report"
}

Key Parameters Explained:

  • Thresholds: Customize similarity and solubility thresholds for better evaluation.
  • Descriptors: Choose molecular descriptors for evaluation, such as molecular weight (MolWt), logP (MolLogP), and polar surface area (TPSA).
  • Tanimoto and Levenshtein: Fine-tune the thresholds for calculating molecular similarity.
  • Solubility Labels: Define the solubility categories based on the solubility values.
  • Report Folder: Define where to save evaluation reports.

Usage

After installing the package and preparing your dataset and configuration file, you can run the evaluation tool via the command line. Run the Evaluation

Use the following command to evaluate your datasets:

mol_eval --real_data /path/to/real_data.csv --fake_data /path/to/fake_data.csv --configs /path/to/config.json
usage: mol_eval [-h] --real_data REAL_DATA --fake_data FAKE_DATA --configs CONFIGS

Molecule Evaluator: Evaluate real and fake SMILES data using a configuration file.

options:
  -h, --help            Show this help message and exit.
  --real_data REAL_DATA Path to the real SMILES data file (CSV).
  --fake_data FAKE_DATA Path to the fake SMILES data file (CSV).
  --configs CONFIGS     Path to the configuration JSON file.

Report Generation

The tool generates a report in the folder specified by REPORT_FOLDER in the configuration file (default is ./report). The report contains detailed information on the evaluation of the SMILES sequences, including:

  • similarity metrics
  • solubility predictions
  • substructure matching
  • 2d visualizations of the molecules and their most similar counterparts

Contributing

Contributions are welcome! Feel free to open issues or submit pull requests. Please ensure all tests pass and that the code follows the PEP 8 style guide.

(More Information coming soon!)

pre-commit

Add pre-commit hook to run tests before commit

    pre-commit run --all-files

License

This project is licensed under the terms of the GNU General Public License, Version 3.

Metadata

Release files for mol-eval 0.1.7

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

Source distribution (sdist)

Source distribution for mol-eval 0.1.7
File Size Uploaded
mol_eval-0.1.7.tar.gz 59.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mol-eval 0.1.7
File Interpreter ABI Platform
mol_eval-0.1.7-py3-none-any.whl Python 3 none any Details

Total release size: 99.5 kB

Release files / mol_eval-0.1.7.tar.gz

Download URL mol_eval-0.1.7.tar.gz
Size 59.2 kB
Tags Source
SHA-256 checksum
How to use checksums
08a2b40e6c5811b95b801da3346b3beccef050ea78a3a725dbe7f86017dd4f17
BLAKE2b-256 checksum
How to use checksums
2ec5c8c039af7bc8e562d453118e471c7f3de06f4bf20f08a455019374fd8698
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.23

Release files / mol_eval-0.1.7-py3-none-any.whl

Download URL mol_eval-0.1.7-py3-none-any.whl
Size 40.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f8ff7cbdc8ba2f694f994184d50c1cae0114ea81c05ae66c893d59cf7afab40c
BLAKE2b-256 checksum
How to use checksums
de995b3028419c30a0dfb57df555203eead9cde5f9a70aee48eebb9f1762501c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.23

Release history Release notifications | RSS feed

This release

0.1.7 This release

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

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