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

Fix NE score from using stress score

parent e86b3163
No related merge requests found
...@@ -816,7 +816,7 @@ scNE <- function(sc10x,neg="EurUro",cut=0.95){ ...@@ -816,7 +816,7 @@ scNE <- function(sc10x,neg="EurUro",cut=0.95){
sc10x <- SetDimReduction(object=sc10x,reduction.type="NE",slot="cell.embeddings",new.data=sc10x.NE.pca) sc10x <- SetDimReduction(object=sc10x,reduction.type="NE",slot="cell.embeddings",new.data=sc10x.NE.pca)
sc10x <- SetDimReduction(object=sc10x,reduction.type="NE",slot="key",new.data="NE") sc10x <- SetDimReduction(object=sc10x,reduction.type="NE",slot="key",new.data="NE")
#Generate PCA PC1 (Stress1/Stress-Score) and PC2 (Stress2) #Generate PCA PC1 (NE1/NE-Score) and PC2 (NE2)
postscript("./analysis/pca/ne/PCA.eps") postscript("./analysis/pca/ne/PCA.eps")
plot <- DimPlot(object=sc10x,reduction.use="NE",pt.size=2.5,do.return=TRUE,vector.friendly=FALSE) plot <- DimPlot(object=sc10x,reduction.use="NE",pt.size=2.5,do.return=TRUE,vector.friendly=FALSE)
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),legend.text=element_text(size=20)) 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),legend.text=element_text(size=20))
...@@ -824,15 +824,15 @@ scNE <- function(sc10x,neg="EurUro",cut=0.95){ ...@@ -824,15 +824,15 @@ scNE <- function(sc10x,neg="EurUro",cut=0.95){
plot(plot) plot(plot)
dev.off() dev.off()
#CDS #CDF
cdf <- ecdf(GetCellEmbeddings(object=sc10x,reduction.type="Stress",dims.use=1)) cdf <- ecdf(GetCellEmbeddings(object=sc10x,reduction.type="NE",dims.use=1))
cut.x <- quantile(cdf,probs=cut) cut.x <- quantile(cdf,probs=cut)
postscript("./analysis/pca/ne/CDF_NE.eps") postscript("./analysis/pca/ne/CDF_NE.eps")
plot(cdf,main="Cumulative Distribution of Stress Score",xlab="Stress Score",ylab="CDF") plot(cdf,main="Cumulative Distribution of NE Score",xlab="NE Score",ylab="CDF")
abline(v=cut.x,col="red") abline(v=cut.x,col="red")
dev.off() dev.off()
#Find first turning point on a KDE of Stress1 #Find first turning point on a KDE of NE1
postscript("./analysis/pca/ne/Histo_NE.eps") postscript("./analysis/pca/ne/Histo_NE.eps")
histo <- hist(GetCellEmbeddings(object=sc10x,reduction.type="NE",dims.use=1),breaks=100,probability=TRUE,plot=TRUE) histo <- hist(GetCellEmbeddings(object=sc10x,reduction.type="NE",dims.use=1),breaks=100,probability=TRUE,plot=TRUE)
d1 <- density(GetCellEmbeddings(object=sc10x,reduction.type="NE",dims.use=1),n=100) d1 <- density(GetCellEmbeddings(object=sc10x,reduction.type="NE",dims.use=1),n=100)
......
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