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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
| f_FindVariableFeatures <- function(sn){ # 以s09s为准 for (lc_ba in names(s09s)){ sn[[lc_ba]] <- NormalizeData(sn[[lc_ba]], normalization.method = "LogNormalize", scale.factor = 10000) sn[[lc_ba]] <- FindVariableFeatures(sn[[lc_ba]], selection.method = "vst", nfeatures = 2000) } sn }
s09s <- f_FindVariableFeatures(s09s) s11s <- f_FindVariableFeatures(s11s) s12s <- f_FindVariableFeatures(s12s) s13s <- f_FindVariableFeatures(s13s)
# 7、进行标准化并筛选可变基因 for (lc_i in 1:length(x10s)) { x10s[[lc_i]] <- NormalizeData(x10s[[lc_i]], normalization.method = "LogNormalize", scale.factor = 10000) x10s[[lc_i]] <- FindVariableFeatures(x10s[[lc_i]], selection.method = "vst", nfeatures = 2000) }
f_IntegrateData <- function(olist){ # 8、鉴定用于多样本数据整合的anchors tp_anchors <- FindIntegrationAnchors(object.list = olist, dims = 1:30, reduction = "cca") gc() # 9、整合多样本数据集 注意 内存需求大于16g!!!,不足请设置足够的swap空间再运行(总内存32g是够的) tp_int <- IntegrateData(anchorset = tp_anchors) gc() tp_int }
scRNAs <- list() scRNAs[['BA213']] <- f_IntegrateData(list(x10s$BA213,s09s$BA213,s11s$BA213,s12s$BA213,s13s$BA213)) scRNAs[['BA04']] <- f_IntegrateData(list(x10s$BA04,s09s$BA04,s11s$BA04,s12s$BA04,s13s$BA04)) scRNAs[['BA06']] <- f_IntegrateData(list(s09s$BA06,s11s$BA06,s12s$BA06,s13s$BA06)) scRNAs[['BA09']] <- f_IntegrateData(list(x10s$BA09,s09s$BA09,s11s$BA09,s12s$BA09,s13s$BA09)) scRNAs[['BA21']] <- f_IntegrateData(list(x10s$BA21,s09s$BA21,s11s$BA21,s12s$BA21,s13s$BA21)) scRNAs[['BA22']] <- f_IntegrateData(list(x10s$BA22,s09s$BA22,s11s$BA22,s12s$BA22,s13s$BA22)) scRNAs[['BA37']] <- f_IntegrateData(list(s09s$BA37,s11s$BA37,s12s$BA37,s13s$BA37)) scRNAs[['BA39']] <- f_IntegrateData(list(x10s$BA39,s09s$BA39,s11s$BA39,s12s$BA39,s13s$BA39)) scRNAs[['BA40']] <- f_IntegrateData(list(x10s$BA40,s09s$BA40,s11s$BA40,s12s$BA40,s13s$BA40)) scRNAs[['BA41']] <- f_IntegrateData(list(s09s$BA41,s11s$BA41,s12s$BA41,s13s$BA41)) scRNAs[['BA42']] <- f_IntegrateData(list(s09s$BA42,s11s$BA42,s12s$BA42,s13s$BA42)) scRNAs[['BA44']] <- f_IntegrateData(list(x10s$BA44,s09s$BA44,s11s$BA44,s12s$BA44,s13s$BA44)) scRNAs[['BA45']] <- f_IntegrateData(list(x10s$BA45,s09s$BA45,s11s$BA45,s12s$BA45,s13s$BA45))
scRNAs
|