dockcert 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. dockcert-1.0.0/LICENSE +21 -0
  2. dockcert-1.0.0/PKG-INFO +186 -0
  3. dockcert-1.0.0/README.md +145 -0
  4. dockcert-1.0.0/dockcert/__init__.py +46 -0
  5. dockcert-1.0.0/dockcert/cli.py +241 -0
  6. dockcert-1.0.0/dockcert/core/__init__.py +40 -0
  7. dockcert-1.0.0/dockcert/core/bias.py +85 -0
  8. dockcert-1.0.0/dockcert/core/bootstrap.py +111 -0
  9. dockcert-1.0.0/dockcert/core/enrichment.py +402 -0
  10. dockcert-1.0.0/dockcert/core/rmsd.py +159 -0
  11. dockcert-1.0.0/dockcert/core/scoring.py +185 -0
  12. dockcert-1.0.0/dockcert/parsers/__init__.py +13 -0
  13. dockcert-1.0.0/dockcert/parsers/generic_csv.py +135 -0
  14. dockcert-1.0.0/dockcert/parsers/structure_io.py +80 -0
  15. dockcert-1.0.0/dockcert/parsers/vina_smina.py +58 -0
  16. dockcert-1.0.0/dockcert/reporters/__init__.py +13 -0
  17. dockcert-1.0.0/dockcert/reporters/html_report.py +336 -0
  18. dockcert-1.0.0/dockcert/reporters/manuscript_prep.py +141 -0
  19. dockcert-1.0.0/dockcert/reporters/plot_generator.py +158 -0
  20. dockcert-1.0.0/dockcert.egg-info/PKG-INFO +186 -0
  21. dockcert-1.0.0/dockcert.egg-info/SOURCES.txt +30 -0
  22. dockcert-1.0.0/dockcert.egg-info/dependency_links.txt +1 -0
  23. dockcert-1.0.0/dockcert.egg-info/entry_points.txt +2 -0
  24. dockcert-1.0.0/dockcert.egg-info/requires.txt +14 -0
  25. dockcert-1.0.0/dockcert.egg-info/top_level.txt +1 -0
  26. dockcert-1.0.0/pyproject.toml +76 -0
  27. dockcert-1.0.0/setup.cfg +4 -0
  28. dockcert-1.0.0/tests/test_bias.py +35 -0
  29. dockcert-1.0.0/tests/test_enrichment.py +68 -0
  30. dockcert-1.0.0/tests/test_parsers.py +82 -0
  31. dockcert-1.0.0/tests/test_rmsd.py +52 -0
  32. dockcert-1.0.0/tests/test_scoring.py +65 -0
dockcert-1.0.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Andre Monreal-Hernández
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,186 @@
1
+ Metadata-Version: 2.4
2
+ Name: dockcert
3
+ Version: 1.0.0
4
+ Summary: Automated Statistical Validation, Enrichment Metrics, and Reproducibility Toolkit for Molecular Docking and Virtual Screening
5
+ Author-email: Andre Monreal-Hernández <amonreal@example.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/sircalch/dockcert
8
+ Project-URL: Documentation, https://github.com/sircalch/dockcert#readme
9
+ Project-URL: Repository, https://github.com/sircalch/dockcert.git
10
+ Project-URL: Bug Tracker, https://github.com/sircalch/dockcert/issues
11
+ Project-URL: Changelog, https://github.com/sircalch/dockcert/blob/main/CHANGELOG.md
12
+ Keywords: molecular-docking,virtual-screening,autodock-vina,smina,gnina,glide,gold,roc-auc,bedroc,enrichment-factor,rmsd,reproducibility,chemoinformatics,drug-discovery
13
+ Classifier: Development Status :: 5 - Production/Stable
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
16
+ Classifier: Topic :: Scientific/Engineering :: Chemistry
17
+ Classifier: License :: OSI Approved :: MIT License
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.9
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Operating System :: OS Independent
24
+ Requires-Python: >=3.9
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Requires-Dist: numpy>=1.20.0
28
+ Requires-Dist: scipy>=1.7.0
29
+ Requires-Dist: pandas>=1.3.0
30
+ Requires-Dist: matplotlib>=3.5.0
31
+ Requires-Dist: jinja2>=3.0.0
32
+ Requires-Dist: scikit-learn>=1.0.0
33
+ Provides-Extra: dev
34
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
35
+ Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
36
+ Requires-Dist: black>=23.0.0; extra == "dev"
37
+ Requires-Dist: flake8>=6.0.0; extra == "dev"
38
+ Requires-Dist: build>=0.10.0; extra == "dev"
39
+ Requires-Dist: twine>=4.0.0; extra == "dev"
40
+ Dynamic: license-file
41
+
42
+ # DockCert
43
+
44
+ [![CI](https://github.com/sircalch/dockcert/actions/workflows/test.yml/badge.svg)](https://github.com/sircalch/dockcert/actions)
45
+ [![PyPI version](https://img.shields.io/pypi/v/dockcert.svg?color=blue)](https://pypi.org/project/dockcert/)
46
+ [![Python versions](https://img.shields.io/pypi/pyversions/dockcert.svg)](https://pypi.org/project/dockcert/)
47
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
48
+ [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1234568.svg)](https://doi.org/10.5281/zenodo.1234568)
49
+
50
+ > **Automated Statistical Validation, Early Enrichment Metrics, and Reproducibility Assessment for Molecular Docking and Virtual Screening Studies.**
51
+
52
+ ---
53
+
54
+ ## Overview
55
+
56
+ **DockCert** is an open-source scientific toolkit engineered to evaluate whether a molecular docking or virtual screening protocol is rigorously validated before publication.
57
+
58
+ Instead of computing enrichment factors or pose RMSD across fragmented scripts, `dockcert` analyzes your screening results and docked structures in a single run:
59
+
60
+ - 🎯 **Redocking & Cross-Docking Pose Accuracy**: Heavy-atom & symmetry-corrected RMSD (Hungarian algorithm).
61
+ - 📈 **Early Enrichment Quantification**:
62
+ - **BEDROC** ($\alpha=20.0, 80.5, 160.9$)
63
+ - **RIE** (Robust Initial Enhancement)
64
+ - **EF1%**, **EF5%**, **EF10%** (Enrichment Factors)
65
+ - **ROC-AUC** & **PR-AUC** (Precision-Recall AUC)
66
+ - **logAUC** & **Optimal MCC** (Matthews Correlation Coefficient)
67
+ - 🎲 **95% Stratified Bootstrap Confidence Intervals** for every metric.
68
+ - 🔬 **Decoy Bias & Artificial Enrichment Audit**: Kolmogorov-Smirnov & Wasserstein property tests (MW, LogP, HBD, HBA).
69
+ - 🚦 **Quality Certification Badges (`PASS` / `WARNING` / `FAIL`)**.
70
+ - 📑 **Publication Deliverables**: Interactive self-contained `report.html`, vector plots (SVG/PDF/PNG 300 DPI), LaTeX summary tables (`.tex`), and a draft **Methods & Supporting Information** paragraph with automated **BibTeX citations**.
71
+ - 🔌 **Engine Agnostic**: Works seamlessly with AutoDock Vina, Smina, GNINA, Schrödinger Glide, CCDC GOLD, DOCK, rDock, and generic CSV tables.
72
+
73
+ ```
74
+ Docking Results (.csv, .sdf, .pdbqt, logs)
75
+
76
+
77
+ ┌───────────────────────────────────────────────────────────┐
78
+ │ DockCert │
79
+ │ ├── Redocking RMSD (Symmetry corrected) │
80
+ │ ├── Early Enrichment (BEDROC, RIE, EF1%, ROC-AUC) │
81
+ │ ├── Stratified 95% Bootstrap Confidence Intervals │
82
+ │ └── Decoy Bias Audit (MW, LogP KS-tests) │
83
+ └───────────────────────────────────────────────────────────┘
84
+
85
+
86
+ ┌───────────────────────────────────────────────────────────┐
87
+ │ Publication Deliverables │
88
+ │ ├── report.html (Interactive Dashboard & Badges) │
89
+ │ ├── dockcert_validation_overview.pdf/svg/png │
90
+ │ ├── dockcert_summary_table.tex / .csv │
91
+ │ ├── methods_snippet.txt (Ready for Manuscript) │
92
+ │ └── citation.bib (BibTeX Reference) │
93
+ └───────────────────────────────────────────────────────────┘
94
+ ```
95
+
96
+ ---
97
+
98
+ ## Installation
99
+
100
+ ### From PyPI
101
+ ```bash
102
+ pip install dockcert
103
+ ```
104
+
105
+ ### From Source
106
+ ```bash
107
+ git clone https://github.com/sircalch/dockcert.git
108
+ cd dockcert
109
+ pip install -e .[dev]
110
+ ```
111
+
112
+ ---
113
+
114
+ ## Quickstart (CLI)
115
+
116
+ ### 1. Run Demonstration Mode (Instant Benchmark Dataset)
117
+ ```bash
118
+ dockcert demo -o my_docking_validation/
119
+ ```
120
+ Open `my_docking_validation/report.html` in your browser!
121
+
122
+ ### 2. Assess Virtual Screening CSV
123
+ ```bash
124
+ dockcert assess -i screening_results.csv --score-col docking_score --label-col is_active -o validation_report/
125
+ ```
126
+
127
+ ### 3. Assess with Reference Ligand Pose RMSD
128
+ ```bash
129
+ dockcert assess -i screening_results.csv --ref-ligand crystal_ligand.sdf --docked-pose docked_pose.sdf -o full_report/
130
+ ```
131
+
132
+ ---
133
+
134
+ ## Python API Usage
135
+
136
+ ```python
137
+ import numpy as np
138
+ from dockcert import assess_docking_quality
139
+ from dockcert.reporters import generate_docking_figures, generate_docking_manuscript_assets, generate_docking_html_report
140
+
141
+ # Screening scores (e.g. 50 actives, 1000 decoys)
142
+ labels = np.array([1]*50 + [0]*1000)
143
+ scores = np.concatenate([np.random.normal(-9.2, 0.8, 50), np.random.normal(-6.5, 1.1, 1000)])
144
+
145
+ # Assess quality
146
+ report = assess_docking_quality(
147
+ labels=labels,
148
+ scores=scores,
149
+ rmsd_values=[1.42, 1.85, 2.30],
150
+ lower_is_better=True
151
+ )
152
+
153
+ print(f"Overall Validation Status: {report.overall_status}")
154
+ print(f"ROC-AUC: {report.enrichment_metrics['roc_auc'].value:.3f}")
155
+ print(f"BEDROC (alpha=20.0): {report.enrichment_metrics['bedroc_20'].value:.3f}")
156
+ print(f"EF 1%: {report.enrichment_metrics['ef_1pct'].value:.1f}x")
157
+
158
+ # Export publication deliverables
159
+ generate_docking_figures(labels, scores, report, "output_dir/")
160
+ generate_docking_manuscript_assets(report, "output_dir/")
161
+ generate_docking_html_report(report, "output_dir/report.html")
162
+ ```
163
+
164
+ ---
165
+
166
+ ## Citation
167
+
168
+ If you use DockCert to evaluate molecular docking validation or virtual screening enrichment, please cite:
169
+
170
+ ```bibtex
171
+ @software{monreal2026dockcert,
172
+ author = {Monreal-Hern{\'a}ndez, Andre},
173
+ title = {{DockCert: An Open-Source Toolkit for Statistical Validation, Enrichment Metrics, and Reproducibility Assessment of Molecular Docking Studies}},
174
+ year = {2026},
175
+ version = {1.0.0},
176
+ publisher = {Zenodo},
177
+ url = {https://github.com/sircalch/dockcert}
178
+ }
179
+ ```
180
+
181
+ ---
182
+
183
+ ## License
184
+
185
+ This project is licensed under the **MIT License** - see the [LICENSE](LICENSE) file for details.
186
+
@@ -0,0 +1,145 @@
1
+ # DockCert
2
+
3
+ [![CI](https://github.com/sircalch/dockcert/actions/workflows/test.yml/badge.svg)](https://github.com/sircalch/dockcert/actions)
4
+ [![PyPI version](https://img.shields.io/pypi/v/dockcert.svg?color=blue)](https://pypi.org/project/dockcert/)
5
+ [![Python versions](https://img.shields.io/pypi/pyversions/dockcert.svg)](https://pypi.org/project/dockcert/)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
+ [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.1234568.svg)](https://doi.org/10.5281/zenodo.1234568)
8
+
9
+ > **Automated Statistical Validation, Early Enrichment Metrics, and Reproducibility Assessment for Molecular Docking and Virtual Screening Studies.**
10
+
11
+ ---
12
+
13
+ ## Overview
14
+
15
+ **DockCert** is an open-source scientific toolkit engineered to evaluate whether a molecular docking or virtual screening protocol is rigorously validated before publication.
16
+
17
+ Instead of computing enrichment factors or pose RMSD across fragmented scripts, `dockcert` analyzes your screening results and docked structures in a single run:
18
+
19
+ - 🎯 **Redocking & Cross-Docking Pose Accuracy**: Heavy-atom & symmetry-corrected RMSD (Hungarian algorithm).
20
+ - 📈 **Early Enrichment Quantification**:
21
+ - **BEDROC** ($\alpha=20.0, 80.5, 160.9$)
22
+ - **RIE** (Robust Initial Enhancement)
23
+ - **EF1%**, **EF5%**, **EF10%** (Enrichment Factors)
24
+ - **ROC-AUC** & **PR-AUC** (Precision-Recall AUC)
25
+ - **logAUC** & **Optimal MCC** (Matthews Correlation Coefficient)
26
+ - 🎲 **95% Stratified Bootstrap Confidence Intervals** for every metric.
27
+ - 🔬 **Decoy Bias & Artificial Enrichment Audit**: Kolmogorov-Smirnov & Wasserstein property tests (MW, LogP, HBD, HBA).
28
+ - 🚦 **Quality Certification Badges (`PASS` / `WARNING` / `FAIL`)**.
29
+ - 📑 **Publication Deliverables**: Interactive self-contained `report.html`, vector plots (SVG/PDF/PNG 300 DPI), LaTeX summary tables (`.tex`), and a draft **Methods & Supporting Information** paragraph with automated **BibTeX citations**.
30
+ - 🔌 **Engine Agnostic**: Works seamlessly with AutoDock Vina, Smina, GNINA, Schrödinger Glide, CCDC GOLD, DOCK, rDock, and generic CSV tables.
31
+
32
+ ```
33
+ Docking Results (.csv, .sdf, .pdbqt, logs)
34
+
35
+
36
+ ┌───────────────────────────────────────────────────────────┐
37
+ │ DockCert │
38
+ │ ├── Redocking RMSD (Symmetry corrected) │
39
+ │ ├── Early Enrichment (BEDROC, RIE, EF1%, ROC-AUC) │
40
+ │ ├── Stratified 95% Bootstrap Confidence Intervals │
41
+ │ └── Decoy Bias Audit (MW, LogP KS-tests) │
42
+ └───────────────────────────────────────────────────────────┘
43
+
44
+
45
+ ┌───────────────────────────────────────────────────────────┐
46
+ │ Publication Deliverables │
47
+ │ ├── report.html (Interactive Dashboard & Badges) │
48
+ │ ├── dockcert_validation_overview.pdf/svg/png │
49
+ │ ├── dockcert_summary_table.tex / .csv │
50
+ │ ├── methods_snippet.txt (Ready for Manuscript) │
51
+ │ └── citation.bib (BibTeX Reference) │
52
+ └───────────────────────────────────────────────────────────┘
53
+ ```
54
+
55
+ ---
56
+
57
+ ## Installation
58
+
59
+ ### From PyPI
60
+ ```bash
61
+ pip install dockcert
62
+ ```
63
+
64
+ ### From Source
65
+ ```bash
66
+ git clone https://github.com/sircalch/dockcert.git
67
+ cd dockcert
68
+ pip install -e .[dev]
69
+ ```
70
+
71
+ ---
72
+
73
+ ## Quickstart (CLI)
74
+
75
+ ### 1. Run Demonstration Mode (Instant Benchmark Dataset)
76
+ ```bash
77
+ dockcert demo -o my_docking_validation/
78
+ ```
79
+ Open `my_docking_validation/report.html` in your browser!
80
+
81
+ ### 2. Assess Virtual Screening CSV
82
+ ```bash
83
+ dockcert assess -i screening_results.csv --score-col docking_score --label-col is_active -o validation_report/
84
+ ```
85
+
86
+ ### 3. Assess with Reference Ligand Pose RMSD
87
+ ```bash
88
+ dockcert assess -i screening_results.csv --ref-ligand crystal_ligand.sdf --docked-pose docked_pose.sdf -o full_report/
89
+ ```
90
+
91
+ ---
92
+
93
+ ## Python API Usage
94
+
95
+ ```python
96
+ import numpy as np
97
+ from dockcert import assess_docking_quality
98
+ from dockcert.reporters import generate_docking_figures, generate_docking_manuscript_assets, generate_docking_html_report
99
+
100
+ # Screening scores (e.g. 50 actives, 1000 decoys)
101
+ labels = np.array([1]*50 + [0]*1000)
102
+ scores = np.concatenate([np.random.normal(-9.2, 0.8, 50), np.random.normal(-6.5, 1.1, 1000)])
103
+
104
+ # Assess quality
105
+ report = assess_docking_quality(
106
+ labels=labels,
107
+ scores=scores,
108
+ rmsd_values=[1.42, 1.85, 2.30],
109
+ lower_is_better=True
110
+ )
111
+
112
+ print(f"Overall Validation Status: {report.overall_status}")
113
+ print(f"ROC-AUC: {report.enrichment_metrics['roc_auc'].value:.3f}")
114
+ print(f"BEDROC (alpha=20.0): {report.enrichment_metrics['bedroc_20'].value:.3f}")
115
+ print(f"EF 1%: {report.enrichment_metrics['ef_1pct'].value:.1f}x")
116
+
117
+ # Export publication deliverables
118
+ generate_docking_figures(labels, scores, report, "output_dir/")
119
+ generate_docking_manuscript_assets(report, "output_dir/")
120
+ generate_docking_html_report(report, "output_dir/report.html")
121
+ ```
122
+
123
+ ---
124
+
125
+ ## Citation
126
+
127
+ If you use DockCert to evaluate molecular docking validation or virtual screening enrichment, please cite:
128
+
129
+ ```bibtex
130
+ @software{monreal2026dockcert,
131
+ author = {Monreal-Hern{\'a}ndez, Andre},
132
+ title = {{DockCert: An Open-Source Toolkit for Statistical Validation, Enrichment Metrics, and Reproducibility Assessment of Molecular Docking Studies}},
133
+ year = {2026},
134
+ version = {1.0.0},
135
+ publisher = {Zenodo},
136
+ url = {https://github.com/sircalch/dockcert}
137
+ }
138
+ ```
139
+
140
+ ---
141
+
142
+ ## License
143
+
144
+ This project is licensed under the **MIT License** - see the [LICENSE](LICENSE) file for details.
145
+
@@ -0,0 +1,46 @@
1
+ """
2
+ DockCert: Automated Statistical Validation, Enrichment Metrics, and Reproducibility
3
+ Assessment for Molecular Docking and Virtual Screening Studies.
4
+ """
5
+
6
+ __version__ = "1.0.0"
7
+ __author__ = "Andre Monreal-Hernández"
8
+ __license__ = "MIT"
9
+
10
+ from dockcert.core.enrichment import (
11
+ calculate_roc_auc,
12
+ calculate_pr_auc,
13
+ calculate_bedroc,
14
+ calculate_rie,
15
+ calculate_enrichment_factor,
16
+ calculate_log_auc,
17
+ calculate_optimal_mcc,
18
+ evaluate_all_enrichment_metrics
19
+ )
20
+ from dockcert.core.rmsd import (
21
+ calculate_heavy_atom_rmsd,
22
+ calculate_symmetry_corrected_rmsd,
23
+ evaluate_redocking_success
24
+ )
25
+ from dockcert.core.bias import evaluate_decoy_bias
26
+ from dockcert.core.bootstrap import bootstrap_enrichment_ci
27
+ from dockcert.core.scoring import assess_docking_quality, DockingValidationReport
28
+
29
+ __all__ = [
30
+ "__version__",
31
+ "calculate_roc_auc",
32
+ "calculate_pr_auc",
33
+ "calculate_bedroc",
34
+ "calculate_rie",
35
+ "calculate_enrichment_factor",
36
+ "calculate_log_auc",
37
+ "calculate_optimal_mcc",
38
+ "evaluate_all_enrichment_metrics",
39
+ "calculate_heavy_atom_rmsd",
40
+ "calculate_symmetry_corrected_rmsd",
41
+ "evaluate_redocking_success",
42
+ "evaluate_decoy_bias",
43
+ "bootstrap_enrichment_ci",
44
+ "assess_docking_quality",
45
+ "DockingValidationReport"
46
+ ]
@@ -0,0 +1,241 @@
1
+ """
2
+ Command Line Interface (CLI) for DockCert.
3
+ """
4
+
5
+ import sys
6
+ import os
7
+ import argparse
8
+ import numpy as np
9
+
10
+ from dockcert import __version__
11
+ from dockcert.parsers.generic_csv import load_docking_csv
12
+ from dockcert.parsers.structure_io import load_molecule_coordinates
13
+ from dockcert.core.rmsd import calculate_heavy_atom_rmsd, calculate_symmetry_corrected_rmsd
14
+ from dockcert.core.scoring import assess_docking_quality
15
+ from dockcert.reporters.plot_generator import generate_docking_figures
16
+ from dockcert.reporters.manuscript_prep import generate_docking_manuscript_assets
17
+ from dockcert.reporters.html_report import generate_docking_html_report
18
+
19
+
20
+ def print_banner():
21
+ banner = rf"""
22
+ _____ _ _____ _
23
+ | __ \ | | / ____| | |
24
+ | | | | ___ ___| | _| | ___ _ __| |_
25
+ | | | |/ _ \ / __| |/ / | / _ \ '__| __|
26
+ | |__| | (_) | (__| <| |___| __/ | | |_
27
+ |_____/ \___/ \___|_|\_\\_____\___|_| \__| v{__version__}
28
+
29
+ Molecular Docking Validation & Statistical Quality Toolkit
30
+ Monreal-Hernández et al., 2026
31
+ """
32
+ print(banner)
33
+
34
+
35
+ def run_demo(output_dir: str = "dockcert_demo_output"):
36
+ """
37
+ Generates a realistic DUD-E-like benchmark dataset (100 actives, 2000 property-matched decoys,
38
+ redocking RMSD = 1.43 A) and executes the full validation pipeline.
39
+ """
40
+ print(f"\n[DockCert] Running demonstration mode...")
41
+ os.makedirs(output_dir, exist_ok=True)
42
+
43
+ n_actives = 100
44
+ n_decoys = 2000
45
+
46
+ rng = np.random.default_rng(42)
47
+
48
+ # Active scores: N(-9.4 kcal/mol, 1.1)
49
+ active_scores = rng.normal(-9.4, 1.1, size=n_actives)
50
+ # Decoy scores: N(-6.8 kcal/mol, 1.2)
51
+ decoy_scores = rng.normal(-6.8, 1.2, size=n_decoys)
52
+
53
+ labels = np.concatenate([np.ones(n_actives, dtype=int), np.zeros(n_decoys, dtype=int)])
54
+ scores = np.concatenate([active_scores, decoy_scores])
55
+
56
+ # Redocking poses: Best RMSD = 1.43 A, ensemble of 9 poses
57
+ redocking_rmsds = [1.43, 1.78, 2.15, 2.40, 2.89, 3.10, 3.45, 4.12, 4.55]
58
+
59
+ # Physicochemical properties for bias audit (MW & LogP)
60
+ active_mw = rng.normal(380.0, 45.0, size=n_actives)
61
+ decoy_mw = rng.normal(375.0, 50.0, size=n_decoys)
62
+
63
+ active_logp = rng.normal(2.8, 0.7, size=n_actives)
64
+ decoy_logp = rng.normal(2.7, 0.8, size=n_decoys)
65
+
66
+ active_props = {"MolecularWeight": active_mw, "LogP": active_logp}
67
+ decoy_props = {"MolecularWeight": decoy_mw, "LogP": decoy_logp}
68
+
69
+ print(" -> Calculating ROC-AUC, PR-AUC, BEDROC (alpha=20.0), EF1%, EF5%, logAUC, and Bootstrap 95% CIs...")
70
+ report = assess_docking_quality(
71
+ labels=labels,
72
+ scores=scores,
73
+ rmsd_values=redocking_rmsds,
74
+ active_properties=active_props,
75
+ decoy_properties=decoy_props,
76
+ lower_is_better=True
77
+ )
78
+
79
+ print(" -> Generating publication-quality vector charts (ROC, PR, Score distributions, RMSD)...")
80
+ generate_docking_figures(labels, scores, report, output_dir, lower_is_better=True, rmsd_values=redocking_rmsds)
81
+
82
+ print(" -> Drafting manuscript Methods text snippet, summary LaTeX tables, and BibTeX citations...")
83
+ assets = generate_docking_manuscript_assets(report, output_dir)
84
+
85
+ with open(assets["methods_text"], "r", encoding="utf-8") as f:
86
+ methods_txt = f.read()
87
+ with open(assets["citation_bib"], "r", encoding="utf-8") as f:
88
+ bib_txt = f.read()
89
+
90
+ html_p = os.path.join(output_dir, "report.html")
91
+ print(f" -> Writing interactive dashboard to {html_p}...")
92
+ generate_docking_html_report(report, html_p, methods_text=methods_txt, citation_bib=bib_txt)
93
+
94
+ print("\n" + "="*70)
95
+ print(f" [RESULT] Overall Docking Certification: {report.overall_status}")
96
+ print(f" [SCORE] {report.validation_score}")
97
+ print("="*70)
98
+ if report.redocking_result:
99
+ rr = report.redocking_result
100
+ print(f" * Redocking RMSD : Best = {rr['min_rmsd']:.2f} A | Success Rate (<=2A) = {rr['success_rate_2a']:.1f}% | Status: {rr['status']}")
101
+ for k, item in report.enrichment_metrics.items():
102
+ ci_s = f"[{item.ci_lower_95:.2f}, {item.ci_upper_95:.2f}]" if item.ci_lower_95 is not None else ""
103
+ print(f" * {item.name:18s}: Value = {item.value:6.3f} {ci_s:14s} | Threshold = {item.threshold_pass:4.2f} | Status: {item.status}")
104
+ if report.decoy_bias_result:
105
+ print(f" * Decoy Bias Risk : Level = {report.decoy_bias_result['risk_level']} | Status: {report.decoy_bias_result['status']}")
106
+ print("="*70)
107
+ print(f"\nAll outputs successfully saved to: {os.path.abspath(output_dir)}/")
108
+ print(f"Open {os.path.abspath(html_p)} in your browser to inspect the full report.\n")
109
+
110
+
111
+ def run_assess(args):
112
+ """
113
+ Evaluates user-provided CSV and optional structure files.
114
+ """
115
+ output_dir = args.output
116
+ os.makedirs(output_dir, exist_ok=True)
117
+
118
+ csv_file = args.input
119
+ if not csv_file:
120
+ print("[Error] Please specify a results CSV file with --input.", file=sys.stderr)
121
+ sys.exit(1)
122
+
123
+ print(f"\n[DockCert] Loading docking screening dataset from {csv_file}...")
124
+ labels, scores, props_dict, meta = load_docking_csv(
125
+ csv_file,
126
+ score_column=args.score_col,
127
+ label_column=args.label_col
128
+ )
129
+ print(f" -> Identified {meta['n_total']} entries: {meta['n_actives']} actives, {meta['n_decoys']} decoys.")
130
+
131
+ # RMSD from structures if provided
132
+ rmsd_values = None
133
+ if args.ref_ligand and args.docked_pose:
134
+ print(" -> Calculating heavy-atom RMSD between reference and docked pose...")
135
+ c_ref, el_ref = load_molecule_coordinates(args.ref_ligand)
136
+ c_dock, el_dock = load_molecule_coordinates(args.docked_pose)
137
+ rmsd_val = calculate_symmetry_corrected_rmsd(c_ref, c_dock, elements=el_ref)
138
+ rmsd_values = [rmsd_val]
139
+ print(f" -> Calculated Redocking RMSD: {rmsd_val:.2f} A")
140
+
141
+ print(" -> Performing statistical validation and enrichment analysis...")
142
+ report = assess_docking_quality(
143
+ labels=labels,
144
+ scores=scores,
145
+ rmsd_values=rmsd_values,
146
+ lower_is_better=not args.higher_is_better
147
+ )
148
+
149
+ print(" -> Generating publication charts...")
150
+ generate_docking_figures(labels, scores, report, output_dir, lower_is_better=not args.higher_is_better, rmsd_values=rmsd_values)
151
+
152
+ print(" -> Generating manuscript text, LaTeX summary table, and BibTeX citations...")
153
+ assets = generate_docking_manuscript_assets(report, output_dir)
154
+
155
+ with open(assets["methods_text"], "r", encoding="utf-8") as f:
156
+ methods_txt = f.read()
157
+ with open(assets["citation_bib"], "r", encoding="utf-8") as f:
158
+ bib_txt = f.read()
159
+
160
+ html_p = os.path.join(output_dir, "report.html")
161
+ print(f" -> Writing HTML quality report to {html_p}...")
162
+ generate_docking_html_report(report, html_p, methods_text=methods_txt, citation_bib=bib_txt)
163
+
164
+ print("\n" + "="*70)
165
+ print(f" [RESULT] Overall Docking Certification: {report.overall_status}")
166
+ print(f" [SCORE] {report.validation_score}")
167
+ print("="*70)
168
+ for k, item in report.enrichment_metrics.items():
169
+ print(f" * {item.name:18s}: {item.value:6.3f} | Status: {item.status}")
170
+ if report.redocking_result:
171
+ print(f" * Redocking RMSD : {report.redocking_result['min_rmsd']:.2f} A | Status: {report.redocking_result['status']}")
172
+ print("="*70)
173
+ print(f"\nReport ready at: {os.path.abspath(html_p)}\n")
174
+
175
+
176
+ def print_citation():
177
+ bib = """@software{monreal2026dockcert,
178
+ author = {Monreal-Hern\\'andez, Andre},
179
+ title = {{DockCert: An Open-Source Toolkit for Statistical Validation, Enrichment Metrics, and Reproducibility Assessment of Molecular Docking Studies}},
180
+ year = {2026},
181
+ version = {1.0.0},
182
+ publisher = {Zenodo},
183
+ url = {https://github.com/sircalch/dockcert}
184
+ }"""
185
+ print("\nIf you use DockCert in your publications, please cite:\n")
186
+ print("APA Style:")
187
+ print("Monreal-Hernández, A. (2026). DockCert: An Open-Source Toolkit for Statistical Validation, Enrichment Metrics, and Reproducibility Assessment of Molecular Docking Studies (v1.0.0). Zenodo. https://github.com/sircalch/dockcert\n")
188
+ print("BibTeX:")
189
+ print(bib)
190
+ print()
191
+
192
+
193
+ def main():
194
+ parser = argparse.ArgumentParser(
195
+ prog="dockcert",
196
+ description="DockCert: Automated Statistical Validation, Enrichment Metrics, and Reproducibility Toolkit for Molecular Docking."
197
+ )
198
+ parser.add_argument("-v", "--version", action="version", version=f"dockcert {__version__}")
199
+
200
+ subparsers = parser.add_subparsers(dest="command", help="Available subcommands")
201
+
202
+ # Assess command
203
+ assess_parser = subparsers.add_parser("assess", help="Assess virtual screening enrichment and docking accuracy")
204
+ assess_parser.add_argument("-i", "--input", required=True, help="Virtual screening results file (.csv, .tsv, .txt)")
205
+ assess_parser.add_argument("--score-col", help="Column name containing docking scores/affinities")
206
+ assess_parser.add_argument("--label-col", help="Column name containing active/decoy labels")
207
+ assess_parser.add_argument("--ref-ligand", help="Reference crystallographic ligand structure (.sdf, .pdb, .pdbqt)")
208
+ assess_parser.add_argument("--docked-pose", help="Docked pose structure (.sdf, .pdb, .pdbqt)")
209
+ assess_parser.add_argument("--higher-is-better", action="store_true", help="Set if higher score values indicate better affinity")
210
+ assess_parser.add_argument("-o", "--output", default="dockcert_output", help="Directory for output report and assets (default: dockcert_output)")
211
+
212
+ # Demo command
213
+ demo_parser = subparsers.add_parser("demo", help="Run DockCert on a benchmark DUD-E-like simulation dataset")
214
+ demo_parser.add_argument("-o", "--output", default="dockcert_demo_output", help="Output directory (default: dockcert_demo_output)")
215
+
216
+ # Cite command
217
+ subparsers.add_parser("cite", help="Display BibTeX and APA citation details")
218
+
219
+ if len(sys.argv) == 1:
220
+ print_banner()
221
+ parser.print_help()
222
+ sys.exit(0)
223
+
224
+ args = parser.parse_args()
225
+
226
+ if args.command == "assess":
227
+ print_banner()
228
+ run_assess(args)
229
+ elif args.command == "demo":
230
+ print_banner()
231
+ run_demo(args.output)
232
+ elif args.command == "cite":
233
+ print_banner()
234
+ print_citation()
235
+ else:
236
+ parser.print_help()
237
+
238
+
239
+ if __name__ == "__main__":
240
+ main()
241
+
@@ -0,0 +1,40 @@
1
+ """
2
+ Core mathematical and validation algorithms for DockCert.
3
+ """
4
+
5
+ from dockcert.core.enrichment import (
6
+ calculate_roc_auc,
7
+ calculate_pr_auc,
8
+ calculate_bedroc,
9
+ calculate_rie,
10
+ calculate_enrichment_factor,
11
+ calculate_log_auc,
12
+ calculate_optimal_mcc,
13
+ evaluate_all_enrichment_metrics
14
+ )
15
+ from dockcert.core.rmsd import (
16
+ calculate_heavy_atom_rmsd,
17
+ calculate_symmetry_corrected_rmsd,
18
+ evaluate_redocking_success
19
+ )
20
+ from dockcert.core.bias import evaluate_decoy_bias
21
+ from dockcert.core.bootstrap import bootstrap_enrichment_ci
22
+ from dockcert.core.scoring import assess_docking_quality, DockingValidationReport
23
+
24
+ __all__ = [
25
+ "calculate_roc_auc",
26
+ "calculate_pr_auc",
27
+ "calculate_bedroc",
28
+ "calculate_rie",
29
+ "calculate_enrichment_factor",
30
+ "calculate_log_auc",
31
+ "calculate_optimal_mcc",
32
+ "evaluate_all_enrichment_metrics",
33
+ "calculate_heavy_atom_rmsd",
34
+ "calculate_symmetry_corrected_rmsd",
35
+ "evaluate_redocking_success",
36
+ "evaluate_decoy_bias",
37
+ "bootstrap_enrichment_ci",
38
+ "assess_docking_quality",
39
+ "DockingValidationReport"
40
+ ]