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.
- Loads molecules from a CSV file.
- Parses SMILES strings with RDKit.
- Applies a standardization pipeline:
- sanitize molecule
- remove explicit hydrogens
- disconnect metals
- normalize functional groups
- keep the largest organic fragment
- reionize
- neutralize charges
- canonicalize tautomer
- Counts PAINS alerts.
- Filters molecules by:
- successful parsing and standardization
- heavy atom count greater than 10
- zero PAINS alerts
- Exports a clean CSV and optional SDF.
- Saves plots and molecule preview images.
- 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 jupyterlabThe 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,CMPD002Start Jupyter:
jupyter labOpen:
molecule_standardization.ipynb
Then run the notebook from top to bottom after editing the configuration cell.
By default, the notebook writes files under skc_outputs/.
Expected outputs include:
reframe_std.csv: standardized and filtered molecule tablereframe_std.sdf: optional SDF exportreframe_distribution_plots.png: PAINS and heavy atom count plotspreview_reframe_mols.png: grid preview of filtered molecules
The CSV includes key columns such as:
std_smilesheavy_atom_countpains_alert_countpains_alert_names- original input metadata columns
The default filtering logic keeps molecules where:
std_ok == Trueheavy_atom_count > 10pains_alert_count == 0
Change these thresholds in the configuration cell:
MIN_HEAVY_ATOMS = 10
MAX_PAINS_ALERTS = 0This notebook is designed as a preprocessing step before downstream cheminformatics tasks such as diversity selection, clustering, docking preparation, or QSAR modeling.