Function for converting the information stored in the clusterLegend slot into other useful formats.
Most of these functions are called internally by plotting functions, but are exported in case the user finds them useful.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
makeBlankData(data, groupsOfFeatures, nBlankLines = 1) ## S4 method for signature 'ClusterExperiment' convertClusterLegend(object, output = c("plotAndLegend", "aheatmapFormat", "matrixNames", "matrixColors")) showBigPalette(wh = NULL) setBreaks(data, breaks = NA, makeSymmetric = FALSE) bigPalette showHeatmapPalettes() seqPal5 seqPal2 seqPal3 seqPal4 seqPal1
matrix with samples on columns and features on rows.
list, with each element of the list containing a vector of numeric indices.
the number of blank lines to add in the data matrix to separate the groups of indices (will govern the amount of white space if data is then fed to heatmap.)
character value, indicating desired type of conversion.
numeric. Which colors to plot. Must be a numeric vector with values between 1 and 62.
either vector of breaks, or number of breaks (integer) or a number between 0 and 1 indicating a quantile, between which evenly spaced breaks should be calculated.
whether to make the range of the breaks symmetric around zero (only used if not all of the data is non-positive and not all of the data is non-negative)
An object of class
character of length 60.
makeBlankData pulls the data corresponding to the row indices
groupsOfFeatures adds lines of NA values into data between these
groups. When given to heatmap, will create white space between these groups
convertClusterLegend pulls out information stored in the
clusterLegend slot of the object and returns it in useful format.
bigPalette is a long palette of colors (length 62) used by
plotClusters and accompanying functions.
showBigPalette creates plot that gives index of each color in
showBigPalette will plot the
bigPalette functions with
their labels and index.
setBreaks gives a set of breaks (of length 52) equally spaced
between the boundaries of the data. If breaks is between 0 and 1, then the
evenly spaced breaks are between these quantiles of the data.
seqPal4 are palettes for the heatmap.
showHeatmapPalettes will show you these palettes.
makeBlankData returns a list with items
"dataWBlanks" The data with the rows of NAs separating the given indices.
"rowNamesWBlanks" A vector of characters giving the rownames for the
data, including blanks for the NA rows. These are not given as rownames to
the returned data because they are not necessarily unique. However, they can be
given to the
labRow argument of
"groupNamesWBlanks" A vector of characters of the same length
as the number of rows of the new data (i.e. with blanks) giving the group name
for the data, indicating which group (i.e. which element of
list) the feature came from. If
groupsOfFeatures has unique names, these
names will be used, other wise "Group1", "Group2", etc. The NA rows are given
return a list that provides the necessary information to color samples
according to cluster and create a legend for it:
"colorVector" A vector the same length as the number of samples, assigning a color to each cluster of the primaryCluster of the object.
"legendNames" A vector the length of the number of clusters of primaryCluster of the object giving the name of the cluster.
"legendColors" A vector the length of the number of clusters of primaryCluster of the object giving the color of the cluster.
output="aheatmap" a conversion of the clusterLegend to be
in the format requested by
aheatmap. The column 'name'
is used for the names and the column 'color' for the color of the clusters.
"matrixColors" a matrix the
same dimension of
clusterMatrix(object), but with the cluster color
or cluster name instead of the clusterIds, respectively.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
data(simData) x <- makeBlankData(simData[,1:10], groupsOfFeatures=list(c(5, 2, 3), c(20, 34, 25))) plotHeatmap(x$dataWBlanks,clusterFeatures=FALSE) showBigPalette() setBreaks(data=simData,breaks=.9) #show the palette colors showHeatmapPalettes() #compare the palettes on heatmap cl <- clusterSingle(simData, subsample=FALSE, sequential=FALSE, mainClusterArgs=list(clusterFunction="pam", clusterArgs=list(k=8))) ## Not run: par(mfrow=c(2,3)) plotHeatmap(cl, colorScale=seqPal1, main="seqPal1") plotHeatmap(cl, colorScale=seqPal2, main="seqPal2") plotHeatmap(cl, colorScale=seqPal3, main="seqPal3") plotHeatmap(cl, colorScale=seqPal4, main="seqPal4") plotHeatmap(cl, colorScale=seqPal5, main="seqPal5") par(mfrow=c(1,1)) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.