
Last chance! 50% off unlimited learning
Sale ends in
ScoreMatrix
object. If desired
it can use clustering using given clustering function
(e.g. k-means) and plot cluster color codes as a sidebar.
In addition, user can define groups of rows using 'group' argument.heatMatrix(mat, grid = FALSE, col = NULL, xcoords = NULL, group = NULL,
group.col = NULL, order = FALSE, user.order = FALSE, winsorize = c(0,
100), clustfun = NULL, main = "", legend.name = NULL, cex.legend = 1,
xlab = NULL, cex.main = 1, cex.lab = 1, cex.axis = 1,
newpage = TRUE)
ScoreMatrix
objectScoreMatrix
.
Alternatively, it could be a numeric vector of two elements. Such
as c(0,100) showing the relative start and end coordinates of the first
and last column of the ScoreMatrix
object.group
is a factor
, it's length must match the number of rows of the matrix, and
factor levels will be used as the names of the groups in the plot.group
argument is given or clustfun
function is given.order=TRUE
the matrix will be ordered
with rowSums(mat) values in descending order.
If group
argument is provided, first the groups
will be ordered in descending order of sums of rows then, everything
within the clusters will be ordered by sums of rows.
If clustfun
is given then rows within clusters
will be order in descending order of sums of rows.group
or clustfun
argument is given).mat
that returns
a vector of integers indicating the cluster to which
each point is allocated (a vector of cluster membership),
e.g. k-means algorithm with 3 centers:
function(x) kmeans(x, centers=3)$cluster.
By default FALSE.grid.newpage()
function should be
invoked if grid=TRUE
.data(cage)
data(promoters)
scores1=ScoreMatrix(target=cage,windows=promoters,strand.aware=TRUE,
weight.col="tpm")
set.seed(1000)
heatMatrix(mat=scores1,legend.name="tpm",winsorize=c(0,99),xlab="region around TSS",
xcoords=-1000:1000,
cex.legend=0.8,main="CAGE clusters on promoters",cex.lab=1,
cex.axis=0.9,grid=FALSE)
## examples using clustering functions
## k-means
cl1 <- function(x) kmeans(x, centers=3)$cluster
set.seed(1000)
heatMatrix(mat=scores1,legend.name="tpm",winsorize=c(0,99),xlab="region around TSS",
xcoords=-1000:1000,clustfun=cl1,
cex.legend=0.8,main="CAGE clusters on promoters",cex.lab=1,
cex.axis=0.9,grid=FALSE,
user.order=c(1,3,2))
## hierarchical clustering
cl2 <- function(x) cutree(hclust(dist(x), method="complete"), k=3)
set.seed(1000)
heatMatrix(mat=scores1,legend.name="tpm",winsorize=c(0,99),xlab="region around TSS",
xcoords=-1000:1000,clustfun=cl2,
cex.legend=0.8,main="CAGE clusters on promoters",cex.lab=1,
cex.axis=0.9,grid=FALSE)
Run the code above in your browser using DataLab