plot_feature_sample_mat: Plot a Feature-Sample Matrix

Description Usage Arguments Examples

Description

Generates a ggplot2::geom_tile plot of features by sample. It is able to deal with multiple types affecting the same sample.

Usage

1
2
3
plot_feature_sample_mat(in.df, feature.order, sample.id.order, fill.colors,
  type.display.mode = c("multiple", "single"), type.order, tile.col = NA,
  rotate.x.labels, missing.fill.col)

Arguments

in.df

A 3 column (feature, sampleID, type) data.frame object

feature.order

character vector indicating the order of the features in the final plot on the y-axis. If not set, then function will set it automatically

sample.id.order

character vector indicating the order of the samples in the final plot on the x-axis. If not set, then function will set it automatically

fill.colors

character vector indicating the colors of the different "types". The names should be the types with the value being the color

type.display.mode

Specify whether multiple or a single feature type can appear in the same feature/sample cell

type.order

Specify the "priority" of the feature types. This only has an effect when type.display.mode is set to single

tile.col

Border color of each cell. If not yet, no border color is used

rotate.x.labels

Rotate the x-axes labels by a certain degree

missing.fill.col

Color of the cell that has missing values

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
v1 <- c("RCOR1", "NCOR1", "LCOR", "RCOR1", "RCOR1", "RCOR1", "RCOR1")
v2 <- c("sampleA", "sampleC", "sampleB", "sampleC", "sampleA", "sampleC", "sampleC")
v3 <- c("Deletion", "Deletion", "SNV", "Rearrangement", "SNV", "Rearrangement", "SNV")
feature.order <- c("RCOR1", "NCOR1", "LCOR")
sample.id.order <- c("sampleA", "sampleB", "sampleC")
in.df <- dplyr::data_frame(feature = v1, sampleID = v2, type = v3)
fill.colors <- c("Deletion" = "Blue", "Rearrangement" = "Green", "SNV" = "Red")

plot_feature_sample_mat(in.df)

# With black tile color
plot_feature_sample_mat(in.df, tile.col = "black")

# Fill in missing values with a lightgrey color
plot_feature_sample_mat(in.df, tile.col = "black", 
  missing.fill.col = "lightgrey")

# Rotate x-axes labels by 90 degrees
plot_feature_sample_mat(in.df, rotate.x.labels = 90)

# Specify order of features, samples, and colors
plot_feature_sample_mat(in.df, feature.order, sample.id.order, 
  fill.colors = fill.colors)

# Specify each cell can only have one "feature type"
plot_feature_sample_mat(in.df, feature.order, sample.id.order, fill.colors = fill.colors,
  type.display.mode = "single")

# Specify the specific priority of the "feature type" for cells with
# multiple features
plot_feature_sample_mat(in.df, feature.order, sample.id.order, fill.colors = fill.colors,
  type.display.mode = "single", type.order = c("Rearrangement", "SNV", "Deletion"))

tinyheero/tinyutils documentation built on May 31, 2019, 3:36 p.m.