R/filter_gene_clusters.R
filter_cluster_size.Rd
This function filters out gene clusters from a ClusterSet object based on their size.
filter_cluster_size(object = NULL, min_cluster_size = 5)
A ClusterSet object.
An integer indicating the minimum size for a clusters to be kept.
A ClusterSet object where clusters not passing the filter have been removed.
# Set verbosity to 1 to display info messages only.
set_verbosity(1)
# Load a dataset
load_example_dataset('7871581/files/pbmc3k_medium_clusters')
#> |-- INFO : Dataset 7871581/files/pbmc3k_medium_clusters was already loaded.
clust_size(pbmc3k_medium_clusters)
#> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#> 51 49 45 24 20 18 14 14 14 12 7 7 6 5 5
# Remove the cluster with less than 20 genes
clust_set <- filter_cluster_size(pbmc3k_medium_clusters,
min_cluster_size = 20)
#> |-- INFO : 10 clusters with less than 20 genes will be filtered out.
clust_size(clust_set)
#> 1 2 3 4 5
#> 51 49 45 24 20