Commit 37869e73 authored by Gervaise Henry's avatar Gervaise Henry 🤠
Browse files

Fix up mouse ID (use res 1.0 for lin)

parent e4c882e5
......@@ -2,6 +2,7 @@ gc()
library(optparse)
library(Seurat)
library(SingleR)
library(scRNAseq)
library(RColorBrewer)
library(viridis)
library(gridExtra)
......@@ -26,9 +27,11 @@ source("./r.scripts/sc-TissueMapper_process.R")
if (opt$s == "hu"){
imm <- MonacoImmuneData()
} else if (opt$s == "mu"){
imm <- ImmGenData()
imm <- imm[,imm$label.main %in% c("Macrophages","Monocytes","B cells","DC","Eosinophils","Neutrophils","T cells","ILC","NK cells","Basophils","Mast cells","Stem cells","Tgd","NKT","B cells, pro")]
}
if (opt$o == "pr" && opt$s == "hu"){
if (opt$o == "pr" && opt$s == "hu") {
pop <- readRDS("/work/urology/ghenry/RNA-Seq/SingleCell/ANALYSIS/REF/huPr_Pd_all.rds")
try(
if (as.numeric(substring(pop@version,1,1))<3){
......@@ -48,8 +51,29 @@ if (opt$o == "pr" && opt$s == "hu"){
pop.st@meta.data <- pop.st@meta.data[,c("label.main","label.fine")]
pop.epi <- as.SingleCellExperiment(pop.epi,assay="RNA")
pop.st <- as.SingleCellExperiment(pop.st,assay="RNA")
rm(pop)
} else if (opt$o == "pr" && opt$s == "mu") {
# pop <- readRDS("/work/urology/ghenry/RNA-Seq/SingleCell/ANALYSIS/REF/muPrUr_all.rds")
# try(
# if (as.numeric(substring(pop@version,1,1))<3){
# pop <- UpdateSeuratObject(pop)
# }
# )
# Idents(pop) <- "Lineage"
# pop.epi <- subset(pop,idents="Epi")
# pop.st <- subset(pop,idents=c("FMSt","Endo"))
# pop.epi$label.main <- pop.epi$Lineage
# pop.st$label.main <- pop.st$Lineage
# pop.epi$label.fine <- pop.epi$Population
# pop.st$label.fine <- pop.st$Population
# pop.epi@meta.data <- pop.epi@meta.data[,c("label.main","label.fine")]
# pop.st@meta.data <- pop.st@meta.data[,c("label.main","label.fine")]
# pop.epi <- as.SingleCellExperiment(pop.epi,assay="RNA")
# pop.st <- as.SingleCellExperiment(pop.st,assay="RNA")
pop <- ImmGenData()
pop.epi <- pop[,pop$label.main %in% c("Epithelial cells")]
pop.st <- pop[,pop$label.main %in% c("Stromal cells","Fibroblasts","Endothelial cells")]
}
rm(pop)
sc10x <- readRDS(paste0("./analysis/",opt$p,"_raw.rds"))
......@@ -61,11 +85,20 @@ pop.epi <- pop.epi[common,]
pop.st <- pop.st[common,]
rm(common)
singler.lin <- SingleR(sc10x.se,ref=list(imm=imm,pop.epi=pop.epi,pop.st=pop.st),method="cluster",clusters=sc10x.se$integrated_snn_res.0.5,labels=list(imm=imm$label.main,pop.epi=pop.epi$label.fine,pop.st=pop.st$label.fine),BPPARAM=BiocParallel::MulticoreParam(workers=20))
singler.lin <- SingleR(sc10x.se,ref=list(imm=imm,pop.epi=pop.epi,pop.st=pop.st),method="cluster",clusters=sc10x.se$integrated_snn_res.1,labels=list(imm=imm$label.main,pop.epi=pop.epi$label.fine,pop.st=pop.st$label.fine),BPPARAM=BiocParallel::MulticoreParam(workers=20))
labs <- singler.lin$labels
labs[labs %in% c("BE","LE","Hillock","Club")] <- "Epi"
labs[labs %in% c("T cells","CD4+ T cells","CD8+ T cells","NK cells","B cells","Monocytes","Dendritic cells","Neutrophils","Basophils","Progenitors")] <- "Leu"
sc10x$lin <- labs[match(sc10x.se$integrated_snn_res.0.5,singler.lin@rownames)]
if (opt$s == "hu") {
labs[labs %in% c("BE","LE","Hillock","Club")] <- "Epi"
labs[labs %in% c("T cells","CD4+ T cells","CD8+ T cells","NK cells","B cells","Monocytes","Dendritic cells","Neutrophils","Basophils","Progenitors")] <- "Leu"
} else if (opt$s == "mu") {
# labs[labs %in% c("BE","LE","Ur")] <- "Epi"
labs[labs %in% c("Epithelial cells (Ep.5wk.MEC.Sca1+)","Epithelial cells (Ep.5wk.MEChi)","Epithelial cells (Ep.5wk.MEClo)","Epithelial cells (Ep.8wk.CEC.Sca1+)","Epithelial cells (Ep.8wk.CEChi)","Epithelial cells (Ep.8wk.MEChi)","Epithelial cells (Ep.8wk.MEClo)","Epithelial cells (MECHI.GFP+.ADULT)","Epithelial cells (MECHI.GFP+.ADULT.KO)","Epithelial cells (MECHI.GFP-.ADULT)","Epithelial cells (EP.MECHI)")] <- "Epi"
labs[labs %in% c("Fibroblasts (FRC.CAD11.WT)","Fibroblasts (FRC.CFA)","Fibroblasts (FRC)","Fibroblasts (FI.MTS15+)","Fibroblasts (FI)")] <- "Fib"
labs[labs %in% c("Stromal cells (DN.CFA)","Stromal cells (DN)","Stromal cells (ST.31-38-44-)")] <- "SM"
labs[labs %in% c("Endothelial cells (LEC.CFA)","Endothelial cells (LEC)","Endothelial cells (BEC)")] <- "Endo"
labs[labs %in% c("Macrophages","Monocytes","B cells","DC","Eosinophils","Neutrophils","T cells","ILC","NK cells","Basophils","Mast cells","Stem cells","Tgd","NKT","B cells, pro")] <- "Leu"
}
sc10x$lin <- labs[match(sc10x.se$integrated_snn_res.1,singler.lin@rownames)]
rm(labs)
DimPlot(sc10x,group.by="lin",reduction="umap",label=TRUE,repel=TRUE)+theme(legend.position="none")
......@@ -148,15 +181,19 @@ rm(results)
sc10x.leu <- scCluster(sc10x.leu,res=res,red="pca",dim=pc.use.leu,print="2",folder="leu")
#DimPlot(sc10x.leu,group.by="integrated_snn_res.0.1",reduction="umap",label=TRUE,repel=TRUE)+theme(legend.position="none")
sc10x.se.epi <- as.SingleCellExperiment(sc10x.epi,assay="RNA")
common <- intersect(rownames(sc10x.se.epi),rownames(pop.epi))
sc10x.se.epi <- sc10x.se.epi[common,]
pop.epi <- pop.epi[common,]
rm(common)
singler.epi <- SingleR(sc10x.se.epi,ref=pop.epi,method="single",labels=pop.epi$label.fine,de.method="wilcox",BPPARAM=BiocParallel::MulticoreParam(workers=20))
sc10x.epi$pop <- singler.epi$labels
Idents(sc10x.epi) <- "pop"
#DimPlot(sc10x.epi,group.by="pop",reduction="umap",label=TRUE,repel=TRUE)+theme(legend.position="none")
if (opt$o == "pr" && opt$s == "hu") {
sc10x.se.epi <- as.SingleCellExperiment(sc10x.epi,assay="RNA")
common <- intersect(rownames(sc10x.se.epi),rownames(pop.epi))
sc10x.se.epi <- sc10x.se.epi[common,]
pop.epi <- pop.epi[common,]
rm(common)
singler.epi <- SingleR(sc10x.se.epi,ref=pop.epi,method="single",labels=pop.epi$label.fine,de.method="wilcox",BPPARAM=BiocParallel::MulticoreParam(workers=20))
sc10x.epi$pop <- singler.epi$labels
Idents(sc10x.epi) <- "pop"
#DimPlot(sc10x.epi,group.by="pop",reduction="umap",label=TRUE,repel=TRUE)+theme(legend.position="none")
} else if (opt$o == "pr" && opt$s == "mu") {
sc10x.epi$pop <- sc10x.epi$lin
}
sc10x.se.leu <- as.SingleCellExperiment(sc10x.leu,assay="RNA")
common <- intersect(rownames(sc10x.se.leu),rownames(imm))
......@@ -169,6 +206,7 @@ Idents(sc10x.leu) <- "pop"
#DimPlot(sc10x.leu,group.by="pop",reduction="umap",label=TRUE,repel=TRUE)+theme(legend.position="none")
sc10x$pop <- sc10x$lin
sc10x$pop[names(sc10x.epi$pop)] <- sc10x.epi$pop
sc10x$pop[names(sc10x.leu$pop)] <- sc10x.leu$pop
#DimPlot(sc10x,group.by="pop",reduction="umap",label=TRUE,repel=TRUE)+theme(legend.position="none")
......
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