Skip to content

Commit d88ebbd

Browse files
committed
update replicate cell subgroups
1 parent dba602c commit d88ebbd

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

R/cell_deconvolution.R

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2010,15 +2010,23 @@ replicate_deconvolution_subgroups = function(deconv_res, deconvolution_test){
20102010

20112011
## Extract the deconv feature without the cluster type
20122012
features_with_clusters <- colnames(deconv_res[["Deconvolution matrix"]])
2013-
has_clusters <- grepl("_S\\d+$", features_with_clusters)
2013+
has_clusters <- grepl("_.*(mixed|immunosuppressive|immunoactive)$", features_with_clusters)
20142014

20152015
if(any(has_clusters)){
2016-
# Extract the base name and cluster suffix from the original names
2017-
base_names <- gsub("_S\\d+$", "", features_with_clusters)
2018-
cluster_suffixes <- sub(".*(_S\\d+$)", "\\1", features_with_clusters)
20192016

2020-
# Create df to map the features with their corresponding clusters
2021-
map <- data.frame(base = base_names, suffix = cluster_suffixes, stringsAsFactors = FALSE)
2017+
# Base name = everything before final cluster label
2018+
base_names <- sub("_(mixed|immunosuppressive|immunoactive)$",
2019+
"",
2020+
features_with_clusters)
2021+
2022+
# Cluster suffix = cluster type
2023+
cluster_suffixes <- sub(".*_(mixed|immunosuppressive|immunoactive)$",
2024+
"\\1",
2025+
features_with_clusters)
2026+
2027+
map <- data.frame(base = base_names,
2028+
suffix = cluster_suffixes,
2029+
stringsAsFactors = FALSE)
20222030
}
20232031

20242032
if (is.infinite(iterations) && iterations < 0) {

0 commit comments

Comments
 (0)