Skip to content

cmap/morpheus.R

Folders and files

NameName
Last commit message
Last commit date

Latest commit

author
jgould
Oct 22, 2020
2fd4f94 · Oct 22, 2020

History

47 Commits
Dec 22, 2017
Sep 19, 2019
Oct 22, 2020
Mar 3, 2018
May 30, 2017
May 23, 2017
May 30, 2017
May 23, 2017
Jun 22, 2017
Sep 19, 2019
May 23, 2017

Repository files navigation

Morpheus

Morpheus.js-based heat map widget in R.

Install

devtools::install_github('cmap/morpheus.R')

Example 1

library(morpheus)
rowAnnotations <- data.frame(annotation1=1:32, annotation2=sample(LETTERS[1:3], nrow(mtcars), replace = TRUE))
morpheus(mtcars, colorScheme=list(scalingMode="fixed", colors=heat.colors(3)), rowAnnotations=rowAnnotations, overrideRowDefaults=FALSE, rows=list(list(field='annotation2', highlightMatchingValues=TRUE, display=list('color'))))

Example Output

Example 2

library(morpheus)
rowAnnotations <- data.frame(annotation1=1:32, annotation2=sample(LETTERS[1:3], nrow(mtcars), replace = TRUE))
morpheus(mtcars, dendrogram='column', colorScheme=list(scalingMode="fixed", colors=heat.colors(3)), rowAnnotations=rowAnnotations, tools=list(list(name='Hierarchical Clustering', params=list(group_rows_by=list('annotation2'), cluster='Rows'))), rowGroupBy=list(list(field='annotation2')),
rows=list(list(field='annotation2',display=list('color'))))

Example Output

Shiny Example

library(morpheus)
library(shiny)
ui <- fluidPage(
  titlePanel(h3("Example")),
  mainPanel(
    morpheusOutput("heatmap")
  )
)

server <- function(input, output) {
  output$heatmap <- renderMorpheus({
    x <- matrix(rnorm(200), 20)
    y <- data.frame(a=letters[1:10], b=rep(c("g","h"),5), stringsAsFactors = F)
    morpheus(x, columnAnnotations = y)
  })
}

shinyApp(ui, server)

Example Output