1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| f_go4pca <- function(scRNA){ for (lc_ba in names(scRNA)){ scRNA[[lc_ba]] <- scRNA[[lc_ba]] %>% NormalizeData() %>% FindVariableFeatures() all.genes <- rownames(scRNA[[lc_ba]]) scRNA[[lc_ba]] <- ScaleData(scRNA[[lc_ba]], features = all.genes) scRNA[[lc_ba]] <- RunPCA(scRNA[[lc_ba]], features = VariableFeatures(object = scRNA[[lc_ba]])) } scRNA } f_go4group <- function(scRNA, mdN, mdNo='orig.ident', s=1, e=4){ for (lc_ba in names(scRNA)){ scRNA[[lc_ba]][[mdN]] <- substr(unlist(scRNA[[lc_ba]][[mdNo]]),s,e) } scRNA }
|