Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
ea908c4
feat(metrics): add optional imputation-bias diagnostic; feat(missing)…
jorgeMFS Aug 9, 2025
f26f4aa
feat(reporting): add Imputation-bias diagnostics to PDF/MD; feat(gui)…
jorgeMFS Aug 9, 2025
28d6155
feat(missing): track imputation_mask for mean/median/mode; tests: bia…
jorgeMFS Aug 9, 2025
6b4be56
feat(reporting): add traffic-light status table for bias; test: cover…
jorgeMFS Aug 9, 2025
f0b6bca
scripts: add super_comprehensive_cli_test with large heterogeneous da…
jorgeMFS Aug 9, 2025
283e853
chore(scripts): rename super_comprehensive_cli_test to end_to_end_e2e…
jorgeMFS Aug 9, 2025
13f3a17
chore(scripts): finalize renames to end_to_end_e2e_cli_test (large), …
jorgeMFS Aug 9, 2025
7773e1c
chore(scripts): remove legacy super_comprehensive_cli_test.py; standa…
jorgeMFS Aug 9, 2025
f3320bd
chore(naming): remove legacy comprehensive/super_* files and folder; …
jorgeMFS Aug 9, 2025
fbb1304
chore(compat): restore super_* configs and add comprehensive_cli_test…
jorgeMFS Aug 9, 2025
5a6a4e3
chore(clean): remove stale scripts/output/super_comprehensive artifac…
jorgeMFS Aug 9, 2025
fa42911
chore(clean): remove legacy comprehensive_cli_test.py; use scripts/e2…
jorgeMFS Aug 9, 2025
79ee754
feat(report/gui): add Triggers explainability for imputation-bias dia…
jorgeMFS Aug 9, 2025
ede45d5
fix(gui): handle quality_metrics as list or dict; store imputation_bi…
jorgeMFS Aug 9, 2025
4e39c6c
fix(report): avoid duplicate quality sections; only render Additional…
jorgeMFS Aug 9, 2025
25aa287
feat: bias diagnostics explainability in PDF/MD/GUI; GUI robustness f…
jorgeMFS Aug 9, 2025
4f55637
chore(scripts): fix unified_scenarios paths to generator/benchmark an…
jorgeMFS Aug 9, 2025
a3308a6
Update src/phenoqc/mapping.py
jorgeMFS Aug 10, 2025
25e5bd5
Update tests/test_imputation_bias.py
jorgeMFS Aug 10, 2025
378a324
Update tests/test_imputation_bias.py
jorgeMFS Aug 10, 2025
190cf3c
Update src/phenoqc/quality_metrics.py
jorgeMFS Aug 10, 2025
9b1250f
Update src/phenoqc/batch_processing.py
jorgeMFS Aug 10, 2025
82a2d49
improving mapping
jorgeMFS Aug 10, 2025
673adf4
Initialize alt ID mapping before ontology loading
jorgeMFS Aug 10, 2025
fe1c7c2
Merge pull request #75 from jorgeMFS/codex/fix-ontology-mappings-and-…
jorgeMFS Aug 10, 2025
98a53bc
Fix test failures: resolve _alt_to_primary attribute error and improv…
jorgeMFS Aug 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,10 @@ Highlights:

## Examples and Scripts

- `scripts/quality_metrics_cli_test.py` – small demo with metrics
- `scripts/imputation_params_cli_test.py` – runs with config-driven imputation and label column
- `scripts/comprehensive_cli_test.py` – generates a comprehensive dataset and runs full pipeline
- `scripts/e2e_small_quality_metrics_cli_test.py` – small demo focusing on quality metrics
- `scripts/e2e_medium_cli_test.py` – mid-sized end-to-end pipeline run
- `scripts/end_to_end_e2e_cli_test.py` – large end-to-end pipeline run
- `scripts/imputation_params_cli_test.py` – imputation params and optional tuning

---

Expand Down
Binary file added report_class_dist.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
56 changes: 56 additions & 0 deletions scripts/config/e2e_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@

ontologies:
HPO:
name: Human Phenotype Ontology
source: url
url: http://purl.obolibrary.org/obo/hp.obo
format: obo
DO:
name: Disease Ontology
source: url
url: http://purl.obolibrary.org/obo/doid.obo
format: obo
MPO:
name: Mammalian Phenotype Ontology
source: url
url: http://purl.obolibrary.org/obo/mp.obo
format: obo

default_ontologies:
- HPO
- DO
- MPO

fuzzy_threshold: 80
cache_expiry_days: 30

imputation:
strategy: knn
params:
n_neighbors: 5
weights: uniform
per_column:
Creatinine_mgdl:
strategy: mice
params:
max_iter: 5
Cholesterol_mgdl:
strategy: svd
params:
rank: 2
tuning:
enable: true
mask_fraction: 0.1
scoring: MAE
max_cells: 10000
random_state: 42
grid:
n_neighbors: [3, 5, 7]

quality_metrics:
imputation_bias:
enable: true
smd_threshold: 0.10
var_ratio_low: 0.5
var_ratio_high: 2.0
ks_alpha: 0.05
96 changes: 96 additions & 0 deletions scripts/config/e2e_schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "End-to-End E2E Schema",
"type": "object",
"properties": {
"SampleID": {
"type": [
"string",
"null"
]
},
"Height_cm": {
"type": [
"number",
"null"
],
"minimum": 30,
"maximum": 250
},
"Weight_kg": {
"type": [
"number",
"null"
],
"minimum": 1,
"maximum": 400
},
"Cholesterol_mgdl": {
"type": [
"number",
"null"
],
"minimum": 50,
"maximum": 600
},
"BP_systolic": {
"type": [
"number",
"null"
],
"minimum": 50,
"maximum": 250
},
"BP_diastolic": {
"type": [
"number",
"null"
],
"minimum": 30,
"maximum": 200
},
"Glucose_mgdl": {
"type": [
"number",
"null"
],
"minimum": 20,
"maximum": 800
},
"Creatinine_mgdl": {
"type": [
"number",
"null"
],
"minimum": 0.1,
"maximum": 20
},
"PrimaryPhenotype": {
"type": [
"string",
"null"
]
},
"DiseaseCode": {
"type": [
"string",
"null"
]
},
"VisitDate": {
"type": [
"string",
"null"
]
},
"class": {
"type": [
"string",
"null"
]
}
},
"required": [
"SampleID"
]
}
56 changes: 56 additions & 0 deletions scripts/config/super_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@

ontologies:
HPO:
name: Human Phenotype Ontology
source: url
url: http://purl.obolibrary.org/obo/hp.obo
format: obo
DO:
name: Disease Ontology
source: url
url: http://purl.obolibrary.org/obo/doid.obo
format: obo
MPO:
name: Mammalian Phenotype Ontology
source: url
url: http://purl.obolibrary.org/obo/mp.obo
format: obo

default_ontologies:
- HPO
- DO
- MPO

fuzzy_threshold: 80
cache_expiry_days: 30

imputation:
strategy: knn
params:
n_neighbors: 5
weights: uniform
per_column:
Creatinine_mgdl:
strategy: mice
params:
max_iter: 5
Cholesterol_mgdl:
strategy: svd
params:
rank: 2
tuning:
enable: true
mask_fraction: 0.1
scoring: MAE
max_cells: 10000
random_state: 42
grid:
n_neighbors: [3, 5, 7]

quality_metrics:
imputation_bias:
enable: true
smd_threshold: 0.10
var_ratio_low: 0.5
var_ratio_high: 2.0
ks_alpha: 0.05
96 changes: 96 additions & 0 deletions scripts/config/super_schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "End-to-End E2E Schema",
"type": "object",
"properties": {
"SampleID": {
"type": [
"string",
"null"
]
},
"Height_cm": {
"type": [
"number",
"null"
],
"minimum": 30,
"maximum": 250
},
"Weight_kg": {
"type": [
"number",
"null"
],
"minimum": 1,
"maximum": 400
},
"Cholesterol_mgdl": {
"type": [
"number",
"null"
],
"minimum": 50,
"maximum": 600
},
"BP_systolic": {
"type": [
"number",
"null"
],
"minimum": 50,
"maximum": 250
},
"BP_diastolic": {
"type": [
"number",
"null"
],
"minimum": 30,
"maximum": 200
},
"Glucose_mgdl": {
"type": [
"number",
"null"
],
"minimum": 20,
"maximum": 800
},
"Creatinine_mgdl": {
"type": [
"number",
"null"
],
"minimum": 0.1,
"maximum": 20
},
"PrimaryPhenotype": {
"type": [
"string",
"null"
]
},
"DiseaseCode": {
"type": [
"string",
"null"
]
},
"VisitDate": {
"type": [
"string",
"null"
]
},
"class": {
"type": [
"string",
"null"
]
}
},
"required": [
"SampleID"
]
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
"""
Generate a comprehensive synthetic dataset and run PhenoQC with
Generate a mid-sized synthetic dataset and run PhenoQC with
config-driven imputation and class-imbalance reporting.

This script verifies that:
Expand Down Expand Up @@ -29,12 +29,12 @@
from phenoqc.batch_processing import unique_output_name


OUT_DIR = os.path.join(SCRIPT_DIR, "output", "comprehensive")
OUT_DIR = os.path.join(SCRIPT_DIR, "output", "e2e_medium")
os.makedirs(OUT_DIR, exist_ok=True)

SCHEMA_PATH = os.path.join(SCRIPT_DIR, "config", "schema.json")
CONFIG_PATH = os.path.join(SCRIPT_DIR, "config", "config.yaml")
DATA_PATH = os.path.join(OUT_DIR, "comprehensive_input.csv")
DATA_PATH = os.path.join(OUT_DIR, "e2e_medium_input.csv")


def create_comprehensive_data(n: int = 1000, seed: int = 42) -> pd.DataFrame:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/usr/bin/env python3
"""
quality_metrics_cli_test.py
small_quality_metrics_cli_test.py

A self-contained script demonstrating PhenoQC's ``--quality-metrics`` option.
It synthesizes a small dataset containing issues for all supported metrics
(accuracy, redundancy, traceability, timeliness) and runs the CLI with those
checks enabled.

Example:
python quality_metrics_cli_test.py
python small_quality_metrics_cli_test.py

Outputs and temporary files are written under ``./output/quality_metrics``.
"""
Expand Down Expand Up @@ -138,7 +138,7 @@ def run_phenoqc(data_path: str, cfg_path: str, output_dir: str) -> None:


def main() -> None:
out_dir = os.path.join(SCRIPT_DIR, "output", "quality_metrics")
out_dir = os.path.join(SCRIPT_DIR, "output", "e2e_small_quality_metrics")
os.makedirs(out_dir, exist_ok=True)

data_path = os.path.join(out_dir, "quality_metrics_input.csv")
Expand Down
Loading