Commit 433f0000 authored by Gervaise H. Henry's avatar Gervaise H. Henry 🤠

Fix diy ident group names

parent 32307ec8
......@@ -25,20 +25,20 @@ Rscript ../r.scripts/sc-TissueMapper_RUN.R --p "$1" --s "$2"
module unload R/3.5.1-gccmkl
module load R/3.6.1-gccmkl
if [[ "$1" == "PdPgb" ]] || [[ "$1" == "PdPb" ]] || [[ "$1" == "huBl" ]]
if [[ "$1" == "huPr_PdPgb" ]] || [[ "$1" == "huPr_PdPb" ]] || [[ "$1" == "huBl" ]]
then
Rscript ../r.scripts/SingleR.R --p "$1" --s "$2" --o "$3"
elif [[ "$3" == "epi" ]] || [["$3" == "fmst" ]]
elif [[ "$1" == "muPrUr" ]]
then
Rscript ../r.scripts/huPr_muPr.R --p "$1" --r "$3"
fi
module unload R/3.5.1-gccmkl
module load R/3.6.1-gccmkl
if [[ "$1" == "PdPgb" ]]
if [[ "$1" == "huPr_PdPgb" ]]
then
Rscript ../r.scripts/diy_PdPgb.R
elif [[ "$3" == "epi" ]]
elif [[ "$1" == "muPrUr" ]]
then
Rscript ../r.scripts/diy_muPrUr_Epi.R
fi
......@@ -36,11 +36,11 @@ sc10x <- RenameIdents(sc10x,"BPH342PrF_Via"="BPH")
sc10x$Phenotype <- Idents(sc10x)
sc10x$Phenotype <- factor(sc10x$Phenotype,levels=c("Normal Pz","BPH"))
sc10x$`Cell Lineage` <- sc10x$lin
Idents(sc10x) <- "Cell Lineage"
sc10x$`Cell Lineage` <- Idents(sc10x)
sc10x$`Cell Lineage` <- factor(sc10x$`Cell Lineage`,levels=c("Epi","FMSt","Endo","Leu"))
Idents(sc10x) <- "Cell Lineage"
sc10x$`Cell.Lineage` <- sc10x$lin
Idents(sc10x) <- "Cell.Lineage"
sc10x$`Cell.Lineage` <- Idents(sc10x)
sc10x$`Cell.Lineage` <- factor(sc10x$`Cell.Lineage`,levels=c("Epi","FMSt","Endo","Leu"))
Idents(sc10x) <- "Cell.Lineage"
postscript(paste0("./analysis/vis/diy/UMAP_lin.eps"))
DimPlot(sc10x)+scale_color_viridis(discrete=TRUE,option="magma")+theme_cowplot()
......@@ -55,12 +55,12 @@ dev.off()
Idents(sc10x) <- "lin"
leu <- WhichCells(sc10x,idents=c("Epi","FMSt","Endo"),invert=TRUE)
sc10x$`Cell Type` <- sc10x$pops
Idents(sc10x) <- "Cell Type"
sc10x$`Cell.Type` <- sc10x$pops
Idents(sc10x) <- "Cell.Type"
sc10x <- SetIdent(sc10x,cells=leu,value="Leu")
sc10x$`Cell Type` <- Idents(sc10x)
sc10x$`Cell Type` <- factor(sc10x$`Cell Type`,levels=c("BE","LE","Hillock","Club","NE","Fib","SM","Endo","Leu"))
Idents(sc10x) <- "Cell Type"
sc10x$`Cell.Type` <- Idents(sc10x)
sc10x$`Cell.Type` <- factor(sc10x$`Cell.Type`,levels=c("BE","LE","Hillock","Club","NE","Fib","SM","Endo","Leu"))
Idents(sc10x) <- "Cell.Type"
postscript(paste0("./analysis/vis/diy/UMAP_pops.eps"))
DimPlot(sc10x)+theme_cowplot()
......@@ -117,7 +117,7 @@ order.lin <- c(
),c("label.main","label.fine")])$label.fine)
)
cor.lin <- cor.lin[order.lin,]
cor.lin.ann <- columnAnnotation(Cell.Lineage=factor(sc10x$`Cell Lineage`[match(singler.lin@rownames,sc10x$integrated_snn_res.5)][order.lin],levels=c("Epi","FMSt","Endo","Leu")),col=list(Cell.Lineage=c("Epi"=magma(4)[1],"FMSt"=magma(4)[2],"Endo"=magma(4)[3],"Leu"=magma(4)[4])))
cor.lin.ann <- columnAnnotation(Cell.Lineage=factor(sc10x$`Cell.Lineage`[match(singler.lin@rownames,sc10x$integrated_snn_res.5)][order.lin],levels=c("Epi","FMSt","Endo","Leu")),col=list(Cell.Lineage=c("Epi"=magma(4)[1],"FMSt"=magma(4)[2],"Endo"=magma(4)[3],"Leu"=magma(4)[4])))
postscript(paste0("./analysis/vis/diy/CorrCustom_lin.eps"))
Heatmap(scale(t(cor.lin)),name="Correlation Z-Score",cluster_rows=FALSE,cluster_columns=FALSE,col=rev(heat.colors(2)),top_annotation=cor.lin.ann,row_title="HPCA Cell Types",column_title_side="bottom",column_title="Human Prostate Clusters",show_row_names=FALSE)
dev.off()
......@@ -139,9 +139,9 @@ sc10x.epi <- RenameIdents(sc10x.epi,"BPH342PrF_Via"="BPH")
sc10x.epi$Phenotype <- Idents(sc10x.epi)
sc10x.epi$Phenotype <- factor(sc10x.epi$Phenotype,levels=c("Normal Pz","BPH"))
sc10x.epi$`Cell Type` <- sc10x.epi$pops
sc10x.epi$`Cell Type` <- factor(sc10x.epi$`Cell Type`,levels=c("BE","LE","Hillock","Club","NE"))
Idents(sc10x.epi) <- "Cell Type"
sc10x.epi$`Cell.Type` <- sc10x.epi$pops
sc10x.epi$`Cell.Type` <- factor(sc10x.epi$`Cell.Type`,levels=c("BE","LE","Hillock","Club","NE"))
Idents(sc10x.epi) <- "Cell.Type"
postscript(paste0("./analysis/vis/diy/UMAP_epi.pops.eps"))
DimPlot(sc10x.epi)+scale_color_brewer(palette="Dark2")+theme_cowplot()
......@@ -171,9 +171,9 @@ sc10x.fmst <- RenameIdents(sc10x.fmst,"BPH342PrF_Via"="BPH")
sc10x.fmst$Phenotype <- Idents(sc10x.fmst)
sc10x.fmst$Phenotype <- factor(sc10x.fmst$Phenotype,levels=c("Normal Pz","BPH"))
sc10x.fmst$`Cell Type` <- sc10x.fmst$pops
sc10x.fmst$`Cell Type` <- factor(sc10x.fmst$`Cell Type`,levels=c("Fib","SM"))
Idents(sc10x.fmst) <- "Cell Type"
sc10x.fmst$`Cell.Type` <- sc10x.fmst$pops
sc10x.fmst$`Cell.Type` <- factor(sc10x.fmst$`Cell.Type`,levels=c("Fib","SM"))
Idents(sc10x.fmst) <- "Cell.Type"
postscript(paste0("./analysis/vis/diy/UMAP_fmst.pops.eps"))
DimPlot(sc10x.fmst)+scale_color_brewer(palette="Dark2")+theme_cowplot()
......@@ -188,23 +188,23 @@ dev.off()
singler.epi@listData$scores <- singler.epi@listData$scores[,c(1,2,4,3,5)]
cor.epi <- as.matrix(singler.epi@listData$scores)[singler.epi@rownames %in% colnames(sc10x.epi),]
cor.epi <- cor.epi[order(sc10x.epi$`Cell Type`[match(singler.epi@rownames[singler.epi@rownames %in% colnames(sc10x.epi)],names(sc10x.epi$`Cell Type`))]),]
cor.epi.ann <- columnAnnotation(Cell.Type=factor(sc10x.epi$`Cell Type`[match(singler.epi@rownames[singler.epi@rownames %in% colnames(sc10x.epi)],names(sc10x.epi$`Cell Type`))][order(sc10x.epi$`Cell Type`[match(singler.epi@rownames[singler.epi@rownames %in% colnames(sc10x.epi)],names(sc10x.epi$`Cell Type`))])],levels=c("BE","LE","Hillock","Club","NE")),col=list(Cell.Type=c("BE"=brewer.pal(n=5,name="Dark2")[1],"LE"=brewer.pal(n=5,name="Dark2")[2],"Hillock"=brewer.pal(n=5,name="Dark2")[3],"Club"=brewer.pal(n=5,name="Dark2")[4],"NE"=brewer.pal(n=5,name="Dark2")[5])))
cor.epi <- cor.epi[order(sc10x.epi$`Cell.Type`[match(singler.epi@rownames[singler.epi@rownames %in% colnames(sc10x.epi)],names(sc10x.epi$`Cell.Type`))]),]
cor.epi.ann <- columnAnnotation(Cell.Type=factor(sc10x.epi$`Cell.Type`[match(singler.epi@rownames[singler.epi@rownames %in% colnames(sc10x.epi)],names(sc10x.epi$`Cell.Type`))][order(sc10x.epi$`Cell.Type`[match(singler.epi@rownames[singler.epi@rownames %in% colnames(sc10x.epi)],names(sc10x.epi$`Cell.Type`))])],levels=c("BE","LE","Hillock","Club","NE")),col=list(Cell.Type=c("BE"=brewer.pal(n=5,name="Dark2")[1],"LE"=brewer.pal(n=5,name="Dark2")[2],"Hillock"=brewer.pal(n=5,name="Dark2")[3],"Club"=brewer.pal(n=5,name="Dark2")[4],"NE"=brewer.pal(n=5,name="Dark2")[5])))
postscript(paste0("./analysis/vis/diy/CorrCustom_epi.eps"))
Heatmap(scale(t(cor.epi)),name="Correlation Z-Score",cluster_rows=FALSE,cluster_columns=FALSE,col=rev(heat.colors(2)),top_annotation=cor.epi.ann,row_title="Human Epi Cell Types",column_title_side="bottom",column_title="Human Epi Cells")
dev.off()
cor.fmst <- as.matrix(singler.fmst@listData$scores)[singler.fmst@rownames %in% colnames(sc10x.fmst),]
cor.fmst <- cor.fmst[order(sc10x.fmst$`Cell Type`[match(singler.fmst@rownames[singler.fmst@rownames %in% colnames(sc10x.fmst)],names(sc10x.fmst$`Cell Type`))]),]
cor.fmst.ann <- columnAnnotation(Cell.Type=factor(sc10x.fmst$`Cell Type`[match(singler.fmst@rownames[singler.fmst@rownames %in% colnames(sc10x.fmst)],names(sc10x.fmst$`Cell Type`))][order(sc10x.fmst$`Cell Type`[match(singler.fmst@rownames[singler.fmst@rownames %in% colnames(sc10x.fmst)],names(sc10x.fmst$`Cell Type`))])],levels=c("Fib","SM")),col=list(Cell.Type=c("Fib"=brewer.pal(n=3,name="Dark2")[1],"SM"=brewer.pal(n=3,name="Dark2")[2])))
cor.fmst <- cor.fmst[order(sc10x.fmst$`Cell.Type`[match(singler.fmst@rownames[singler.fmst@rownames %in% colnames(sc10x.fmst)],names(sc10x.fmst$`Cell.Type`))]),]
cor.fmst.ann <- columnAnnotation(Cell.Type=factor(sc10x.fmst$`Cell.Type`[match(singler.fmst@rownames[singler.fmst@rownames %in% colnames(sc10x.fmst)],names(sc10x.fmst$`Cell.Type`))][order(sc10x.fmst$`Cell.Type`[match(singler.fmst@rownames[singler.fmst@rownames %in% colnames(sc10x.fmst)],names(sc10x.fmst$`Cell.Type`))])],levels=c("Fib","SM")),col=list(Cell.Type=c("Fib"=brewer.pal(n=3,name="Dark2")[1],"SM"=brewer.pal(n=3,name="Dark2")[2])))
postscript(paste0("./analysis/vis/diy/CorrCustom_fmst.eps"))
Heatmap(scale(t(cor.fmst)),name="Correlation Z-Score",cluster_rows=FALSE,cluster_columns=FALSE,col=rev(heat.colors(2)),top_annotation=cor.fmst.ann,row_title="Human FMSt Cell Types",column_title_side="bottom",column_title="Human FMSt Cells")
dev.off()
write.table(table(sc10x$`Cell Type`,sc10x$samples),file="./analysis/vis/diy/Table_pops.Samples.csv",sep=",",quote=FALSE,row.names=TRUE,col.names=NA)
write.table(table(sc10x$`Cell Type`,sc10x$Phenotype),file="./analysis/vis/diy/Table_pops.Phenotype.csv",sep=",",quote=FALSE,row.names=TRUE,col.names=NA)
write.table(table(sc10x$`Cell.Type`,sc10x$samples),file="./analysis/vis/diy/Table_pops.Samples.csv",sep=",",quote=FALSE,row.names=TRUE,col.names=NA)
write.table(table(sc10x$`Cell.Type`,sc10x$Phenotype),file="./analysis/vis/diy/Table_pops.Phenotype.csv",sep=",",quote=FALSE,row.names=TRUE,col.names=NA)
Idents(sc10x) <- "Cell Type"
Idents(sc10x) <- "Cell.Type"
for (i in c("BE","LE","Hillock","Club","NE","Fib","SM")){
data <- subset(sc10x,idents=i)
Idents(data) <- "Phenotype"
......
......@@ -43,11 +43,11 @@ sc10x <- RenameIdents(sc10x,"musAd004n5_UrF_GEX"="Urethra")
sc10x$Region <- Idents(sc10x)
sc10x$Region <- factor(sc10x$Region,levels=c("Prostate","Urethra"))
sc10x$`Cell Lineage` <- sc10x$lin
Idents(sc10x) <- "Cell Lineage"
sc10x$`Cell Lineage` <- Idents(sc10x)
sc10x$`Cell Lineage` <- factor(sc10x$`Cell Lineage`,levels=c("Epi","FMSt","Endo","Leu"))
Idents(sc10x) <- "Cell Lineage"
sc10x$`Cell.Lineage` <- sc10x$lin
Idents(sc10x) <- "Cell.Lineage"
sc10x$`Cell.Lineage` <- Idents(sc10x)
sc10x$`Cell.Lineage` <- factor(sc10x$`Cell.Lineage`,levels=c("Epi","FMSt","Endo","Leu"))
Idents(sc10x) <- "Cell.Lineage"
postscript(paste0("./analysis/vis/diy/UMAP_lin.eps"))
DimPlot(sc10x)+scale_color_viridis(discrete=TRUE,option="magma")+theme_cowplot()
......@@ -113,7 +113,7 @@ order.lin <- c(
),c("label.main","label.fine")])$label.fine)
)
cor.lin <- cor.lin[order.lin,]
cor.lin.ann <- columnAnnotation(Cell.Lineage=factor(sc10x$`Cell Lineage`[match(singler.lin@rownames,sc10x$integrated_snn_res.1)][order.lin],levels=c("Epi","FMSt","Endo","Leu")),col=list(Cell.Lineage=c("Epi"=magma(4)[1],"FMSt"=magma(4)[2],"Endo"=magma(4)[3],"Leu"=magma(4)[4])))
cor.lin.ann <- columnAnnotation(Cell.Lineage=factor(sc10x$`Cell.Lineage`[match(singler.lin@rownames,sc10x$integrated_snn_res.1)][order.lin],levels=c("Epi","FMSt","Endo","Leu")),col=list(Cell.Lineage=c("Epi"=magma(4)[1],"FMSt"=magma(4)[2],"Endo"=magma(4)[3],"Leu"=magma(4)[4])))
postscript(paste0("./analysis/vis/diy/CorrCustom_lin.eps"))
Heatmap(scale(t(cor.lin)),name="Correlation Z-Score",cluster_rows=FALSE,cluster_columns=FALSE,col=rev(heat.colors(2)),top_annotation=cor.lin.ann,row_title="ImmGen Cell Types",column_title_side="bottom",column_title="Mouse Clusters",show_row_names=FALSE)
dev.off()
......@@ -140,15 +140,15 @@ cells.vp <- WhichCells(sc10x.epi,idents="3")
cells.ed <- WhichCells(sc10x.epi,idents="4")
cells.dlp <- WhichCells(sc10x.epi,idents="5")
sc10x.epi$`Cell Type` <- sc10x.epi$hu_pops
Idents(sc10x.epi) <- "Cell Type"
sc10x.epi$`Cell.Type` <- sc10x.epi$hu_pops
Idents(sc10x.epi) <- "Cell.Type"
sc10x.epi <- SetIdent(sc10x.epi,cell=cells.ap,value="APr LE")
sc10x.epi <- SetIdent(sc10x.epi,cell=cells.vp,value="VPr LE")
sc10x.epi <- SetIdent(sc10x.epi,cell=cells.ed,value="ED")
sc10x.epi <- SetIdent(sc10x.epi,cell=cells.dlp,value="DLPr LE")
sc10x.epi$`Cell Type` <- Idents(sc10x.epi)
sc10x.epi$`Cell Type` <- factor(sc10x.epi$`Cell Type`,levels=c("BE","Ur","VPr LE","DLPr LE","APr LE","ED"))
Idents(sc10x.epi) <- "Cell Type"
sc10x.epi$`Cell.Type` <- Idents(sc10x.epi)
sc10x.epi$`Cell.Type` <- factor(sc10x.epi$`Cell.Type`,levels=c("BE","Ur","VPr LE","DLPr LE","APr LE","ED"))
Idents(sc10x.epi) <- "Cell.Type"
postscript(paste0("./analysis/vis/diy/UMAP_epi.eps"))
DimPlot(sc10x.epi)+scale_color_brewer(palette="Dark2")+theme_cowplot()
......@@ -160,9 +160,9 @@ dev.off()
Idents(sc10x.epi) <- "Region"
sc10x.epi.pr <- subset(sc10x.epi,idents="Prostate")
sc10x.epi.ur <- subset(sc10x.epi,idents="Urethra")
Idents(sc10x.epi) <- "Cell Type"
Idents(sc10x.epi.pr) <- "Cell Type"
Idents(sc10x.epi.ur) <- "Cell Type"
Idents(sc10x.epi) <- "Cell.Type"
Idents(sc10x.epi.pr) <- "Cell.Type"
Idents(sc10x.epi.ur) <- "Cell.Type"
postscript(paste0("./analysis/vis/diy/UMAP_epi.split.pr.eps"))
DimPlot(sc10x.epi.pr)+scale_color_brewer(palette="Dark2")+theme_cowplot()
dev.off()
......@@ -190,8 +190,8 @@ postscript(paste0("./analysis/vis/diy/Dot_epi.sc.eps"))
DotPlot(sc10x.epi,features=rev(c("Svs2","Krt8","Cd24a","Dpp4","Pbsn","Msmb","Sbp","Tgm4","Trp63","Krt5","Krt19","Krt4","Ly6d","Psca","Tacstd2","Ly6e","Ly6a","Prom1")),dot.scale=10,cols=rev(heat.colors(2)))+theme(axis.text.x=element_text(angle=45,hjust=1))
dev.off()
sc10x.epi$`Cell ID` <- factor(sc10x.epi$hu_pops,levels=c("BE","Ur","LE"))
Idents(sc10x.epi) <- "Cell ID"
sc10x.epi$`Cell.ID` <- factor(sc10x.epi$hu_pops,levels=c("BE","Ur","LE"))
Idents(sc10x.epi) <- "Cell.ID"
postscript(paste0("./analysis/vis/diy/UMAP_epi_hupop.eps"))
DimPlot(sc10x.epi)+theme_cowplot()
dev.off()
......@@ -217,11 +217,11 @@ postscript(paste0("./analysis/vis/diy/UMAP_epi.res0.1.eps"))
DimPlot(sc10x.epi)+theme_cowplot()
dev.off()
write.table(table(sc10x$`Cell Lineage`,sc10x$samples),file="./analysis/vis/diy/Table_Lin.Samples.csv",sep=",",quote=FALSE,row.names=TRUE,col.names=NA)
write.table(table(sc10x$`Cell Lineage`,sc10x$Region),file="./analysis/vis/diy/Table_Lin.Region.csv",sep=",",quote=FALSE,row.names=TRUE,col.names=NA)
write.table(table(sc10x$`Cell.Lineage`,sc10x$samples),file="./analysis/vis/diy/Table_Lin.Samples.csv",sep=",",quote=FALSE,row.names=TRUE,col.names=NA)
write.table(table(sc10x$`Cell.Lineage`,sc10x$Region),file="./analysis/vis/diy/Table_Lin.Region.csv",sep=",",quote=FALSE,row.names=TRUE,col.names=NA)
write.table(table(sc10x.epi$`Cell Type`,sc10x.epi$samples),file="./analysis/vis/diy/Table_Epi.Samples.csv",sep=",",quote=FALSE,row.names=TRUE,col.names=NA)
write.table(table(sc10x.epi$`Cell Type`,sc10x.epi$Region),file="./analysis/vis/diy/Table_Epi.Region.csv",sep=",",quote=FALSE,row.names=TRUE,col.names=NA)
write.table(table(sc10x.epi$`Cell.Type`,sc10x.epi$samples),file="./analysis/vis/diy/Table_Epi.Samples.csv",sep=",",quote=FALSE,row.names=TRUE,col.names=NA)
write.table(table(sc10x.epi$`Cell.Type`,sc10x.epi$Region),file="./analysis/vis/diy/Table_Epi.Region.csv",sep=",",quote=FALSE,row.names=TRUE,col.names=NA)
#deg.ne <- rownames(sc10x.epi)[rownames(sc10x.epi) %in% deg.ne]
#results <- scScore(sc10x.epi,score="NE",geneset=as.list(deg.ne),cut.pt=0.95,anchor=anchor)
......@@ -244,7 +244,7 @@ names(E.MTAB.4991_OE) <- "LSCmed"
E.MTAB.4991 <- list()
E.MTAB.4991 <- c(E.MTAB.4991_BE,E.MTAB.4991_LE,E.MTAB.4991_OE)
sc10x.epi$CellType <- sc10x.epi$`Cell Type`
sc10x.epi$CellType <- sc10x.epi$`Cell.Type`
Idents(sc10x.epi) <- "CellType"
sc10x.epi <- RenameIdents(sc10x.epi,"VPr LE"="VPrLE")
sc10x.epi <- RenameIdents(sc10x.epi,"DLPr LE"="DLPrLE")
......@@ -257,6 +257,6 @@ postscript(paste0("./analysis/vis/diy/UMAP_epi.Calca.eps"))
FeaturePlot(sc10x.epi,features="Calca",cols=c("lightgrey","darkred"),pt.size=2.5)+theme_cowplot()
dev.off()
Idents(sc10x.epi) <- "Cell Type"
Idents(sc10x.epi) <- "Cell.Type"
deg.epi <- FindAllMarkers(sc10x.epi,assay="SCT",slot="data",logfc.threshold=0,test.use="MAST",only.pos=TRUE)
write.table(deg.epi,file="./analysis/vis/diy/DEG_epi.CellType.csv",sep=",",quote=FALSE,row.names=FALSE,col.names=TRUE)
\ No newline at end of file
write.table(deg.epi,file="./analysis/vis/diy/DEG_epi.CellType.csv",sep=",",quote=FALSE,row.names=FALSE,col.names=TRUE)
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