Description Usage Arguments Details Value See Also Examples
View source: R/scMethrix_clustering.R
Generates a cluster object for an scMethrix
object
1 2 3 4 5 6 7 8 9 10 |
scm |
scMethrix; Input |
dist |
dist; Optional. A distance matrix generated for an assay. Will use default paramaters for |
assay |
string; The assay to use. Default is 'score' |
type |
string; The type of distance metric to use. Available options are 'hierarchical', 'partition', "model". An arbitrary cluster function can be used, and must return a named vector containing integers representing the cluster membership (e.g. |
colname |
string; the name of the colData column that contains the cluster information |
n_clusters |
integer; the desired number of clusters. This is ignored for model-based clustering |
verbose |
boolean; flag to output messages or not |
... |
Additional parameters for the clustering functions |
Enables multiple methods of clustering to classify samples in an scMethrix
object. Either an scMethrix
object or a dist
object must be provided for clustering.
An scMethrix
object
get_distance_matrix()
for distance metrics, hclust()
for heirarchical clustering, kmeans()
for partition clustering, Mclust()
for model clustering
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | data('scMethrix_data')
scMethrix_data <- impute_regions(scMethrix_data)
dist <- get_distance_matrix(scMethrix_data,assay = "impute")
# For a generic clustering function
# The function must return a named vector of integers
fun <- function (dist) {
fit <- hclust(dist, method="ward.D")
fit <- cutree(fit, k=2)
return(fit)
}
fun(dist) # Example of arbitrary function output
colData(cluster_scMethrix(scMethrix_data, dist = dist, type = fun))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.