| name | survival-analysis-km |
| description | Generates Kaplan-Meier survival curves, calculates survival statistics (log-rank test, median survival time), and estimates hazard ratios for clinical and biological survival data analysis. Triggered when user requests survival analysis, Kaplan-Meier plots, time-to-event analysis, or asks about survival statistics in biomedical contexts. |
| version | 1.0.0 |
| category | Bioinfo |
| tags | [] |
| author | AIPOCH |
| license | MIT |
| status | Draft |
| risk_level | Medium |
| skill_type | Tool/Script |
| owner | AIPOCH |
| reviewer | |
| last_updated | 2026-02-06 |
Survival Analysis (Kaplan-Meier)
Kaplan-Meier survival analysis tool for clinical and biological research. Generates publication-ready survival curves with statistical tests.
Features
- Kaplan-Meier Curve Generation: Publication-quality survival plots with confidence intervals
- Statistical Tests: Log-rank test, Wilcoxon test, Peto-Peto test
- Hazard Ratios: Cox proportional hazards regression with 95% CI
- Summary Statistics: Median survival time, restricted mean survival time (RMST)
- Multi-group Analysis: Supports 2+ comparison groups
- Risk Tables: Optional at-risk table below curves
Usage
Python Script
python scripts/main.py --input data.csv --time time_col --event event_col --group group_col --output results/
Arguments
| Argument | Description | Required |
|---|
--input | Input CSV file path | Yes |
--time | Column name for survival time | Yes |
--event | Column name for event indicator (1=event, 0=censored) | Yes |
--group | Column name for grouping variable | Optional |
--output | Output directory for results | Yes |
--conf-level | Confidence level (default: 0.95) | Optional |
--risk-table | Include risk table in plot | Optional |
Input Format
CSV with columns:
- Time column: Numeric, time to event or censoring
- Event column: Binary (1 = event occurred, 0 = censored/right-censored)
- Group column: Categorical variable for stratification
Example:
patient_id,time_months,death,treatment_group
P001,24.5,1,Drug_A
P002,36.2,0,Drug_A
P003,18.7,1,Placebo
Output Files