forked from katholt/plotTree
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathui.R
More file actions
175 lines (150 loc) · 7.07 KB
/
ui.R
File metadata and controls
175 lines (150 loc) · 7.07 KB
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
library(shiny)
library(ape)
library(RLumShiny)
shinyUI(fluidPage(
#titlePanel("Plot tree"),
sidebarLayout(
sidebarPanel(
tabsetPanel(
tabPanel("Tree",
### UPLOAD TREE
br(),
fileInput('tree', 'Upload tree file (nwk)', multiple=F,
accept=c('biotree/newick','.nwk', '.tree')),
checkboxInput("label_tips", "Label tree tips?", value=FALSE),
conditionalPanel(
condition = "input.label_tips",
textInput("tipLabelSize", label = "Text size", value = "1"),
textInput("offset", label = "Offset", value = "0")
),
textInput("tree_line_width", label = "Branch width", value = "1.5"),
jscolorInput(inputId="branch_colour", label="Branch colour:", value="#000000", position = "bottom", color = "transparent", mode = "HSV", slider = T, close = T),
br()
), # finished tree tab
tabPanel("Info",
### METADATA (info file)
br(),
fileInput('info_file', 'Upload metadata (CSV)'),
checkboxInput('info_data', 'Use metadata', value = FALSE),
conditionalPanel(
condition = "input.info_data",
checkboxInput('print_metadata', 'Print columns', value = FALSE),
conditionalPanel(
condition = "input.print_metadata",
selectInput('print_column', 'Metadata columns to print:', c(''), multiple=TRUE)
),
"--------",
selectInput('colour_tips_by', 'Colour tips by:', c('')),
# options if colouring by tips
conditionalPanel(
condition = "input.colour_tips_by != '(none)'",
sliderInput("tip_size", label = "Tip size", min = 0.1, max = 20, value = 0.5),
### COLOUR PANELS
checkboxInput("legend", "Legend for node colours?", value=TRUE),
selectInput("legend_pos", label = "Position for legend",
choices = list( "bottomleft"="bottomleft", "bottomright"="bottomright",
"top-left"="topleft", "topright"="topright")
),
"--------",
checkboxInput("ancestral", "Ancestral state reconstruction?", value=FALSE),
sliderInput("pie_size", label = "Pie graph size", min = 0.1, max = 20, value = 0.5)
)
)
), # finished metadata tab
tabPanel("Data",
### HEATMAP DATA
br(),
fileInput('heatmap', 'Upload heatmap file (CSV)', multiple = F, accept = c('text/csv', '.csv')),
checkboxInput('chk_heatmap', 'Plot heatmap', value = FALSE),
conditionalPanel(
condition = "input.chk_heatmap", h4("Heatmap options"),
selectInput("clustering", label = h5("Clustering:"),
choices = list("Select..."=F, "Cluster columns by values"=T, "Square matrix"="square"),
selected = "Select"),
"--------",
# OPTIONALLY DISPLAY COLOUR OPTIONS
checkboxInput("heatColoursPrompt", "Change heatmap colour ramp", value=FALSE),
conditionalPanel(
condition = "input.heatColoursPrompt",
jscolorInput(inputId="start_col", label="Start colour:", value="FFFFFF", position = "bottom", color = "transparent", mode = "HSV", slider = T, close = T),
jscolorInput(inputId="middle_col", label="Middle colour:", value="FFF94D", position = "bottom", color = "transparent", mode = "HSV", slider = T, close = T),
jscolorInput(inputId="end_col", label="End colour:", value="1755FF", position = "bottom", color = "transparent", mode = "HSV", slider = T, close = T),
textInput("heatmap_breaks", label = "Breaks:", value = "100")
),
# checkboxInput("heatColoursSpecify", "Specify heatmap colours manually", value=FALSE),
# conditionalPanel(
# condition = "input.heatColoursSpecify",
# textInput("heatmap_colour_vector", label = "R code (vector), e.g. rev(gray(seq(0,1,0.1)))", value = "")
# ),
"--------",
textInput("heatmapDecimalPlaces", label = "Decimal places to show in heatmap legend:", value = "1"),
textInput("colLabelCex", label = "Text size for column labels:", value = "0.75")
# textInput("vlines_heatmap", label = "y-coordinates for vertical lines (e.g. c(2,5)):", value = ""),
# jscolorInput(inputId="vlines_heatmap_col", label=h5("Colour for vertical lines:"), value="1755FF", position = "bottom", color = "transparent", mode = "HSV", slider = T, close = T)
)
), # finished heatmap options
tabPanel("Other",
tabsetPanel(
tabPanel("Barplots",
br(),
# bar plots
fileInput('barData', 'Upload data for bar plots (CSV)', multiple = F, accept = c('text/csv', '.csv')),
checkboxInput('chk_barplot', 'Plot bar graphs', value = FALSE),
conditionalPanel(
condition = "input.chk_barplot", h5("Barplot options"),
jscolorInput(inputId="barDataCol", label="Colour for barplots:", value="1755FF", position = "bottom", color = "transparent", mode = "HSV", slider = T, close = T)
)
),
tabPanel("Genome blocks",
br(),
# genome blocks
fileInput('blockFile', 'Upload genome block coordinates', multiple = F, accept = c('text/tab', '.txt')),
checkboxInput('chk_blocks', 'Plot genome blocks', value = FALSE),
conditionalPanel(
condition = "input.chk_blocks", h5("Genome block plotting options"),
textInput("genome_size", label = "Genome size (bp):", value = "5E6"),
jscolorInput(inputId="block_colour", label="Colour for blocks:", value="1755FF", position = "bottom", color = "transparent", mode = "HSV", slider = T, close = T),
sliderInput("blwd", label = "Block size", min = 0.1, max = 20, value = 5)
)
),
tabPanel("SNPs",
br(),
# snps
fileInput('snpFile', 'Upload SNP allele table (CSV)', multiple = F, accept = c('text/csv', '.csv')),
checkboxInput('chk_snps', 'Plot SNPs', value = FALSE),
conditionalPanel(
condition = "input.chk_snps", h5("SNP plotting options"),
textInput("genome_size", label = "Genome size (bp):", value = "5E6"), # make this linked to previous conditional
jscolorInput(inputId="snp_colour", label="Colour for SNPs:", value="1755FF", position = "bottom", color = "transparent", mode = "HSV", slider = T, close = T)
)
)
) #finished other data subtabs
), # finished other data tab
tabPanel("Layout",
br(),
h5("Relative widths"),
textInput("tree_width", label = "Tree", value = 10),
textInput("info_width", label = "Info columns", value = 10),
textInput("heatmap_width", label = "Heatmap", value = 30),
textInput("bar_width", label = "Bar plots", value = 10),
textInput("genome_width", label = "Genome data (blocks, SNPs)", value = 10),
br(),
h5("Relative heights"),
textInput("main_height", label = "Main panels", value = 100),
textInput("label_height", label = "Heatmap labels", value = 10),
br(),
h5("Borders"),
textInput("edge_width", label = "Border width/height", value = 1)
)
), # finish tabpanel
### DRAW BUTTON
br(),
actionButton("drawButton", "Draw!")
# ADD PRINT BUTTON HERE
), # finished sidebarPanel
mainPanel(
plotOutput("Tree", height=800)
)
) # finished sidebarLayout
) # fluidPage
) # shinyUI