mrtree | R Documentation |
The method take as input the flat clusterings obtained across multiple resolution parameters. It reconciles the clusterings to produce a hierarchical cluster tree structure.
mrtree
with label saved in a matrix as input
mrtree
with labelmatrix save as a data frame as input
mrtree
with SingleCellExperiment object as input
mrtree
with Seurat object as input
mrtree(x, ...) ## S3 method for class 'matrix' mrtree( x, prefix = NULL, suffix = NULL, max.k = Inf, consensus = FALSE, sample.weighted = FALSE, augment.path = FALSE, verbose = FALSE, n.cores = 1 ) ## S3 method for class 'data.frame' mrtree(x, prefix = NULL, suffix = NULL, ...) ## S3 method for class 'SingleCellExperiment' mrtree(x, prefix = "sc3_", suffix = "_clusters", ...) ## S3 method for class 'Seurat' mrtree(x, prefix = "RNA_snn_res.", suffix = NULL, ...)
x |
Seurat object |
... |
other parameters |
prefix |
srting indicating columns containing clustering information |
suffix |
string at the end of column names containing clustering information |
max.k |
the maximum resolution (number of clusters) to consider in building the tree |
consensus |
boolean, whether to perform consensus clustering within the clusterings with the same number of clusters. |
sample.weighted |
boolean, whether to weight the samples by the size of clusters, where higher weight is given to rare clusters. False by default. |
augment.path |
boolean, whether to augment one NA cluster in each layer to avoid shrinking the width of the tree with clustering alternate across layers. This will dramatically increase the running time. False by default. |
verbose |
boolean, whether to show running messages. False by default. |
n.cores |
integer, number of cores for parallel computation. 1 core by default. |
A list containing
The Reconciled tree saved as a label matrix, with duplicated layers omited.
The full reconciled tree save in a label matrix
The initial flat clustering (cluster tree) as input for MRtree algorithm
The corresponding clustering resolution of the initial cluster tree
The unique path in the resulted reconciled hierarchical cluster tree
data("clust_example") # matrix as input out = mrtree(clust_example$clusterings) # out$labelmat.mrtree # data frame with given prefix and suffix as input df = as.data.frame(clust_example$clusterings); colnames(df) = paste0('K_', 1:4) df$other = 1:nrow(clust_example$clusterings) # add an additional column out = mrtree(df, prefix = 'K_', suffix=NULL) cl = cbind(clust_example$clusterings, clust_example$clusterings) # add some additional noise for (i in 1:ncol(cl)){ cl[sample(10),i] = sample(1:length(unique(cl[,i])), 10, replace = TRUE) } mrtree(cl, consensus=TRUE) # mrtree with within-resolution consensus clustering mrtree(cl, augment.path=TRUE) # mrtree with augmentation of NA cluster mrtree(cl, sample.weighted=TRUE) # weight the sample by inverse of cluster size # More example with Seurat and SingelCellExperiment object as input, see vignettes.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.