plot_cofeature_mat {cofeatureR}R Documentation

Plot a Cofeature Matrix


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


plot_cofeature_mat(in.df, feature.order,, fill.colors,
  type.display.mode = c("multiple", "single"), type.order, tile.col = NA,
  rotate.x.labels, missing.fill.col, dot.flag = FALSE, dot.size,
  tile.flag = TRUE, drop.x = FALSE, tile.border.size = 1)



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


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

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


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


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


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


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


Rotate the x-axes labels by a certain degree


Color of the cell that has missing values


Boolean to turn on/off dots (dot.flag)


Column name indicating the size of the dots. Only takes effect if dot.flag is TRUE.


Boolean to turn on/off tiles (tile.flag)


Boolean to drop levels (from a factor) in the x dimension.


Integer to indicate the size of the tile borders.


## Not run: 
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")
v4 <- c(0.05, 0.5, 0.25, 0.01, 0.03, 0.24, 0.89)
v5 <- c(1, 2, 1, 1, 2, 2, 1)
feature.order <- c("RCOR1", "NCOR1", "LCOR") <- c("sampleA", "sampleB", "sampleC")
in.df <- dplyr::data_frame(feature = v1, sampleID = v2, type = v3, 
  p_value = -log10(v4), dir_flag = v5)
fill.colors <- c("Deletion" = "Blue", "Rearrangement" = "Green", "SNV" = "Red")

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

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

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

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

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

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

# Add dots to tiles for an additional layer of information
plot_cofeature_mat(in.df, dot.size = "p_value")

# Only display dots
plot_cofeature_mat(in.df, dot.flag = TRUE, dot.size = "p_value", 
  tile.flag = FALSE)

# Samples will not be dropped <- c("sampleA", "sampleB", "sampleC", "sampleD")
plot_cofeature_mat(in.df, tile.col = "black", =

# Samples can be dropped by setting drop.x = TRUE
plot_cofeature_mat(in.df, tile.col = "black", =, drop.x = TRUE)

## End(Not run)

[Package cofeatureR version 1.1.1 Index]