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

Change Stress cell determination back to PC1

parent c9dc1124
No related merge requests found
...@@ -65,7 +65,7 @@ if (skewness(sc10x.Group.Stress.pca[,2])<0){ ...@@ -65,7 +65,7 @@ if (skewness(sc10x.Group.Stress.pca[,2])<0){
sc10x.Group <- SetDimReduction(object=sc10x.Group,reduction.type="Stress",slot="cell.embeddings",new.data=sc10x.Group.Stress.pca) sc10x.Group <- SetDimReduction(object=sc10x.Group,reduction.type="Stress",slot="cell.embeddings",new.data=sc10x.Group.Stress.pca)
sc10x.Group <- SetDimReduction(object=sc10x.Group,reduction.type="Stress",slot="key",new.data="Stress") sc10x.Group <- SetDimReduction(object=sc10x.Group,reduction.type="Stress",slot="key",new.data="Stress")
#generate PCA PC1 (Stress1) and PC2 (Stress2) #generate PCA PC1 (Stress1/Stress-Score) and PC2 (Stress2)
postscript(paste0("./analysis/",opt$g,"/pc-score/PCS_Stress.eps")) postscript(paste0("./analysis/",opt$g,"/pc-score/PCS_Stress.eps"))
plot <- DimPlot(object=sc10x.Group,reduction.use="Stress",pt.size=2.5,do.return=TRUE,vector.friendly=FALSE) plot <- DimPlot(object=sc10x.Group,reduction.use="Stress",pt.size=2.5,do.return=TRUE,vector.friendly=FALSE)
plot <- plot+geom_density2d(color="black",bins=25,alpha=0.5) plot <- plot+geom_density2d(color="black",bins=25,alpha=0.5)
...@@ -74,19 +74,19 @@ plot <- plot+guides(colour=guide_legend(override.aes=list(size=10))) ...@@ -74,19 +74,19 @@ plot <- plot+guides(colour=guide_legend(override.aes=list(size=10)))
plot(plot) plot(plot)
dev.off() dev.off()
#find first turning point on a KDE of Stress1 & Stress2 #find first turning point on a KDE of Stress1
d1 <- density(GetCellEmbeddings(object=sc10x.Group,reduction.type="Stress",dims.use=1),n=1000) d1 <- density(GetCellEmbeddings(object=sc10x.Group,reduction.type="Stress",dims.use=1),n=1000)
d2 <- density(GetCellEmbeddings(object=sc10x.Group,reduction.type="Stress",dims.use=2),n=1000) #d2 <- density(GetCellEmbeddings(object=sc10x.Group,reduction.type="Stress",dims.use=2),n=1000)
ts_1 <- ts(d1$y) ts_1 <- ts(d1$y)
ts_2 <- ts(d2$y) #ts_2 <- ts(d2$y)
tp1 <- turnpoints(ts_1) tp1 <- turnpoints(ts_1)
tp2 <- turnpoints(ts_2) #tp2 <- turnpoints(ts_2)
pit1 <- min(d1$x[tp1$pits]) pit1 <- min(d1$x[tp1$pits])
pit2 <- min(d2$x[tp2$pits]) #pit2 <- min(d2$x[tp2$pits])
#plot clusters #plot clusters
ALL <- GetCellEmbeddings(object=sc10x.Group,reduction.type="Stress",dims.use=1:2) ALL <- GetCellEmbeddings(object=sc10x.Group,reduction.type="Stress",dims.use=1:2)
Stress <- rownames(ALL[ALL[,1]>pit1 | ALL[,2]>pit2,]) Stress <- rownames(ALL[ALL[,1]>pit1)
sc10x.Group <- SetAllIdent(object=sc10x.Group,id="ALL") sc10x.Group <- SetAllIdent(object=sc10x.Group,id="ALL")
sc10x.Group <- SetIdent(object=sc10x.Group,cells.use=Stress,ident.use="Stress") sc10x.Group <- SetIdent(object=sc10x.Group,cells.use=Stress,ident.use="Stress")
postscript(paste0("./analysis/",opt$g,"/pc-score/PCS_Stress.Group.eps")) postscript(paste0("./analysis/",opt$g,"/pc-score/PCS_Stress.Group.eps"))
......
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