Create contrasts for testing DE of a cluster
Description
Uses clustering to create different types of contrasts to be tested that can then be fed into DE testing programs.
Usage
1 2 3 4 5 6 7  ## S4 method for signature 'ClusterExperiment'
clusterContrasts(cluster, contrastType, ...)
## S4 method for signature 'vector'
clusterContrasts(cluster, contrastType = c("Dendro",
"Pairs", "OneAgainstAll"), dendro = NULL, pairMat = NULL,
outputType = "limma", removeNegative = TRUE)

Arguments
cluster 
Either a vector giving contrasts assignments or a ClusterExperiment object 
contrastType 
What type of contrast to create. ‘Dendro’ traverses the given dendrogram and does contrasts of the samples in each side, ‘Pairs’ does pairwise contrasts based on the pairs given in pairMat (if pairMat=NULL, does all pairwise), and ‘OneAgainstAll’ compares each cluster to the average of all others. 
... 
arguments that are passed to from the 
dendro 
The dendrogram to traverse if contrastType="Dendro". Note that this should be the dendrogram of the clusters, not of the individual samples. 
pairMat 
matrix giving the pairs of clusters for which to do pairwise
contrasts (must match to elements of cl). If NULL, will do all pairwise of
the clusters in 
outputType 
character string. Gives format for the resulting contrast
matrix. Currently the only option is the format appropriate for

removeNegative 
logical, whether to remove negative valued clusters from the design matrix. Appropriate to pick TRUE (default) if design will be input into linear model on samples that excludes 1. 
Details
The input vector must be numeric clusters, but the external commands
that make the contrast matrix (e.g. makeContrasts
) require
syntatically valid R names. For this reason, the names of the levels will
be "X1" instead of "1". And negative values (if removeNegative=FALSE) will
be "X.1","X.2", etc.
Value
List with components:
contrastMatrix
Contrast matrix, the form of which depends onoutputType
. IfoutputType=="limma"
, the result of runningmakeContrasts
: a matrix with number of columns equal to the number of contrasts, and rows equal to the number of levels of the factor that will be fit in a linear model.contrastNames
A vector of names for each of the contrasts. NULL if no such additional names.
Author(s)
Elizabeth Purdom
Examples
1 2 3 4 5 6 7 8 9  data(simData)
cl < clusterMany(simData,nPCADims=c(5,10,50), dimReduce="PCA",
clusterFunction="pam", ks=2:4, findBestK=c(FALSE), removeSil=TRUE,
subsample=FALSE)
#Pairs:
clusterContrasts(cl,contrastType="Pairs")
#Dendrogram
cl<makeDendrogram(cl)
clusterContrasts(cl,contrastType="Pairs")
