Last data update: 2014.03.03

R: Gene Expression Heatmap
ct.plot.heatmapR Documentation

Gene Expression Heatmap

Description

Plots a heatmap of gene expression, with cells ordered according to the structure computed by compute.backbone.tree.

Usage

ct.plot.heatmap(data, b.tree, log.scale = TRUE, sd.filter = 0.7,
  reorder.genes = TRUE)

Arguments

data

A matrix of (non-negative) RNA-seq expression levels where each row is a gene and each column is the cell sequenced.

b.tree

igraph object returned by compute.backbone.tree.

log.scale

Boolean (optional). Whether the data should be log-scaled.

sd.filter

Numeric or FALSE (optional). Standard-deviation threshold below which genes should be removed from the data (no filtering if set to FALSE).

reorder.genes

Boolean (optional). Whether the gene rows should be reordered using a dendrogram of their mean value.

Value

data object reordered according to the backbone tree, such as used to plot the heatmap.

Examples

# Load pre-computed LDA model for skeletal myoblast RNA-Seq data from HSMMSingleCell package:
data(HSMM_lda_model)

# Recover sampling time (in days) for each cell:
library(HSMMSingleCell)
data(HSMM_sample_sheet)
days.factor = HSMM_sample_sheet$Hours
days = as.numeric(levels(days.factor))[days.factor]

# Compute near-optimal backbone tree:
b.tree = compute.backbone.tree(HSMM_lda_model, days)
# Plot heatmap:
data(HSMM_expr_matrix)
ct.plot.heatmap(HSMM_expr_matrix[1:2000,], b.tree, reorder.genes=FALSE)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(cellTree)
Loading required package: topGO
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, cbind, colnames, do.call, duplicated, eval, evalq,
    get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply,
    match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank,
    rbind, rownames, sapply, setdiff, sort, table, tapply, union,
    unique, unsplit

Loading required package: graph
Loading required package: Biobase
Welcome to Bioconductor

    Vignettes contain introductory material; view with
    'browseVignettes()'. To cite Bioconductor, see
    'citation("Biobase")', and for packages 'citation("pkgname")'.

Loading required package: GO.db
Loading required package: AnnotationDbi
Loading required package: stats4
Loading required package: IRanges
Loading required package: S4Vectors

Attaching package: 'S4Vectors'

The following objects are masked from 'package:base':

    colMeans, colSums, expand.grid, rowMeans, rowSums


Loading required package: SparseM

Attaching package: 'SparseM'

The following object is masked from 'package:base':

    backsolve


groupGOTerms: 	GOBPTerm, GOMFTerm, GOCCTerm environments built.

Attaching package: 'topGO'

The following object is masked from 'package:IRanges':

    members

> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/cellTree/ct.plot.heatmap.Rd_%03d_medium.png", width=480, height=480)
> ### Name: ct.plot.heatmap
> ### Title: Gene Expression Heatmap
> ### Aliases: ct.plot.heatmap
> 
> ### ** Examples
> 
> # Load pre-computed LDA model for skeletal myoblast RNA-Seq data from HSMMSingleCell package:
> data(HSMM_lda_model)
> 
> # Recover sampling time (in days) for each cell:
> library(HSMMSingleCell)
> data(HSMM_sample_sheet)
> days.factor = HSMM_sample_sheet$Hours
> days = as.numeric(levels(days.factor))[days.factor]
> 
> # Compute near-optimal backbone tree:
> b.tree = compute.backbone.tree(HSMM_lda_model, days)
Loading required namespace: maptpx
Using start group: 0 (1)
Using rooting method: center.start.group
Using root vertex: 4
Adding branch #1:
 [1]  65  53  45   2  55  47  57  48  44   7  19  25  69  66   9  63  18  62  51
[20]  56  16  70 136 133 143  89  78 140  94 100 177 194 141 199 201 181 161 204
[39] 225 236 255 247 246 233 229 259 258 146 235 159 185 191 216 166 149  83 168
[58] 158   8
Using branch width: 0.927 (width.scale.factor: 1.2)
Outliers: 1
Total number of branches: 1 (forks: 0)
Backbone fork merge (width: 0.927): 60 ->  60 
Ranking all cells...
> # Plot heatmap:
> data(HSMM_expr_matrix)
> ct.plot.heatmap(HSMM_expr_matrix[1:2000,], b.tree, reorder.genes=FALSE)
Converting to log values...
Filtering out rows with standard deviation < 0.7 (2000 -> 1274)...
Error in dev.new(width = 10, height = 4) : 
  no suitable unused file name for pdf()
Calls: ct.plot.heatmap -> dev.new
Execution halted