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

Prevent error if anchor gene does not exist in data, PC.Score.Stress/NE.R

parent 7bd79114
No related merge requests found
......@@ -136,12 +136,13 @@ sc10x.Group@ident <- factor(sc10x.Group@ident,levels=c("NE","Epi","St"))
#generate violin plot of NE gene expression
anchors <- c("CHGA","CHGB","SYP")
for (i in anchors){
postscript(paste0("./analysis/",opt$g,"/global",sub.folder,"/pc-score","/Violin_NE.",i,".eps"))
plot <- VlnPlot(object=sc10x.Group.sample,features.plot=i,point.size.use=2.5,size.title.use=25,x.lab.rot=TRUE)
plot <- plot+theme(axis.text.x=element_text(size=20),axis.text.y=element_text(size=20),axis.title.x=element_text(size=20),axis.title.y=element_text(size=20))
plot(plot)
dev.off()
}
if (i %in% rownames(sc10x.Group.sample@data)){
postscript(paste0("./analysis/",opt$g,"/global",sub.folder,"/pc-score","/Violin_NE.",i,".eps"))
plot <- VlnPlot(object=sc10x.Group.sample,features.plot=i,point.size.use=2.5,size.title.use=25,x.lab.rot=TRUE)
plot <- plot+theme(axis.text.x=element_text(size=20),axis.text.y=element_text(size=20),axis.title.x=element_text(size=20),axis.title.y=element_text(size=20))
plot(plot)
dev.off()
}}
rm(anchors)
#save NE identity
......
......@@ -114,12 +114,13 @@ sc10x.Group <- SetIdent(object=sc10x.Group,cells.use=clusterCut,ident.use="Stres
#generate violin plot of stres gene expression
anchors <- c("EGR1","FOS","JUN")
for (i in anchors){
postscript(paste0("./analysis/",opt$g,"/pc-score/Violin_Stress.",i,".eps"))
plot <- VlnPlot(object=sc10x.Group.sample,features.plot=i,point.size.use=2.5,size.title.use=25,x.lab.rot=TRUE)
plot <- plot+theme(axis.text.x=element_text(size=20),axis.text.y=element_text(size=20),axis.title.x=element_text(size=20),axis.title.y=element_text(size=20))
plot(plot)
dev.off()
}
if (i %in% rownames(sc10x.Group@data)){
postscript(paste0("./analysis/",opt$g,"/pc-score/Violin_Stress.",i,".eps"))
plot <- VlnPlot(object=sc10x.Group.sample,features.plot=i,point.size.use=2.5,size.title.use=25,x.lab.rot=TRUE)
plot <- plot+theme(axis.text.x=element_text(size=20),axis.text.y=element_text(size=20),axis.title.x=element_text(size=20),axis.title.y=element_text(size=20))
plot(plot)
dev.off()
}}
rm(anchors)
#save stress cell identity
......
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