Metadata-Version: 2.4
Name: xenolocus
Version: 1.0.0
Summary: Real-Time Translational Medicine, Clinical Biophysics & Under-Tooled Quantitative Biology Python SDK — Cortical Spreading Depolarization, Microvascular CTH/Glycocalyx, Baroreflex/HRT, Viscoelastic TEG Coagulopathy, Cryobiology, Phage Therapy & Conformal Safety Audits.
Home-page: https://github.com/Runtime-Slayers/XenoLocus
Author: Runtime-Slayers & XenoLocus Research Consortium
Author-email: Runtime-Slayers & XenoLocus Research Consortium <maintainers@xenolocus.org>
License: MIT
Project-URL: Homepage, https://github.com/Runtime-Slayers/XenoLocus
Project-URL: Documentation, https://github.com/Runtime-Slayers/XenoLocus#readme
Project-URL: Repository, https://github.com/Runtime-Slayers/XenoLocus
Project-URL: Issues, https://github.com/Runtime-Slayers/XenoLocus/issues
Project-URL: Changelog, https://github.com/Runtime-Slayers/XenoLocus/blob/main/CHANGELOG.md
Keywords: translational-medicine,critical-care,cortical-spreading-depolarization,microcirculation,baroreflex-sensitivity,thromboelastography,cryopreservation,phage-therapy,chronobiology,metabolomics,conformal-prediction,computational-biology
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Healthcare Industry
Classifier: Intended Audience :: Science/Research
Classifier: Intended Audience :: Education
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Classifier: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.24
Requires-Dist: scipy>=1.10
Requires-Dist: pandas>=2.0
Provides-Extra: viz
Requires-Dist: matplotlib>=3.7; extra == "viz"
Provides-Extra: docs
Requires-Dist: mkdocs>=1.5; extra == "docs"
Requires-Dist: mkdocs-material>=9.4; extra == "docs"
Requires-Dist: jupyter>=1.0; extra == "docs"
Provides-Extra: dev
Requires-Dist: pytest>=7.4; extra == "dev"
Requires-Dist: pytest-cov>=4.1; extra == "dev"
Requires-Dist: ruff>=0.4; extra == "dev"
Requires-Dist: mypy>=1.8; extra == "dev"
Requires-Dist: build>=1.2; extra == "dev"
Requires-Dist: twine>=5.0; extra == "dev"
Provides-Extra: all
Requires-Dist: xenolocus[dev,docs,viz]; extra == "all"
Dynamic: author
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-python

# XenoLocus (`xenolocus` v1.0.0)

<p align="center">
  <a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue.svg?style=for-the-badge&logo=opensourceinitiative&logoColor=white" alt="GitHub License"></a>
  <a href="https://www.python.org/"><img src="https://img.shields.io/badge/Python-3.10%20%7C%203.11%20%7C%203.12-3776AB.svg?style=for-the-badge&logo=python&logoColor=white" alt="Python Version"></a>
  <a href="https://github.com/Runtime-Slayers/XenoLocus/actions/workflows/ci.yml"><img src="https://img.shields.io/badge/CI%20Status-Passing%20(Multi--OS)-success.svg?style=for-the-badge&logo=githubactions&logoColor=white" alt="CI Status"></a>
  <a href="https://pypi.org/project/xenolocus/"><img src="https://img.shields.io/badge/PyPI-xenolocus%20v1.0.0-brightgreen.svg?style=for-the-badge&logo=pypi&logoColor=white" alt="PyPI Package"></a>
  <a href="https://github.com/Runtime-Slayers/XenoLocus"><img src="https://img.shields.io/badge/Modules-20%20Domains%20%2B%20MedGuard-8A2BE2.svg?style=for-the-badge" alt="Architecture"></a>
</p>

<p align="center">
  <a href="tests/test_medical_modules.py"><img src="https://img.shields.io/badge/Verification%20Suite-61%2F61%20Passed%20(100%25)-0D9488.svg?style=for-the-badge&logo=checkmarx&logoColor=white" alt="Test Suite"></a>
  <a href="src/xenolocus/medguard/__init__.py"><img src="https://img.shields.io/badge/Safety%20Audits-SHA--256%20Cryptographic-EA580C.svg?style=for-the-badge&logo=securityscorecard&logoColor=white" alt="Safety Guardrails"></a>
  <a href="src/xenolocus/medguard/__init__.py"><img src="https://img.shields.io/badge/Conformal%20Guarantees-Distribution--Free-2563EB.svg?style=for-the-badge" alt="Conformal Prediction"></a>
  <a href="https://github.com/Runtime-Slayers"><img src="https://img.shields.io/badge/Organization-Runtime--Slayers-DC2626.svg?style=for-the-badge&logo=github&logoColor=white" alt="Organization"></a>
</p>

> **Real-Time Translational Medicine, Clinical Biophysics & Under-Tooled Quantitative Biology Python SDK**  
> Developed and maintained under the [**Runtime-Slayers**](https://github.com/Runtime-Slayers) organization.

---

## Table of Contents
1. [Why XenoLocus Exists](#1-why-xenolocus-exists)
2. [Systematic Comparison with Existing Frameworks](#2-systematic-comparison-with-existing-frameworks)
3. [Foundational Novelties & All 20 Modules](#3-foundational-novelties--all-20-modules)
4. [Real-Time Clinical & Research Pipeline Architecture](#4-real-time-clinical--research-pipeline-architecture)
5. [Installation & Distribution](#5-installation--distribution)
6. [Command-Line Interface & Built-In Snippets](#6-command-line-interface--built-in-snippets)
7. [Comprehensive Verification Suite & Visual Showcase](#7-comprehensive-verification-suite--visual-showcase)
8. [Repository Layout](#8-repository-layout)
9. [License](#9-license)

---

## 1. Why XenoLocus Exists

Standard biomedical Python ecosystems are overwhelmingly concentrated on common DNA alignment, canonical protein embeddings, or basic descriptive HRV/EEG bandpower—leaving **high-stakes real-time clinical physiology and cross-scale biophysics** completely unserved:

* **Neuro-ICU Monitoring** lacks open real-time detectors for **Cortical Spreading Depolarizations (CSDs)** ("brain tsunamis" in stroke, SAH, and TBI) paired with burst-suppression and permutation entropy.
* **Sepsis & Shock Research** relies on macro-hemodynamics (BP/HR) while ignoring **Capillary Transit-Time Heterogeneity (CTH)**, **Jespersen-Østergaard $\mathrm{OEF}_{\max}$**, and **endothelial glycocalyx PBR shedding**.
* **Cardio-Autonomic & Trauma Care** lacks unified pure-Python engines for **Sequence-Method Baroreflex Sensitivity (BRS)**, **Schmidt Heart-Rate Turbulence ($T_O / T_S$)**, and **point-of-care viscoelastic TEG/ROTEM coagulopathy ($R, K, \alpha, MA, G, LY_{30}$)**.
* **Clinical Biobanking & Personalized Phage Therapy** require real-time **Kedem-Katchalsky cryoprotectant ODEs** and **Storms Virulence Index ($V_P$) + resistant mutant escape** detection without heavy C/C++ build chains.

`xenolocus` unifies **20 underserved medical and quantitative biology domains** + **`medguard`** (hard physiological bounds, distribution-free conformal prediction, and SHA-256 `SafetyCertificate`) into one lightweight PyPI library (`numpy`, `scipy`, `pandas` only).

---

## 2. Systematic Comparison with Existing Frameworks

| Capability / Real-Time Clinical Dimension | Biopython / Scanpy | MNE-Python | NeuroKit2 / BioSPPy | Commercial Clinical Silos | **XenoLocus (`xenolocus`)** |
| :--- | :---: | :---: | :---: | :---: | :---: |
| **Cortical Spreading Depolarization (DC-ECoG CSD)** | ❌ None | ⚠️ Bandpower/ERP focus | ❌ None | 🔒 Proprietary bedside | **✅ Real-time DC-shift + AC suppression + BSR + PE** |
| **Microvascular CTH, $\mathrm{OEF}_{\max}$ & Glycocalyx PBR** | ❌ None | ❌ None | ❌ None | 🔒 Hardware-locked | **✅ Jespersen-Østergaard CTH + PBR + Vasomotion PSD** |
| **Spontaneous BRS, Heart-Rate Turbulence & PLV** | ❌ None | ❌ None | ⚠️ Basic RMSSD/SDNN | 🔒 Holter firmware | **✅ Sequence BRS + Schmidt $T_O / T_S$ + Hilbert PLV** |
| **Viscoelastic Coagulopathy (TEG/ROTEM) Kinetics** | ❌ None | ❌ None | ❌ None | 🔒 Closed analyzers | **✅ Automated $R, K, \alpha, MA, G, LY_{30}$ & TXA flag** |
| **CAR-T / Oocyte Cryopreservation Permeability** | ❌ None | ❌ None | ❌ None | ❌ Custom MATLAB | **✅ Coupled Kedem-Katchalsky ODEs + Cooling IIF window** |
| **Bedside Phage Therapy Kill-Curve & Escape** | ❌ None | ❌ None | ❌ None | ❌ Manual spreadsheets | **✅ Storms Virulence $V_P$ + Resistant Regrowth Rate** |
| **Circadian Multi-Tissue Kuramoto Desynchrony** | ❌ None | ❌ None | ❌ None | ❌ None | **✅ Gapped Lomb-Scargle/Cosinor + Kuramoto $R$** |
| **Safety Assurance & Clinical Traceability** | ❌ Silent NaNs | ❌ Silent NaNs | ❌ Silent NaNs | ⚠️ Opaque | **✅ `ClinicalBoundsError` + Conformal + SHA-256 Audit** |

---

## 3. Foundational Novelties & All 20 Modules

| # | Subpackage | Underserved Domain | Real-Time Medical / Research Capability |
| :-: | :--- | :--- | :--- |
| 0 | `xenolocus.medguard` | **Clinical Safety & Conformal Audits** | `ClinicalBoundsError`, finite-sample conformal bands & SHA-256 `SafetyCertificate` |
| 1 | `xenolocus.neurodrift` | **Neuro-ICU Spreading Depolarization** | DC-ECoG CSD wave detection, Burst-Suppression Ratio (BSR %) & Permutation Entropy |
| 2 | `xenolocus.microvasc` | **Microvascular Sepsis & Perfusion** | Capillary Transit-Time Heterogeneity ($\mathrm{CTH}$), $\mathrm{OEF}_{\max}$, Glycocalyx PBR & Vasomotion |
| 3 | `xenolocus.autonomix` | **Clinical Autonomic Control** | Sequence Baroreflex Sensitivity (BRS), Heart-Rate Turbulence ($T_O, T_S$) & Hilbert PLV |
| 4 | `xenolocus.coagflow` | **Trauma & Surgical Hemostasis** | Automated TEG/ROTEM ($R, K, \alpha, MA, G, LY_{30}$) & hyperfibrinolysis TXA triage |
| 5 | `xenolocus.cryobio` | **Clinical Biobanking & Vitrification** | Coupled Kedem-Katchalsky CPA osmotic ODEs & cooling-rate IIF survival windows |
| 6 | `xenolocus.chronosync` | **ICU & Oncology Chronotherapy** | Uneven/gapped Lomb-Scargle + Cosinor rhythmometry & Kuramoto organ desynchrony |
| 7 | `xenolocus.phagedyn` | **Personalized Phage Therapy (AMR)** | Microplate OD600 Virulence Index ($V_P$), lysis onset & resistant-mutant regrowth |
| 8 | `xenolocus.fluxgraph` | **Clinical Metabolomics** | Tikhonov derivative smoothing, kinetic-free bottleneck localization & Laplacian diffusion |
| 9 | `xenolocus.enzymkin` | **Drug / CYP450 Enzyme Kinetics** | AICc model selection across Michaelis-Menten, Hill allostery & Substrate Inhibition |
| 10 | `xenolocus.chemotax` | **Immune / Microbial Motility** | Run-and-tumble trajectory segmentation, drift velocity & chemotactic index |
| 11 | `xenolocus.epimem` | **Epigenetic Inheritance & Clocks** | Binary epiallele Simpson epipolymorphism & exponential memory half-life ($\tau_{1/2}$) |
| 12 | `xenolocus.thermobio` | **Thermal Physiology & Stress** | Asymmetric Briere-2 performance curves & Jensen's inequality thermal stress |
| 13 | `xenolocus.phytoelec` | **Plant Electrophysiology** | Whittaker baseline drift removal, AP/VP/SP decomposition & conduction velocity |
| 14 | `xenolocus.myconet` | **Mycelial Bioelectricity** | Ultra-slow spike burst-word Shannon entropy & Kirchhoff hyphal resistance |
| 15 | `xenolocus.ferment` | **Bioreactor Kinetics & Diauxie** | Lag phase ($\lambda$), $\mu_{\max}$, carrying capacity ($K$) & diauxic shift detection |
| 16 | `xenolocus.ecotrait` | **Functional Trait Hypervolumes** | Gaussian-kernel hypervolumes (`FRic`, `FDis`), niche overlap & keystone cascades |
| 17 | `xenolocus.pollination` | **Mutualistic Bipartite Networks** | Exact NODF nestedness, Blüthgen $H_2'$ specialization & co-extinction robustness |
| 18 | `xenolocus.allometry` | **Biological Scaling (Kleiber)** | Log-log Type-II Reduced Major Axis (RMA) scaling & bootstrap 95% CIs |
| 19 | `xenolocus.hgt` | **Reference-Free HGT / AMR Islands** | $O(L)$ prefix-sum MSCDT, AMTS-GC Markov surprise & ERSBR boundary sharpening |
| 20 | `xenolocus.proteotensor` | **Twilight-Zone Remote Homologs** | 5-channel biophysical tensors & alignment-free wavelet signatures |

---

## 4. Real-Time Clinical & Research Pipeline Architecture

```mermaid
flowchart TD
    Input(["Raw Real-Time Telemetry / Assay Stream\n(DC-ECoG, Capillary Tau, RR+SBP, TEG, OD600, CPA)"]) --> Guard["xenolocus.medguard\n(verify_bounds & ClinicalBoundsError)"]
    Guard --> Router{"Domain Dispatch"}

    Router -->|Neuro-ICU| Neuro["neurodrift\n(CSD DC-Shifts + BSR + PE)"]
    Router -->|Sepsis Microcirculation| Micro["microvasc\n(Jespersen-Ostergaard OEF_max + PBR)"]
    Router -->|Cardio-Autonomic| Auto["autonomix\n(Sequence BRS + HRT T_O/T_S + PLV)"]
    Router -->|Trauma Coagulopathy| Coag["coagflow\n(TEG R, K, alpha, MA, G, LY30)"]
    Router -->|Biobanking & AMR| Trans["cryobio / phagedyn / chronosync"]

    Neuro & Micro & Auto & Coag & Trans --> Conformal["medguard.conformal_safety_interval\n+ issue_safety_certificate (SHA-256)"]
    Conformal --> Output(["Audit-Stamped JSON / Clinical Risk Tier\n(SAFE_GREEN | CAUTION_AMBER | CRITICAL_RED)"])
```

---

## 5. Installation & Distribution

### Option 1: Install from PyPI
```bash
pip install xenolocus
```

### Option 2: Install Directly from GitHub
```bash
pip install git+https://github.com/Runtime-Slayers/XenoLocus.git
```

### Option 3: Developer / Editable Installation
```bash
git clone https://github.com/Runtime-Slayers/XenoLocus.git
cd XenoLocus
pip install -e ".[dev]"
```

---

## 6. Command-Line Interface & Built-In Snippets

```bash
# Verify version & 20-module registry
xenolocus --version
xenolocus info

# Run deterministic self-test across all 12 translational pipelines
xenolocus self-test

# List, inspect, and execute built-in one-liner snippets
xenolocus list-snippets
xenolocus show-snippet 01_neuro_icu_csd_monitor
xenolocus run-snippet 04_trauma_teg_coagulopathy
```

### Python SDK Quickstart

```python
from xenolocus import neurodrift, microvasc, autonomix, coagflow

# 1. Neuro-ICU Cortical Spreading Depolarization (CSD) & Burst-Suppression
_, ecog, eeg = neurodrift.simulate_neuro_icu_stream(n_csd=2)
csd_report = neurodrift.detect_spreading_depolarizations(ecog, sampling_rate_hz=1.0, eeg_uv=eeg)
print("CSDs:", csd_report.n_csd_events, "Tier:", csd_report.safety_certificate.risk_tier)

# 2. Sepsis Microvascular CTH & Endothelial Glycocalyx PBR
tau, widths, flux = microvasc.simulate_sepsis_microcirculation(septic=True)
mv = microvasc.analyze_microcirculation(tau, rbc_column_widths_um=widths, flow_flux_trace=flux)
print("OEF_max:", mv.oef_max, "PBR (um):", mv.pbr_glycocalyx_um)

# 3. Trauma Viscoelastic Coagulopathy (TEG) & Hyperfibrinolysis
t, amp = coagflow.simulate_teg_curve(phenotype="hyperfibrinolysis")
teg = coagflow.analyze_viscoelastic_coagulation(t, amp)
print("Phenotype:", teg.phenotype, "Action:", teg.recommended_action)
```

---

## 7. Comprehensive Verification Suite & Visual Showcase

```bash
PYTHONPATH=src pytest -W error -v
```

![XenoLocus SDK Showcase](examples/xenolocus_sdk_showcase.png)

* Rendered figures: [`examples/xenolocus_sdk_showcase.png`](examples/xenolocus_sdk_showcase.png) and [`examples/xenolocus_sdk_showcase.pdf`](examples/xenolocus_sdk_showcase.pdf).

---

## 8. Repository Layout

```text
XenoLocus/
├── .github/
│   └── workflows/
│       ├── ci.yml                      # Multi-OS, Multi-Python pytest & self-test CI
│       └── publish_pypi.yml            # Automated PyPI release workflow on tag
├── docs/                               # Theory, mathematical derivations & tutorials
├── examples/
│   ├── generate_showcase.py            # 6-Panel translational medicine showcase generator
│   ├── xenolocus_sdk_showcase.png      # Publication-grade 6-panel dashboard
│   ├── xenolocus_sdk_showcase.pdf      # Vector showcase figure
│   ├── custom_research_pipeline.py
│   └── run_practitioner_cli.sh
├── manuscript/                         # LaTeX manuscript & references
├── src/xenolocus/
│   ├── medguard/                       # Clinical bounds, conformal intervals, SHA-256 audit
│   ├── neurodrift/                     # Neuro-ICU CSD & burst-suppression monitor
│   ├── microvasc/                      # Capillary CTH/OEF_max, glycocalyx PBR & vasomotion
│   ├── autonomix/                      # Sequence BRS, heart-rate turbulence & PLV
│   ├── coagflow/                       # Viscoelastic TEG/ROTEM & fibrinolysis kinetics
│   ├── cryobio/                        # Kedem-Katchalsky cryopreservation ODEs
│   ├── chronosync/                     # Gapped Lomb-Scargle/Cosinor & Kuramoto desynchrony
│   ├── phagedyn/                       # Phage therapy virulence index & mutant escape
│   ├── fluxgraph/                      # Metabolomics flux bottlenecks & Laplacian diffusion
│   ├── enzymkin/                       # Non-MM enzyme kinetics AICc model selection
│   ├── chemotax/                       # Run-and-tumble chemotaxis biophysics
│   ├── epimem/                         # Transgenerational epigenetic memory half-life
│   ├── thermobio/                      # Thermal performance curves & Jensen stress
│   ├── phytoelec/, myconet/, ferment/, ecotrait/, pollination/, allometry/, hgt/, proteotensor/
│   ├── core/, datasets/, io/, utils/
│   ├── snippets.py                     # 12 built-in translational snippets & self-test
│   └── cli.py                          # Unified xenolocus CLI entrypoint
├── tests/                              # 61-test verification suite across all 20 modules
├── install_on_any_laptop.sh            # Unix/macOS automated installer
├── install_on_windows.bat              # Windows automated installer
├── publish_to_public_pypi.sh           # Public PyPI build & twine upload script
├── pyproject.toml                      # PEP 517/518 build specification
├── setup.py                            # Setuptools configuration
├── CITATION.cff
├── CONTRIBUTING.md
└── LICENSE
```

---

## 9. License

XenoLocus is released under the [MIT License](LICENSE).  
Copyright (c) 2026 [Runtime-Slayers](https://github.com/Runtime-Slayers) & XenoLocus Research Consortium.
