citrus.plotHierarchicalClusterFeatureGroups: Plot clustering hierarchy with clusters highlighted

View source: R/citrus.plot.R

citrus.plotHierarchicalClusterFeatureGroupsR Documentation

Plot clustering hierarchy with clusters highlighted

Description

Plot clustering heirarchy with a subset of clusters (clusters of interest) highlighted by color and/or encircled.

Usage

citrus.plotHierarchicalClusterFeatureGroups(outputFile, featureClusterMatrix,
  graph, layout, theme = "black", plotSize = 15, plotClusterIDs = T,
  featureClusterColors = NULL, encircle = T)

Arguments

outputFile

Full path to output file (should end in '.pdf').

featureClusterMatrix

Matrix of clusters to encircle. See details.

graph

Graph object to be plotted

layout

Layout for graph

theme

General color theme for plot. Options are 'black' and 'white'.

plotSize

Size of square pdf (inches).

plotClusterIDs

Plot cluster IDs on vertices?

featureClusterColors

Named vector of colors for each vertex. See details.

encircle

Should related highlighted clusters be encircled?

Details

The featureClusterMatrix argument should be a two column matrix. The first column should be names 'cluster' and rows should contain a cluster id to be highlighted. The second column should be named 'feature' and should contain a string or property describing the general property of interest for this cluster. Entries having the same 'feature' value are plotted in the graph. One plot is created for each unique value of the 'feature' column.

The featureClusterColors argument can be used to supply custom colors for graph vertices. The vector should be a named vector with each entry being a color value and the name of the entry should be a vertex id (cluster id) that will be colored.

Author(s)

Robert Bruggner

Examples

# Where the data lives
dataDirectory = file.path(system.file(package = "citrus"),"extdata","example1")

# Create list of files to be analyzed
fileList = data.frame("unstim"=list.files(dataDirectory,pattern=".fcs"))

# Read the data
citrus.combinedFCSSet = citrus.readFCSSet(dataDirectory,fileList)

# List of columns to be used for clustering
clusteringColumns = c("Red","Blue")

# Cluster data
citrus.clustering = citrus.cluster(citrus.combinedFCSSet,clusteringColumns)

# Large enough clusters
largeEnoughClusters = citrus.selectClusters(citrus.clustering)

# Create graph for plotting
hierarchyGraph = citrus.createHierarchyGraph(citrus.clustering,selectedClusters=largeEnoughClusters)

# Features to highlight
featureClusterMatrix = data.frame(cluster=c(19992,19978,19981,19987,19983,19973),feature=rep(c("Property 1","Property 2"),each=3))

# Plot features in clustering hierarchy
# citrus.plotHierarchicalClusterFeatureGroups(outputFile="/path/to/outputFile.pdf",featureClusterMatrix,graph=hierarchyGraph$graph,layout=hierarchyGraph$layout,plotSize=hierarchyGraph$plotSize)

nolanlab/citrus documentation built on April 19, 2024, 6:49 p.m.