Commit e3622098 authored by Gervaise H. Henry's avatar Gervaise H. Henry 🤠

Cleanup

parent 638318de
......@@ -25,4 +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
Rscript ../r.scripts/SingleR.R --p "$1" --s "$2" --o "$3"
if [ "$1" == "PdPgb" | "$1" == "PdPb" ]
then
Rscript ../r.scripts/SingleR.R --p "$1" --s "$2" --o "$3"
elif [ "$3" == "epi" | "$3" == "fmst" ]
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" ]
then
Rscript ../r.scripts/diy_PdPgb.R
elif [ "$3" == "epi" ]
then
Rscript ../r.scripts/diy_muPrUr_Epi.R
fi
......@@ -13,5 +13,4 @@ module load python/3.6.4-anaconda
source activate umap
module load R/3.6.1-gccmkl
module load hdf5_18/1.8.17
Rscript ../r.scripts/SingleR.R --p "$1" --s "$2" --o "$3"
#!/bin/bash
#SBATCH --job-name sc10x.shiny
#SBATCH -p super
#SBATCH --job-name sc10x.id_orth
#SBATCH -p 128GB,256GB,256GBv1,384GB
#SBATCH -N 1
#SBATCH -t 7-0:0:0
#SBATCH -o job_%j.out
......@@ -13,5 +13,4 @@ module load python/3.6.4-anaconda
source activate umap
module load R/3.6.1-gccmkl
module load hdf5_18/1.8.17
Rscript ../r.scripts/Shiny.R --p "$1"
Rscript ../r.scripts/huPr_muPr.R --p "$1" --r "$3"
......@@ -13,5 +13,4 @@ module load python/3.6.4-anaconda
source activate umap
module load R/3.5.1-gccmkl
module load hdf5_18/1.8.17
Rscript ../r.scripts/sc-TissueMapper_RUN.R --p "$1" --s "$2"
#!/bin/bash
mkdir ../analysis
mkdir ../analysis/DATA
ln -s /work/urology/ghenry/RNA-Seq/SingleCell/PIPELINE/DATA/"$1"/10x/filtered_gene_bc_matrices_mex/GRCh38/* ../analysis/DATA/
ln -s /work/urology/ghenry/RNA-Seq/SingleCell/PIPELINE/DATA/ANALYSIS/"$1"/sc10x.Pr.ALL.cluster.NOStress.IDepi+st+ne.Merge.Rda ../analysis/DATA/sc10x.data.Rda
mkdir ../analysis/CI.TestData.downsample
mkdir ../analysis/CI.TestData.downsample/10x
mkdir ../analysis/CI.TestData.downsample/10x/filtered_gene_bc_matrices_mex
mkdir ../analysis/CI.TestData.downsample/10x/filtered_gene_bc_matrices_mex/GRCh38
cp /work/urology/ghenry/RNA-Seq/SingleCell/PIPELINE/DATA/"$1"/"$1"-demultiplex.csv ../analysis/CI.TestData.downsample/"$1"-demultiplex.csv
cp /work/urology/ghenry/RNA-Seq/SingleCell/PIPELINE/DATA/"$1"/10x/"$1"-aggr.csv ../analysis/CI.TestData.downsample/10x/"$1"-aggr.csv
\ No newline at end of file
gc()
library(methods)
library(optparse)
library(Seurat)
library(readr)
library(readxl)
library(fBasics)
library(pastecs)
library(qusage)
library(RColorBrewer)
library(dplyr)
library(viridis)
library(gridExtra)
library(SingleR)
library(sctransform)
library(autothresholdr)
library(ggplot2)
options(bitmapType="cairo")
option_list=list(
make_option("--p",action="store",default="Biopsy",type='character',help="Project Name")
)
opt=parse_args(OptionParser(option_list=option_list))
rm(option_list)
setwd("../")
source("./r.scripts/sc-TissueMapper_functions.R")
source("./r.scripts/sc-TissueMapper_process.R")
scFolders()
load(paste0("/work/urology/ghenry/RNA-Seq/SingleCell/PIPELINE/RUN/",opt$p,"/analysis/sc10x.id.rda"))
res <- c(seq(0.1,0.5,0.1),0.75,seq(1,5,1))
#scShinyOutput(sc10x,anal="id")
scShinyOutput(sc10x.epi,anal="id.epi")
scShinyOutput(sc10x.fmst,anal="id.fmst")
scShinyOutput(sc10x.st,anal="id.st")
scShinyOutput(sc10x.leu,anal="id.leu")
This diff is collapsed.
# genes.leu <- read_excel("./genesets/40425_2017_215_MOESM1_ESM.xlsx",sheet="S3. Candidate markers")
# leu <- as.list(unique(genes.leu[,2]))$Cell
# leu <- leu[-c(9,17,20,24,26,28)]
# #leu.l <- leu[-c(1,3:4,7:8,13:18,21,20:30)]
# #leu.lin <- c("Myeloid","Lymphoid","Lymphoid","Lymphoid","Myeloid","Myeloid","Lymphoid","Myeloid","Myeloid","Myeloid","Myeloid","Myeloid","Lymphoid","Lymphoid","Lymphoid","Myeloid","Lymphoid","Lymphoid","Lymphoid","Lymphoid","Lymphoid","Lymphoid","Lymphoid","Lymphoid","Lymphoid","Lymphoid","Lymphoid")
# #leu.lin <- c("Lymphoid","Myeloid","Myeloid","Myeloid","Myeloid","Myeloid","Myeloid","Lymphoid")
# genes.leu <- genes.leu[unlist(genes.leu[,2]) %in% unlist(leu),]
# #genes.leu.l <- genes.leu[unlist(genes.leu[,2]) %in% unlist(leu.l),]
# #genes.leu.l[nrow(genes.leu.l)+1,] <- list("MS4A7","Macrophages",0)
# #genes.leu.l[nrow(genes.leu.l)+1,] <- list("CD14","Macrophages",0)
# # genes.leu.l[nrow(genes.leu.l)+1,] <- list("CD86","Macrophages",0)
# # genes.leu.l[nrow(genes.leu.l)+1,] <- list("S100A9","Neutrophils",0)
# # genes.leu.l[nrow(genes.leu.l)+1,] <- list("EREG","Neutrophils",0)
# # genes.leu.l[nrow(genes.leu.l)+1,] <- list("S100A8","Neutrophils",0)
# # genes.leu.l[nrow(genes.leu.l)+1,] <- list("FCN1","Neutrophils",0)
# gene.set1 <- split(genes.leu[,1], genes.leu[,2])
# #gene.set1 <- split(genes.leu.l[,1], genes.leu.l[,2])
# gene.set1 <- lapply(gene.set1,unname)
# gene.set1 <- lapply(gene.set1,unlist)
# #names(gene.set1) <- leu.lin
# names(gene.set1) <- leu
# gene.set <- c(gene.set,gene.set1)
write.csv(GetAssayData(sc10x,assay="RNA"),file=paste0("./analysis/",project.name,".csv"))
library(tidyverse)
library(readxl)
library(genefilter)
library(jsonlite)
library(SingleR)
load("/work/urology/ghenry/RNA-Seq/SingleCell/PIPELINE/RUN/Pd/PUBLISH/Pd/sc-TissueMapper_Pr/analysis/sc10x.Rda")
sc10x <- UpdateSeuratObject(sc10x)
Idents(object=sc10x) <- "Merge_Epi.dws_St.go_NE"
sc10x <- RenameIdents(object=sc10x,"OE1"="Club")
sc10x <- RenameIdents(object=sc10x,"OE2"="Hillock")
name = 'scDWS'
expr = as.matrix(GetAssayData(object = sc10x))
types = as.character(as.character(sc10x@active.ident))
main_types = types
main_types = gsub("BE","Epi",main_types)
main_types = gsub("LE","Epi",main_types)
main_types = gsub("Club","Epi",main_types)
main_types = gsub("Hillock","Epi",main_types)
main_types = gsub("NE","Epi",main_types)
main_types = gsub("Fib","FMSt",main_types)
main_types = gsub("SM","FMSt",main_types)
ref = list(name=name,data = expr, types=types, main_types=main_types)
ref$de.genes = CreateVariableGeneSet(expr,types,200)
ref$de.genes.main = CreateVariableGeneSet(expr,main_types,300)
scDWS.lin <- ref
save(scDWS.lin,file='./genesets/scDWS.lin.rda')
Idents(object=sc10x) <- "Merge_Epi.dws_St.go_NE"
sc10x <- RenameIdents(object=sc10x,"OE1"="Club")
sc10x <- RenameIdents(object=sc10x,"OE2"="Hillock")
name = 'scDWS'
expr = as.matrix(GetAssayData(object = sc10x))
types = as.character(as.character(sc10x@active.ident))
main_types = types
main_types = gsub("BE","Epi",main_types)
main_types = gsub("LE","Epi",main_types)
main_types = gsub("Club","Epi",main_types)
main_types = gsub("Hillock","Epi",main_types)
main_types = gsub("NE","Epi",main_types)
main_types = gsub("Fib","FMSt",main_types)
main_types = gsub("SM","FMSt",main_types)
ref = list(name=name,data = expr, types=types, main_types=main_types)
ref.10 <- ref
ref.50 <- ref
ref.100 <- ref
ref.200 <- ref
ref.250 <- ref
ref.10$de.genes = CreateVariableGeneSet(expr,types,10)
ref.10$de.genes.main = CreateVariableGeneSet(expr,main_types,10)
ref.50$de.genes = CreateVariableGeneSet(expr,types,50)
ref.50$de.genes.main = CreateVariableGeneSet(expr,main_types,50)
ref.100$de.genes = CreateVariableGeneSet(expr,types,100)
ref.100$de.genes.main = CreateVariableGeneSet(expr,main_types,100)
ref.200$de.genes = CreateVariableGeneSet(expr,types,200)
ref.200$de.genes.main = CreateVariableGeneSet(expr,main_types,200)
ref.250$de.genes = CreateVariableGeneSet(expr,types,250)
ref.250$de.genes.main = CreateVariableGeneSet(expr,main_types,250)
scDWS.10 <- ref.10
scDWS.50 <- ref.50
scDWS.100 <- ref.100
scDWS.200 <- ref.200
scDWS.250 <- ref.250
save(scDWS.10,file='./genesets/scDWS.10.rda')
save(scDWS.50,file='./genesets/scDWS.50.rda')
save(scDWS.100,file='./genesets/scDWS.100.rda')
save(scDWS.200,file='./genesets/scDWS.200.rda')
save(scDWS.250,file='./genesets/scDWS.250.rda')
Idents(object=sc10x) <- "Merge_Epi.dws_St.go_NE"
sc10x.epi <- subset(sc10x,idents=c("BE","LE","OE1","OE2","NE"))
sc10x.epi <- RenameIdents(object=sc10x.epi,"OE1"="Club")
sc10x.epi <- RenameIdents(object=sc10x.epi,"OE2"="Hillock")
name = 'scDWS.epi'
expr = as.matrix(GetAssayData(object = sc10x.epi))
types = as.character(as.character(sc10x.epi@active.ident))
main_types = types
main_types = gsub("BE","Epi",main_types)
main_types = gsub("LE","Epi",main_types)
main_types = gsub("Club","Epi",main_types)
main_types = gsub("Hillock","Epi",main_types)
main_types = gsub("NE","Epi",main_types)
ref = list(name=name,data = expr, types=types, main_types=main_types)
ref$de.genes = CreateVariableGeneSet(expr,types,200)
ref$de.genes.main = CreateVariableGeneSet(expr,main_types,300)
scDWS.epi <- ref
save(scDWS.epi,file='./genesets/scDWS.epi.rda')
Idents(object=sc10x) <- "Merge_Epi.dws_St.go_NE"
sc10x.fmst <- subset(sc10x,idents=c("Fib","SM"))
name = 'scDWS.fmst'
expr = as.matrix(GetAssayData(object = sc10x.fmst))
types = as.character(as.character(sc10x.fmst@active.ident))
main_types = types
main_types = gsub("Fib","FMSt",main_types)
main_types = gsub("SM","FMSt",main_types)
ref = list(name=name,data = expr, types=types, main_types=main_types)
ref$de.genes = CreateVariableGeneSet(expr,types,200)
ref$de.genes.main = CreateVariableGeneSet(expr,main_types,300)
scDWS.fmst <- ref
save(scDWS.fmst,file='./genesets/scDWS.fmst.rda')
cibersort <- read_excel("./genesets/nmeth.3337-S2.xls",sheet="SuppTable1_GEP_Matrix",skip=13)
cibersort <- as_data_frame(as.matrix(cibersort))
cibersort <- cibersort[,-c(1,2)]
cibersort <- column_to_rownames(cibersort, var = "Gene symbol")
colnames(cibersort) <- gsub(" ","_",colnames(cibersort))
cibersort.main <- read_excel("./genesets/nmeth.3337-S2.xls",sheet="SuppTable1_GEP_Matrix",range="D12:Y12",col_names=FALSE)
cibersort.main <- as.character(cibersort.main[1,])
for (i in 1:22){
if (cibersort.main[i]=="NA"){
for (j in seq(i,1,-1)){
if (cibersort.main[j]!="NA"){
cibersort.main[i] <- cibersort.main[j]
break
}
}
}
}
cibersort.main <- gsub(" ","_",cibersort.main)
name = 'cibersort'
expr <- mapply(cibersort, FUN=as.numeric)
expr <- matrix(data=expr,ncol=ncol(cibersort),nrow=nrow(cibersort))
rownames(expr) <- rownames(cibersort)
colnames(expr) <- colnames(cibersort)
types = as.character(colnames(cibersort))
main_types = cibersort.main
ref = list(name=name,data = expr, types=types, main_types=main_types)
ref$de.genes = CreateVariableGeneSet(expr,types,300)
ref$de.genes.main = CreateVariableGeneSet(expr,main_types,500)
cibersort <- ref
save(cibersort,file='./genesets/cibersort.rda')
#fantom5 <- read.csv("./genesets/9606_symbol.csv")
fantom5 <- read_csv("./genesets/9606_symbol.csv")
fantom5 <- as_data_frame(as.matrix(fantom5))
fantom5 <- column_to_rownames(fantom5, var = "symbol")
colnames(fantom5) <- gsub("\\..","",colnames(fantom5))
fantom5.main.oto <- read_json("./genesets/human_samples_oto.txt",simplifyVector = TRUE)
# fantom5.main.oto <- lapply(fantom5.main.oto,function(y) gsub(":",".",y))
# fantom5.main.oto <- lapply(fantom5.main.oto,function(y) gsub("-",".",y))
# fantom5.main.oto <- lapply(fantom5.main.oto,function(y) gsub(" ",".",y))
fantom5.main.oto <- lapply(fantom5.main.oto,function(x) gsub("\\..","",x))
fantom5 <- fantom5[,!(colnames(fantom5) %in% unlist(unname(unlist((fantom5.main.oto[grep("DOID",names(fantom5.main.oto))])))))]
fantom5 <- fantom5[,!(colnames(fantom5) %in% unlist(unname(unlist((fantom5.main.oto[grep("UBERON",names(fantom5.main.oto))])))))]
fantom5.main <- colnames(fantom5)
name = 'fantom5'
expr <- mapply(fantom5, FUN=as.numeric)
expr <- matrix(data=expr,ncol=ncol(fantom5),nrow=nrow(fantom5))
rownames(expr) <- rownames(fantom5)
colnames(expr) <- colnames(fantom5)
types = as.character(colnames(fantom5))
main_types = fantom5.main
ref = list(name=name,data = expr, types=types, main_types=main_types)
ref$de.genes = CreateVariableGeneSet(expr,types,200)
ref$de.genes.main = CreateVariableGeneSet(expr,main_types,300)
fantom5 <- ref
save(fantom5,file='./genesets/fantom5.rda')
\ No newline at end of file
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