citrus.plotClusteringHierarchy: Plot clustering hierarchy

View source: R/citrus.plot.R

citrus.plotClusteringHierarchyR Documentation

Plot clustering hierarchy

Description

Plots clustering hierarchy in graph form

Usage

citrus.plotClusteringHierarchy(outputFile, clusterColors, graph, layout,
  theme = "black", plotSize = 15, singlePDF = F, ncol = 3, scale = 1,
  plotClusterIDs = T)

Arguments

outputFile

Full path to output file (should have '.pdf' extension)

clusterColors

Numeric or Character matrix of values to colors clusters by. 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).

singlePDF

Plot graphs for all variables in clusterColors in a single PDF?

ncol

Number of columns if plotting all graphs in single PDF.

scale

Scale up the size of the single PDF plot.

plotClusterIDs

Plot cluster IDs on vertices?

Details

The clusterCols argument enables multiple plots of the clustering hierarchy to be made, each colored by a different variable. clusterCols should be a numeric matrix with each cluster being plotted represented in a different row and each variable to be plotted represented in a different column. Row and column names should be cluster IDs and variable names respectively. If clusterCols is numeric, a color scale is generated across the range of matrix values. Alternatively clusterCols can be a matrix of color names that are directly used to color vertices.

Author(s)

Robert Bruggner

See Also

citrus.createHierarchyGraph

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)

# Create matrix of variables to plot (in this case, cluster medians)
clusterMedians = t(sapply(largeEnoughClusters,citrus:::.getClusterMedians,clusterAssignments=citrus.clustering$clusterMembership,data=citrus.combinedFCSSet$data,clusterCols=clusteringColumns))
rownames(clusterMedians) = largeEnoughClusters
colnames(clusterMedians) = clusteringColumns

# Plot Clustering Hierarchy - Uncomment and Specify an output file
# citrus.plotClusteringHierarchy(outputFile="/path/to/output.pdf",clusterColors=clusterMedians,graph=hierarchyGraph$graph,layout=hierarchyGraph$layout,plotSize=hierarchyGraph$plotSize)

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