The functions contour2dDP and plotContour functions can be used to compute bayesian density estimates for a given set of elements (points)
from a pre-generated 2D MDS object. These functions are used internally by clusGPS to draw cluster contours but are also useful to visualize other type of
contours over the map (ie genes from a given Gene Ontology term, having
a specific epigenetic mark of interest, etc).
The S4 accessors clusNames,tabClusters and clusterID
retrieve information stored within a clusGPS object.
clusGPS(d, m, h, sel=NULL, id=NULL, grid, ngrid=1000, densgrid=FALSE, preMerge=TRUE, type = "hclust", method =
"average", samplesize = 1, p.adjust = TRUE, k, mc.cores = 1,
set.seed = 149, verbose=TRUE, minpoints=70,...)
contour2dDP(x, ngrid, grid = NULL, probContour = 0.5, xlim, ylim, labels = "", labcex = 0.01, col = colors()[393], lwd = 4, lty = 1, contour.type = "single", contour.fill = FALSE,
minpoints=100, ...)
clusNames(clus)
tabClusters(clus,name)
clusterID(clus,name)distGPS with the pairwise observed dissimilarities
between elements.
mds with a MDS object generated from the
distances in d. Only MDS type "boostMDS" is available. The mds
function performs an optimization of the approximated distances in
m in order to improve R-square correlation between them and the
observed dissimilarities en d, maximizing goodness of fit.
hclust with a pre-calculated clustering for the
elements in d.
d will be used for performing hierarchical clustering with average linkage. This is useful if we want to focus on a given set of points only (i.e. those from a big cluster which we want to study in more detail).
sel specified above.
minpoints gets merged with its closest cluster based on their centroid distances. This is performed until no clusters < minpoints exist.
h. This variable is to become deprecated, since clusGPS will only work with a precomputed clustering.
hclust for details. This variable is to become deprecated, since clusGPS will only work with a precomputed clustering.
parallel package.
minpoints elements. This is
useful if the clustering method used tends to generate many very
small clusters of limited use and difficult interpretation and for which density estimates may not be correctly computed. The default method is to preMerge clusters since this ensures density estimation is available for all clusters and helps interpreting the map, since no elements are ignored.
clusGPS object from which we want to extract information.
clusGPS object,
from which we want to extract information.
clusGPS returns an object of class
clusGPS. See help for clusGPS-methods for
details. contour2dDP returns a DPdensity object with
density contour information which can be plotted as 2D contours with our
plotContour function, as well as with the plot function
from the DPpackage package.
d. For each cluster partition given in k, cluster
identity for each element is returned, and semiparametric
bayesian density estimation is computed using the point density
information from m.
signature(m = "clusGPS"): S4 plot method for
clusGPS objects.
signature(m = "clusGPS"): Retrieves names of the
clustering configurations stored in clusGPS objects, one for
each distance threshold indicated in k, that get automatically named accordingly.
signature(m = "clusGPS"): Returns a table with
the number of elements in each of the clusters found for an existing
clustering configuration with name name within the clusGPS object.
signature(m = "clusGPS"): Returns a vector of
cluster assignments for all the elements in an existing
clustering configuration name within the clusGPS object.
# Not run
# data(s2)
# # Computing distances
# d <- distGPS(s2.tab,metric='tanimoto',uniqueRows=TRUE)
# # Creating MDS object
# mds1 <- mds(d,type='isoMDS')
# mds1
# plot(mds1)
# Precomputing clustering
# h <- hclust(as.dist(d@d),method='average')
# # Calculating densities (contours and probabilities), takes a while
# clus <- clusGPS(d,mds1,preMerge=TRUE,k=max(cutree(h,h=0.5)))
# # clus contains information for contours and probabilities
# plot(clus,type='contours',k=125,lwd=3,probContour=.75)
# plot(clus,type='stats',k=125,ylim=c(0,1))
# plot(clus,type='avgstat')
# plot(clus,type='density',k=3,ask=TRUE,xlim=range(mds1@points),ylim=range(mds1@points))
Run the code above in your browser using DataLab