Commit 1b9bedf4 authored by Gervaise H. Henry's avatar Gervaise H. Henry 🤠

Add test code for SingleR

parent c13c6967
load("./genesets/scDWS.50.rda")
load("./genesets/scDWS.100.rda")
load("./genesets/scDWS.200.rda")
load("./genesets/scDWS.250.rda")
load("./genesets/scDWS.lin.rda")
load("./genesets/scDWS.epi.rda")
load("./genesets/scDWS.fmst.rda")
load("./genesets/cibersort.rda")
load("./genesets/blueprint_encode.rda")
load("./genesets/hpca.rda")
singler = CreateSinglerObject(GetAssayData(object = sc10x), annot = NULL, "PbPcDeep", min.genes = 0,
technology = "10X", species = "Human", citation = "",
ref.list = list(scDWS.50,scDWS.100,scDWS.200,scDWS.250), normalize.gene.length = F, variable.genes = "de",
fine.tune = T, do.signatures = T, clusters = NULL, do.main.types = T,
reduce.file.size = T, numCores = SingleR.numCores)
singler$seurat <- sc10x
singler$meta.data$res.0.1 <- sc10x@meta.data$integrated_snn_res.0.1
singler$meta.data$xy <- sc10x[["umap"]]@cell.embeddings
save(singler,file='./analysis/singler_object.RData')
p <-SingleR.PlotTsne(singler$singler[[1]]$SingleR.single,singler$meta.data$xy)
table(singler$singler[[1]]$SingleR.single.main$labels,singler$meta.dat$res.0.1)
# gene.set1 <- read_delim("./genesets/DEG_Epi_5FC.txt","\t",escape_double=FALSE,trim_ws=TRUE,col_names=FALSE)
# gene.set1 <- as.list(gene.set1)
# names(gene.set1) <- "Epi"
# gene.set <- c(gene.set1)
# gene.set1 <- read_delim("./genesets/DEG_FMSt_5FC.txt","\t",escape_double=FALSE,trim_ws=TRUE,col_names=FALSE)
# gene.set1 <- as.list(gene.set1)
# names(gene.set1) <- "St"
# gene.set <- c(gene.set,gene.set1)
gene.set1 <- read_delim("./genesets/genes.deg.BE.csv",",",escape_double=FALSE,trim_ws=TRUE,col_names=TRUE)
gene.set1 <- gene.set1[1]
gene.set1 <- as.list(gene.set1)
names(gene.set1) <- "BE"
#gene.set <- c(gene.set,gene.set1)
gene.set <- c(gene.set1)
gene.set1 <- read_delim("./genesets/genes.deg.LE.csv",",",escape_double=FALSE,trim_ws=TRUE,col_names=TRUE)
gene.set1 <- gene.set1[1]
gene.set1 <- as.list(gene.set1)
names(gene.set1) <- "LE"
gene.set <- c(gene.set,gene.set1)
gene.set1 <- read_delim("./genesets/genes.deg.OE1.csv",",",escape_double=FALSE,trim_ws=TRUE,col_names=TRUE)
gene.set1 <- gene.set1[1]
gene.set1 <- as.list(gene.set1)
names(gene.set1) <- "Club"
gene.set <- c(gene.set,gene.set1)
gene.set1 <- read_delim("./genesets/genes.deg.OE2.csv",",",escape_double=FALSE,trim_ws=TRUE,col_names=TRUE)
gene.set1 <- gene.set1[1]
gene.set1 <- as.list(gene.set1)
names(gene.set1) <- "Hillock"
gene.set <- c(gene.set,gene.set1)
gene.set1 <- read_delim("./genesets/genes.deg.NE.csv",",",escape_double=FALSE,trim_ws=TRUE,col_names=TRUE)
gene.set1 <- gene.set1[1]
gene.set1 <- as.list(gene.set1)
names(gene.set1) <- "NE"
gene.set <- c(gene.set,gene.set1)
gene.set1 <- read_delim("./genesets/genes.deg.Endo.csv",",",escape_double=FALSE,trim_ws=TRUE,col_names=TRUE)
gene.set1 <- gene.set1[1]
gene.set1 <- as.list(gene.set1)
names(gene.set1) <- "Endo"
gene.set <- c(gene.set,gene.set1)
gene.set1 <- read_delim("./genesets/genes.deg.SM.csv",",",escape_double=FALSE,trim_ws=TRUE,col_names=TRUE)
gene.set1 <- gene.set1[1]
gene.set1 <- as.list(gene.set1)
names(gene.set1) <- "SM"
gene.set <- c(gene.set,gene.set1)
gene.set1 <- read_delim("./genesets/genes.deg.Fib.csv",",",escape_double=FALSE,trim_ws=TRUE,col_names=TRUE)
gene.set1 <- gene.set1[1]
gene.set1 <- as.list(gene.set1)
names(gene.set1) <- "Fib"
gene.set <- c(gene.set,gene.set1)
gene.set1 <- read_delim("./genesets/genes.deg.Leu.csv",",",escape_double=FALSE,trim_ws=TRUE,col_names=TRUE)
gene.set1 <- gene.set1[1]
gene.set1 <- as.list(gene.set1)
names(gene.set1) <- "Leu"
gene.set <- c(gene.set,gene.set1)
# genes.leu <- read_excel("./genesets/40425_2017_215_MOESM1_ESM.xlsx",sheet="S3. Candidate markers")
# leu <- as.list(unique(genes.leu[,2]))$Cell
# leu <- leu[-c(9,17,20,24,26,28)]
# #leu.l <- leu[-c(1,3:4,7:8,13:18,21,20:30)]
# #leu.lin <- c("Myeloid","Lymphoid","Lymphoid","Lymphoid","Myeloid","Myeloid","Lymphoid","Myeloid","Myeloid","Myeloid","Myeloid","Myeloid","Lymphoid","Lymphoid","Lymphoid","Myeloid","Lymphoid","Lymphoid","Lymphoid","Lymphoid","Lymphoid","Lymphoid","Lymphoid","Lymphoid","Lymphoid","Lymphoid","Lymphoid")
# #leu.lin <- c("Lymphoid","Myeloid","Myeloid","Myeloid","Myeloid","Myeloid","Myeloid","Lymphoid")
# genes.leu <- genes.leu[unlist(genes.leu[,2]) %in% unlist(leu),]
# #genes.leu.l <- genes.leu[unlist(genes.leu[,2]) %in% unlist(leu.l),]
# #genes.leu.l[nrow(genes.leu.l)+1,] <- list("MS4A7","Macrophages",0)
# #genes.leu.l[nrow(genes.leu.l)+1,] <- list("CD14","Macrophages",0)
# # genes.leu.l[nrow(genes.leu.l)+1,] <- list("CD86","Macrophages",0)
# # genes.leu.l[nrow(genes.leu.l)+1,] <- list("S100A9","Neutrophils",0)
# # genes.leu.l[nrow(genes.leu.l)+1,] <- list("EREG","Neutrophils",0)
# # genes.leu.l[nrow(genes.leu.l)+1,] <- list("S100A8","Neutrophils",0)
# # genes.leu.l[nrow(genes.leu.l)+1,] <- list("FCN1","Neutrophils",0)
# gene.set1 <- split(genes.leu[,1], genes.leu[,2])
# #gene.set1 <- split(genes.leu.l[,1], genes.leu.l[,2])
# gene.set1 <- lapply(gene.set1,unname)
# gene.set1 <- lapply(gene.set1,unlist)
# #names(gene.set1) <- leu.lin
# names(gene.set1) <- leu
# gene.set <- c(gene.set,gene.set1)
rm(gene.set1)
min <- min(table(sc10x$integrated_snn_res.0.5))
results <- scQuSAGE(sc10x,gs=gene.set,save=TRUE,type="lg",id="integrated_snn_res.0.5",ds=0,nm="all.pops",print="2")
sc10x <- results[[1]]
results.cor.all.pops <- results[[2]]
results.clust.all.pops.id <- results[[3]]
rm(results)
rm(gene.set)
save(sc10x,file=paste0("./analysis/",project.name,".RData"))
save.image(file="./analysis/Data.RData")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment