Skip to content

Commit 0ea2655

Browse files
committed
Added profiles to nextflow.config. Docker, singularity and standard working. Added help and cool info stuff to main.nf
1 parent f4853fa commit 0ea2655

13 files changed

+1485
-14
lines changed

Dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,5 @@ RUN scif install /opt/bcftools_v1.9_centos7.scif
1919
ENV PATH=${PATH}:/scif/apps/bcftools/bin
2020

2121
# SciF Entrypoint
22-
ENTRYPOINT ["scif"]
22+
# Disabled because of compatibility with nextflow.
23+
#ENTRYPOINT ["scif"]

conf/base.config

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
* -------------------------------------------------
3+
* Nextflow base config file
4+
* -------------------------------------------------
5+
* A 'blank slate' config file, appropriate for general
6+
* use on most high performace compute environments.
7+
* Assumes that all software is installed and available
8+
* on the PATH. Runs in `local` mode - all jobs will be
9+
* run on the logged in environment.
10+
*/
11+
12+
13+
// TO-DO. Prepare configuration for local execution. Define mem, cpus, etc.

conf/docker.config

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* -------------------------------------------------
3+
* Nextflow config file for use with Docker
4+
* -------------------------------------------------
5+
* Defines basic usage limits and docker image id.
6+
* Imported under the default 'docker' Nextflow
7+
* profile in nextflow.config
8+
*/
9+
10+
docker {
11+
enabled = true
12+
}
13+
process {
14+
container = 'nextflow-scif'
15+
executor = 'local'
16+
17+
// To define
18+
//cpus = 8
19+
/* $executor.cpus*/
20+
//memory = 20G
21+
/* $executor.memory*/
22+
//time = 48.h
23+
}

conf/singularity.config

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
/*
3+
* -------------------------------------------------
4+
* Nextflow config file for use with Singularity
5+
* -------------------------------------------------
6+
* Defines basic usage limits and docker image id.
7+
* Imported under the default 'docker' Nextflow
8+
* profile in nextflow.config
9+
*/
10+
11+
singularity {
12+
enabled = true
13+
}
14+
process {
15+
// Path to container
16+
container = './nextflow-scif.simg'
17+
executor = 'local'
18+
19+
// To define
20+
//cpus = 8
21+
/* $executor.cpus*/
22+
//memory = 20G
23+
/* $executor.memory*/
24+
//time = 48.h
25+
}

main.nf

+73-8
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,60 @@
1+
/*
2+
========================================================================================
3+
N E X T F L O W B A S I C W O R K F L O W
4+
========================================================================================
5+
#### Homepage / Documentation
6+
https://github.com/BU-ISCIII/nextflow-scif
7+
@#### Authors
8+
S. Monzon <[email protected]>
9+
10+
## Based on nf-core pipelines
11+
# https://github.com/nf-core
12+
----------------------------------------------------------------------------------------
13+
----------------------------------------------------------------------------------------
14+
Pipeline overview:
15+
- 1: BWA indexing of reference genome.
16+
- 2: BWA mapping against indexed genome.
17+
- 3: Samtools sorting and indexing.
18+
- 4: Variant calling using bcftools
19+
----------------------------------------------------------------------------------------
20+
*/
21+
22+
def helpMessage() {
23+
log.info"""
24+
=========================================
25+
BU-ISCIII/nextflow-scif DEMO PIPELINE v${version}
26+
=========================================
27+
Usage:
28+
29+
The typical command for running the pipeline is as follows:
30+
31+
nextflow run BU-ISCIII/nextflow-scif -profile standard
32+
33+
Pipeline arguments:
34+
--reads Path to input data (must be surrounded with quotes).
35+
--genome Path to reference genome.
36+
--outdir Output dir.
37+
--help show this message.
38+
-profile Hardware config to use. standard/docker/singularity. Default: standard.
39+
40+
""".stripIndent()
41+
}
42+
43+
// Pipeline version
44+
version = '0.1'
45+
46+
// Show help message
47+
params.help = false
48+
if (params.help){
49+
helpMessage()
50+
exit 0
51+
}
52+
53+
// Default parameters
154
params.reads = "$baseDir/data/samples/*.fastq"
255
params.genome = "$baseDir/data/genome.fa"
356
params.outdir = 'results'
457

5-
log.info """\
6-
VARIANT CALLING TOY PIPELINE
7-
=============================
8-
genome: ${params.genome}
9-
reads : ${params.reads}
10-
outdir: ${params.outdir}
11-
"""
12-
.stripIndent()
1358

1459
/*
1560
* the reference genome file
@@ -24,6 +69,23 @@ Channel
2469
.ifEmpty { error "Cannot find any reads matching: ${params.reads}" }
2570
.set { reads }
2671

72+
73+
// Header log info
74+
log.info "========================================================="
75+
log.info " BU-ISCIII/nextflow-scif : basic nf workflow"
76+
log.info "========================================================="
77+
def summary = [:]
78+
summary['Reads'] = params.reads
79+
summary['Reference genome'] = params.genome
80+
summary['Results dir'] = params.outdir
81+
log.info summary.collect { k,v -> "${k.padRight(21)}: $v" }.join("\n")
82+
log.info "===================================="
83+
84+
85+
// Posible software version and profile checks (p.e check if standar profile is used in hpc server)
86+
// if().....
87+
88+
2789
/*
2890
* Step 1. Builds the genome index required by the mapping process
2991
*/
@@ -104,4 +166,7 @@ process variantCalling {
104166

105167
workflow.onComplete {
106168
println ( workflow.success ? "Done!" : "Oops .. something went wrong" )
169+
170+
// E-mail and html reporting configuration.
171+
107172
}

nextflow.config

+80-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,80 @@
1-
process.container = '/home/smonzon/Documents/desarrollo/builder/nexflow-scif.img'
2-
singularity.enabled = true
1+
/*
2+
* -------------------------------------------------
3+
* Nextflow config file
4+
* -------------------------------------------------
5+
* Default config options for all environments.
6+
* Cluster-specific config options should be saved
7+
* in the conf folder and imported under a profile
8+
* name here.
9+
*/
10+
11+
manifest {
12+
homePage = 'https://github.com/BU-ISCIII/nextflow-scif'
13+
description = 'This is a template project for develop and deploy nextflow pipelines with container and scif integration'
14+
mainScript = 'main.nf'
15+
}
16+
17+
// Global default params, used in configs
18+
params {
19+
version = '0.1' //Pipeline version
20+
nf_required_version = '0.27.6' //Minimum version of Nextflow required
21+
22+
reads="$baseDir/data/samples/*.fastq"
23+
genome="$baseDir/data/genome.fa"
24+
outdir='results'
25+
26+
}
27+
28+
profiles {
29+
30+
standard {
31+
includeConfig 'conf/base.config'
32+
}
33+
34+
docker {
35+
includeConfig 'conf/docker.config'
36+
}
37+
38+
singularity {
39+
includeConfig 'conf/singularity.config'
40+
}
41+
42+
hpc_isciii {
43+
// TODO. with modules.
44+
}
45+
46+
testing {
47+
// TODO
48+
}
49+
50+
aws {
51+
// TO DO
52+
}
53+
54+
none {
55+
// Don't load any config (for use with custom home configs)
56+
}
57+
58+
}
59+
60+
// Capture exit codes from upstream processes when piping
61+
process.shell = ['/bin/bash', '-euo', 'pipefail']
62+
63+
// By default output execution reports
64+
timeline {
65+
enabled = true
66+
file = "${params.outdir}/timeline.html"
67+
}
68+
report {
69+
enabled = true
70+
file = "${params.outdir}/report.html"
71+
}
72+
trace {
73+
enabled = true
74+
file = "${params.outdir}/trace.txt"
75+
}
76+
dag {
77+
enabled = true
78+
file = "${params.outdir}/DAG.svg"
79+
}
80+

results/DAG.dot

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
digraph DAG {
2+
p0 [shape=point,label="",fixedsize=true,width=0.1,xlabel="Channel.fromFilePairs"];
3+
p1 [shape=circle,label="",fixedsize=true,width=0.1,xlabel="ifEmpty"];
4+
p0 -> p1;
5+
6+
p1 [shape=circle,label="",fixedsize=true,width=0.1,xlabel="ifEmpty"];
7+
p5 [label="mapping"];
8+
p1 -> p5 [label="reads"];
9+
10+
p2 [shape=point,label="",fixedsize=true,width=0.1];
11+
p3 [label="makeBWAindex"];
12+
p2 -> p3 [label="fasta"];
13+
14+
p3 [label="makeBWAindex"];
15+
p5 [label="mapping"];
16+
p3 -> p5 [label="bwa_index"];
17+
18+
p4 [shape=point,label="",fixedsize=true,width=0.1];
19+
p5 [label="mapping"];
20+
p4 -> p5 [label="fasta"];
21+
22+
p5 [label="mapping"];
23+
p6 [label="samtools"];
24+
p5 -> p6 [label="bwa_bam"];
25+
26+
p6 [label="samtools"];
27+
p9 [label="variantCalling"];
28+
p6 -> p9 [label="bam_for_bcftools"];
29+
30+
p6 [label="samtools"];
31+
p9 [label="variantCalling"];
32+
p6 -> p9 [label="bai_for_bcftools"];
33+
34+
p6 [label="samtools"];
35+
p7 [shape=point];
36+
p6 -> p7 [label="samtools_stats"];
37+
38+
p8 [shape=point,label="",fixedsize=true,width=0.1];
39+
p9 [label="variantCalling"];
40+
p8 -> p9 [label="genome"];
41+
42+
p9 [label="variantCalling"];
43+
p10 [shape=point];
44+
p9 -> p10 [label="vcf_file"];
45+
46+
}

results/report.html

+998
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)