citrus.plotClusteringHierarchy | R Documentation |
Plots clustering hierarchy in graph form
citrus.plotClusteringHierarchy(outputFile, clusterColors, graph, layout,
theme = "black", plotSize = 15, singlePDF = F, ncol = 3, scale = 1,
plotClusterIDs = T)
outputFile |
Full path to output file (should have '.pdf' extension) |
clusterColors |
Numeric or Character matrix of values to colors clusters by. See |
graph |
Graph object to be plotted |
layout |
Layout for graph |
theme |
General color theme for plot. Options are |
plotSize |
Size of square pdf (inches). |
singlePDF |
Plot graphs for all variables in |
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? |
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.
Robert Bruggner
citrus.createHierarchyGraph
############
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.