diff --git a/r.scripts/sc-TissueMapper_RUN.DS_D17.R b/r.scripts/sc-TissueMapper_RUN.DS_D17.R index 5c1b927b704dae234e008e1a3da9ad73ad69d50e..b1766dc054b9bec797537e88a4d194604f7aa1d7 100644 --- a/r.scripts/sc-TissueMapper_RUN.DS_D17.R +++ b/r.scripts/sc-TissueMapper_RUN.DS_D17.R @@ -124,7 +124,6 @@ colnames(cell.codes) <- "barcodes" rownames(cell.codes) <- cell.codes$barcodes cell.codes$samples <- "All" sc10x <- CreateSeuratObject(raw.data=sc10x.data,meta.data=cell.codes["samples"],min.cells=3,min.genes=-Inf,project="DS.D17") -#sc10x <- AddMetaData(sc10x,cell.codes["samples"],"samples") rm(cell.codes) rm(sc10x.data) @@ -307,10 +306,6 @@ sc10x.Epi.NE <- scNE(sc10x.Epi,neg="dws",cut=opt$cut.ne) sc10x <- scMerge(sc10x,sc10x.Epi,sc10x.St,i.1="Epi.dws.sc",i.2="St.dws.sc",nm="Merge_Epi.dws.sc_St.dws.sc") -#sc10x <- scMerge(sc10x,sc10x,sc10x.Epi.NE,i.1="Merge_Epi.dws.sc_St.dws.sc",i.2="NE",nm="Merge_Epi.dws.sc_St.dws.sc_NE") - -#sc10x.Epi <- scMerge(sc10x.Epi,sc10x.Epi,sc10x.Epi.NE,i.1="Epi.dws.sc",i.2="NE",nm="Epi.dws.sc_NE") - sc10x <- SetAllIdent(object=sc10x,id="Merge_Epi.dws.sc_St.dws.sc") sc10x <- SetAllIdent(object=sc10x,id="Merge_Epi.dws.sc_St.dws.sc") sc10x@ident <- factor(sc10x@ident,levels=c("BE","LE","OE_SCGB","OE_KRT13","Fib","SM","Endo","Leu")) @@ -322,8 +317,6 @@ plot(plot) dev.off() scTables(sc10x,i.1="samples",i.2="Merge_Epi.dws.sc_St.dws.sc") -#scTables(sc10x,i.1="samples",i.2="Merge_Epi.dws.sc_St.dws.sc_NE") -#scTables(sc10x,i.1="Merge_Epi.dws.sc_St.dws.sc_NE",i.2="Merge_Epi.dws.sc_St.dws.sc") sctSNECustCol(sc10x,i="Lin",bl="Epi",rd="St",file="D17") sctSNECustCol(sc10x,i="Merge_Epi.dws.sc_St.dws.sc",bl=c("BE","LE","OE_SCGB","OE_KRT13"),rd=c("Fib","SM","Endo","Leu"),file="D17") @@ -344,7 +337,6 @@ for (g in c("BE","LE","OE_SCGB","OE_KRT13")){ sctSNEHighlight(sc10x,i="Merge_Epi.dws.sc_St.dws.sc",g=g,file="D17") sctSNEHighlight(sc10x.Epi,i="Epi.dws.c",g=g,file="D17") } -#sctSNEHighlight(sc10x.Epi.NE,i="NE",g="NE",file="D17") for (g in c("Fib","SM","Endo","Leu")){ sctSNEHighlight(sc10x,i="Merge_Epi.dws.sc_St.dws.sc",g=g,file="D17") sctSNEHighlight(sc10x.St,i="St.dws.sc",g=g,file="D17") diff --git a/r.scripts/sc-TissueMapper_RUN.DS_D17.aggr.R b/r.scripts/sc-TissueMapper_RUN.DS_D17.aggr.R index d960263961406b5d16c7a005edafa3620458a0dc..cac02a21cb42514e98900e8a21a90ffc2f57dadb 100755 --- a/r.scripts/sc-TissueMapper_RUN.DS_D17.aggr.R +++ b/r.scripts/sc-TissueMapper_RUN.DS_D17.aggr.R @@ -44,14 +44,12 @@ for (i in downsample){ for (i in downsample){ assign(paste0("sc10x.",i),SetAllIdent(get(paste0("sc10x.",i)),id="Merge_Epi.dws.sc_St.dws.sc")) assign(paste0("cluster.",i),data.frame(Barcodes=names(get(paste0("sc10x.",i))@ident),Cluster=get(paste0("sc10x.",i))@ident)) - #assign(paste0("cluster.",i,".filter"),get(paste0("cluster.",i))[get(paste0("cluster.",i))$Barcodes %in% shared.cells,]) assign(paste0("cluster.",i,".filter"),get(paste0("cluster.",i))[get(paste0("cluster.",i))$Barcodes %in% sc10x.All@data@Dimnames[[2]],]) } nmi <- data.frame(Sample=character(),value=double()) for (i in downsample[-1]){ nmi <- rbind(nmi,data.frame(Sample=i,value=NMI(cluster.All.filter,get(paste0("cluster.",i,".filter"))))) - #nmi <- rbind(nmi,data.frame(Sample=i,value=NMI(cluster.All.filter,get(paste0("cluster.",i))))) } nmi$Sample <- as.numeric(levels(nmi$Sample)) @@ -98,11 +96,9 @@ model <- loess(NMI~RPC,data=nmi.rpc) fit.y <- 0.9 fit.x <- approx(y=nmi.rpc$RPC,x=predict(model),xout=fit.y)$y plot.comb <- plot.comb+geom_vline(xintercept=fit.x,linetype=2,size=1.5)+geom_hline(yintercept=fit.y,linetype=2,size=1.5) -#plot.comb <- plot.comb+geom_text(aes(40000,0.5,label=paste0("Mean Read/Cell = ",round(fit.x,0)),vjust=3)) -#plot.comb <- plot.comb+geom_text(aes(40000,0.5,label=paste0("NMI = ",fit.y),vjust=1.5)) plot.comb <- plot.comb+labs(x="Mean Reads Per Cell",y="NMI") plot.comb <- plot.comb+scale_x_continuous(expand=c(0,0),limits=c(0,80000),breaks=c(seq(0,100000,25000),round(fit.x,0)))+scale_y_continuous(expand=c(0,0),limits=c(0,1),breaks=c(seq(0,1,0.2),fit.y)) plot(plot.comb) dev.off() -save.image(file="./analysis/NMI.RData") \ No newline at end of file +save.image(file="./analysis/NMI.RData")