Metadata-Version: 2.4
Name: chara-survival
Version: 0.1.3
Summary: Thermodynamic graph survival inference
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: numpy==1.26.4
Requires-Dist: pandas==2.2.1
Requires-Dist: scikit-learn==1.4.1
Requires-Dist: scikit-survival==0.22.0
Requires-Dist: lifelines==0.28.0
Requires-Dist: joblib==1.3.2
Dynamic: description
Dynamic: description-content-type
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# Chara Survival

Chara Survival is a cross-platform survival-analysis toolkit for frozen molecular prognostic models. It provides strict gene-signature alignment, independent microarray standardization, Coxnet inference, thermodynamic graph utilities, and reproducible clinical benchmarking for lung adenocarcinoma cohorts.

## Scientific scope

The package supports inference with the 4,337-gene Chara intersection signature derived between TCGA-LUAD RNA-seq and the independent GSE31210 Affymetrix cohort. Its preprocessing path preserves feature order, coerces expression values safely, imputes unavailable genes deterministically, and applies external-cohort `StandardScaler` normalization before generating linear risk scores.

The repository also contains utilities for thermodynamic graph Laplacians, exponential heat kernels, frozen Coxnet model bundles, survival-curve rendering, and comparative frontier benchmarking against Coxnet, Random Survival Forest, clinical Cox-PH, and DeepSurv baselines.

## Research context

This work was carried out under the guidance of **Dr. Kharerin Hungyo**, who is leading the **Computational and Physical Genomics Lab at IIT, Mandi**.

## Installation

```bash
pip install chara-survival
```

For development:

```bash
git clone https://github.com/<your-account>/chara-survival.git
cd chara-survival
pip install -e .
```

## Model inference

```python
import pandas as pd
from chara import CharaModel

model = CharaModel.load("chara_model_4337.pkl")
expression = pd.read_csv("patient_expression.csv", index_col=0)
risk, x_scaled, aligned, scaler, alpha_index = model.predict(expression)
```

The frozen model artifact is distributed separately from the lightweight Python package. Keep `chara_model_4337.pkl` beside application code when launching the included Gradio interface.

## Web application

Run the Apple-inspired scientific interface with:

```bash
python app.py
```

Upload a patient-by-gene CSV to receive aligned risk scores, survival curves, and a downloadable report.

## License and citation

This repository is intended for research use. Cite the associated manuscript and acknowledge the Computational and Physical Genomics Lab at IIT, Mandi when using the model or software in published work.
