Skip to content

Commit a0f419b

Browse files
committed
Change to states instead of clusters naming
1 parent 9b8b8e1 commit a0f419b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

R/cell_deconvolution.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1976,12 +1976,12 @@ replicate_deconvolution_subgroups = function(deconv_res, deconvolution_test){
19761976

19771977
## Extract the deconv feature without the cluster type
19781978
features_with_clusters <- colnames(deconv_res[["Deconvolution matrix"]])
1979-
has_clusters <- grepl("_Cluster_\\d+$", features_with_clusters)
1979+
has_clusters <- grepl("_S\\d+$", features_with_clusters)
19801980

19811981
if(any(has_clusters)){
19821982
# Extract the base name and cluster suffix from the original names
1983-
base_names <- gsub("_Cluster_\\d+$", "", features_with_clusters)
1984-
cluster_suffixes <- sub(".*(_Cluster_\\d+$)", "\\1", features_with_clusters)
1983+
base_names <- gsub("_S\\d+$", "", features_with_clusters)
1984+
cluster_suffixes <- sub(".*(_S\\d+$)", "\\1", features_with_clusters)
19851985

19861986
# Create df to map the features with their corresponding clusters
19871987
map <- data.frame(base = base_names, suffix = cluster_suffixes, stringsAsFactors = FALSE)
@@ -2722,7 +2722,7 @@ deconvolution_dictionary = function(deconv_subgroups, pathway_matrix){
27222722

27232723
clusters_global <- stats::cutree(dendrogram_global, k = k_cluster)
27242724
clusters_global <- split(names(clusters_global), clusters_global)
2725-
names(clusters_global) <- paste0("Cluster_", seq_along(clusters_global))
2725+
names(clusters_global) <- paste0("S", seq_along(clusters_global))
27262726

27272727
# Calculate eigenvector-based score (PC1) for each cluster
27282728
corr_matrix_global <- data.frame(global_x[[1]])
@@ -2792,7 +2792,7 @@ deconvolution_dictionary = function(deconv_subgroups, pathway_matrix){
27922792
flat_list <- purrr::list_flatten(cell_subgroups)
27932793
deconv_subgroups[["Deconvolution matrix"]] = bind_cols(flat_list)
27942794
deconv_subgroups[["Deconvolution subgroups per cell types"]] = cell_subgroups
2795-
deconv_subgroups[["Clusters"]] = clusters_global
2795+
deconv_subgroups[["States"]] = clusters_global
27962796

27972797
return(deconv_subgroups)
27982798
}

0 commit comments

Comments
 (0)