#selected genes
library(reactable)
b_cell_div <- readRDS("~/new_data/selected_b_cell_div.rds")
cdc_1 <- readRDS("~/new_data/selected_cdc_1.rds")
neutrophils <- readRDS("~/new_data/selected_neutrophils.rds")
T_cell_CD8_effector_memory <- readRDS("~/new_data/selected_T_cell_CD8_effector_memory.rds")
t_cell_cd8_activated <- readRDS("~/new_data/selected_t_cell_cd8_activated.rds")
reactable(b_cell_div)
reactable(cdc_1)
reactable(neutrophils)
reactable(T_cell_CD8_effector_memory)
reactable(t_cell_cd8_activated)
#"ENSG00000176845" : cDC1
#"ENSG00000129657" : neutrophils
#"ENSG00000111796" : t_cell_cd8_activated
#"ENSG00000105193" : b_cell_dividing
#"ENSG00000147168" : t_cell_cd8_effector_memory
library(ggplot2)
ggplot(univ_results_df, aes(x = gene, y = coef, fill = factor(coef > 0))) +
geom_col(width = 0.6) +
scale_fill_manual(values = c("TRUE" = "salmon", "FALSE" = "lightblue"),
name = "Coef Value",
labels = c("Negative", "Positive")) +
coord_cartesian(ylim = c(-1.567420e-04, 4.461992e-04)) +
labs(title = "Coef Values by Gene Names",
x = "Gene Names",
y = "Coef") +
theme_minimal() +
theme(axis.text.x = element_text(angle = 45, hjust = 1),
legend.position = "top") +
geom_text(aes(label = cell_type), vjust = -0.5, size = 3, color = "black")
final <- data_clean[,3:7] #bulk data not deconv
gen_expression <- final
coef_values <- univ_results_df$coef
risk_scores <- apply(gen_expression, 1, function(x) sum(x * coef_values))
risk_scores <- as.data.frame(risk_scores)
final$risk_scores <- risk_scores$risk_scores
library(survival)
library(survminer)
## Loading required package: ggpubr
##
## Attaching package: 'survminer'
## The following object is masked from 'package:survival':
##
## myeloma
final$overall_survival <- data_clean$overall_survival
final$vital_status <- data_clean$vital_status
final$deceased <- ifelse(final$vital_status == "1", FALSE, TRUE)
final$overall_survival <- as.numeric(final$overall_survival)
plot_list <- list()
res.cut <- surv_cutpoint(final, time = "overall_survival", event = "deceased",
variables = c("risk_scores"))
cutpoint <- res.cut[["cutpoint"]][["cutpoint"]]
final$risk_scores <- ifelse(final$risk_scores > cutpoint, "HIGH", "LOW")
fit_risk_scores <- survfit(Surv(overall_survival, deceased) ~ risk_scores, data = final)
ggsurvplot(fit_risk_scores,
final,
pval = TRUE)