plottingFunctions: Convert clusterLegend into useful formats In clusterExperiment: Compare Clusterings for Single-Cell Sequencing

Description

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.

Usage

 ``` 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 ```

Arguments

 `data` matrix with samples on columns and features on rows. `groupsOfFeatures` list, with each element of the list containing a vector of numeric indices. `nBlankLines` 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.) `object` a `ClusterExperiment` object. `output` character value, indicating desired type of conversion. `wh` numeric. Which colors to plot. Must be a numeric vector with values between 1 and 62. `breaks` 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. `makeSymmetric` 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)

Format

An object of class `character` of length 60.

Details

`makeBlankData` pulls the data corresponding to the row indices in `groupsOfFeatures` adds lines of NA values into data between these groups. When given to heatmap, will create white space between these groups of features.

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 bigPalette.

`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.

`seqPal1`-`seqPal4` are palettes for the heatmap. `showHeatmapPalettes` will show you these palettes.

Value

`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 `aheatmap` or `plotHeatmap`.

• "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 `groupsOfFeatures` 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 NA values.

If `output="plotAndLegend"`, `"convertClusterLegend"` will 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.

If `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.

If `output="matrixNames"` or `"matrixColors"` a matrix the same dimension of `clusterMatrix(object)`, but with the cluster color or cluster name instead of the clusterIds, respectively.

`plotHeatmap`
 ``` 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) ```