ComparePlot: Comparison of clustering results over multiple results

Description Usage Arguments Details Value Examples

Description

A visual comparison of all methods is handy to see which objects will always cluster together independent of the applied methods. To this aid the function ComparePlot has been written. The function relies on methods of the circlize package.

Usage

1
2
3
4
ComparePlot(List, nrclusters = NULL, cols = NULL, fusionsLog = FALSE,
  weightclust = FALSE, names = NULL, margins = c(8.1, 3.1, 3.1, 4.1),
  circle = FALSE, canvaslims = c(-1, 1, -1, 1), Highlight = NULL,
  plottype = "new", location = NULL)

Arguments

List

A list of the outputs from the methods to be compared. The first element of the list will be used as the reference in ReorderToReference.

nrclusters

The number of clusters to cut the dendrogram in. Default is NULL.

cols

A character vector with the colours to be used. Default is NULL.

fusionsLog

Logical. To be handed to ReorderToReference: indicator for the fusion of clusters. Default is TRUE

weightclust

Logical. To be handed to ReorderToReference: to be used for the outputs of CEC, WeightedClust or WeightedSimClust. If TRUE, only the result of the Clust element is considered. Default is TRUE.

names

Optional. Names of the methods to be used as labels for the columns. Default is NULL.

margins

Optional. Margins to be used for the plot. Default is c(8.1,3.1,3.1,4.1).

circle

Logical. Whether the figure should be circular (TRUE) or a rectangle (FALSE). Default is FALSE.

canvaslims

The limits for the circular dendrogam. Default is c(-1.0,1.0,-1.0,1.0).

Highlight

Optional. A list of character vectors of objects to be highlighted. The names of the elements in the list are the names to appear on the figure. The median similarities of the objects in each list elemented is computed. Default is NULL.

plottype

Should be one of "pdf","new" or "sweave". If "pdf", a location should be provided in "location" and the figure is saved there. If "new" a new graphic device is opened and if "sweave", the figure is made compatible to appear in a sweave or knitr document, i.e. no new device is opened and the plot appears in the current device or document. Default is "new".

location

Optional. If plottype is "pdf", a location should be provided in "location" and the figure is saved there. Default is NULL.

Details

This function makes use of the functions ReorderToReference and Colorsnames. Given a list with the outputs of several methods, the first step is to call upon ReorderToReference and to produce a matrix of which the columns are ordered according to the ordering of the objects of the first method in the list. Each cell represent the number of the cluster the object belongs to for a specific method indicated by the rows. The clusters are arranged in such a way that these correspond to that one cluster of the referenced method that they have the most in common with. The function color2D.matplot produces a plot of this matrix but needs a vector indicating the names of the colors to be used. This is where ColorsNames comes in. A vector of the color names of the output of the ReorderToReference is created and handed to color2D.matplot. It is optional to adjust the margins of the plot and to give a vector with the names of the methods which will be used as labels for the rows in the plot. The labels for the columns are the names of the object in the order of clustering of the referenced method. Further, the similarity measures of the methods compared to the reference will be computed and shown on the right side of the plot.

Value

A plot which translates the matrix output of the function ReorderToReference in which the columns represent the objects in the ordering the referenced method and the rows the outputs of the given methods. Each cluster is given a distinct color. This way it can be easily observed which objects will cluster together. The labels on the right side of the plot are the similarity measures computed by SimilarityMeasure.

Examples

 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
26
27
## Not run: 
data(fingerprintMat)
data(targetMat)
data(Colors1)

MCF7_F = Cluster(fingerprintMat,type="data",distmeasure="tanimoto",normalize=FALSE,
method=NULL,clust="agnes",linkage="flexible",gap=FALSE,maxK=55,StopRange=FALSE)
MCF7_T = Cluster(targetMat,type="data",distmeasure="tanimoto",normalize=FALSE,
method=NULL,clust="agnes",linkage="flexible",gap=FALSE,maxK=55,StopRange=FALSE)

L=list(MCF7_F,MCF7_T)
N=c("FP","TP")

#rectangular
ComparePlot(List=L,nrclusters=7,cols=Colors1,fusionsLog=TRUE,weightclust=TRUE,
names=N,margins=c(9.1,4.1,4.1,4.1),plottype="new",location=NULL)

#circle
Comps_I=c("fluphenazine","trifluoperazine","prochlorperazine","chlorpromazine")  
Comps_II=c("butein","genistein","resveratrol")

ComparePlot(List=L,nrclusters=7,cols=c(Colors1), fusionsLog=TRUE,weightclust=FALSE,
names =N, margins = c(8.1, 3.1,3.1, 4.1),circle=TRUE,canvaslims=c(-1.1,1.1,-1.1,1.1),
Highlight=list("Comps I"=Comps_I,"Comps II"=Comps_II,"Cancer Treatments"=c("estradiol",
"fulvestrant")),plottype = "new")

## End(Not run)

IntClust documentation built on May 2, 2019, 5:51 a.m.