renameClusters {clusterExperiment} | R Documentation |
Change the assigned names or colors of the clusters in a clustering stored in the clusterLegend slot of the object.
## S4 method for signature 'ClusterExperiment,character' renameClusters( object, value, whichCluster = "primary", matchTo = c("name", "clusterIds") ) ## S4 method for signature 'ClusterExperiment,character' recolorClusters( object, value, whichCluster = "primary", matchTo = c("name", "clusterIds") )
object |
a ClusterExperiment object. |
value |
The value to be substituted in the corresponding slot. See the
slot descriptions in |
whichCluster |
argument that can be a single numeric or character value
indicating the single clustering to be used. Giving values that result in more than one clustering will result in an error. See details of |
matchTo |
whether to match to the cluster name
( |
renameClusters
changes the names assigned to clusters within a
clustering
recolorClusters
changes the colors assigned to clusters within
a clustering
#create CE object data(simData) cl1 <- clusterSingle(simData, subsample=FALSE, sequential=FALSE, mainClusterArgs=list(clusterArgs=list(k=3), clusterFunction="pam")) #Give names to the clusters clusterLegend(cl1) cl1<-renameClusters(cl1, c("1"="A","2"="B","3"="C"), matchTo="clusterIds") clusterLegend(cl1) # Change name of single one cl1<-renameClusters(cl1, c("1"="D"), matchTo="clusterIds") clusterLegend(cl1) # Match to existing name, rather than clusterId cl1<-renameClusters(cl1, c("B"="N"), matchTo="name") clusterLegend(cl1) # Change colors in similar way cl1<-recolorClusters(cl1, c("N"="red"),matchTo=c("name")) clusterLegend(cl1)