plotClustersTable {clusterExperiment} | R Documentation |
Plot heatmap of cross-tabulations of two clusterings
## S4 method for signature 'ClusterExperiment' plotClustersTable(object, whichClusters, ignoreUnassigned = FALSE, margin = NA, ...) ## S4 method for signature 'table' plotClustersTable(object, clusterLegend = NULL, cluster = FALSE, plotType = c("heatmap", "bubble"), sizeTable = object, ...) ## S4 method for signature 'ClusterExperiment,character' tableClusters(object, whichClusters, ...) ## S4 method for signature 'ClusterExperiment,missing' tableClusters(object, whichClusters, ...) ## S4 method for signature 'ClusterExperiment,numeric' tableClusters(object, whichClusters, useNames = TRUE, tableMethod = c("intersect", "union"), ...) ## S4 method for signature 'table,table' bubblePlot(propTable, sizeTable, gridColor = rgb(0, 0, 0, 0.05), maxCex = 8, cexFactor, ylab, xlab, legend = TRUE, las = 2, colorScale = RColorBrewer::brewer.pal(11, "Spectral")[-6])
object |
ClusterExperiment object (or matrix with table result) |
whichClusters |
argument that can be either numeric or character value
indicating the clusters to be used. If numeric, gives the indices of the
|
ignoreUnassigned |
logical as to whether to ignore unassigned clusters
in the plotting. This means they will also be ignored in the calculations
of the proportions (if |
margin |
if NA, the counts from |
... |
arguments passed on to |
clusterLegend |
list in |
cluster |
logical, whether to cluster the rows and columns of the table. Passed
to arguments |
plotType |
type of plot. If "heatmap", then a heatmap will be created of
the values of the contingency table of the two clusters (calculated as
determined by the argument "margin") using |
sizeTable |
table of sizes |
useNames |
for |
tableMethod |
the type of table calculation to perform. "intersect" refers to the standard contingency table ( |
propTable |
table of proportions |
gridColor |
color for grid lines |
maxCex |
largest value of cex for any point (others will scale proportionally smaller). |
cexFactor |
factor to multiple by to get values of circles. If missing, finds value automatically, namely by using the maxCex value default. Overrides value of maxCex. |
ylab |
label for y-axis. If missing, uses the name for rows in
sizeTable. If set to |
xlab |
label for x-axis. If missing, uses the name for columns in
sizeTable. If set to |
legend |
whether to draw legend along top |
las |
the value for the las value in the call to |
colorScale |
the color scale for the values of the proportion table |
For plotClustersTable
whichClusters
should define 2 clusters, for tableClusters
can indicate arbitrary
number.
Note that the cluster labels in plotClustersTable
and
tableClusters
are converted to "proper" R names via make.names
. This is
because tableClusters
calls the R function table
, which makes this
conversion
bubblePlot
is mainly used internally by
plotClustersTable
but is made public for users who want more control
and to allow documentation of the arguments. bubblePlot
plots a
circle for each intersection of two clusters, where the color of the circle
is based on the value in propTable
and the size of the circle is
based on the value in sizeTable
. The size is determined by setting
the cex
value of the point as
$sqrt(sizeTable[i,j])/sqrt(max(sizeTable))*cexFactor$.
#clustering using pam: try using different dimensions of pca and different k data(simData) cl <- clusterMany(simData, nReducedDims=c(5, 10, 50), reducedDim="PCA", clusterFunction="pam", ks=2:4, findBestK=c(TRUE,FALSE), removeSil=c(TRUE,FALSE)) #give arbitrary names to clusters for demonstration cl<-renameClusters(cl,value=letters[1:nClusters(cl)[1]],whichCluster=1) tableClusters(cl,whichClusters=1:2) #heatmap of the counts in each entry of table: plotClustersTable(cl,whichClusters=1:2, ignoreUnassigned=TRUE)