forked from apratap/PCBC_DataExplorer_ShinyApp
-
Notifications
You must be signed in to change notification settings - Fork 5
/
load.R
75 lines (58 loc) · 2.04 KB
/
load.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
flog.debug("Starting App", name="server")
getFileLocation <- function(entity) {
entity$path
}
#source the heatmap code
source("expression_heatmap.R")
#source generic heatmap functions
source("generic_annotation_functions.R")
#get the global functions
source("global_functions.R")
###############################
## Load precomputed data
###############################
source("loadPrecomputedData.R")
###############################
## Load synapse data
###############################
## This may break!
## Cache the data thats actually used
# save(list=c("combined_metadata", "eset.mRNA", "eset.miRNA", "eset.meth", "meth_to_gene", "miRNA_to_genes", "pathways_list"),
# file="cached_data.RData")
# f <- File("cached_data.RData", parentId="syn4108202")
# o <- synStore(f)
# Use only these metadata columns
metadataColsToUse <- c("Cell_Line_Type", "Reprogramming_Gene_Combination",
"Reprogramming_Vector_Type", "Tissue_of_Origin", "Diffname_short",
"Cell_Type_of_Origin", "Gender", "Originating_Lab_ID",
"Cell_Line_of_Origin", "Donor_ID", "Originating_Lab", "Cell_Type",
"Culture_Conditions")
# metadataColsToUse <- c("Cell_Line_Type")
metadataIdCol <- "UID"
# cacheId <- "syn4108151"
cacheId <- NA
# cacheId <- "local"
if (!is.na(cacheId)) {
## Caching for testing
if (cacheId == "local") {
load("cached_data.RData")
}
else {
o <- synGet(cacheId)
load(getFileLocation(o))
}
flog.debug("Using cached data loaded from Synapse", name="server")
} else {
#get the MSigDB data
source("msigdb_data_prep.R")
#get the mRNA expression data
source("mRNA_data_prep.R")
#get the miRNA expression data
source("miRNA_data_prep.R")
#get the methylation data
source("methylation_data_prep.R")
#prepare single global metadata
combined_metadata <- rbind(mRNA_metadata, miRNA_metadata, meth_metadata, deparse.level = 0)
# Sample column required for expression matrix filtering
combined_metadata$Sample <- rownames(combined_metadata)
}