Skip to content
Snippets Groups Projects
Commit 8bf0a96b authored by Gervaise Henry's avatar Gervaise Henry :cowboy:
Browse files

Add mouse options and id lin by cluster

parent 866f9a77
2 merge requests!6Develop,!5Refactor
......@@ -68,29 +68,55 @@ if (opt$s == "hu"){
pop.st <- as.SingleCellExperiment(pop.st,assay="RNA")
rm(pop)
} else if (opt$s == "mu"){
load("/work/urology/ghenry/RNA-Seq/SingleCell/ANALYSIS/REF/Travaglini_Nature2020/assets/Analysis/r objects/mouse_droplet_TMS_tiss10x.mouse.anno.ncbi.20200222.RC4.Robj")
lin <- UpdateSeuratObject(tiss10x.mouse.anno)
lin$label.main <- lin$free_annotation
lin$label.fine <- lin$free_annotation
lin@meta.data <- lin@meta.data[,c("label.main","label.fine")]
lin <- as.SingleCellExperiment(lin,assay="RNA")
rm(tiss10x.mouse.anno)
}
sc10x <- readRDS(paste0("./analysis/",opt$p,"_raw.rds"))
sc10x.se <- as.SingleCellExperiment(sc10x)
common <- Reduce(intersect, list(rownames(sc10x.se),rownames(lin.P1),rownames(lin.P2),rownames(lin.P3)))
if (opt$s == "hu"){
common <- Reduce(intersect, list(rownames(sc10x.se),rownames(lin.P1),rownames(lin.P2),rownames(lin.P3)))
lin.P1 <- lin.P1[common,]
lin.P2 <- lin.P1[common,]
lin.P3 <- lin.P3[common,]
} else if (opt$s == "mu"){
common <- Reduce(intersect, list(rownames(sc10x.se),rownames(lin)))
lin <- lin[common,]
}
sc10x.se <- sc10x.se[common,]
lin.P1 <- lin.P1[common,]
lin.P2 <- lin.P1[common,]
lin.P3 <- lin.P3[common,]
rm(common)
singler <- SingleR(sc10x.se,ref=list(lung.P1=lin.P1,lung.P2=lin.P2,lung.P3=lin.P3),method="single",labels=list(lung.P1=lin.P1$label.fine,lung.P2=lin.P2$label.fine,lung.P3=lin.P3$label.fine),de.method="wilcox",BPPARAM=BiocParallel::MulticoreParam(workers=20))
sc10x$pop <- singler$labels
labs.raw <- singler$labels
labs <- singler$labels
if (opt$s == "hu"){
ref <- list(lung.P1=lin.P1,lung.P2=lin.P2,lung.P3=lin.P3)
labels <- list(lung.P1=lin.P1$label.fine,lung.P2=lin.P2$label.fine,lung.P3=lin.P3$label.fine)
rm(lin.P1)
rm(lin.P2)
rm(lin.P3)
} else if (opt$s == "mu"){
ref <- lin
labels <- lin$label.fine
rm(lin)
}
#singler <- SingleR(sc10x.se,ref=ref,method="single",labels=labels,de.method="wilcox",BPPARAM=BiocParallel::MulticoreParam(workers=20))
#labs <- singler$labels
singler <- SingleR(sc10x.se,ref=ref,clusters=sc10x.se$integrated_snn_res.1,labels=labels,de.method="wilcox",BPPARAM=BiocParallel::MulticoreParam(workers=20))
labs <- singler$labels[match(sc10x.se$integrated_snn_res.1,singler@rownames)]
sc10x$pop <- labs
labs.raw <- labs
labs[labs %in% c("Differentiating Basal","Proliferating Basal","Basal","Mesothelial","Alveolar Epithelial Type 2","Club","Alveolar Epithelial Type 1","Ciliated","Signaling Alveolar Epithelial Type 2","Proximal Basal","Neuroendocrine","Mucous","Ionocyte","Serous","Proximal Ciliated","Goblet")] <- "Epithelia"
labs[labs %in% c("Adventitial Fibroblast","Alveolar Fibroblast","Lipofibroblast")] <- "Fibroblast"
labs[labs %in% c("Airway Smooth Muscle","Pericyte","Myofibroblast","Fibromyocyte","Vascular Smooth Muscle")] <- "Smooth Muscle"
labs[labs %in% c("Capillary Aerocyte","Capillary","Bronchial Vessel 2","Vein","Artery","Lymphatic","Bronchial Vessel 1")] <- "Endothelia"
labs[labs %in% c("CD4+ Memory/Effector T","CD4+ Naive T","CD8+ Memory/Effector T","CD8+ Naive T","Natural Killer","B","Plasmacytoid Dendritic","Plasma","Proliferating NK/T","Natural Killer T")] <- "Lymphoid"
labs[labs %in% c("Classical Monocyte","Nonclassical Monocyte","Myeloid Dendritic Type 2","IGSF21+ Dendritic","EREG+ Dendritic","Myeloid Dendritic Type 1","TREM2+ Dendritic","Macrophage","Proliferating Macrophage")] <- "Myeloid"
labs[labs %in% c("Basophil/Mast 1","Basophil/Mast 2")] <- "Granulocyte"
labs[labs %in% c("Capillary Aerocyte","Capillary","Bronchial Vessel 2","Vein","Artery","Lymphatic","Bronchial Vessel 1","Lympatic")] <- "Endothelia"
labs[labs %in% c("CD4+ Memory/Effector T","CD4+ Naive T","CD8+ Memory/Effector T","CD8+ Naive T","Natural Killer","B","Plasmacytoid Dendritic","Plasma","Proliferating NK/T","Natural Killer T","CD4+ T","CD8+ T","Proliferating T","Regulatory T","Ly6g5b+ T","Proliferating NK","Alox5+ Lymphocytes","Zbtb32+ B")] <- "Lymphoid"
labs[labs %in% c("Classical Monocyte","Nonclassical Monocyte","Myeloid Dendritic Type 2","IGSF21+ Dendritic","EREG+ Dendritic","Myeloid Dendritic Type 1","TREM2+ Dendritic","Macrophage","Proliferating Macrophage","Proliferating Classical Monocyte","Intermediate Monocyte","Ccr7+ Dendritic","Proliferating Dendritic","Alveolar Macrophage","Interstitial Macrophage","Proliferating Alveolar Macrophage")] <- "Myeloid"
labs[labs %in% c("Basophil/Mast 1","Basophil/Mast 2","Basophil","Neutrophil")] <- "Granulocyte"
sc10x$lin <- labs
sc10x$lung <- labs.raw
#DimPlot(sc10x,group.by="lin",reduction="umap",label=TRUE,repel=TRUE)+theme(legend.position="none")
......@@ -183,6 +209,7 @@ if (opt$o == "pr" && opt$s == "hu") {
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"
sc10x[["pop"]][row.names(sc10x.epi[["pop"]])] <- sc10x.epi[["pop"]][,"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
......@@ -224,12 +251,20 @@ DefaultAssay(object=sc10x.fmst) <- "SCT"
DefaultAssay(object=sc10x.fib) <- "SCT"
DefaultAssay(object=sc10x.sm) <- "SCT"
DefaultAssay(object=sc10x.leu) <- "SCT"
sc10x@meta.data <- sc10x@meta.data[,c("lin","pop","lung","samples","integrated_snn_res.0.1","integrated_snn_res.0.2","integrated_snn_res.0.3","integrated_snn_res.0.4","integrated_snn_res.0.5","integrated_snn_res.0.75","integrated_snn_res.1","integrated_snn_res.2","integrated_snn_res.3","integrated_snn_res.4","integrated_snn_res.5","nCount_RNA","nFeature_RNA","percent.mito","percent.ribo","Stress1")]
sc10x.epi@meta.data <- sc10x.epi@meta.data[,c("lin","pop","lung","samples","integrated_snn_res.0.1","integrated_snn_res.0.2","integrated_snn_res.0.3","integrated_snn_res.0.4","integrated_snn_res.0.5","integrated_snn_res.0.75","integrated_snn_res.1","integrated_snn_res.2","integrated_snn_res.3","integrated_snn_res.4","integrated_snn_res.5","nCount_RNA","nFeature_RNA","percent.mito","percent.ribo","Stress1")]
sc10x.fmst@meta.data <- sc10x.fmst@meta.data[,c("lin","lung","samples","integrated_snn_res.0.1","integrated_snn_res.0.2","integrated_snn_res.0.3","integrated_snn_res.0.4","integrated_snn_res.0.5","integrated_snn_res.0.75","integrated_snn_res.1","integrated_snn_res.2","integrated_snn_res.3","integrated_snn_res.4","integrated_snn_res.5","nCount_RNA","nFeature_RNA","percent.mito","percent.ribo","Stress1")]
sc10x.fib@meta.data <- sc10x.fib@meta.data[,c("lin","lung","samples","integrated_snn_res.0.1","integrated_snn_res.0.2","integrated_snn_res.0.3","integrated_snn_res.0.4","integrated_snn_res.0.5","integrated_snn_res.0.75","integrated_snn_res.1","integrated_snn_res.2","integrated_snn_res.3","integrated_snn_res.4","integrated_snn_res.5","nCount_RNA","nFeature_RNA","percent.mito","percent.ribo","Stress1")]
sc10x.sm@meta.data <- sc10x.sm@meta.data[,c("lin","lung","samples","integrated_snn_res.0.1","integrated_snn_res.0.2","integrated_snn_res.0.3","integrated_snn_res.0.4","integrated_snn_res.0.5","integrated_snn_res.0.75","integrated_snn_res.1","integrated_snn_res.2","integrated_snn_res.3","integrated_snn_res.4","integrated_snn_res.5","nCount_RNA","nFeature_RNA","percent.mito","percent.ribo","Stress1")]
sc10x.leu@meta.data <- sc10x.leu@meta.data[,c("lin","lung","pop","samples","integrated_snn_res.0.1","integrated_snn_res.0.2","integrated_snn_res.0.3","integrated_snn_res.0.4","integrated_snn_res.0.5","integrated_snn_res.0.75","integrated_snn_res.1","integrated_snn_res.2","integrated_snn_res.3","integrated_snn_res.4","integrated_snn_res.5","nCount_RNA","nFeature_RNA","percent.mito","percent.ribo","Stress1")]
for (i in res){
sc10x[[paste0("resolution_",i)]] <- sc10x[[paste0("integrated_snn_res.",i)]]
sc10x.epi[[paste0("resolution_",i)]] <- sc10x.epi[[paste0("integrated_snn_res.",i)]]
sc10x.fmst[[paste0("resolution_",i)]] <- sc10x.fmst[[paste0("integrated_snn_res.",i)]]
sc10x.fib[[paste0("resolution_",i)]] <- sc10x.fib[[paste0("integrated_snn_res.",i)]]
sc10x.sm[[paste0("resolution_",i)]] <- sc10x.sm[[paste0("integrated_snn_res.",i)]]
sc10x.leu[[paste0("resolution_",i)]] <- sc10x.leu[[paste0("integrated_snn_res.",i)]]
}
sc10x@meta.data <- sc10x@meta.data[,c("lin","pop","lung","samples","resolution_0.1","resolution_0.2","resolution_0.3","resolution_0.4","resolution_0.5","resolution_0.75","resolution_1","resolution_2","resolution_3","resolution_4","resolution_5","nCount_RNA","nFeature_RNA","percent.mito","percent.ribo","Stress1")]
sc10x.epi@meta.data <- sc10x.epi@meta.data[,c("lin","pop","lung","samples","resolution_0.1","resolution_0.2","resolution_0.3","resolution_0.4","resolution_0.5","resolution_0.75","resolution_1","resolution_2","resolution_3","resolution_4","resolution_5","nCount_RNA","nFeature_RNA","percent.mito","percent.ribo","Stress1")]
sc10x.fmst@meta.data <- sc10x.fmst@meta.data[,c("lin","lung","samples","resolution_0.1","resolution_0.2","resolution_0.3","resolution_0.4","resolution_0.5","resolution_0.75","resolution_1","resolution_2","resolution_3","resolution_4","resolution_5","nCount_RNA","nFeature_RNA","percent.mito","percent.ribo","Stress1")]
sc10x.fib@meta.data <- sc10x.fib@meta.data[,c("lin","lung","samples","resolution_0.1","resolution_0.2","resolution_0.3","resolution_0.4","resolution_0.5","resolution_0.75","resolution_1","resolution_2","resolution_3","resolution_4","resolution_5","nCount_RNA","nFeature_RNA","percent.mito","percent.ribo","Stress1")]
sc10x.sm@meta.data <- sc10x.sm@meta.data[,c("lin","lung","samples","resolution_0.1","resolution_0.2","resolution_0.3","resolution_0.4","resolution_0.5","resolution_0.75","resolution_1","resolution_2","resolution_3","resolution_4","resolution_5","nCount_RNA","nFeature_RNA","percent.mito","percent.ribo","Stress1")]
sc10x.leu@meta.data <- sc10x.leu@meta.data[,c("lin","lung","pop","samples","resolution_0.1","resolution_0.2","resolution_0.3","resolution_0.4","resolution_0.5","resolution_0.75","resolution_1","resolution_2","resolution_3","resolution_4","resolution_5","nCount_RNA","nFeature_RNA","percent.mito","percent.ribo","Stress1")]
saveRDS(sc10x,paste0("./analysis/",opt$p,"_id_all.rds"))
saveRDS(sc10x.epi,paste0("./analysis/",opt$p,"_id_epi.rds"))
saveRDS(sc10x.fmst,paste0("./analysis/",opt$p,"_id_fmst.rds"))
......
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