For JavaScript-based interactive heatmaps, all necessary files (html, js and css files) can be saved to disk and interactive heatmaps can be opened in another computer without R being installed. But InteractiveComplexHeatmap is different. The interactivity of InteractiveComplexHeatmap is implemented with shiny, ComplexHeatmap and other related R packages, which means, R must be installed on computers where interactive heatmaps are going to be opened. Nevertheless, there are the following two ways that can used to share interactive heatmaps generated by InteractiveComplexHeatmap.
save
argumentIn htShiny()
, there is a save
argument which can be set to a path of a folder where interactive heatmap files are stored.
Then in the folder test_ht
, there are the following files generated:
guz@B069-mb04:~/test_ht$ ls -l
total 40
-rw-r--r-- 1 guz staff 1.1K Oct 18 15:19 htShiny.R
-rw-r--r-- 1 guz staff 5.9K Oct 18 15:19 htShiny.RData
-rw-r--r-- 1 guz staff 18B Oct 18 15:19 htShiny.bat
-rw-r--r--@ 1 guz staff 18B Oct 18 15:19 htShiny.sh
htShiny.R
contains R code that generates the interactive heatmap. htShiny.RData
contains all R objects needed for heatmap and it will be loaded in htShiny.R
. The other two files htShiny.sh
and htShiny.bat
are basically identical and they can be run in the terminal under Linux/MacOS or Windows.
The four files can be sent to collaborators and they can run the following commands to open the interactive heatmap:
cd ~/test_ht
sh htShiny.sh
# or
Rscript htShiny.R
Under Windows, they can simply double click htShiny.bat
.
Executing htShiny.sh
or htShiny.bat
prints a message where collaborators can find the link and paste it to browser to open the interactive heatmap.
guz@B069-mb04:~/test_ht$ sh htShiny.sh
If the shiny app is not automatically opened in the browser, you can manually
copy the following link and paste it to the browser.
Listening on http://127.0.0.1:4132
Note, on the collaborator’s side, R must be installed (however, they don’t need to directly interact with R). If the InteractiveComplexHeatmap package is not yet installed there, htShiny.R
automatically installs it for them.
It would be much easier if there is already a Shiny Server available. Users simply put all code that generates interactive heatmaps into a script named app.R
. Under RStudio, they execute the script and click “Publish” in the Shiny app window.
Or under command-line:
Check https://shiny.rstudio.com/deploy/ to find out how to publish Shiny apps to Shiny Server.
Please note, in the R session which publishes the Shiny app, you must execute the command setRepositories(ind = 1:4)
so that on the Shiny Server side, it can successfully install InteractiveComplexHeatmap package.
`