geneCorHeatmap: Correlation heatmap of genes

View source: R/visualize.R

geneCorHeatmapR Documentation

Correlation heatmap of genes

Description

Heatmap of correlation coefficients between any two queried genes in a SummarizedExperiment object.

Usage

geneCorHeatmap(
  object,
  gene.df,
  group = "center",
  matrix = "scaled",
  size = 5,
  cor.method = "pearson"
)

Arguments

object

A SummarizedExperiment object.

gene.df

Data.frame. The first column must be a vector of gene names, and has the name "gene". Additional columns in gene.df can be used to set the colors of genes.

group

Character, a column name in gene.df defining the groups of genes. Genes in the same group have same colors on the side bar.

matrix

Character, must be one of "count", "normalized", or "scaled".

size

Numeric, the size of gene names. Set it to 0 if you do not want to show gene names.

cor.method

Character, the method to calculate correlation coefficients. must be one of "pearson", "kendall", or "spearman".

Details

This method can create a pure heatmap or a heatmap with side bar. If you prefer a pure heatmap, input a gene.df with a single column of gene names. However, you may want to show additional information of genes with a side bar, and the grouping information should be saved as additional column(s) of gene.df, and declared as group. By default, you can use the output by findPeakGene as input gene.df. Peak genes will be grouped by their centers on the side bar.

Value

A ggplot object.

Examples

data(zh.data)
zh <- createTomo(zh.data)

# Correlation heatmap for all peak genes.
peak_genes <- findPeakGene(zh)
geneCorHeatmap(zh, peak_genes)

# Use Spearman correlation coefficients.
geneCorHeatmap(zh, peak_genes, cor.method="spearman")

# Group genes by peak start.
geneCorHeatmap(zh, peak_genes, group="start")

# Plot without side bar.
geneCorHeatmap(zh, data.frame(
 gene=c("ENSDARG00000002131", "ENSDARG00000003061", "ENSDARG00000076075", "ENSDARG00000076850")))

liuwd15/tomoda documentation built on March 29, 2022, 1:09 a.m.