-
Notifications
You must be signed in to change notification settings - Fork 2
/
global.R
123 lines (105 loc) · 5.29 KB
/
global.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
######### Loading packages
library(tidyverse)
library(shiny)
library(shinyalert)
library(shinydashboard)
library(shinythemes)
library(shinyWidgets)
library(shinyjs)
library(shinyBS)
library(data.table)
library(DT)
library(viridis)
library(viridisLite)
library(ggplot2)
library(plotly)
library(fst)
library(ComplexHeatmap)
library(survival)
library(survminer)
library(ggsurvfit)
library(biomaRt)
#library(RSelenium)
#library(netstat)
# https://rstudio.github.io/bslib/articles/bslib.html#bootswatch New themes package to check out
######### Loading modules
source("waterfallPlot_module.R")
source("kaplanMeierPlot_module.R")
source("degTable_module.R")
source("geneExpressors_module.R")
#source("heatmap_module.R")
source("HPA_module.R")
source("oncoprint_module.R")
source("classification_module.R")
source("cancerModule.R")
######### Loading external data
# PLEASE NOTE: Large expression datasets required for this app to function are *not* stored in the Github repo,
# as the filesizes are >1 GB. To access the expression data & run this app on your local machine,
# the appropriate "data" directory will need to be copied down from our AWS S3 bucket to replace the "data" folder in the local repo.
# When pushing/pulling back to Github, the "data" folder in this repo will be ignored!
# To modify the data used by this app, the Shiny app "data" object in S3 must be modified. Changes to the
# local "data" folder accessed by the Shiny scripts will NOT affect the web version of the app.
readData <- function(x) {
# Gene-level expression matrices
target_expData38 <<- readRDS("data/mRNA/TARGET_RBD_Dx_AML_ExpressionData_TPM_filt4dupGenes_with_cellLines_CD34posNBM_DSAML_MPN_GRCh38_12.17.2020_FinalforShiny.RDS")
target_expData37 <<- readRDS("data/mRNA/TARGET_RBD_Dx_AML_ExpressionData_TPM_filt4dupGenes_with_cellLines_CD34posNBM_DSAML_MPN_GRCh37_10.16.2020_FinalforShiny.RDS")
beatAML_expData <<- readRDS("data/mRNA/BeatAML_Supplementary_Tables_TPM_Linear_Scale.RDS")
swog_expData <<- readRDS("data/mRNA/SWOG_AML_ExpressionData_TPM_GRCh38_FinalforShiny.RDS")
laml_expData <<- readRDS("data/mRNA/TCGA_LAML_ExpressionData_TPM_FinalforShiny.RDS")
stjude_expData <<- readRDS("data/mRNA/St_Jude_Expression_Data_TPM_filt4dupGenes_FinalforShiny_1.RDS")
gmkf_expData <<- readRDS("data/mRNA/GMKF_TALL_TPM_Expression.RDS")
ccle_expData <<- readRDS("data/mRNA/CCLE_TPM_Expression.RDS")
# miRNA expression matrices (for TARGET dataset only)
load("data/miRNA/TARGET_AML_AAML1031_expn_matrix_mimat_norm_miRNA_RPM_01.07.2019_FinalforShiny.RData", .GlobalEnv)
miRmapping <<- read.csv("data/miRNA/hsa_gff3_IDMap.csv")
# Clinical data
load("data/Clinical/Beat_AML_Supplementary_ClinicalData_FinalforShiny.RData", .GlobalEnv)
load("data/Clinical/TARGET_AML_merged_CDEs_Shareable_FinalforShiny_Updated_08_28_24_NA.RData", .GlobalEnv)
load("data/Clinical/SWOG_AML_Merged_CDEs_FinalforShiny.RData", .GlobalEnv)
load("data/Clinical/TCGA_LAML_ClinicalData_FinalforShiny.RData", .GlobalEnv)
load("data/Clinical/StJude_ALL_ClinicalData_FinalforShiny.RData", .GlobalEnv)
load("data/Clinical/GMKF_TALL_Clinical.RData", .GlobalEnv)
load("data/Clinical/CCLE_Clinical_Data.RData", .GlobalEnv)
# Misc accessory files
load("data/ADC_and_CARTcell_Targets_Database_ADCReview_clinicaltrialsGov_FinalforShiny.RData", .GlobalEnv)
load("data/DEGs/TARGET_AML_vs_NBM_and_Others_Ribodepleted_DEGs_per_Group_GRCh37_12.18.2020_FinalforShiny.RData", .GlobalEnv)
deColKey <<- read.csv("data/Limma_Column_Descriptions.csv")
colMapping <<- read.csv("data/Dataset_Column_Mapping_File.csv", check.names = F, na.strings = "")
aml_restricted_genelist <<- read.csv("data/aml_restricted_genelist.csv")
transmembrane_genelist <<- read.csv("data/transmembraneprot.csv")
immdata <<- read.fst("data/hpa/rna_immune_cell_sample.fst") #the HPA data
all_genes <<- readRDS("data/hpa/all_genes.RDS") #a list of genes from both of the datasets for autocorrection
subloc <<- read.fst("data/hpa/subcellular_location.fst")
protein <<- read.fst("data/hpa/tissue_data.fst")
# for the classification module
classification <<- read.csv("data/classification.csv")
km_cde <<- read.csv("data/km_updated_1_29_24.csv")
# tcga_cancer <<- readRDS("data/concat_gtex_tcga_data.RDS")
# tcga_csv <<- read.csv("data/listforcancers_bothlocat_10in90_final.csv")
# gtex_tcga_combined <<- readRDS("data/concatenated_for_comparison_tcga_gtex.RDS")
#tcga_newcsv <<- readRDS("data/tcga_expression_matrix.rds")
tcga_newcsv <<- readRDS("data/tcga_concatenated_full.rds")
tcga_manifest <<- read.csv("data/tcga_manifest.csv")
gtex_csv <<- readRDS("data/gtex_concatenated_full.rds")
gtex_manifest <<- read.csv("data/gtex_manifest.csv")
gtex_manifest$Tissue <- gsub("(^|[[:space:]])([[:alpha:]])", "\\1\\U\\2", gtex_manifest$Tissue, perl=TRUE)
}
testing <- FALSE
if (identical(testing, TRUE)) {
print("Testing mode - Data already in environment")
} else if (exists("target_expData38")) {
print("Data already exists in the environment")
} else {
readData()
}
####### Misc global functions & files
`%then%` <- function(a, b) {
if (is.null(a)) b else a
}
bs <- 16 # Base font size for figures
dataset_choices <- list(
aml = c("TARGET", "Beat AML" = "BeatAML", "SWOG", "TGCA LAML" = "TCGA"),
all = c("St. Jude" = "StJude"),
tall = c("GMKF" = "GMKF"),
ccle = c("CCLE" = "CCLE")
)