Plots with shiny app

Author

Jyotirmoy Das

Published

February 18, 2023

1 Module-1: Create figure with legend

This document is made for easy heatmap tutorial. To create a heatmap from a data frame or a matrix using the ComplexHeatmap R package.

1.1 Input data

Please upload the input data from a text file or CSV file. Only .txt or .csv format are currently accepted as input file format.

1.2 Create Figure

Figure will be generated as soon as you create the “Create the Heatmap” button. There will be a notification prompt at the right bottom corner of the page for the processing of the file.

Code
suppressMessages(library(ComplexHeatmap))
suppressMessages(library(extrafont))
suppressMessages(library(shiny))
#suppressMessages(library(InteractiveComplexHeatmap))
## read dataset
  selectInput("selin",
              "Please select the graph type",
              choices = c("heatmap",
                          "bean",
                          "violin"),
              selected = "heatmap",
              multiple = FALSE           
                        )
Code
  fileInput("inputdata", 
            "Please upload your table",
            accept = c(".txt",
                       ".csv"))
Code
  actionButton("plot", 
               "Create the plot")

Code
  plotOutput("plot",
             width = 600, height = 800)

1.3 Figure legend

The above heatmap is created with R (v4.2.1) ComplexHeatmap (v2.12) package from the user dataset. The color sets according to the color bar legend. The raw values from the user-defined table used here without any modification.

1.4 R session information

Detail of R version, used package versions to generate the Heatmap will be displayed here.

Code
  sessionInfo()
R version 4.1.3 (2022-03-10)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur/Monterey 10.16

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib

locale:
[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8

attached base packages:
[1] grid      stats     graphics  grDevices utils     datasets  methods  
[8] base     

other attached packages:
[1] extrafont_0.18        ComplexHeatmap_2.10.0 shiny_1.7.1          

loaded via a namespace (and not attached):
 [1] circlize_0.4.14     shape_1.4.6         GetoptLong_1.0.5   
 [4] xfun_0.30           bslib_0.3.1         colorspace_2.0-3   
 [7] vctrs_0.5.1         htmltools_0.5.2     stats4_4.1.3       
[10] yaml_2.3.6          rlang_1.0.6         jquerylib_0.1.4    
[13] later_1.3.0         glue_1.6.2          BiocGenerics_0.40.0
[16] RColorBrewer_1.1-3  matrixStats_0.61.0  foreach_1.5.2      
[19] lifecycle_1.0.3     stringr_1.5.0       htmlwidgets_1.5.4  
[22] GlobalOptions_0.1.2 codetools_0.2-18    evaluate_0.15      
[25] knitr_1.38          IRanges_2.28.0      fastmap_1.1.0      
[28] doParallel_1.0.17   httpuv_1.6.5        parallel_4.1.3     
[31] Rttf2pt1_1.3.10     Rcpp_1.0.9          xtable_1.8-4       
[34] promises_1.2.0.1    S4Vectors_0.32.4    jsonlite_1.8.4     
[37] mime_0.12           rjson_0.2.21        png_0.1-7          
[40] digest_0.6.29       stringi_1.7.8       clue_0.3-60        
[43] cli_3.5.0           tools_4.1.3         sass_0.4.1         
[46] magrittr_2.0.3      cluster_2.1.3       crayon_1.5.2       
[49] extrafontdb_1.0     ellipsis_0.3.2      rmarkdown_2.13     
[52] iterators_1.0.14    R6_2.5.1            compiler_4.1.3