From af6cb76197f29c6a4446b6b737cdd10982526ef5 Mon Sep 17 00:00:00 2001 From: "Gervaise H. Henry" Date: Sun, 16 Feb 2020 21:29:35 -0600 Subject: [PATCH] Change singler to res 5 and fine --- r.scripts/SingleR.R | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/r.scripts/SingleR.R b/r.scripts/SingleR.R index e623290..ba45a84 100644 --- a/r.scripts/SingleR.R +++ b/r.scripts/SingleR.R @@ -68,22 +68,27 @@ lin.se <- lin.se[common,] sc10x.se <- sc10x.se[common,] rm(common) -singler.lin <- SingleR(sc10x.se,ref=lin.se,method="cluster",clusters=sc10x.se$integrated_snn_res.0.5,labels=lin.se$label.main,BPPARAM=MulticoreParam(workers=10)) -sc10x$lin <- singler.lin$labels[match(sc10x.se$integrated_snn_res.0.5,singler.lin@rownames)] +singler.lin <- SingleR(sc10x.se,ref=lin.se,method="cluster",clusters=sc10x.se$integrated_snn_res.5,labels=lin.se$label.fine,BPPARAM=MulticoreParam(workers=10)) +sc10x$lin <- singler.lin$labels[match(sc10x.se$integrated_snn_res.5,singler.lin@rownames)] #singler.lin <- SingleR(sc10x.se,ref=lin.se,method="single",labels=lin.se$label.main,BPPARAM=MulticoreParam(workers=10)) #sc10x$lin <- singler.lin$labels -if (opt$s == "hu"){ - sc10x$lin[sc10x$lin %in% c("DC","B_cell","Neutrophil","T_cells","Monocyte","Macrophage","NK_cell","Neutrophils","CMP","GMP","MEP","Myelocyte","Pre-B_cell_CD34-","Pro-B_cell_CD34+","Pro-Myelocyte","HSC_-G-CSF","HSC_CD34+")] <- "Leu" - sc10x$lin[sc10x$lin %in% c("Endothelial_cells","Erythroblast","Platelets")] <- "Endo" - sc10x$lin[sc10x$lin %in% c("Smooth_muscle_cells","Fibroblasts","Chondrocytes","Osteoblasts","MSC","Tissue_stem_cells")] <- "FMSt" - sc10x$lin[sc10x$lin %in% c("Epithelial_cells","Keratinocytes","Neuroepithelial_cell")] <- "Epi" -} else if (opt$s == "mu"){ - sc10x$lin[sc10x$lin %in% c("Macrophages","Monocytes","B cells","DC","Eosinophils","Neutrophils","T cells","ILC","NK cells","Basophils","Mast cells","Tgd","NKT","B cells, pro","Microglia")] <- "Leu" - sc10x$lin[sc10x$lin %in% c("Endothelial cells")] <- "Endo" - sc10x$lin[sc10x$lin %in% c("Stromal cells","Fibroblasts")] <- "FMSt" - sc10x$lin[sc10x$lin %in% c("Epithelial cells")] <- "Epi" -} -#DimPlot(sc10x,group.by="lin",reduction="umap",label=TRUE,repel=TRUE)+theme(legend.position="none") +sc10x$lin[sc10x$lin %in% unique(lin.se@colData[lin.se@colData[,"label.main"] %in% c( + c("DC","B_cell","Neutrophil","T_cells","Monocyte","Macrophage","NK_cell","Neutrophils","CMP","GMP","MEP","Myelocyte","Pre-B_cell_CD34-","Pro-B_cell_CD34+","Pro-Myelocyte","HSC_-G-CSF","HSC_CD34+"), + c("Macrophages","Monocytes","B cells","DC","Eosinophils","Neutrophils","T cells","ILC","NK cells","Basophils","Mast cells","Tgd","NKT","B cells, pro","Microglia") + ),c("label.main","label.fine")])$label.fine] <- "Leu" +sc10x$lin[sc10x$lin %in% unique(lin.se@colData[lin.se@colData[,"label.main"] %in% c( + c("Endothelial_cells","Erythroblast","Platelets"), + c("Endothelial cells") + ),c("label.main","label.fine")])$label.fine] <- "Endo" +sc10x$lin[sc10x$lin %in% unique(lin.se@colData[lin.se@colData[,"label.main"] %in% c( + c("Smooth_muscle_cells","Fibroblasts","Chondrocytes","Osteoblasts","MSC","Tissue_stem_cells"), + c("Stromal cells","Fibroblasts") + ),c("label.main","label.fine")])$label.fine] <- "FMSt" +sc10x$lin[sc10x$lin %in% unique(lin.se@colData[lin.se@colData[,"label.main"] %in% c( + c("Epithelial_cells","Keratinocytes","Neuroepithelial_cell"), + c("Epithelial cells") + ),c("label.main","label.fine")])$label.fine] <- "Epi" +DimPlot(sc10x,group.by="lin",reduction="umap",label=TRUE,repel=TRUE)+theme(legend.position="none") Idents(sc10x) <- "lin" sc10x.epi <- subset(sc10x,idents="Epi") -- GitLab