alter_graphic: Automatically generate alter_fun

Description Usage Arguments Details Examples

View source: R/oncoPrint.R

Description

Automatically generate alter_fun

Usage

1
2
3
4
alter_graphic(graphic = c("rect", "point"),
    width = 1, height = 1,
    horiz_margin = unit(1, "pt"), vertical_margin = unit(1, "pt"),
    fill = "red", col = NA, pch = 16, ...)

Arguments

graphic

Graphic to draw.

width

Relative width of the rectangle.

height

Relative height of the rectangle.

horiz_margin

Horizontal margin. E.g. if you want 1mm margin on top and 1mm margin at bottom of the rectangle, set this value to unit(1, 'mm').

vertical_margin

Vertical margin.

fill

Filled color.

col

Border color.

pch

Pch for points

...

Pass to gpar

Details

This function aims to simplify the definition of functions in alter_fun. Now it only supports rectangles and points.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
mat = read.table(textConnection(
"s1,s2,s3
g1,snv;indel,snv,indel
g2,,snv;indel,snv
g3,snv,,indel;snv"), row.names = 1, header = TRUE, sep = ",", stringsAsFactors = FALSE)
mat = as.matrix(mat)
col = c(snv = "red", indel = "blue")

oncoPrint(mat, 
	alter_fun = list(
		snv = alter_graphic("rect", width = 0.9, height = 0.9, fill = col["snv"]),
		indel = alter_graphic("rect", width = 0.9, height = 0.9, fill = col["indel"])
	), col = col)

Example output

Loading required package: grid
========================================
ComplexHeatmap version 2.6.2
Bioconductor page: http://bioconductor.org/packages/ComplexHeatmap/
Github page: https://github.com/jokergoo/ComplexHeatmap
Documentation: http://jokergoo.github.io/ComplexHeatmap-reference

If you use it in published research, please cite:
Gu, Z. Complex heatmaps reveal patterns and correlations in multidimensional 
  genomic data. Bioinformatics 2016.

This message can be suppressed by:
  suppressPackageStartupMessages(library(ComplexHeatmap))
========================================

All mutation types: snv, indel.
`alter_fun` is assumed vectorizable. If it does not generate correct
plot, please set `alter_fun_is_vectorized = FALSE` in `oncoPrint()`.

ComplexHeatmap documentation built on Nov. 14, 2020, 2:01 a.m.