Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,35 @@ df = load_meds_events("~/.cache/synthlab/meds/synthea_100")

Install the optional extra: `pip install synthlab[meds]`.

### Olink NPX simulator (NEW)

Simulate case/control Olink proteomics data with LOD-driven missingness
and configurable group effects — the first greenfield open-source
simulator targeted at Olink's NPX / PEA readout (existing tools like
[MSstatsSampleSize](https://bioconductor.org/packages/MSstatsSampleSize/)
target LC-MS/MS, and [OlinkAnalyze](https://github.com/Olink-Proteomics/OlinkRPackage)
ships demo data but no simulator). Priors reflect UKB-PPP
([Sun et al. 2023](https://www.nature.com/articles/s41586-023-06592-6))
and OlinkAnalyze `npx_data1` / `npx_data2` baseline distributions:

```python
from synthlab import OlinkSimConfig, default_explore_3072_panel, simulate_olink_npx

cfg = OlinkSimConfig(
n_samples=500,
panel=default_explore_3072_panel(),
group_effects={"CRP": {"case": 1.8}, "IL6": {"case": 1.2}},
group_assignments=["case"] * 250 + ["control"] * 250,
seed=42,
)
df = simulate_olink_npx(cfg)
```

See [`synthlab/olink.py`](synthlab/olink.py) for the full API
(`OlinkPanelConfig`, `OlinkSimConfig`, `simulate_olink_npx`,
`default_explore_3072_panel`, `write_olink_parquet`,
`load_olink_parquet`).

## Installation

```bash
Expand Down
41 changes: 41 additions & 0 deletions notebooks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# SynthLab notebooks

Demos and walkthroughs for the [SynthLab](https://github.com/bschilder/synthlab)
synthetic-healthcare-data toolkit.

## Index

| Notebook | Module | Description |
| -------- | ------ | ----------- |
| [`olink_demo.ipynb`](olink_demo.ipynb) | [`synthlab.olink`](../synthlab/olink.py) | Olink NPX proteomics simulator — generate, analyse, visualise case vs control with LOD missingness + plate batch effects. |
| [`Synthea.ipynb`](Synthea.ipynb) | [`synthlab.synthea`](../synthlab/synthea.py) | Run Synthea and convert CSV to OMOP. |
| [`Coherent_MultimodalDataset.ipynb`](Coherent_MultimodalDataset.ipynb) | [`synthlab.coherent`](../synthlab/coherent.py) | Load and explore the Synthea Coherent multimodal dataset. |
| [`Generate_MultimodalDataset.ipynb`](Generate_MultimodalDataset.ipynb) | [`synthlab.coherent`](../synthlab/coherent.py) | Generate multimodal synthetic cohorts. |
| [`MedGemma_SOAP_Notes.ipynb`](MedGemma_SOAP_Notes.ipynb) | [`synthlab.soap`](../synthlab/soap.py) | MedGemma-based SOAP note generation with causal graph analysis. |
| [`SNOMED_Entity_Linking.ipynb`](SNOMED_Entity_Linking.ipynb) | [`synthlab.snomed`](../synthlab/snomed.py) | SNOMED entity linking with SapBERT and FAISS. |
| [`UKBiobank_Synthetic.ipynb`](UKBiobank_Synthetic.ipynb) | [`synthlab.download_ukbiobank_synthetic`](../synthlab/download_ukbiobank_synthetic.py) | Download and explore the UK Biobank Synthetic Dataset. |

## Running the Olink demo

The Olink NPX demo notebook needs the `viz` optional dependency group
(`matplotlib`, `seaborn`, `scikit-learn`, `umap-learn`). Install alongside the
core SynthLab package:

```bash
pip install 'synthlab[viz]'
```

Then open [`olink_demo.ipynb`](olink_demo.ipynb) in Jupyter — it runs
end-to-end in under a minute on CPU with no external data dependencies.

## Reproducing `olink_demo.ipynb`

The notebook is assembled from
[`_build_olink_demo.py`](_build_olink_demo.py) so the cell layout stays
reviewable under version control. After editing the builder:

```bash
python notebooks/_build_olink_demo.py # rebuild cells
jupyter nbconvert --to notebook --execute --inplace \\
notebooks/olink_demo.ipynb # embed outputs
```
Loading
Loading