hp: Drawing heatmap

Description Usage Arguments Value Note Author(s) References See Also Examples

View source: R/hp.R

Description

This function is an user-friendly and automatic heatmap drawing function.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
hp(
  x,
  output.path = "~/Desktop/heatmap.pdf",
  mode = "matrix",
  x.lab = NA,
  y.lab = NA,
  pmatrix = NA,
  legend = "-log10(P)",
  low.color = 10,
  high.color = 1,
  mid.color = "white",
  title = NA,
  basepoint = 0,
  pdf.width = NA,
  pdf.height = NA,
  axis.lab = F,
  legend.break = NA,
  sig.level = 0.05,
  sig.lab = "*"
)

Arguments

x

a matrix of values to be ploted.

output.path

a character of the output pdf file path. Default is '~/Desktop/heatmap.pdf'.

mode

It indicates the mode of heatmap. It should be 'matrix' or 'melt'. If mode = 'matrix', please input your raw matrix. If you want to input data in melt form after melt() function of reshape2 package.

x.lab

a character of x axis label. Default is NA.

y.lab

a character of y axis label. Default is NA.

pmatrix

a matrix of p-values, not necessary.

legend

a character of legend name. Default is '-log10(P)'.

low.color

a integer indicates the color you want to use when value is low. Default is 10.

high.color

a integer indicates the color you want to use when value is high. Default is 1.

mid.color

a character indicates the color you want to use for mid-value. Default is 'white'.

title

a character of figure title. Default is NA.

basepoint

a integer of your mid-value. Default is 0.

pdf.width

a integer of width of the output pdf. Default is NA for automatic setting.

pdf.height

a integer of height of the output pdf. Default is NA for automatic setting.

axis.lab

a logical value decides whether label of axis to be shown. Default is FALSE.

legend.break

a vector of break points for legend. Default is NA.

sig.level

significant levels of pmatrix(p-values). Default is 0.05.

sig.lab

label of significant results. Default is '*'.

Value

A pdf file for heatmap produced in output.path.

Note

Please change the parameter output.path to makesure the output pdf file will be produced in your target directory. The parameters only need to be set is x the matrix you want to draw and output.path for a very easy using. If you want to draw something like enrichment values, and highlight the significant results, you can input the enrichment values matrix as x and input the p-values matrix as pmatrix. And also you can set significant levels of p-values as sig.level.

Author(s)

Zhijian Yang

References

None

See Also

None

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Not run: 

set.seed(666)
a <- matrix(rnorm(30,sd = 3),ncol = 5)
hp(a)
# null device 
#          1 

p <- matrix(runif(30),ncol = 5)
hp(a,output.path = "~/Downloads//heatmap.pdf",pmatrix = p)
# null device 
#          1 
# Warning message:
# Removed 29 rows containing missing values (geom_text). 

## End(Not run)

xiashen/sysubiostat documentation built on Aug. 30, 2020, 12:05 a.m.