View source: R/sig_surv_plot.R
| sig_surv_plot | R Documentation |
Creates Kaplan-Meier survival plots for a given signature or gene, with automatic cutoff determination. Generates three types of plots: optimal cutoff (best cutoff), tertile-based (3 groups), and median split (2 groups).
sig_surv_plot(
input_pdata,
signature,
project = "KM",
ID = "ID",
time = "time",
status = "status",
time_type = "month",
break_month = "auto",
cols = NULL,
palette = "jama",
show_col = TRUE,
mini_sig = "score",
fig.type = "png",
save_path = NULL,
index = 1
)
input_pdata |
Data frame with survival data and signature scores. |
signature |
Character string. Column name of the target signature. |
project |
Character string. Project name for output. Default is '"KM"'. |
ID |
Character string. Column name for sample IDs. Default is '"ID"'. |
time |
Character string. Column name for survival time. Default is '"time"'. |
status |
Character string. Column name for survival status. Default is '"status"'. |
time_type |
Character string. Time unit ('"month"' or '"day"'). Default is '"month"'. |
break_month |
Numeric or '"auto"'. Time axis breaks. Default is '"auto"'. |
cols |
Character vector. Optional custom colors. |
palette |
Character string. Color palette if 'cols' not provided. Default is '"jama"'. |
show_col |
Logical indicating whether to show colors. Default is 'TRUE'. |
mini_sig |
Character string. Label for low score group. Default is '"score"'. |
fig.type |
Character string. File format. Default is '"png"'. |
save_path |
Character string or 'NULL'. Directory for saving plots. If 'NULL', plots are not saved. Default is 'NULL'. |
index |
Integer. Index for multiple plots. Default is '1'. |
A list containing:
Processed input data with group assignments
Combined survival plots
Dongqiang Zeng
# Create small example data
set.seed(123)
test_data <- data.frame(
time = runif(100, 0, 100),
OS_status = sample(c(0, 1), 100, replace = TRUE),
TMEscore_plus = rnorm(100),
ID = paste0("S", 1:100)
)
sig_surv_plot(
input_pdata = test_data,
signature = "TMEscore_plus",
time = "time",
status = "OS_status"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.