-
Notifications
You must be signed in to change notification settings - Fork 4
/
ui.R
242 lines (226 loc) · 23.7 KB
/
ui.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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
#!/usr/bin/R
# UI side for imputation visualization:
# UI for tree editor:
shinyUI(
# fluidPage(
navbarPage(theme = shinytheme("cosmo"),
"Epimap Data Exploration", id='navBarSet',
tabPanel("Epigenomes Table + TrackHubs", value='tracksNV',
sidebarLayout(sidebarPanel(
selectizeInput('textNodes', 'Add specific samples (by short name):', choices = meta$infostr, multiple = TRUE, options = list(create = TRUE)),
selectizeInput('textNodesCT', 'Add specific samples (by full name):', choices = meta$ctstr, multiple = TRUE, options = list(create = TRUE)),
radioButtons("selTree", "Select from:", c("Groups" = "groups", "Tree" = "tree"), inline=TRUE, selected='groups'),
tags$b("Add samples from sample groups or", tags$a(href=paste0(resdir, 'gwas_resources/enhancer_sample_tree.png'), "enhancer tree:")),
shinyTree("tree", "Add samples from tree:", checkbox=TRUE, theme="proton", types=typeslist)),
mainPanel(tabsetPanel(type='tabs',
tabPanel("Sample Table",
DT::dataTableOutput("selTable"),
downloadButton('downSampleTable', label="Download Table")),
tabPanel("Preset TrackHubs and Views",
h4("Representative track hubs:"),
tags$b('1. Full track hubs (all 17,938 tracks):'),
# Full track hub here:
tags$a(href=paste0(WUSTLnewprefix, 'wustlhub.fulldataset.config.json'), "WUSTL"),'/',
tags$a(href=paste0(UCSCprefix, 'trackHub_full.txt'), "UCSC"),
br(),
"These full hubs are huge track hubs and will be very slow to load.", br(),
"We recommend making custom hubs (next tab) to restrict to datasets of interest.",
br(), br(),
tags$b('2. Average tracks for 33 major sample groups in each mark:'),
tags$a(href=paste0(WUSTLprefix, 'wustlhub.groupaverages.json'), "WUSTL"),'/',
tags$a(href=paste0(UCSCprefix, 'trackHub_groupaverages.txt'), "UCSC"),
br(), br(),
tags$b('3. Chromatin state tracks:'), tags$a(href="https://epilogos.altius.org/?application=viewer&sampleSet=vC&mode=single&genome=hg19&model=18&complexity=KL&group=all&chrLeft=chr5&chrRight=chr5&start=38580123&stop=39602208", "Epilogos"),'/',
# tags$a(href=paste0(WUSTLprefix, 'wustlhub.chromhmm.json'), "WUSTL"),'/',
tags$a(href=paste0(UCSCprefix, 'trackHub_chromHMM_hg19.txt'), "UCSC (hg19)"),'/',
tags$a(href=paste0(UCSC38prefix, 'trackHub_chromHMM_hg38.txt'), "UCSC (hg38)"),
br(), br(),
tags$b('4. All epigenomes and average tracks for a specific sample group:'),
uiOutput("presetHubGroup"),
selectizeInput('selTrackHubGroups', 'Selected sample group:',
choices = groups.full, multiple = FALSE, options = list(create = TRUE))
),
tabPanel("Make Custom TrackHubs",
# Choose marks here:
h3("TrackHub Options:"),
# Only imputed, only observed, both
fluidRow(
column(2,radioButtons("selIO", "Track type(s):",
c("Imputed" = "imp", "Observed" = "obs", "Both" = "both"), selected='both')),
column(2, checkboxGroupInput("selMarkTiers", "Marks/Assays (by set):",
c("Tier 1 (Core Marks + DNase-seq)" = "t1", "Tier 2 (Secondary Marks + ATAC-seq)" = "t2", "Tier 3 (DNA Factors)" = "t3", "Tier 4 (Other Marks)" = "t4"),selected='t1')),
column(4, selectizeInput('selMarks', 'Specific histone marks and assays to add to the track hub:',
choices = all.assays, multiple = TRUE, options = list(create = TRUE)))
),
# Information about number of tracks chosen:
span(tags$b(textOutput("txtHubsize")), style="color:blue"),
"Note: Some sample by assay combinations may either have both imputed and observed data or neither.",
hr(),
downloadButton('downSampleWUSTL', label="Download WUSTL TrackHub"),
downloadButton('downSampleUCSC', label="Download UCSC TrackHub"),
downloadButton('downSampleExport', label="Download File List"),
h3("Usage Instructions:"),
h4("WUSTL Epigenome Browser (Legacy):"),
'1. Select tracks and download WUSTL TrackHub (json formatted)',
br(),
'2. Go to the ', tags$a(href="http://epigenomegateway.wustl.edu/legacy/?genome=hg19", "WUSTL Browser (legacy)"),
br(),
'3. Select the Tracks > Custom Tracks > Add new tracks > Datahub by upload > Upload File',
br(), br(),
tags$b("NOTE: We do not recommend loading more than 100 tracks in the same WUSTL legacy track hub."),
br(),
"The WUSTL legacy client does not allow you to select specific tracks from a hub.",
hr(),
h4("WUSTL Epigenome Browser (new):"),
'1. Select tracks and download WUSTL TrackHub (json formatted)',
br(),
"2. Go to the ", tags$a(href="http://epigenomegateway.wustl.edu/browser/?genome=hg19", "WUSTL Browser (new)"),
br(),
'3. Select the Tracks > Remote Tracks > Add Remote Data Hub > Upload File',
br(), br(),
"The new WUSTL browser does allow you to select specific tracks from a hub, so your hub can be much larger than the legacy version, as long as you do not load everything in.",
br(),
tags$b("Do not load in the coordinate override or native tracks - these are for the legacy version."),
br(),
hr(),
h4("UCSC Epigenome Browser:"),
'1. Select tracks and download UCSC TrackHub (plain text, all in one file)',
br(),
"2. Host hub on a http or ftp server (or use GBiB to host UCSC locally)",
br(),
"3. Edit the following link with your hub location, then use it to connect the hub to the UCSC browser:",
br(),
tags$ul("http://genome.ucsc.edu/cgi-bin/hgTracks?db=hg19&hubUrl=https://www.yourserver.org/hubfile.txt"),
br(),
tags$b("We do not recommend loading more than 1000 tracks in the same UCSC track hub."),
br(),
"You do not have to display all tracks on the UCSC trackhub, but it may take a while to load in all of the data for many tracks."
)
),
)
)
),
tabPanel("Modules/Motifs", value='enhNV',
sidebarPanel(selectizeInput('selMotifGroups', 'View specific sample group subpanel:',
choices = groups.full, multiple = FALSE, selected="Heart", options = list(create = TRUE)),
hr(),
radioButtons("motifDataset", "Motif dataset:",
c("Archetypes" = "arch", "All Motifs" = "full"), selected='arch'),
checkboxInput("motifImages", "Show motifs as logos in network", value=FALSE),
sliderInput("motifFCFilter", "Filter enrichments with absolute log2FC above:",
min = 0, max = 3, value = 1.5, step = .1)
),
mainPanel(tabsetPanel(type="tabs", id="modulesTabset",
tabPanel("Fig. 2 Subpanels", value='tabMFigure',
HTML("<div style ='overflow:auto; width:1000px ' >"),
htmlOutput("motifExample"),
HTML("</div>")
),
tabPanel("Motif-Module Network", value='tabMNet',
tags$b("Note:"), " Select nodes to see edge and node descriptions below the network.",
fluidRow(style='height:600px', column(12, withSpinner(visNetworkOutput("motifNetwork", height="600px"), color='#212121'))),
tags$b("Network edges (for selected node):"),
withSpinner(DT::dataTableOutput("networkSummaryTable"), color='#212121'),
hr(),
tags$b("Node summary (samples in cluster/motif logo):"),
withSpinner(DT::dataTableOutput("nodeSummaryTable"), color='#212121')
),
tabPanel("Motif Enr. Table", value='tabMTable',
withSpinner(DT::dataTableOutput("MotifEnrTable"), color='#212121'),
downloadButton('downMotifEnrTable', label="Download Table")
),
# NOTE: Too slow, consider taking out:
tabPanel("Module Centers", value='tabMMod',
tags$b("Note:"), "Interactive heatmap (size = 833 x 300) may be slow to load.",
withSpinner(plotlyOutput("centersHeatmap", height = "1000px"), color="#212121")),
tabPanel("Motif Heatmap", value='tabMMotifHeat',
tags$b("Note:"), "Interactive heatmap may be slow to load.",
withSpinner(plotlyOutput("motifHeatmap", height = "1000px"), color="#212121"))
)
)),
tabPanel("GWAS Enrichments", value='treeNV',
useShinyjs(),
sidebarPanel(
radioButtons("useAnalysis", "Analysis:",
c("Original (*Improper FDR: see About page*)" = "original", "Revised" = "revised"), selected='revised'),
selectizeInput('selGWASTree', 'Select single GWAS of interest (PubMedID - Trait):',
choices = treeGWASlist[['revised_1%']], multiple = FALSE, options = list(create = TRUE)),
fluidRow(
column(3, tags$b("Adj. p-value:")),
column(3, selectizeInput('selFDR', label=NULL,
# 'Select FDR (only for enr. vis):',
choices = c('1%', '0.1%'),
multiple = FALSE, selected = '1%', options = list(create = TRUE))),
column(6, actionButton("prevButton", "Previous"), actionButton("nextButton", "Next"))
),
hr(),
selectizeInput('filtNode', 'Filter tables by enrichment:',
choices = NULL, multiple = TRUE, options = list(create = TRUE)),
selectizeInput('filtSNP', 'Filter tables by SNP:',
choices = NULL, multiple = TRUE, options = list(create = TRUE)),
hr(),
sliderInput("GWASsnpENHdist", "Maximum distance between SNP and center of enhancer:",
min = 0, max = 2500, value = 2500, step = 10),
radioButtons("selGWASPrioType", "Show prioritization:",
c("All" = "all", "Has linked gene" = "any", "Linked gene disagrees with nearest gene" = "disagree"),
selected='all'),
hr(),
selectizeInput('selGWASTreeMult', 'Select multiple GWAS of interest to plot side-by-side:',
choices = treeGWASlist[['revised_1%']], multiple = TRUE, options = list(create = TRUE)),
sliderInput("GWASTreeScale", "Image Scale (for side-by-side):",
min = 0.25, max = 2, value = 1, step = 0.05)
),
mainPanel(tabsetPanel(type="tabs", id="treeTabset",
tabPanel("Tree Overview", value='tabTree',
tags$b("GWAS Enrichment on ",
tags$a(href=paste0(resdir, 'gwas_resources/enhancer_sample_tree.pdf'), "epigenomes hierarchy:")),
htmlOutput("GWASTreePng"), br(), uiOutput('renderGWASOverview')),
tabPanel("Enrichments", value='tabEnr', br(), uiOutput('renderGWASOverview2'),
hr(), DT::dataTableOutput("GWASOvlStats")),
tabPanel("Enhancers", value='tabEnh', br(), tags$b("Tissue-specific enhancers near GWAS lead SNPs:"),
"All enhancers within 2.5kb of a GWAS lead SNP that are also active ",
"in one of the top-enriched tree nodes in the GWAS.",
hr(), withSpinner(DT::dataTableOutput("GWASEnhStats"), color='#212121'),
downloadButton('downGWASEnh', label="Download Enhancers")),
tabPanel("Links", value='tabLinks', br(), tags$b("Table of gene-enhancer links:"),
"Gene-enhancer links in the GWAS loci (SNPs +/- 1Mb), ",
"reported for the top-enriched sample groups in the GWAS.",
hr(), withSpinner(DT::dataTableOutput("GWASLinksStats"), color='#212121'),
downloadButton('downGWASLinks', label="Download Links")
),
tabPanel("Enr. Heatmap", value='tabHeatmap',
htmlOutput("GWASEnhancerSNP")),
tabPanel("Locus Vis.", value='tabLocusVis',
# Selection + navigation:
selectizeInput('selGWASLocus', 'Select locus:', choices = NULL, multiple=FALSE, options=list(create = TRUE)),
actionButton("prevLocusButton", "Previous"),
actionButton("nextLocusButton", "Next"),
# For resizing GWAS locus:
tags$head(tags$style(type="text/css", "#GWASLocusPng img {max-width: 100%; width: 100%; height: auto}")),
tags$head(tags$script(src = "jquery.elevatezoom.min.js")),
tags$head(tags$script('Shiny.addCustomMessageHandler("zoomon",
function(message) {
var zoomConfig = {cursor: "crosshair", scrollZoom : true,
zoomWindowPosition: 5, zoomWindowHeight:400, zoomWindowWidth:800};
$("#GWASLocusPng img").elevateZoom(zoomConfig); });')),
tags$head(tags$script('Shiny.addCustomMessageHandler("zoomoff",
function(message){
var image = $("#GWASLocusPng img");
// Remove old instance of EZ
$(".zoomContainer").remove();
image.removeData("elevateZoom");
image.removeData("zoomImage");
});')),
div(id='locusDiv', uiOutput("GWASLocusPng")),
htmlOutput("renderLocusOverview"),
tags$b("Click to enable/disable zoom on locus, scroll to change zoom size.")
),
tabPanel("Side-by-side",
tags$b("Select multiple GWAS on sidebar to visualize their enrichments side by side:"),
uiOutput("GWASTreePngMultiple"))
))
),
tabPanel("About/Download",
includeMarkdown("download.md"))
)
)