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

Fix output for plotIdentGroup

parent 40fb67f5
1 merge request!1Resolve "Fix outputs to GUDMAP/RBK standards"
process {
executor = 'local'
// Process specific configuration
}
trace {
enabled = true
file = 'pipeline_trace.txt'
fields = 'task_id,native_id,process,name,status,exit,submit,start,complete,duration,realtime,%cpu,%mem,rss'
}
timeline {
enabled = true
file = 'timeline.html'
}
report {
enabled = true
file = 'report.html'
}
tower {
accessToken = '3ade8f325d4855434b49aa387421a44c63e3360f'
enabled = true
}
singularity {
enabled = true
cacheDir = '/project/shared/bicf_workflow_ref/singularity_images/'
}
env {
http_proxy = 'http://proxy.swmed.edu:3128'
https_proxy = 'http://proxy.swmed.edu:3128'
all_proxy = 'http://proxy.swmed.edu:3128'
}
profiles {
standard {
includeConfig 'conf/biohpc.config'
includeConfig 'conf/biohpc_local.config'
}
}
......@@ -19,15 +19,17 @@ rm(option_list)
id <- read.csv(paste0("./group_",opt$g,".csv"),header=FALSE)
names(id)[2] <- opt$g
#Create output folders
if (!dir.exists(paste0("./",opt$g))){
dir.create(paste0("./",opt$g))
}
#Load dr and plot
if (opt$t == TRUE){
dr.tsne <- read.csv(paste0("./dr_tSNE.csv"),header=TRUE)
colnames(dr.tsne)[1] <- "Cells"
dr.tsne <- merge(x=dr.tsne,y=id,by.x="Cells",by.y="V1",all.x=TRUE)
if (!dir.exists("./tsne")){
dir.create("./tsne")
}
png(paste0("./tsne/ClusterGroup_tSNE_",opt$g,".png"),width=500,height=500,bg="white")
png(paste0("./",opt$g,"/tSNE.png"),width=500,height=500,bg="white")
plot(ggplot(dr.tsne,aes_string(x="tSNE_1",y="tSNE_2",col=opt$g))+geom_point(size=2)+labs(col="ID")+theme_cowplot())
dev.off()
}
......@@ -35,10 +37,7 @@ if (opt$u == TRUE){
dr.umap <- read.csv(paste0("./dr_UMAP.csv"),header=TRUE)
colnames(dr.umap)[1] <- "Cells"
dr.umap <- merge(x=dr.umap,y=id,by.x="Cells",by.y="V1",all.x=TRUE)
if (!dir.exists("./umap")){
dir.create("./umap")
}
png(paste0("./umap/ClusterGroup_UMAP_",opt$g,".png"),width=500,height=500,bg="white")
png(paste0("./",opt$g,"/UMAP.png"),width=500,height=500,bg="white")
plot(ggplot(dr.umap,aes_string(x="UMAP_1",y="UMAP_2",col=opt$g))+geom_point(size=2)+labs(col="ID")+theme_cowplot())
dev.off()
}
\ No newline at end of file
......@@ -12,6 +12,9 @@ params.sample = 100
params.groups = "${baseDir}/../test_data/groups.txt"
params.convert = "GRCh38p5"
params.studyIID = "studyIID"
params.applicationName = "applicationName"
params.outDir = "${baseDir}/../output"
// Parse input variables
......@@ -37,8 +40,8 @@ groups_plotIdentGroup = file(params.groups).readLines()
groups_plotViolinPlot = file(params.groups)
convert = params.convert
outDir = params.outDir
logsDir = "${outDir}/Logs"
outDir = "${params.outDir}/deriva/Seq/${params.studyIID}/application_files/${params.applicationName}"
logsDir = "${params.outDir}/Logs"
/*
* createMatrix: extract cell/gene matrix from Seurat object
......@@ -74,7 +77,6 @@ process createMatrix {
*/
process createGroup {
tag "${group_createGroup}"
publishDir "${outDir}/matrix", mode: 'copy', overwrite: true
input:
file rda_createGroup
......@@ -105,7 +107,6 @@ id.into {
*/
process renameGenes {
tag "NCBI"
publishDir "${outDir}/matrix", mode: 'copy', overwrite: false
input:
file matrixRaw
......@@ -147,7 +148,7 @@ matrixFinal.into {
*/
process plotIdentGroup {
tag "${group_plotIdentGroup}"
publishDir "${outDir}/png/IdentGroup", mode: 'move', overwrite: true
publishDir "${outDir}", mode: 'move', overwrite: true
input:
file matrix_plotIdentGroup
......@@ -224,4 +225,4 @@ process plotViolinBox {
done < groups.txt
wait
"""
}
}
\ No newline at end of file
#!/usr/bin/env nextflow
// Define input variables
params.rda = "${baseDir}/../test_data/sc10x.rda"
params.seurat = "sc10x"
params.tsne = true
params.umap = true
params.assay = "RNA"
params.slot = "scale.data"
params.scale = true
params.sample = 100
params.groups = "${baseDir}/../test_data/groups.txt"
params.convert = "GRCh38p5"
params.studyIID = "studyIID"
params.applicationName = "applicationName"
params.outDir = "${baseDir}/../output"
// Parse input variables
rda = Channel.fromPath(params.rda)
rda.into {
rda_createMatrix
rda_createGroup
}
seurat_createMatrix = params.seurat
seurat_createGroup = params.seurat
tsne_createMatrix = params.tsne
tsne_plotIdentGroup = params.tsne
tsne_plotFeature = params.tsne
umap_createMatrix = params.umap
umap_plotIdentGroup = params.umap
umap_plotFeature = params.umap
assay = params.assay
slot = params.slot
scale = params.scale
sample = params.sample
groups_createGroup = file(params.groups).readLines()
groups_plotIdentGroup = file(params.groups).readLines()
groups_plotViolinPlot = file(params.groups)
convert = params.convert
outDir = "${params.outDir}/deriva/Seq/${params.studyIID}/application_files/${params.applicationName}"
logsDir = "${params.outDir}/Logs"
/*
* createMatrix: extract cell/gene matrix from Seurat object
*/
process createMatrix {
tag "${seurat_createMatrix}"
input:
file rda_createMatrix
val seurat_createMatrix
val tsne_createMatrix
val umap_createMatrix
val assay
val slot
val scale
val sample
output:
file("matrix/*") into matrixRaw
file("cells.csv") into cells
script:
"""
hostname
ulimit -a
module load seurat/3.0.0
seurat-Rscript ${baseDir}/scripts/createMatrix.R --r ${rda_createMatrix} --o ${seurat_createMatrix} --t ${tsne_createMatrix} --u ${umap_createMatrix} --a ${assay} --s ${slot} --l ${scale} --p ${sample}
"""
}
/*
* createGroup: extract ident groups from Seurat object
*/
process createGroup {
tag "${group_createGroup}"
input:
file rda_createGroup
val seurat_createGroup
each group_createGroup from groups_createGroup
file cells
output:
file("*") into id
script:
"""
hostname
ulimit -a
module load seurat/3.0.0
seurat-Rscript ${baseDir}/scripts/createGroup.R --r ${rda_createGroup} --o ${seurat_createGroup} --g ${group_createGroup}
"""
}
//Duplicate group IDs
id.into {
id_plotIdentGroup
id_plotViolinBox
}
/*
* renameGenes: convert gene symbols to NCBI ID's for GUDMAP/RBK
*/
process renameGenes {
tag "NCBI"
input:
file matrixRaw
val convert
output:
file("*") into matrixFinal
file("genes.csv") into genes
script:
if (convert == "NO"){
"""
hostname
ulimit -a
cp -R ./raw/*.mtx .
cp -R ./raw/*.csv .
"""
} else {
"""
hostname
ulimit -a
cp -R ./raw/*.csv .
module load seurat/3.0.0
seurat-Rscript ${baseDir}/scripts/renameGenes.R --g ${convert}
"""
}
}
// Duplicate matrix files
matrixFinal.into {
matrix_plotIdentGroup
matrix_plotFeature
matrix_plotViolinBox
}
/*
* plotIdentGroup: plot identity groups in reduced dimensions
*/
process plotIdentGroup {
tag "${group_plotIdentGroup}"
publishDir "${outDir}", mode: 'move', overwrite: true
input:
file matrix_plotIdentGroup
file("*") from id_plotIdentGroup.collect()
each group_plotIdentGroup from groups_plotIdentGroup
val tsne_plotIdentGroup
val umap_plotIdentGroup
output:
file("**/*.png") into plotsIdentGroup
script:
"""
hostname
ulimit -a
module load seurat/3.0.0
seurat-Rscript ${baseDir}/scripts/plotIdentGroup.R --g ${group_plotIdentGroup} --t ${tsne_plotIdentGroup} --u ${umap_plotIdentGroup}
"""
}
\ No newline at end of file
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