Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Molecule Standardization and Filtering Pipeline

Standardize a molecule CSV dataset, remove PAINS compounds, filter by heavy atom count, and export a clean cheminformatics-ready dataset.

The main workflow is implemented in molecule_standardization.ipynb.

What the Notebook Does

  1. Loads molecules from a CSV file.
  2. Parses SMILES strings with RDKit.
  3. Applies a standardization pipeline:
    • sanitize molecule
    • remove explicit hydrogens
    • disconnect metals
    • normalize functional groups
    • keep the largest organic fragment
    • reionize
    • neutralize charges
    • canonicalize tautomer
  4. Counts PAINS alerts.
  5. Filters molecules by:
    • successful parsing and standardization
    • heavy atom count greater than 10
    • zero PAINS alerts
  6. Exports a clean CSV and optional SDF.
  7. Saves plots and molecule preview images.

Requirements

  • Python 3.8+
  • Jupyter Notebook or JupyterLab
  • pandas
  • numpy
  • tqdm
  • matplotlib
  • RDKit

Recommended installation with conda:

conda install -c conda-forge rdkit pandas numpy tqdm matplotlib jupyterlab

Input Data

The notebook expects a CSV file with a SMILES column.

The configuration cell uses these defaults:

INPUT_CSV = "reframe_raw.csv"
SMILES_COL = "smiles"
MOL_ID_COL = "source_id"
OUTPUT_CSV = "skc_outputs/reframe_std.csv"

Update those values before running the notebook.

Example input columns:

smiles,name,source_id
CCO,ethanol,CMPD001
c1ccccc1,benzene,CMPD002

Usage

Start Jupyter:

jupyter lab

Open:

molecule_standardization.ipynb

Then run the notebook from top to bottom after editing the configuration cell.

Outputs

By default, the notebook writes files under skc_outputs/.

Expected outputs include:

  • reframe_std.csv: standardized and filtered molecule table
  • reframe_std.sdf: optional SDF export
  • reframe_distribution_plots.png: PAINS and heavy atom count plots
  • preview_reframe_mols.png: grid preview of filtered molecules

The CSV includes key columns such as:

  • std_smiles
  • heavy_atom_count
  • pains_alert_count
  • pains_alert_names
  • original input metadata columns

Filtering Rules

The default filtering logic keeps molecules where:

  • std_ok == True
  • heavy_atom_count > 10
  • pains_alert_count == 0

Change these thresholds in the configuration cell:

MIN_HEAVY_ATOMS = 10
MAX_PAINS_ALERTS = 0

Notes

This notebook is designed as a preprocessing step before downstream cheminformatics tasks such as diversity selection, clustering, docking preparation, or QSAR modeling.

About

Molecule Standardization and Filtering Pipeline

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages