1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| n_ExN <- c('L4 IT','L5 IT','L5 ET','IT','L6b','L5/6 IT Car3','L6 IT','L2/3 IT','L5/6 NP','L6 IT Car3','L6 CT') n_InN <- c('Lamp5','Pvalb','Sst','Vip','Sncg') n_NoN <- c('Astro','PAX6','Endo','Micro-PVM','OPC','Oligo','Pericyte','VLMC') n_groups <- list(NoN=n_NoN, ExN=n_ExN, InN=n_InN) f_listUpdateRe <- function(lc_obj, lc_bool, lc_item){ lc_obj[lc_bool] <- rep(lc_item,times=sum(lc_bool)) lc_obj } f_grouplabel <- function(lc_meta.data, lc_groups){ res <- lc_meta.data[[1]] for(lc_g in names(lc_groups)){ lc_bool = (res %in% lc_groups[[lc_g]]) for(c_n in colnames(lc_meta.data)){ lc_bool = lc_bool (lc_meta.data[[c_n]] %in% lc_groups[[lc_g]]) } res <- f_listUpdateRe(res, lc_bool, lc_g) } names(res) <- rownames(lc_meta.data) res }
scRNA_split[['n_groups']] <- f_grouplabel(scRNA_split[[c("hM1_hmca_class")]], n_groups)
sc_Neuron <- subset(x = scRNA_split, n_groups %in% c("InN", "ExN"))
|