Verified Commit cc2d49f6 authored by Laurent Modolo's avatar Laurent Modolo
Browse files

switcth to nextflow DSL2

parent 6614fc01
profiles {
docker {
docker.temp = "auto"
docker.enabled = true
process {
withLabel: bedtools {
container = "lbmc/bedtools:2.25.0"
cpus = 1
}
}
}
singularity {
singularity.enabled = true
singularity.cacheDir = "./bin/"
process {
withLabel: bedtools {
container = "lbmc/bedtools:2.25.0"
cpus = 1
}
}
}
psmn{
singularity.enabled = true
singularity.cacheDir = "/.singularity_psmn/"
singularity.runOptions = "--bind /Xnfs,/scratch"
process{
withLabel: bedtools {
container = "lbmc/bedtools:2.25.0"
executor = "sge"
clusterOptions = "-cwd -V"
cpus = 1
memory = "20GB"
time = "12h"
queue = "monointeldeb128"
}
}
}
ccin2p3 {
singularity.enabled = true
singularity.cacheDir = "$baseDir/.singularity_in2p3/"
singularity.runOptions = "--bind /pbs,/sps,/scratch"
process{
withLabel: bedtools {
container = "lbmc/bedtools:2.25.0"
scratch = true
stageInMode = "copy"
stageOutMode = "rsync"
executor = "sge"
clusterOptions = "-P P_lbmc -l os=cl7 -l sps=1 -r n"
cpus = 1
queue = "huge"
}
}
}
}
/*
* bedtools :
* Imputs : fasta files
* Imputs : bed files
* Output : fasta files
*/
/* fasta extraction */
params.fasta = "$baseDir/data/fasta/*.fasta"
params.bed = "$baseDir/data/annot/*.bed"
log.info "fasta file : ${params.fasta}"
log.info "bed file : ${params.bed}"
Channel
.fromPath( params.fasta )
.ifEmpty { error "Cannot find any fasta files matching: ${params.fasta}" }
.set { fasta_files }
Channel
.fromPath( params.bed )
.ifEmpty { error "Cannot find any bed files matching: ${params.bed}" }
.set { bed_files }
process fasta_from_bed {
tag "${bed.baseName}"
publishDir "results/fasta/", mode: 'copy'
label "bedtools"
input:
file fasta from fasta_files
file bed from bed_files
output:
file "*_extracted.fasta" into fasta_files_extracted
script:
"""
bedtools getfasta -name \
-fi ${fasta} -bed ${bed} -fo ${bed.baseName}_extracted.fasta
"""
}
profiles {
docker {
docker.temp = "auto"
docker.enabled = true
process {
withLabel: bowtie {
cpus = 4
container = "lbmc/bowtie:1.2.2"
}
}
}
singularity {
singularity.enabled = true
singularity.cacheDir = "./bin/"
process {
withLabel: bowtie {
cpus = 4
container = "lbmc/bowtie:1.2.2"
}
}
}
psmn{
singularity.enabled = true
singularity.cacheDir = "/.singularity_psmn/"
singularity.runOptions = "--bind /Xnfs,/scratch"
process{
withLabel: bowtie {
container = "lbmc/bowtie:1.2.2"
executor = "sge"
clusterOptions = "-cwd -V"
memory = "20GB"
cpus = 32
time = "12h"
queue = "CLG6242deb384A,CLG6242deb384C,CLG5218deb192A,CLG5218deb192B,CLG5218deb192C,CLG5218deb192D,SLG5118deb96,SLG6142deb384A,SLG6142deb384B,SLG6142deb384C,SLG6142deb384D"
penv = "openmp32"
}
}
}
ccin2p3 {
singularity.enabled = true
singularity.cacheDir = "$baseDir/.singularity_in2p3/"
singularity.runOptions = "--bind /pbs,/sps,/scratch"
process{
withLabel: bowtie {
container = "lbmc/bowtie:1.2.2"
scratch = true
stageInMode = "copy"
stageOutMode = "rsync"
executor = "sge"
clusterOptions = "-P P_lbmc -l os=cl7 -l sps=1 -r n"
cpus = 1
queue = "huge"
}
}
}
}
/* fasta indexing */
params.fasta = "$baseDir/data/bam/*.fasta"
log.info "fasta files : ${params.fasta}"
Channel
.fromPath( params.fasta )
.ifEmpty { error "Cannot find any bam files matching: ${params.fasta}" }
.set { fasta_file }
process index_fasta {
tag "$fasta.baseName"
publishDir "results/mapping/index/", mode: 'copy'
label "bowtie"
input:
file fasta from fasta_file
output:
file "*.index*" into index_files
file "*_report.txt" into indexing_report
script:
"""
bowtie-build --threads ${task.cpus} -f ${fasta} ${fasta.baseName}.index &> ${fasta.baseName}_bowtie_report.txt
if grep -q "Error" ${fasta.baseName}_bowtie_report.txt; then
exit 1
fi
"""
}
profiles {
docker {
docker.temp = "auto"
docker.enabled = true
process {
withLabel: bowtie {
container = "lbmc/bowtie:1.2.2"
cpus = 4
}
}
}
singularity {
singularity.enabled = true
singularity.cacheDir = "./bin/"
process {
withLabel: bowtie {
cpus = 4
container = "lbmc/bowtie:1.2.2"
}
}
}
psmn{
singularity.enabled = true
singularity.cacheDir = "/.singularity_psmn/"
singularity.runOptions = "--bind /Xnfs,/scratch"
process{
withLabel: bowtie {
container = "lbmc/bowtie:1.2.2"
executor = "sge"
clusterOptions = "-cwd -V"
cpus = 32
memory = "30GB"
time = "24h"
queue = "CLG6242deb384A,CLG6242deb384C,CLG5218deb192A,CLG5218deb192B,CLG5218deb192C,CLG5218deb192D,SLG5118deb96,SLG6142deb384A,SLG6142deb384B,SLG6142deb384C,SLG6142deb384D"
penv = "openmp32"
}
}
}
ccin2p3 {
singularity.enabled = true
singularity.cacheDir = "$baseDir/.singularity_in2p3/"
singularity.runOptions = "--bind /pbs,/sps,/scratch"
process{
withLabel: bowtie {
container = "lbmc/bowtie:1.2.2"
scratch = true
stageInMode = "copy"
stageOutMode = "rsync"
executor = "sge"
clusterOptions = "-P P_lbmc -l os=cl7 -l sps=1 -r n"
cpus = 1
queue = "huge"
}
}
}
}
/*
* mapping paired fastq
*/
params.fastq = "$baseDir/data/fastq/*_{1,2}.fastq"
params.index = "$baseDir/data/index/*.index.*"
log.info "fastq files : ${params.fastq}"
log.info "index files : ${params.index}"
Channel
.fromFilePairs( params.fastq )
.ifEmpty { error "Cannot find any fastq files matching: ${params.fastq}" }
.set { fastq_files }
Channel
.fromPath( params.index )
.ifEmpty { error "Cannot find any index files matching: ${params.index}" }
.set { index_files }
process mapping_fastq {
tag "$pair_id"
publishDir "results/mapping/bams/", mode: 'copy'
label "bowtie"
input:
set pair_id, file(reads) from fastq_files
file index from index_files.collect()
output:
file "*.bam" into bam_files
file "*_report.txt" into mapping_report
script:
index_id = index[0]
for (index_file in index) {
if (index_file =~ /.*\.1\.ebwt/ && !(index_file =~ /.*\.rev\.1\.ebwt/)) {
index_id = ( index_file =~ /(.*)\.1\.ebwt/)[0][1]
}
}
"""
# -v specify the max number of missmatch, -k the number of match reported per
# reads
bowtie --best -v 3 -k 1 --sam -p ${task.cpus} ${index_id} \
-1 ${reads[0]} -2 ${reads[1]} 2> \
${pair_id}_bowtie_report_tmp.txt | \
samtools view -Sb - > ${pair_id}.bam
if grep -q "Error" ${pair_id}_bowtie_report_tmp.txt; then
exit 1
fi
tail -n 19 ${pair_id}_bowtie_report_tmp.txt > ${pair_id}_bowtie_report.txt
"""
}
profiles {
docker {
docker.temp = "auto"
docker.enabled = true
process {
withLabel: bowtie {
container = "lbmc/bowtie:1.2.2"
cpus = 4
}
}
}
singularity {
singularity.enabled = true
singularity.cacheDir = "./bin/"
process {
withLabel: bowtie {
cpus = 4
container = "lbmc/bowtie:1.2.2"
}
}
}
psmn{
singularity.enabled = true
singularity.cacheDir = "/.singularity_psmn/"
singularity.runOptions = "--bind /Xnfs,/scratch"
process{
withLabel: bowtie {
container = "lbmc/bowtie:1.2.2"
executor = "sge"
clusterOptions = "-cwd -V"
cpus = 32
memory = "30GB"
time = "24h"
queue = "CLG6242deb384A,CLG6242deb384C,CLG5218deb192A,CLG5218deb192B,CLG5218deb192C,CLG5218deb192D,SLG5118deb96,SLG6142deb384A,SLG6142deb384B,SLG6142deb384C,SLG6142deb384D"
penv = "openmp32"
}
}
}
ccin2p3 {
singularity.enabled = true
singularity.cacheDir = "$baseDir/.singularity_in2p3/"
singularity.runOptions = "--bind /pbs,/sps,/scratch"
process{
withLabel: bowtie {
container = "lbmc/bowtie:1.2.2"
scratch = true
stageInMode = "copy"
stageOutMode = "rsync"
executor = "sge"
clusterOptions = "-P P_lbmc -l os=cl7 -l sps=1 -r n"
cpus = 1
queue = "huge"
}
}
}
}
/*
* mapping single end fastq
*/
params.fastq = "$baseDir/data/fastq/*.fastq"
log.info "fastq files : ${params.fastq}"
log.info "index files : ${params.index}"
Channel
.fromPath( params.fastq )
.ifEmpty { error "Cannot find any fastq files matching: ${params.fastq}" }
.map { it -> [(it.baseName =~ /([^\.]*)/)[0][1], it]}
.set { fastq_files }
Channel
.fromPath( params.index )
.ifEmpty { error "Cannot find any index files matching: ${params.index}" }
.set { index_files }
process mapping_fastq {
tag "$file_id"
publishDir "results/mapping/bams/", mode: 'copy'
label "bowtie"
input:
set file_id, file(reads) from fastq_files
file index from index_files.collect()
output:
set file_id, "*.bam" into bam_files
file "*_report.txt" into mapping_report
script:
index_id = index[0]
for (index_file in index) {
if (index_file =~ /.*\.1\.ebwt/ && !(index_file =~ /.*\.rev\.1\.ebwt/)) {
index_id = ( index_file =~ /(.*)\.1\.ebwt/)[0][1]
}
}
"""
bowtie --best -v 3 -k 1 --sam -p ${task.cpus} ${index_id} \
-q ${reads} 2> \
${file_id}_bowtie_report_tmp.txt | \
samtools view -Sb - > ${file_id}.bam
if grep -q "Error" ${file_id}_bowtie_report_tmp.txt; then
exit 1
fi
tail -n 19 ${file_id}_bowtie_report_tmp.txt > ${file_id}_bowtie_report.txt
"""
}
profiles {
docker {
docker.temp = "auto"
docker.enabled = true
process {
withLabel: bowtie2 {
container = "lbmc/bowtie2:2.3.4.1"
cpus = 4
}
}
}
singularity {
singularity.enabled = true
singularity.cacheDir = "./bin/"
process {
withLabel: bowtie2 {
container = "lbmc/bowtie2:2.3.4.1"
cpus = 4
}
}
}
psmn{
singularity.enabled = true
singularity.cacheDir = "/.singularity_psmn/"
singularity.runOptions = "--bind /Xnfs,/scratch"
process{
withLabel: bowtie2 {
container = "lbmc/bowtie2:2.3.4.1"
executor = "sge"
clusterOptions = "-cwd -V"
cpus = 32
memory = "20GB"
time = "12h"
queue = "CLG6242deb384A,CLG6242deb384C,CLG5218deb192A,CLG5218deb192B,CLG5218deb192C,CLG5218deb192D,SLG5118deb96,SLG6142deb384A,SLG6142deb384B,SLG6142deb384C,SLG6142deb384D"
penv = "openmp32"
}
}
}
ccin2p3 {
singularity.enabled = true
singularity.cacheDir = "$baseDir/.singularity_in2p3/"
singularity.runOptions = "--bind /pbs,/sps,/scratch"
process{
withLabel: bowtie2 {
container = "lbmc/bowtie2:2.3.4.1"
scratch = true
stageInMode = "copy"
stageOutMode = "rsync"
executor = "sge"
clusterOptions = "-P P_lbmc -l os=cl7 -l sps=1 -r n"
cpus = 1
queue = "huge"
}
}
}
}
params.fasta = "$baseDir/data/bam/*.fasta"
log.info "fasta files : ${params.fasta}"
Channel
.fromPath( params.fasta )
.ifEmpty { error "Cannot find any bam files matching: ${params.fasta}" }
.set { fasta_file }
process index_fasta {
tag "$fasta.baseName"
publishDir "results/mapping/index/", mode: 'copy'
label "bowtie2"
input:
file fasta from fasta_file
output:
file "*.index*" into index_files
file "*_report.txt" into indexing_report
script:
"""
bowtie2-build --threads ${task.cpus} ${fasta} ${fasta.baseName}.index &> ${fasta.baseName}_bowtie2_report.txt
if grep -q "Error" ${fasta.baseName}_bowtie2_report.txt; then
exit 1
fi
"""
}
profiles {
docker {
docker.temp = "auto"
docker.enabled = true
process {
withLabel: bowtie2 {
container = "lbmc/bowtie2:2.3.4.1"
cpus = 4
}
}
}
singularity {
singularity.enabled = true
singularity.cacheDir = "./bin/"
process {
withLabel: bowtie2 {
container = "lbmc/bowtie2:2.3.4.1"
cpus = 4
}
}
}
psmn{
singularity.enabled = true
singularity.cacheDir = "/.singularity_psmn/"
singularity.runOptions = "--bind /Xnfs,/scratch"
process{
withLabel: bowtie2 {
container = "lbmc/bowtie2:2.3.4.1"
executor = "sge"
clusterOptions = "-cwd -V"
cpus = 32
memory = "30GB"
time = "24h"
queue = "CLG6242deb384A,CLG6242deb384C,CLG5218deb192A,CLG5218deb192B,CLG5218deb192C,CLG5218deb192D,SLG5118deb96,SLG6142deb384A,SLG6142deb384B,SLG6142deb384C,SLG6142deb384D"
penv = "openmp32"
}
}
}
ccin2p3 {
singularity.enabled = true
singularity.cacheDir = "$baseDir/.singularity_in2p3/"
singularity.runOptions = "--bind /pbs,/sps,/scratch"
process{
withLabel: bowtie2 {
container = "lbmc/bowtie2:2.3.4.1"
scratch = true
stageInMode = "copy"
stageOutMode = "rsync"
executor = "sge"
clusterOptions = "-P P_lbmc -l os=cl7 -l sps=1 -r n"
cpus = 1
queue = "huge"
}
}
}
}
params.fastq = "$baseDir/data/fastq/*_{1,2}.fastq"
params.index = "$baseDir/data/index/*.index.*"
log.info "fastq files : ${params.fastq}"
log.info "index files : ${params.index}"
Channel
.fromFilePairs( params.fastq )
.ifEmpty { error "Cannot find any fastq files matching: ${params.fastq}" }
.set { fastq_files }
Channel
.fromPath( params.index )
.ifEmpty { error "Cannot find any index files matching: ${params.index}" }
.set { index_files }
process mapping_fastq {
tag "$pair_id"
publishDir "results/mapping/bams/", mode: 'copy'
label "bowtie2"
input:
set pair_id, file(reads) from fastq_files
file index from index_files.collect()
output:
set pair_id, "*.bam" into bam_files
file "*_report.txt" into mapping_report
script:
index_id = index[0]
for (index_file in index) {
if (index_file =~ /.*\.1\.bt2/ && !(index_file =~ /.*\.rev\.1\.bt2/)) {
index_id = ( index_file =~ /(.*)\.1\.bt2/)[0][1]
}
}
"""
bowtie2 --very-sensitive -p ${task.cpus} -x ${index_id} \
-1 ${reads[0]} -2 ${reads[1]} 2> \
${pair_id}_bowtie2_report_tmp.txt | \
samtools view -Sb - > ${pair_id}.bam
if grep -q "Error" ${pair_id}_bowtie2_report_tmp.txt; then
exit 1
fi
tail -n 19 ${pair_id}_bowtie2_report_tmp.txt > ${pair_id}_bowtie2_report.txt
"""
}
profiles {
docker {
docker.temp = "auto"
docker.enabled = true
process {
withLabel: bowtie2 {