Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small updates to plots + subtype AUC interaction #71

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,9 @@ cohort_summary/NMF/multinomial_models_k_4_elastic_net/cell_line_data_notes.txt
cohort_summary/NMF/peptide_subtype_interaction/Protein peptide deviation Vlad.pptx
cohort_summary/NMF/peptide_subtype_interaction/Protein Peptide Deviation PTRC tuesday.pptx
cohort_summary/supplemental_table_1.txt
cohort_summary/NMF/cophenetic_correlation.txt
cohort_summary/NMF/logFC.txt
cohort_summary/NMF/subtype_mutation_AUC/drug_response.csv
cohort_summary/NMF/subtype_mutation_AUC/Figures
Figures
cohort_summary/NMF/diving_into_subtype_drivers.Rmd
2 changes: 1 addition & 1 deletion cohort_summary/NMF/NMF_raw_results.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ library(dplyr)
library(tibble)
library(tidyr)


source("../../util/synapseUtil.R")
source("../../util/loading_data.R")
source("NMF_helper.R")
load.combined.data()


```


Expand Down
14 changes: 9 additions & 5 deletions cohort_summary/NMF/NMF_summary.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ coph.correlation <- sapply(results, cophcor) %>%
data.frame(coph.cor = ., k = 2:8) %>%
filter(k <= 8)

write.table(coph.correlation, file = "cophenetic_correlation.txt",
sep = "\t", quote = F, row.names = F)

p <- ggplot(coph.correlation, aes(x = k, y = coph.cor)) + geom_line() +
ylab("Cophenetic correlation") + scale_x_continuous(breaks = 2:8)

Expand Down Expand Up @@ -229,7 +232,7 @@ fab_annotations <- summary.table %>%
## pheatmap column labels
ann.labels <- meta %>%
filter(Barcode.ID %in% samples.common) %>%
select(FLT3.ITD, PostChemotherapy, vitalStatus) %>%
select(FLT3.ITD, PostChemotherapy) %>%
mutate(FLT3.ITD = as.factor(FLT3.ITD),
PostChemotherapy = as.factor(PostChemotherapy),
Barcode.ID = rownames(.))
Expand Down Expand Up @@ -260,12 +263,12 @@ ann.labels <- ann.labels %>%
mutate(FAB = factor(FAB, levels = c("M0", "M1", "M2", "M3", "M4", "M5", "None"))) %>%
column_to_rownames("Barcode.ID") %>%
as.data.frame() %>%
select(PostChemotherapy, NPM1, NPM1_clinical, RAS, vitalStatus, FLT3.ITD, FLT3_MAF, FLT3_AR, FAB) %>%
select(PostChemotherapy, NPM1, NPM1_clinical, RAS, FLT3.ITD, FLT3_MAF, FLT3_AR, FAB) %>%
dplyr::rename(`FLT3_MAF (percentage)` = FLT3_MAF,
`RAS vaf` = RAS)

## Slimming down annotations
ann.labels <- ann.labels[, c("RAS vaf", "FLT3.ITD", "NPM1_clinical", "FAB", "vitalStatus")]
ann.labels <- ann.labels[, c("RAS vaf", "FLT3.ITD", "NPM1_clinical", "FAB")] #, "vitalStatus")]

## White to dark purple (like the snow storms on weather maps)
colors.wp <- scales::seq_gradient_pal("#FFFFFF", "#4A0078", "Lab")(seq(0,1,length.out = p.celing*10 + 1))
Expand All @@ -282,9 +285,10 @@ ann.colors <- lapply(names(ann.labels), function(x){
"None" = "white")
} else if (length(levels(ann.labels[[x]])) == 2) {
c(`FALSE` = "white", `TRUE` = "darkgrey")
} else {
c("Alive" = "white", "Dead" = "darkgrey", "Unknown" = "brown")
}
# } else {
# c("Alive" = "white", "Dead" = "darkgrey", "Unknown" = "brown")
# }
})
names(ann.colors) <- names(ann.labels)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ combined <- get_probabilities(tram$`Global msnset`, tram_comp$`Global msnset`) %


```{r Quizartinib Resistance setup}
##Updating for paper

## Quizartinib Resistance Proteomics Data
quizProtData <- querySynapseTable('syn23595222') %>%
Expand Down Expand Up @@ -621,6 +622,7 @@ ggsave(plot = p, filename = path_str, height = 5, width = 7)


```{r Quizartinib Resistance}
##Updating for paper
m <- quiz$`Global msnset`
plot_title <- "Quizartinib Resistance"
path_str <- tolower(plot_title) %>% gsub(" ", "_", .)
Expand Down Expand Up @@ -680,10 +682,9 @@ alluvial_df <- quiz_meta %>%
p3 <- ggplot(alluvial_df,
aes(x = CellLine, y = Proportion, alluvium = Subtype)) +
geom_alluvium(aes(fill = Subtype)) + scale_fill_manual(values = subtype_colors) +
scale_x_discrete(expand = c(0.15, 0)) +
ggtitle(plot_title) + scale_x_discrete(expand = c(0.3, 0)) +
ggtitle(plot_title) +
theme(axis.title.x = element_blank(),
axis.text.x = element_text(size = 7))
axis.text.x = element_text(size = 9, angle = 45, vjust = .65))

path_str <- sub(".pdf$", "_no_ligand.pdf", path_str)
ggsave(plot = p3, filename = path_str, height = 5.2, width = 10)
Expand All @@ -708,13 +709,12 @@ alluvial_df <- quiz_meta %>%
p4 <- ggplot(alluvial_df,
aes(x = CellLine, y = Proportion, alluvium = Subtype)) +
geom_alluvium(aes(fill = Subtype)) + scale_fill_manual(values = subtype_colors) +
scale_x_discrete(expand = c(0.3, 0)) +
ggtitle(plot_title) + scale_x_discrete(expand = c(0.3, 0)) +
ggtitle(plot_title) +
theme(axis.title.x = element_blank(),
axis.text.x = element_text(size = 7))
axis.text.x = element_text(size = 9, angle = 45, vjust = .65))

path_str <- sub(".pdf$", "_v2.pdf", path_str)
ggsave(plot = p4, filename = path_str, height = 5.2, width = 7)
ggsave(plot = p4, filename = path_str, height = 5.2, width = 8)


```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,19 @@ drug_data <- auc.dat %>%

```


```{r}
table_df <- pilot_meta %>%
filter(exp_3_new) %>%
select(Sample = sample, Subtype, `New to 210-patient cohort` = exp_3_new)
write.table(table_df, "enet_multinomial_data/experiment_3_new_samples.txt", sep = "\t",
col.names = TRUE, row.names = FALSE, quote = F)


```



```{r}
cohort_subtypes <- read.table(syn$get("syn30030154")$path) %>%
dplyr::rename(Subtype = Cluster) %>%
Expand Down
8 changes: 5 additions & 3 deletions cohort_summary/NMF/subtype_drivers.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,10 @@ ksea_wrap <- function(m, var_name, top_n = 7, font_size = 7, ending = "", ...){
plot_path <- paste0("Data/subtype_drivers/ksea_", var_name, ".pdf")
}

colnames(ksea_mat) <- sub("^Cluster", "Subtype", colnames(ksea_mat))
heatmap_breaks <- seq(-5, 5, by = 0.2)
heatmap_colors <- colorRampPalette(rev(brewer.pal(n = 7, name = "RdYlBu")))(length(heatmap_breaks))
p <- pheatmap(ksea_mat, display_numbers = ksea_mat_p2, cluster_cols = F, fontsize = 9,
p <- pheatmap(ksea_mat, display_numbers = ksea_mat_p2, cluster_cols = F, fontsize = 9, fontsize_number = 15,
fontsize_row = font_size, main = title, treeheight_row = 0, cellwidth = 33,
breaks = heatmap_breaks, color = heatmap_colors, width = 6,
filename = plot_path, ...)
Expand Down Expand Up @@ -274,10 +275,11 @@ rank_gsea <- function(m, var_name, t2g, wrap_width = 40, font_size = 7,
plot_path <- paste0("Data/subtype_drivers/rank_gsea_", var_name, ".pdf")
}

p <- pheatmap(gsea_mat, display_numbers = gsea_mat_p2, cluster_cols = F, fontsize = 9,
colnames(gsea_mat) <- sub("^Cluster", "Subtype", colnames(gsea_mat))
p <- pheatmap(gsea_mat, display_numbers = gsea_mat_p2, cluster_cols = F, fontsize = 9, fontsize_number = 15,
fontsize_row = font_size, main = title, treeheight_row = 0, cellwidth = 33,
width = 6, filename = plot_path, ...)
pheatmap(gsea_mat, display_numbers = gsea_mat_p2, cluster_cols = F, fontsize = 9,
pheatmap(gsea_mat, display_numbers = gsea_mat_p2, cluster_cols = F, fontsize = 9, fontsize_number = 15,
fontsize_row = font_size, main = title, treeheight_row = 0, cellwidth = 33,
width = 6, filename = sub(".pdf$", ".png", plot_path), ...)

Expand Down
Loading