openbiox / UCSCXenaShiny

📊 An R package for interactively exploring UCSC Xena https://xenabrowser.net/datapages/; Book: https://lishensuo.github.io/UCSCXenaShiny_Book; App online: https://shiny.hiplot.cn/ucsc-xena-shiny/, https://shiny.zhoulab.ac.cn/UCSCXenaShiny
https://openbiox.github.io/UCSCXenaShiny/
GNU General Public License v3.0
83 stars 29 forks source link

How do we set cutoff_mode = "Auto" in `vis_unicox_tree` function #329

Open quiquemedina opened 3 weeks ago

quiquemedina commented 3 weeks ago

Dear developers,

For the results from functions tcga_surv_get and vis_unicox_tree be corresponding, I argue that in both functions, the customer should be able to set both at optimal cutoof, which is achieved using cutoff “Auto”.

How do we set cutoff_mode = "Auto" in vis_unicox_tree function?

Settings

RStudio UCSCXenaShiny version 2.1.0 UCSCXenaTools version 1.4.8

Library(UCSCXenaXhiby) Library(UCSCXenaTools) Library(survival) library(dplyr) data = tcga_surv_get( item ="RCAN2", TCGA_cohort = "ESCA", profile = "mRNA", # c("mRNA", "miRNA", "methylation", "transcript", "protein", "mutation", "cnv"), TCGA_cli_data = dplyr::full_join(load_data("tcga_clinical"), load_data("tcga_surv"), by = "sample"), opt_pancan = .opt_pancan )

tcga_surv_plot( data, time = "OS.time", status = "OS", cutoff_mode = "Auto", #c("Auto", "Custom"),

cutpoint = c(50, 50),

cnv_type = c("Duplicated", "Normal", "Deleted"),

profile = "mRNA", #c("mRNA", "miRNA", "methylation", "transcript", "protein", "mutation", "cnv"), palette = "aaas" )

How do we set cutoff_mode = "Auto" in vis_unicox_tree function?

vis_unicox_tree( Gene = "TP53", measure = "OS", data_type = "mRNA", threshold = 0.5, # 0.25 values = c("grey", "#E31A1C", "#377DB8"), opt_pancan = .opt_pancan )

Regards, Enrique

ShixiangWang commented 3 weeks ago

Hello @quiquemedina,

That's a great question about Cox analysis. In my opinion, setting an optimal cutoff is essential for survival analysis to maximize the difference between survival curves. This is why we have implemented it in the surv_plot function. In Cox analysis, we primarily consider the change in hazard ratio per variable unit (e.g., per TP53 expression increase) for the plot. In the background, we use ?survminer::surv_cutpoint() to set the optimal cutoff. You can refer to this for more information about the process.

ShixiangWang commented 3 weeks ago

It is technically possible to implement this feature, but handling input cases with signatures may be challenging. For now, you can refer to the following code. We will consider it as a new option for Cox analysis and corresponding user interfaces (@lishensuo ).

library(survminer)
# 0. Load some data
data(myeloma)
head(myeloma)

# 1. Determine the optimal cutpoint of variables
res.cut <- surv_cutpoint(myeloma, time = "time", event = "event",
                         variables = c("DEPDC1", "WHSC1", "CRIM1"))

summary(res.cut)

# 2. Plot cutpoint for DEPDC1
# palette = "npg" (nature publishing group), see ?ggpubr::ggpar
plot(res.cut, "DEPDC1", palette = "npg")

# 3. Categorize variables
res.cat <- surv_categorize(res.cut)
head(res.cat)

# 4. Fit survival curves and visualize
library("survival")
fit <- survfit(Surv(time, event) ~DEPDC1, data = res.cat)
ggsurvplot(fit, data = res.cat, risk.table = TRUE, conf.int = TRUE)

# 5. Plot forest plots using thresholding variables
fit <- coxph(Surv(time, event) ~DEPDC1 + WHSC1 + CRIM1, data = res.cat)
survminer::ggforest(fit)
quiquemedina commented 3 weeks ago

Great! Thank you for, as always, expedite response and actions! Enrique

ShixiangWang commented 3 weeks ago

You're welcome. Thanks for your suggestion, as always.