Skip to content

Commit 48a1b2f

Browse files
committed
Split pipeline into two independent steps.
There's now a `--workflow` parameter that allows to select between `build_atlas` and `downstream_analyses`. Closes #24.
1 parent f13125c commit 48a1b2f

14 files changed

+125
-76
lines changed

conf/modules.config renamed to conf/build_atlas.config

Lines changed: 2 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ process {
113113
mode: params.publish_dir_mode
114114
]
115115
}
116-
withName: "annotate_dataset:SPLIT_ANNDATA" {
116+
withName: ".*annotate_dataset:SPLIT_ANNDATA" {
117117
container = "containers/pircher-sc-integrate2_centos7.sif"
118118
}
119119
withName: ".*:NEIGHBORS_LEIDEN_UMAP_CELL_TYPES:MERGE_UMAP_LEIDEN" {
@@ -140,7 +140,7 @@ process {
140140
mode: params.publish_dir_mode
141141
]
142142
}
143-
withName: "annotate_dataset:EXPORT_ATLAS" {
143+
withName: ".*annotate_dataset:EXPORT_ATLAS" {
144144
container = "containers/pircher-sc-integrate2_centos7.sif"
145145
ext.kernel = "python3"
146146
publishDir = [
@@ -149,51 +149,6 @@ process {
149149
]
150150
}
151151

152-
/***************************************************
153-
* SCISSOR
154-
***************************************************/
155-
156-
withName: "scissor:SPLIT_ANNDATA" {
157-
container = "containers/pircher-sc-integrate2_centos7.sif"
158-
publishDir = [
159-
path: "${params.outdir}/scissor/adata_by_sample",
160-
mode: params.publish_dir_mode
161-
]
162-
}
163-
withName: "scissor:H5AD_TO_SCE" {
164-
publishDir = [
165-
path: "${params.outdir}/scissor/adata_by_sample",
166-
mode: params.publish_dir_mode
167-
]
168-
}
169-
withName: "scissor:SCISSOR" {
170-
errorStrategy = 'ignore'
171-
conda = "/data/scratch/sturm/conda/envs/2020-pircher-scissor"
172-
publishDir = [
173-
path: "${params.outdir}/scissor/scissor_by_sample",
174-
mode: params.publish_dir_mode
175-
]
176-
}
177-
178-
179-
/***************************************************
180-
* DE TUMOR/NORMAL
181-
***************************************************/
182-
183-
withName: "de_tumor_normal:PREPARE_FOR_DE" {
184-
ext.kernel = "python3"
185-
container = "containers/pircher-sc-integrate2_centos7.sif"
186-
publishDir = [
187-
path: "${params.outdir}/de_tumor_normal/41_prepare_for_de",
188-
mode: params.publish_dir_mode
189-
]
190-
}
191-
withName: "de_tumor_normal:DE_EDGER_TUMOR_NORMAL" {
192-
publishDir = [
193-
path: "${params.outdir}/de_tumor_normal/de_edger",
194-
mode: params.publish_dir_mode
195-
]
196-
}
197152

198153
}
199154

conf/downstream_analyses.config

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
process {
2+
3+
/***************************************************
4+
* SCISSOR
5+
***************************************************/
6+
7+
withName: ".*scissor:SPLIT_ANNDATA" {
8+
container = "containers/pircher-sc-integrate2_centos7.sif"
9+
publishDir = [
10+
path: "${params.outdir}/scissor/adata_by_sample",
11+
mode: params.publish_dir_mode
12+
]
13+
}
14+
withName: ".*scissor:H5AD_TO_SCE" {
15+
publishDir = [
16+
path: "${params.outdir}/scissor/adata_by_sample",
17+
mode: params.publish_dir_mode
18+
]
19+
}
20+
withName: ".*scissor:SCISSOR" {
21+
errorStrategy = 'ignore'
22+
conda = "/data/scratch/sturm/conda/envs/2020-pircher-scissor"
23+
publishDir = [
24+
path: "${params.outdir}/scissor/scissor_by_sample",
25+
mode: params.publish_dir_mode
26+
]
27+
}
28+
29+
30+
/***************************************************
31+
* DE TUMOR/NORMAL
32+
***************************************************/
33+
34+
withName: ".*de_tumor_normal:PREPARE_FOR_DE" {
35+
ext.kernel = "python3"
36+
container = "containers/pircher-sc-integrate2_centos7.sif"
37+
publishDir = [
38+
path: "${params.outdir}/de_tumor_normal/41_prepare_for_de",
39+
mode: params.publish_dir_mode
40+
]
41+
}
42+
withName: ".*de_tumor_normal:DE_EDGER_TUMOR_NORMAL" {
43+
publishDir = [
44+
path: "${params.outdir}/de_tumor_normal/de_edger",
45+
mode: params.publish_dir_mode
46+
]
47+
}
48+
49+
}
50+

main.nf

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
#!/usr/bin/env nextflow
22

3-
@Grab('com.xlson.groovycsv:groovycsv:1.3')
4-
import static com.xlson.groovycsv.CsvParser.parseCsv
5-
63
nextflow.enable.dsl = 2
7-
assert params.input: "Input samplesheet not specified!"
84

9-
include { integrate_datasets } from "./workflows/integrate_datasets.nf"
10-
include { annotate_dataset } from "./workflows/annotate_dataset.nf"
11-
include { de_tumor_normal } from "./workflows/de_tumor_normal.nf"
12-
include { scissor } from "./workflows/scissor.nf"
5+
include { build_atlas } from "./workflows/build_atlas.nf"
6+
include { downstream_analyses } from "./workflows/downstream_analyses.nf"
137

148
workflow {
15-
integrate_datasets()
16-
annotate_dataset(integrate_datasets.out.adata_integrated)
17-
de_tumor_normal(annotate_dataset.out.final_atlas)
18-
scissor(annotate_dataset.out.final_atlas)
19-
}
209

10+
if(params.workflow == "build_atlas") {
11+
build_atlas()
12+
} else if (params.workflow == "downstream_analyses") {
13+
downstream_analyses()
14+
} else {
15+
assert False: "Invalid --workflow parameter"
16+
}
17+
18+
}

nextflow.config

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
params {
2-
input = "${baseDir}/tables/samplesheet_scrnaseq_preprocessing.csv"
3-
outdir = "data/20_integrate_scrnaseq_data"
42
publish_dir_mode = "link"
53
singularity_pull_docker_container = false
64
}
@@ -14,4 +12,8 @@ process {
1412
clusterOptions = '-V -S /bin/bash -q all.q@apollo-0[0-9]'
1513
}
1614

17-
includeConfig 'conf/modules.config'
15+
if (params.workflow == "build_atlas") {
16+
includeConfig 'conf/build_atlas.config'
17+
} else {
18+
includeConfig 'conf/downstream_analyses.config'
19+
}

run_build_atlas.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/bash
2+
3+
nextflow run main.nf --workflow build_atlas \
4+
--input ./tables/samplesheet_scrnaseq_preprocessing.csv \
5+
--outdir ./data/20_build_atlas \
6+
-resume \
7+
-profile icbi \
8+
-w /data/scratch/sturm/projects/2020/pircher-scrnaseq-lung/atlas

run_downstream_analyses.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/bash
2+
3+
nextflow run main.nf --workflow downstream_analyses \
4+
--atlas /data/projects/2020/Pircher-scRNAseq-lung/20_integrate_scrnaseq_data/annotate_datasets/35_final_atlas/artifacts/full_atlas_annotated.h5ad \
5+
--outdir ./data/30_downstream_analyses \
6+
-resume \
7+
-profile icbi \
8+
-w /data/scratch/sturm/projects/2020/pircher-scrnaseq-lung/downstream

run_pipeline.sh

Lines changed: 0 additions & 6 deletions
This file was deleted.

workflows/annotate_dataset.nf renamed to subworkflows/annotate_dataset.nf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ include { JUPYTERNOTEBOOK as ANNOTATE_CELL_TYPES_COARSE } from "../modules/loca
33
include { JUPYTERNOTEBOOK as ANNOTATE_CELL_TYPES_FINE } from "../modules/local/jupyternotebook/main.nf"
44
include { JUPYTERNOTEBOOK as ANNOTATE_CELL_TYPES_EPI } from "../modules/local/jupyternotebook/main.nf"
55
include { SPLIT_ANNDATA } from "../modules/local/scconversion/main.nf"
6-
include { NEIGHBORS_LEIDEN_UMAP as NEIGHBORS_LEIDEN_UMAP_CELL_TYPES } from "../subworkflows/neighbors_leiden_umap/main.nf"
6+
include { NEIGHBORS_LEIDEN_UMAP as NEIGHBORS_LEIDEN_UMAP_CELL_TYPES } from "./neighbors_leiden_umap.nf"
77
include { JUPYTERNOTEBOOK as EXPORT_ATLAS } from "../modules/local/jupyternotebook/main.nf"
88

99
/**

workflows/de_tumor_normal.nf renamed to subworkflows/de_tumor_normal.nf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ workflow de_tumor_normal {
1616
file("${baseDir}/analyses/40_de_tumor_normal/41_prepare_de_analysis.py")
1717
]),
1818
[
19-
"input_adata": "full_atlas_annotated.h5ad",
19+
"input_adata": adata_annotated.name,
2020
],
2121
adata_annotated
2222
)

workflows/integrate_datasets.nf renamed to subworkflows/integrate_datasets.nf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@ include { check_samplesheet } from '../modules/local/check_samplesheet'
33
include { SCQC } from "../modules/local/scqc/main"
44
include { SCQC_MERGE_STATS } from "../modules/local/scqc_merge_stats/main.nf"
55
include { SCVI as SCVI_SEED } from "../modules/local/scvi/main.nf"
6-
include { NEIGHBORS_LEIDEN_UMAP as NEIGHBORS_LEIDEN_UMAP_SEED } from "../subworkflows/neighbors_leiden_umap/main.nf"
6+
include { NEIGHBORS_LEIDEN_UMAP as NEIGHBORS_LEIDEN_UMAP_SEED } from "./neighbors_leiden_umap.nf"
77
include { JUPYTERNOTEBOOK as ANNOTATE_SEED } from "../modules/local/jupyternotebook/main.nf"
88

99

1010
include { JUPYTERNOTEBOOK as MERGE_ALL } from "../modules/local/jupyternotebook/main.nf"
1111
include { SCVI } from "../modules/local/scvi/main.nf"
1212
include { SCANVI } from "../modules/local/scvi/main.nf"
1313
include { SOLO } from "../modules/local/solo/main.nf"
14-
include { NEIGHBORS_LEIDEN_UMAP as NEIGHBORS_LEIDEN_UMAP_DOUBLET } from "../subworkflows/neighbors_leiden_umap/main.nf"
14+
include { NEIGHBORS_LEIDEN_UMAP as NEIGHBORS_LEIDEN_UMAP_DOUBLET } from "./neighbors_leiden_umap.nf"
1515
include { JUPYTERNOTEBOOK as MERGE_SOLO } from "../modules/local/jupyternotebook/main.nf"
16-
include { NEIGHBORS_LEIDEN_UMAP as NEIGHBORS_LEIDEN_UMAP_NODOUBLET } from "../subworkflows/neighbors_leiden_umap/main.nf"
16+
include { NEIGHBORS_LEIDEN_UMAP as NEIGHBORS_LEIDEN_UMAP_NODOUBLET } from "./neighbors_leiden_umap.nf"
1717

1818

1919
/**

0 commit comments

Comments
 (0)