@@ -28,8 +28,8 @@ DEsummaryPanelUI <- function(id, metadata){
2828 onStatus = FALSE
2929 ),
3030 checkboxInput(ns(" pca.show.labels" ), label = " Show sample labels" , value = FALSE ),
31- checkboxInput(ns(' pca.show.ellipses' ),label = " Show ellipses around groups" ,value = TRUE ),
32- textInput(ns(' plotPCAFileName' ), ' File name for PCA plot download' , value = ' PCAPlotDE.png' ),
31+ checkboxInput(ns(' pca.show.ellipses' ), label = " Show ellipses around groups" , value = TRUE ),
32+ textInput(ns(' plotPCAFileName' ), ' File name for PCA plot download' , value = ' PCAPlotDE.png' ),
3333 downloadButton(ns(' downloadPCAPlot' ), ' Download PCA Plot' ),
3434
3535 status = " info" ,
@@ -42,12 +42,10 @@ DEsummaryPanelUI <- function(id, metadata){
4242 radioButtons(ns(' heatmap.processing' ), label = " Heatmap values" ,
4343 choices = c(' Expression' ,' Log2 Expression' ,' Z-score' ),
4444 selected = ' Z-score' ),
45- shinyjqui :: orderInput(ns(' heatmap.annotations' ), label = " Show annotations" ,
46- items = colnames(metadata )[c(ncol(metadata ), seq_len(ncol(metadata ) - 1 ))][- 2 ]),
45+ shinyjqui :: orderInput(ns(' heatmap.annotations' ), label = " Show annotations" , items = colnames(metadata )),
4746 selectInput(ns(" geneName" ), " Additional genes to include:" , multiple = TRUE , choices = character (0 )),
4847 div(" \n If no genes are selected in the DE panel or here then the top 50 DE genes are chosen.\n " ),
4948 div(style = " margin-bottom:10px" ),
50- actionButton(ns(' goHeatmap' ), label = ' Create heatmap' ),
5149 textInput(ns(' plotHeatmapFileName' ), ' File name for heatmap plot download' , value = ' HeatmapPlot.png' ),
5250 downloadButton(ns(' downloadHeatmapPlot' ), ' Download Heatmap Plot' ),
5351
@@ -99,6 +97,16 @@ DEsummaryPanelServer <- function(id, expression.matrix, metadata, DEresults, ann
9997 })
10098 output [[' pca' ]] <- renderPlot(pca.plot())
10199
100+ observe({
101+ items <- colnames(metadata())
102+ include.exclude <- apply(metadata(), 2 , function (x ){
103+ l <- length(unique(x ))
104+ (l > 1 ) & (l < length(x ))
105+ })
106+ items <- colnames(metadata())[include.exclude ]
107+ items <- items [c(length(items ), seq_len(length(items ) - 1 ))]
108+ shinyjqui :: updateOrderInput(session , " heatmap.annotations" , items = items )
109+ })
102110 heatmap.plot <- reactive({
103111 selectedGenes = DEresults()$ selectedGenes()
104112 if (length(selectedGenes )){
@@ -119,14 +127,14 @@ DEsummaryPanelServer <- function(id, expression.matrix, metadata, DEresults, ann
119127 dplyr :: arrange(dplyr :: across(input [[' heatmap.annotations' ]]))
120128
121129 myplot <- expression_heatmap(
122- expression.matrix = subsetExpression [, meta [, 1 ]],
130+ expression.matrix = subsetExpression [, meta [, 1 ], drop = FALSE ],
123131 top.annotation.ids = match(input [[' heatmap.annotations' ]], colnames(meta )),
124132 metadata = meta ,
125- type = input [[" heatmap.processing" ]]
133+ type = input [[" heatmap.processing" ]],
134+ show.column.names = (nrow(meta ) < = 20 )
126135 )
127136 return (myplot )
128- }) %> %
129- bindEvent(DEresults(), input [[' goHeatmap' ]])
137+ })
130138 output [[' heatmap' ]] <- renderPlot(heatmap.plot(), height = 800 )
131139
132140 output [[' downloadHeatmapPlot' ]] <- downloadHandler(
0 commit comments