Default emissions from ChromHMM

knitr::include_graphics("../demodata/emissions_8.png")

Run chromHMMviewR

Install and load

# install devtools if not installed
if(!require(devtools)){ install.packages("devtools") }

# install chromHMMviewR if not installed
if(!require(chromHMMviewR)){ devtools::install_github("amitjavilaventura/chromHMMviewR") }
# load chromHMMviewR
library(chromHMMviewR)

Read and explore data

# read emissions file from the demodata
emissions <- read.delim("../demodata/emissions_8.txt")

# head
head(emissions)
##   state..Emission.order.      H3K27me3      H3K4me3    H3K27ac      H3K4me1
## 1                      1  2.236209e-02 7.595717e-01 0.04914771 3.809225e-01
## 2                      2  2.984666e-04 9.954622e-01 0.83629268 9.942925e-01
## 3                      3 4.843090e-134 9.948019e-01 0.95524218 1.543800e-26
## 4                      4  2.335850e-03 9.521054e-33 0.01215246 6.752605e-03
## 5                      5  8.374285e-05 2.518637e-03 0.91093149 9.250385e-01
## 6                      6  1.103930e-02 8.250104e-27 0.04832786 8.377408e-01

Call emission2hm()

Minimum

# set the states with numbers
# states should be named later depending on the results
states <- paste("S", 1:8, sep = "")

# set the names of marks in the same order as in the emission files
# (they do not need to have the same name as in the file)
features <- c("H3K27me3", "H3K4me3", "H3K27ac", "H3K4me1")
# call emission2hm()
emission2hm(data = emissions, features = features, states = states)
## Loading required package: dplyr
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
## Loading required package: magrittr
## Loading required package: reshape2
## Loading required package: ggplot2
## Loading required package: ggpubr
## Using State as id variables

From a file

# call emission2hm()
emission2hm(data = "../demodata/emissions_8.txt", features = features, states = states)
## Using State as id variables

Customize the output

# change title subtitle and xlab
emission2hm(data = emissions, features = features, states = states, title = "This is a title", subtitle = "This is a subtitle", xlab = "This is the x-axis title")
## Using State as id variables

# change color of the heatmap: color = "gray30"
emission2hm(data = emissions, features = features, states = states, color = "gray30")
## Using State as id variables

# change the size of the likelihood labels (default: lh_size = 2)
emission2hm(data = emissions, features = features, states = states, lh_size = 5)
## Using State as id variables

# without likelihood labels: show_lh = F
emission2hm(data = emissions, features = features, states = states, show_lh = F)
## Using State as id variables