{ "cells": [ { "cell_type": "markdown", "id": "7517a025", "metadata": {}, "source": [ "# Drug-Like Molecules — ChEMBL Physicochemistry\n", "\n", "Starter notebook for the Kaggle dataset in this folder. It loads `chembl_molecules.csv` with pandas and walks through quality checks and a first piece of analysis.\n", "\n", "**Files:** `chembl_molecules.csv`, `data_dictionary.csv`." ] }, { "cell_type": "markdown", "id": "0000f7f2", "metadata": {}, "source": [ "## 1. Load the data" ] }, { "cell_type": "code", "id": "ba5a9c2f", "metadata": {}, "execution_count": null, "outputs": [], "source": [ "import pandas as pd\n", "\n", "df = pd.read_csv(\"chembl_molecules.csv\", low_memory=False)\n", "print(df.shape)" ] }, { "cell_type": "markdown", "id": "325de123", "metadata": {}, "source": [ "## 2. Shape, types and missing values" ] }, { "cell_type": "code", "id": "6eb42bc8", "metadata": {}, "execution_count": null, "outputs": [], "source": [ "print(f\"{df.shape[0]:,} rows x {df.shape[1]} columns\")\n", "\n", "missing = df.isna().mean().mul(100).sort_values(ascending=False)\n", "missing[missing > 0].round(1).to_frame(\"missing_%\").head(15)" ] }, { "cell_type": "markdown", "id": "f2d963fe", "metadata": {}, "source": [ "## 3. Numeric summary" ] }, { "cell_type": "code", "id": "aa2f8fd4", "metadata": {}, "execution_count": null, "outputs": [], "source": [ "df.describe(include='number').T.round(2).head(20)" ] }, { "cell_type": "markdown", "id": "3c38c675", "metadata": {}, "source": [ "## 4. Clinical phase" ] }, { "cell_type": "code", "id": "5df0e354", "metadata": {}, "execution_count": null, "outputs": [], "source": [ "df[\"max_phase\"].value_counts().sort_index().to_frame(\"molecules\")" ] }, { "cell_type": "markdown", "id": "32dfe7ad", "metadata": {}, "source": [ "## 5. Molecular weight vs ALogP" ] }, { "cell_type": "code", "id": "454c46f3", "metadata": {}, "execution_count": null, "outputs": [], "source": [ "sub = df.dropna(subset=[\"mw_freebase\", \"alogp\"])\n", "sub.plot.scatter(x=\"mw_freebase\", y=\"alogp\", s=4, alpha=0.2, figsize=(8, 5))" ] }, { "cell_type": "markdown", "id": "4b7a41af", "metadata": {}, "source": [ "## 6. Lipinski violations" ] }, { "cell_type": "code", "id": "75858718", "metadata": {}, "execution_count": null, "outputs": [], "source": [ "df[\"num_ro5_violations\"].value_counts().sort_index().to_frame(\"molecules\")" ] }, { "cell_type": "markdown", "id": "a8e386a0", "metadata": {}, "source": [ "## 7. Approved vs preclinical properties" ] }, { "cell_type": "code", "id": "eed53b49", "metadata": {}, "execution_count": null, "outputs": [], "source": [ "df.groupby(\"is_approved\")[[\"mw_freebase\", \"alogp\", \"psa\", \"qed_weighted\"]].median().round(2)" ] }, { "cell_type": "markdown", "id": "953c7e95", "metadata": {}, "source": [ "## 8. Modalities" ] }, { "cell_type": "code", "id": "c3f7f40e", "metadata": {}, "execution_count": null, "outputs": [], "source": [ "df[\"molecule_type\"].value_counts().head(10).to_frame(\"molecules\")" ] }, { "cell_type": "markdown", "id": "6e43770c", "metadata": {}, "source": [ "## Next steps\n", "\n", "See `KAGGLE.md` for analysis ideas, caveats and provenance." ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "name": "python", "version": "3.11", "mimetype": "text/x-python", "file_extension": ".py", "codemirror_mode": { "name": "ipython", "version": 3 }, "pygments_lexer": "ipython3", "nbconvert_exporter": "python" } }, "nbformat": 4, "nbformat_minor": 5 }