visCluster: using visCluster to visualize cluster results from...

View source: R/4.visCluster.R

visClusterR Documentation

using visCluster to visualize cluster results from clusterData and enrichCluster output

Description

Visualize Clustered Gene Data Using Line Plots and Heatmaps

Usage

visCluster(
  object = NULL,
  ht.col.list = list(col_range = c(-2, 0, 2), col_color = c("#08519C", "white",
    "#A50F15")),
  border = TRUE,
  plot.type = c("line", "heatmap", "both"),
  ms.col = c("#0099CC", "grey90", "#CC3333"),
  line.size = 0.1,
  line.col = "grey90",
  add.mline = TRUE,
  mline.size = 2,
  mline.col = "#CC3333",
  ncol = 4,
  ctAnno.col = NULL,
  set.md = "median",
  textbox.pos = c(0.5, 0.8),
  textbox.size = 8,
  panel.arg = c(2, 0.25, 4, "grey90", NA),
  ggplot.panel.arg = c(2, 0.25, 4, "grey90", NA),
  annoTerm.data = NULL,
  annoTerm.mside = "right",
  termAnno.arg = c("grey95", "grey50"),
  add.bar = FALSE,
  bar.width = 8,
  textbar.pos = c(0.8, 0.8),
  go.col = NULL,
  go.size = NULL,
  by.go = "anno_link",
  annoKegg.data = NULL,
  annoKegg.mside = "right",
  keggAnno.arg = c("grey95", "grey50"),
  add.kegg.bar = FALSE,
  kegg.col = NULL,
  kegg.size = NULL,
  by.kegg = "anno_link",
  word_wrap = TRUE,
  add_new_line = TRUE,
  add.box = FALSE,
  boxcol = NULL,
  box.arg = c(0.1, "grey50"),
  add.point = FALSE,
  point.arg = c(19, "orange", "orange", 1),
  add.line = TRUE,
  line.side = "right",
  markGenes = NULL,
  markGenes.side = "right",
  genes.gp = c("italic", 10, NA),
  term.text.limit = c(10, 18),
  mulGroup = NULL,
  lgd.label = NULL,
  show_row_names = FALSE,
  subgroup.anno = NULL,
  annnoblock.text = TRUE,
  annnoblock.gp = c("white", 8),
  add.sampleanno = TRUE,
  sample.group = NULL,
  sample.col = NULL,
  sample.order = NULL,
  cluster.order = NULL,
  sample.cell.order = NULL,
  HeatmapAnnotation = NULL,
  column.split = NULL,
  cluster_columns = FALSE,
  pseudotime_col = NULL,
  gglist = NULL,
  row_annotation_obj = NULL,
  ...
)

Arguments

object

clusterData object, default NULL.

ht.col.list

list of heatmap col_range and col_color, default list(col_range = c(-2, 0, 2),col_color = c("#08519C", "white", "#A50F15")).

border

whether add border for heatmap, default TRUE.

plot.type

the plot type to choose which incuding "line","heatmap" and "both".

ms.col

membership line color form Mfuzz cluster method results, default c('#0099CC','grey90','#CC3333').

line.size

line size for line plot, default 0.1.

line.col

line color for line plot, default "grey90".

add.mline

whether add median line on plot, default TRUE.

mline.size

median line size, default 2.

mline.col

median line color, default "#CC3333".

ncol

the columns for facet plot with line plot, default 4.

ctAnno.col

the heatmap cluster annotation bar colors, default NULL.

set.md

the represent line method on heatmap-line plot(mean/median), default "median".

textbox.pos

the relative position of text in left-line plot, default c(0.5,0.8).

textbox.size

the text size of the text in left-line plot, default 8.

panel.arg

the settings for the left-line panel which are panel size,gap,width,fill and col, default c(2,0.25,4,"grey90",NA).

ggplot.panel.arg

the settings for the ggplot2 object plot panel which are panel size,gap,width,fill and col, default c(2,0.25,4,"grey90",NA).

annoTerm.data

the GO term annotation for the clusters, default NULL.

annoTerm.mside

the wider GO term annotation box side, default "right".

termAnno.arg

the settings for GO term panel annotations which are fill and col, default c("grey95","grey50").

add.bar

whether add bar plot for GO enrichment, default FALSE.

bar.width

the GO enrichment bar width, default 8.

textbar.pos

the barplot text relative position, default c(0.8,0.8).

go.col

the GO term text colors, default NULL.

go.size

the GO term text size(numeric or "pval"), default NULL.

by.go

the GO term text box style("anno_link" or "anno_block"), default "anno_link".

annoKegg.data

the KEGG term annotation for the clusters, default NULL.

annoKegg.mside

the wider KEGG term annotation box side, default "right".

keggAnno.arg

the settings for KEGG term panel annotations which are fill and col, default c("grey95","grey50").

add.kegg.bar

whether add bar plot for KEGG enrichment, default FALSE.

kegg.col

the KEGG term text colors, default NULL.

kegg.size

the KEGG term text size(numeric or "pval"), default NULL.

by.kegg

the KEGG term text box style("anno_link" or "anno_block"), default "anno_link".

word_wrap

whether wrap the text, default TRUE.

add_new_line

whether add new line when text is long, default TRUE.

add.box

whether add boxplot, default FALSE.

boxcol

the box fill colors, default NULL.

box.arg

this is related to boxplot width and border color, default c(0.1,"grey50").

add.point

whether add point, default FALSE.

point.arg

this is related to point shape,fill,color and size, default c(19,"orange","orange",1).

add.line

whether add line, default TRUE.

line.side

the line annotation side, default "right".

markGenes

the gene names to be added on plot, default NULL.

markGenes.side

the gene label side, default "right".

genes.gp

gene labels graphics settings, default c('italic',10,NA).

term.text.limit

the GO term text size limit, default c(10,18).

mulGroup

to draw multiple lines annotation, supply the groups numbers with vector, default NULL.

lgd.label

the lines annotation legend labels, default NULL.

show_row_names

whether to show row names, default FALSE.

subgroup.anno

the sub-cluster for annotation, supply sub-cluster id, default NULL.

annnoblock.text

whether add cluster numbers on right block annotation, default TRUE.

annnoblock.gp

right block annotation text color and size, default c("white",8).

add.sampleanno

whether add column annotation, default TRUE.

sample.group

the column sample groups, default NULL.

sample.col

column annotation colors, default NULL.

sample.order

the orders for column samples, default NULL.

cluster.order

the row cluster orders for user's own defination, default NULL.

sample.cell.order

the celltype order when input is scRNA data and "showAverage = FALSE" for prepareDataFromscRNA.

HeatmapAnnotation

the 'HeatmapAnnotation' object from 'ComplexHeatmap' when you have multiple annotations, default NULL.

column.split

how to split the columns when supply multiple column annotations, default NULL.

cluster_columns

whether cluster the columns, default FALSE.

pseudotime_col

the branch color control for monocle input data.

gglist

a list of ggplot object to annotate each cluster, default NULL.

row_annotation_obj

Row annotation for heatmap, it is a ComplexHeatmap::rowAnnotation() object when "markGenes.side" or ”line.side“ is "right". Otherwise is a list of named vectors.

...

othe aruguments passed by Heatmap fuction.

Details

This function visualizes clustered gene expression data as line plots, heatmaps, or a combination of both, using the ComplexHeatmap and ggplot2 frameworks. Gene annotations, sample annotations, and additional features like custom color schemes and annotations for GO/KEGG terms are supported for visualization.

Value

a ggplot2 or Heatmap object.

Author(s)

JunZhang

Examples


data("exps")

# mfuzz
cm <- clusterData(obj = exps,
                  cluster.method = "kmeans",
                  cluster.num = 8)

# plot
visCluster(object = cm,
           plot.type = "line")


ClusterGVis documentation built on April 4, 2025, 2:27 a.m.