UCSCXenaShiny icon indicating copy to clipboard operation
UCSCXenaShiny copied to clipboard

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

Open quiquemedina opened this issue 1 year ago • 4 comments

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

quiquemedina avatar Jun 13 '24 19:06 quiquemedina

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 avatar Jun 14 '24 02:06 ShixiangWang

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)

ShixiangWang avatar Jun 14 '24 02:06 ShixiangWang

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

quiquemedina avatar Jun 14 '24 12:06 quiquemedina

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

ShixiangWang avatar Jun 16 '24 14:06 ShixiangWang

Hi @quiquemedina

I have added auto thresholding in the lastest version.

# use_optimal_cutoff use `surv_cutpoint` from survminer package for
# thresholding samples in each cancer type.
vis_unicox_tree(use_optimal_cutoff = TRUE)

image

ShixiangWang avatar Jul 18 '24 09:07 ShixiangWang

Dear @ShixiangWang, , Thank you for addressing the issue of setting use_optimal_cutoff = TRUE in the Cox analysis to match the default in the logrank survival Kaplan-Meier (K-M) analysis. R Copiar código q <- vis_unicox_tree( Gene = "TP53", measure = "OS", data_type = "mRNA", use_optimal_cutoff = TRUE, # =FALSE values = c("grey", "#E31A1C", "#377DB8"), opt_pancan = .opt_pancan ) plot(q)

I have compared the univariate Cox (unicox) trees and K-M plots under the optimal cutoff. I noticed that with the optimal cutoff, the effects (risk, protective) are inverted compared to the prognostic values from the K-M plots. This is intriguing (and presumably incorrect) since setting the optimal cutoff = TRUE should primarily affect the statistical strength of the p-value rather than change the direction of the effect (risk to protective and vice versa). To illustrate this, I will use the TP53 gene with appropriate screenshots. A. Unicox tree plot with cutoff_optimal = FALSE: image

B. K-M plot set to cutoff mode: Auto (optimal) default, cancer type = ACC image

Results: • TP53 expression is a risk factor in ACC, LGG, PRAD, THCA cancer types. • TP53 overexpression is associated with poor prognosis in ACC.

Conclusion: • Congruent effects.

C. Unicox tree plot with cutoff_optimal = TRUE: image

D. K-M plot set to optimal cutoff (default), cancer type = ACC image

Results: • TP53 expression is a protective factor in ACC, LGG, PRAD, and other cancer types. • TP53 overexpression is associated with poor prognosis in ACC.

Conclusion: • Incongruent effects.

I believe that in the latest update (V2.2), there seems to be an issue causing the inversion of effects from risk to protective, which seems odd and requires further investigation.

Regards, Enrique

quiquemedina avatar Jul 18 '24 16:07 quiquemedina

Thanks for your feedback. We have checked the relevant codes and found the reasons. The issue with the optimal Cox analysis is due to the default grouping level, with the High group (e.g., higher TP53 expression) as the reference. We have now changed the reference to the Low group, which produces the expected results, as follows. cda3bc34104a7bdffa70f78c05525e6

lishensuo avatar Jul 19 '24 01:07 lishensuo

Yeah. I missed the point about default factor level by surv_cutpoint, which made the 'high' group as reference label.

ShixiangWang avatar Jul 19 '24 01:07 ShixiangWang

Great! solved! Many thanks!

quiquemedina avatar Jul 19 '24 13:07 quiquemedina