Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
pertz-lab
shiny-timecourse-inspector
Commits
c4fb7539
Commit
c4fb7539
authored
Nov 26, 2018
by
dmattek
Browse files
Merge branch 'feature-manual-cluster-assignment'
Incorporated manual assignment of cluster colours in heatmaps
parents
cfc6be30
8f41d9f4
Changes
1
Hide whitespace changes
Inline
Side-by-side
modules/tabClHier.R
View file @
c4fb7539
...
@@ -45,6 +45,8 @@ clustHierUI <- function(id, label = "Hierarchical CLustering") {
...
@@ -45,6 +45,8 @@ clustHierUI <- function(id, label = "Hierarchical CLustering") {
ticks
=
TRUE
,
ticks
=
TRUE
,
round
=
TRUE
round
=
TRUE
),
),
checkboxInput
(
ns
(
'chBPlotHierClAss'
),
'Manually assign cluster colours'
),
uiOutput
(
ns
(
'uiPlotHierClAss'
)),
checkboxInput
(
ns
(
'chBPlotHierClSel'
),
'Manually select clusters to display'
),
checkboxInput
(
ns
(
'chBPlotHierClSel'
),
'Manually select clusters to display'
),
uiOutput
(
ns
(
'uiPlotHierClSel'
)),
uiOutput
(
ns
(
'uiPlotHierClSel'
)),
downloadButton
(
ns
(
'downCellCl'
),
'Download CSV with cell IDs and cluster no.'
)
downloadButton
(
ns
(
'downCellCl'
),
'Download CSV with cell IDs and cluster no.'
)
...
@@ -174,6 +176,17 @@ clustHierUI <- function(id, label = "Hierarchical CLustering") {
...
@@ -174,6 +176,17 @@ clustHierUI <- function(id, label = "Hierarchical CLustering") {
# SERVER
# SERVER
clustHier
<-
function
(
input
,
output
,
session
,
in.data4clust
,
in.data4trajPlot
,
in.data4stimPlot
)
{
clustHier
<-
function
(
input
,
output
,
session
,
in.data4clust
,
in.data4trajPlot
,
in.data4stimPlot
)
{
output
$
uiPlotHierClAss
=
renderUI
({
ns
<-
session
$
ns
if
(
input
$
chBPlotHierClAss
)
{
selectInput
(
ns
(
'inPlotHierClAss'
),
'Assign cluster order'
,
choices
=
seq
(
1
,
input
$
inPlotHierNclust
,
1
),
multiple
=
TRUE
,
selected
=
seq
(
1
,
input
$
inPlotHierNclust
,
1
))
}
})
output
$
uiPlotHierClSel
=
renderUI
({
output
$
uiPlotHierClSel
=
renderUI
({
ns
<-
session
$
ns
ns
<-
session
$
ns
...
@@ -249,10 +262,21 @@ clustHier <- function(input, output, session, in.data4clust, in.data4trajPlot, i
...
@@ -249,10 +262,21 @@ clustHier <- function(input, output, session, in.data4clust, in.data4trajPlot, i
cl.hc
=
hclust
(
dm.dist
,
method
=
s.cl.linkage
[
as.numeric
(
input
$
selectPlotHierLinkage
)])
cl.hc
=
hclust
(
dm.dist
,
method
=
s.cl.linkage
[
as.numeric
(
input
$
selectPlotHierLinkage
)])
# number of clusters at which dendrigram is cut
loc.k
=
input
$
inPlotHierNclust
# make a palette with the amount of colours equal to the number of clusters
loc.col
=
get
(
input
$
selectPlotHierPaletteDend
)(
n
=
loc.k
)
# take into account manual assignment of cluster numbers
if
(
input
$
chBPlotHierClAss
)
{
loc.col
=
loc.col
[
as.numeric
(
input
$
inPlotHierClAss
)]
}
dend
<-
as.dendrogram
(
cl.hc
)
dend
<-
as.dendrogram
(
cl.hc
)
dend
<-
color_branches
(
dend
,
dend
<-
color_branches
(
dend
,
col
=
get
(
input
$
selectPlotHierPaletteDend
),
# make sure that n here equals max in the input$inPlotHierNclust slider
col
=
loc.col
,
k
=
input
$
inPlotHierNclust
)
k
=
loc.k
)
return
(
dend
)
return
(
dend
)
})
})
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment