Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • dev
  • master
  • v0.1.0
  • v0.1.2
  • v0.2.0
  • v0.2.1
  • v0.2.2
  • v0.2.3
  • v0.2.4
  • v0.2.5
  • v0.2.6
  • v0.2.7
  • v0.2.8
  • v0.2.9
  • v0.3.0
  • v0.4.0
  • v2.0.0
17 results

Target

Select target project
  • LBMC/regards/nextflow
  • elabaron/nextflow
  • lanani/nextflow
  • mlepetit/nextflow
  • mdjaffar/nextflow
  • LBMC/RMI2/rmi2_pipelines
  • lpicard/nextflow
  • rseraphi/nextflow
  • hregue/nextflow
  • letien02/nextflow
  • mshamjal/nextflow
  • z483801/nextflow
  • fduveau/nextflow
  • cginevra/nextflow
  • dtorresc/nextflow
  • fmortreu/nextflow
  • jshapiro/nextflow
  • carpin/nextflow
  • LBMC/Delattre/JU28_59vs17_SNP
  • jclaud01/nextflow
  • dchalopi/nextflow
  • mvilcot/nextflow
  • mherbett/nextflow
  • lestrada/nextflow
  • nfontrod/nextflow
  • gbenoit/nextflow
  • gyvert/nextflow
  • aguill09/nextflow
  • alapendr/nextflow
  • jprobin/nextflow
  • vvanoost/nextflow
  • jblin/nextflow
  • mparis/nextflow
  • ogandril/nextflow
  • cbourgeo/nextflow
  • ggirau03/nextflow
  • ecombe01/nextflow
  • acorbin/nextflow
  • pberna01/nextflow
  • pmarie01/nextflow
  • rhoury/nextflow
  • lgely/nextflow
  • jvalat/nextflow
  • cfournea/nextflow
  • mprieux/nextflow
  • hpolvech/nextflow
  • LBMC/nextflow
  • mcariou/nextflow
  • z483800/nextflow
  • yjia01/nextflow
  • jkleine/nextflow
  • LBMC/Palladino/RNAseq_nextflow
  • jseimand/nextflow
  • nlecouvr/nextflow-nathan
54 results
Select Git revision
  • master
  • tp_experimental_biologists
2 results
Show changes
Showing
with 1056 additions and 390 deletions
// SPDX-FileCopyrightText: 2022 Laurent Modolo <laurent.modolo@ens-lyon.fr>
//
// SPDX-License-Identifier: AGPL-3.0-or-later
version = "1.2.2"
container_url = "lbmc/bowtie:${version}"
params.index_fasta = ""
params.index_fasta_out = ""
process index_fasta {
container = "${container_url}"
label "big_mem_multi_cpus"
tag "$file_id"
if (params.index_fasta_out != "") {
publishDir "results/${params.index_fasta_out}", mode: 'copy'
}
input:
tuple val(file_id), path(fasta)
output:
tuple val(file_id), path("*.index*"), emit: index
tuple val(file_id), path("*_report.txt"), emit: report
script:
"""
bowtie-build --threads ${task.cpus} \
${params.index_fasta} \
-f ${fasta} ${fasta.baseName}.index &> \
${fasta.baseName}_bowtie_index_report.txt
if grep -q "Error" ${fasta.baseName}_bowtie_index_report.txt; then
exit 1
fi
"""
}
params.mapping_fastq = "--very-sensitive"
params.mapping_fastq_out = ""
process mapping_fastq {
container = "${container_url}"
label "big_mem_multi_cpus"
tag "$pair_id"
if (params.mapping_fastq_out != "") {
publishDir "results/${params.mapping_fastq_out}", mode: 'copy'
}
input:
tuple val(index_id), path(index)
tuple val(file_id), path(reads)
output:
tuple val(file_id), path("*.bam"), emit: bam
path "*_report.txt", emit: report
script:
if (file_id instanceof List){
file_prefix = file_id[0]
} else {
file_prefix = file_id
}
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]
}
}
if (reads.size() == 2)
"""
# -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} \
${params.mapping_fastq} \
-1 ${reads[0]} -2 ${reads[1]} 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_mapping_report.txt
"""
else
"""
bowtie --best -v 3 -k 1 --sam -p ${task.cpus} ${index_id} \
${params.mapping_fastq}
-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_mapping_report.txt
"""
}
params.mapping_fastq_pairedend = ""
process mapping_fastq_pairedend {
container = "${container_url}"
label "big_mem_multi_cpus"
tag "$pair_id"
input:
path index
tuple val(pair_id), path(reads)
output:
tuple val(pair_id), path("*.bam"), emit: bam
path "*_report.txt", emit: 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]
}
}
"""
# -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} \
${params.mapping_fastq_pairedend} \
-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_mapping_report.txt
"""
}
params.mapping_fastq_singleend = ""
process mapping_fastq_singleend {
container = "${container_url}"
label "big_mem_multi_cpus"
tag "$file_id"
input:
path index
tuple val(file_id), path(reads)
output:
set file_id, "*.bam", emit: bam
file "*_report.txt", emit: 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]
}
}
"""
bowtie --best -v 3 -k 1 --sam -p ${task.cpus} ${index_id} \
${params.mapping_fastq_singleend} \
-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_mapping_report.txt
"""
}
// SPDX-FileCopyrightText: 2022 Laurent Modolo <laurent.modolo@ens-lyon.fr>
//
// SPDX-License-Identifier: AGPL-3.0-or-later
version = "2.3.4.1"
container_url = "lbmc/bowtie2:${version}"
params.index_fasta = ""
params.index_fasta_out = ""
process index_fasta {
container = "${container_url}"
label "big_mem_multi_cpus"
tag "$file_id"
if (params.index_fasta_out != "") {
publishDir "results/${params.index_fasta_out}", mode: 'copy'
}
input:
tuple val(file_id), path(fasta)
output:
tuple val(file_id), path("*.bt2"), emit: index
tuple val(file_id), path("*_report.txt"), emit: report
script:
"""
bowtie2-build --threads ${task.cpus} \
${fasta} \
${fasta.simpleName} &> \
${fasta.simpleName}_bowtie2_index_report.txt
if grep -q "Error" ${fasta.simpleName}_bowtie2_index_report.txt; then
exit 1
fi
"""
}
params.mapping_fastq = "--very-sensitive"
params.mapping_fastq_out = ""
process mapping_fastq {
container = "${container_url}"
label "big_mem_multi_cpus"
tag "$file_id"
if (params.mapping_fastq_out != "") {
publishDir "results/${params.mapping_fastq_out}", mode: 'copy'
}
input:
tuple val(index_id), path(index)
tuple val(file_id), path(reads)
output:
tuple val(file_id), path("*.bam"), emit: bam
path "*_report.txt", emit: 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]
}
}
switch(file_id) {
case {it instanceof List}:
file_prefix = file_id[0]
break
case {it instanceof Map}:
file_prefix = file_id.values()[0]
break
default:
file_prefix = file_id
break
}
if (reads.size() == 2)
"""
bowtie2 ${params.mapping_fastq} \
-p ${task.cpus} \
-x ${index_id} \
-1 ${reads[0]} \
-2 ${reads[1]} 2> \
${file_prefix}_bowtie2_mapping_report_tmp.txt | \
samtools view -Sb - > ${file_prefix}.bam
if grep -q "Error" ${file_prefix}_bowtie2_mapping_report_tmp.txt; then
exit 1
fi
tail -n 19 ${file_prefix}_bowtie2_mapping_report_tmp.txt > \
${file_prefix}_bowtie2_mapping_report.txt
"""
else
"""
bowtie2 ${params.mapping_fastq} \
-p ${task.cpus} \
-x ${index_id} \
-U ${reads} 2> \
${file_prefix}_bowtie2_mapping_report_tmp.txt | \
samtools view -Sb - > ${file_prefix}.bam
if grep -q "Error" ${file_prefix}_bowtie2_mapping_report_tmp.txt; then
exit 1
fi
tail -n 19 ${file_prefix}_bowtie2_mapping_report_tmp.txt > \
${file_prefix}_bowtie2_mapping_report.txt
"""
}
// SPDX-FileCopyrightText: 2022 Laurent Modolo <laurent.modolo@ens-lyon.fr>
//
// SPDX-License-Identifier: AGPL-3.0-or-later
version = "0.7.17"
container_url = "lbmc/bwa:${version}"
workflow mapping {
take:
fasta
fastq
main:
index_fasta(fasta)
mapping_fastq(index_fasta.out.index.collect(), fastq)
emit:
bam = mapping_fastq.out.bam
report = mapping_fastq.out.report
}
params.index_fasta = ""
params.index_fasta_out = ""
process index_fasta {
container = "${container_url}"
label "big_mem_mono_cpus"
tag "$file_id"
if (params.index_fasta_out != "") {
publishDir "results/${params.index_fasta_out}", mode: 'copy'
}
input:
tuple val(file_id), path(fasta)
output:
tuple val(file_id), path("${fasta.simpleName}.*"), emit: index
tuple val(file_id), path("*_bwa_report.txt"), emit: report
script:
"""
bwa index ${params.index_fasta} -p ${fasta.simpleName} ${fasta} \
&> ${fasta.simpleName}_bwa_report.txt
"""
}
params.mapping_fastq = ""
params.mapping_fastq_out = ""
process mapping_fastq {
container = "${container_url}"
label "big_mem_multi_cpus"
tag "$file_id"
if (params.mapping_fastq_out != "") {
publishDir "results/${params.mapping_fastq_out}", mode: 'copy'
}
input:
tuple val(index_id), path(index)
tuple val(file_id), path(reads)
output:
tuple val(file_id), path("*.bam"), emit: bam
tuple val(file_id), path("${file_prefix}_bwa_report.txt"), emit: report
script:
if (file_id instanceof List){
library = file_id[0]
file_prefix = file_id[0]
} else if (file_id instanceof Map) {
library = file_id[0]
file_prefix = file_id[0]
if (file_id.containsKey('library')) {
library = file_id.library
file_prefix = file_id.id
}
} else {
library = file_id
file_prefix = file_id
}
bwa_mem_R = "@RG\\tID:${library}\\tSM:${library}\\tLB:lib_${library}\\tPL:illumina"
if (reads.size() == 2)
"""
bwa mem -t ${task.cpus} \
${params.mapping_fastq} \
-R '${bwa_mem_R}' \
${index[0].baseName} ${reads[0]} ${reads[1]} 2> \
${file_prefix}_bwa_report.txt | \
samtools view -@ ${task.cpus} -Sb - > ${file_prefix}.bam
"""
else
"""
bwa mem -t ${task.cpus} \
${params.mapping_fastq} \
-R '${bwa_mem_R}' \
${index[0].baseName} ${reads} 2> \
${file_prefix}_bwa_report.txt | \
samtools view -@ ${task.cpus} -Sb - > ${file_prefix}.bam
"""
}
// SPDX-FileCopyrightText: 2022 Laurent Modolo <laurent.modolo@ens-lyon.fr>
//
// SPDX-License-Identifier: AGPL-3.0-or-later
version = "3.0.0"
container_url = "mlepetit/cellphonedb:latest"
params.cellphonedb = ""
params.cellphonedb_out = ""
params.pval=""
params.thres=""
params.iterations=""
params.gene_id=""
workflow cellphone_statistical_analysis {
take:
meta
counts
main:
cpdb_methods_stats(meta,counts)
cpdb_plot_dot_plot(cpdb_methods_stats.out.means,cpdb_methods_stats.out.pvalues)
cpdb_plot_heatmap(cpdb_methods_stats.out.pvalues)
emit:
means = cpdb_methods_stats.out.means
pvalues = cpdb_methods_stats.out.pvalues
deconvoluted = cpdb_methods_stats.out.deconvoluted
significant_means = cpdb_methods_stats.out.significant_means
dot_plot = cpdb_plot_dot_plot.out.dot_plot
heatmap = cpdb_plot_heatmap.out.heatmap
heatmap_log = cpdb_plot_heatmap.out.heatmap_log
count_network = cpdb_plot_heatmap.out.count_network
interactions_count = cpdb_plot_heatmap.out.interactions_count
}
process cpdb_methods_stats {
container = "${container_url}"
label "big_mem_multi_cpus"
if (params.cellphonedb_out != "") {
publishDir "results/${params.cellphonedb_out}", mode: 'copy'
}
input:
tuple val(id_mtx), path(meta)
tuple val(id_mtx), path(counts)
output:
tuple val(id_mtx), path("out/means.txt"), emit: means
tuple val(id_mtx), path("out/pvalues.txt"), emit: pvalues
tuple val(id_mtx), path("out/deconvoluted.txt"), emit: deconvoluted
tuple val(id_mtx), path("out/significant_means.txt"), emit: significant_means
script:
"""
cellphonedb method statistical_analysis ${params.meta} ${params.counts} --counts-data ${params.gene_id} --threads ${task.cpus} --iterations ${params.iterations} --pvalue ${params.pval} --threshold ${params.thres}
"""
}
process cpdb_plot_dot_plot {
container = "${container_url}"
label "big_mem_mono_cpus"
if (params.cellphonedb_out != "") {
publishDir "results/${params.cellphonedb_out}", mode: 'copy'
}
input:
tuple val(id_mtx), path(means)
tuple val(id_mtx), path(pvalues)
output:
tuple val(id_mtx), path("out/plot.pdf"), emit: dot_plot
script:
"""
mkdir ./out
cellphonedb plot dot_plot --means-path ${means} --pvalues-path ${pvalues}
"""
}
process cpdb_plot_heatmap {
container = "${container_url}"
label "big_mem_multi_cpus"
if (params.cellphonedb_out != "") {
publishDir "results/${params.cellphonedb_out}", mode: 'copy'
}
input:
tuple val(id_mtx), path(pvalues)
output:
tuple val(id_mtx), path("out/heatmap_count.pdf"), emit: heatmap
tuple val(id_mtx), path("out/heatmap_log_count.pdf"), emit: heatmap_log
tuple val(id_mtx), path("out/count_network.txt"), emit: count_network
tuple val(id_mtx), path("out/interaction_count.txt"), emit: interactions_count
script:
"""
mkdir ./out
cellphonedb plot heatmap_plot --pvalues-path ${pvalues} --pvalue ${params.pval} ${params.meta}
"""
}
profiles {
docker {
docker.temp = 'auto'
docker.enabled = true
process {
withName: adaptor_removal {
container = "cutadapt:1.14"
}
}
}
psmn {
process{
withName: adaptor_removal {
beforeScript = "source /usr/share/lmod/lmod/init/bash; module use ~/privatemodules"
module = "cutadapt/1.14"
executor = "sge"
clusterOptions = "-m e -cwd -V"
memory = "20GB"
time = "12h"
queue = 'monointeldeb128'
}
}
}
}
log.info "fastq files : ${params.fastq}"
Channel
.fromFilePairs( params.fastq )
.ifEmpty { error "Cannot find any fastq files matching: ${params.fastq}" }
.set { fastq_files }
process adaptor_removal {
tag "$pair_id"
publishDir "results/fastq/adaptor_removal/", mode: 'copy'
input:
set pair_id, file(reads) from fastq_files
output:
set pair_id, "*_cut_R{1,2}.fastq.gz" into fastq_files_cut
script:
"""
cutadapt -a AGATCGGAAGAG -g CTCTTCCGATCT -A AGATCGGAAGAG -G CTCTTCCGATCT \
-o ${pair_id}_cut_R1.fastq.gz -p ${pair_id}_cut_R2.fastq.gz \
${reads[0]} ${reads[1]} > ${pair_id}_report.txt
"""
}
profiles {
docker {
docker.temp = 'auto'
docker.enabled = true
process {
withName: adaptor_removal {
container = "cutadapt:1.14"
}
}
}
psmn {
process{
withName: adaptor_removal {
beforeScript = "source /usr/share/lmod/lmod/init/bash; module use ~/privatemodules"
module = "cutadapt/1.14"
executor = "sge"
clusterOptions = "-m e -cwd -V"
memory = "20GB"
time = "12h"
queue = 'monointeldeb128'
}
}
}
}
log.info "fastq files : ${params.fastq}"
Channel
.fromPath( params.fastq )
.ifEmpty { error "Cannot find any fastq files matching: ${params.fastq}" }
.map { it -> [(it.baseName =~ /([^\.]*)/)[0][1], it]}
.set { fastq_files }
process adaptor_removal {
tag "$file_id"
input:
set file_id, file(reads) from fastq_files
output:
set file_id, "*_cut.fastq.gz" into fastq_files_cut
script:
"""
cutadapt -a AGATCGGAAGAG -g CTCTTCCGATCT\
-o ${file_id}_cut.fastq.gz \
${reads} > ${file_id}_report.txt
"""
}
// SPDX-FileCopyrightText: 2022 Laurent Modolo <laurent.modolo@ens-lyon.fr>
//
// SPDX-License-Identifier: AGPL-3.0-or-later
version = "2.1"
container_url = "lbmc/cutadapt:${version}"
params.adapter_3_prim = "AGATCGGAAGAG"
params.adapter_5_prim = "CTCTTCCGATCT"
params.adaptor_removal = "-a ${params.adapter_3_prim} -g ${params.adapter_5_prim} -A ${params.adapter_3_prim} -G ${params.adapter_5_prim}"
params.adaptor_removal_out = ""
process adaptor_removal {
container = "${container_url}"
label "big_mem_mono_cpus"
tag "$file_id"
if (params.adaptor_removal_out != "") {
publishDir "results/${params.adaptor_removal_out}", mode: 'copy'
}
input:
tuple val(file_id), path(reads)
output:
tuple val(file_id), path("*_cut_*"), emit: fastq
path "*_report.txt", emit: report
script:
if (file_id instanceof List){
file_prefix = file_id[0]
} else {
file_prefix = file_id
}
if (reads.size() == 2)
"""
cutadapt ${params.adaptor_removal} \
-o ${file_prefix}_cut_R1.fastq.gz -p ${file_prefix}_cut_R2.fastq.gz \
${reads[0]} ${reads[1]} > ${file_prefix}_report.txt
"""
else
"""
cutadapt ${params.adaptor_removal} \
-o ${file_prefix}_cut.fastq.gz \
${reads} > ${file_prefix}_report.txt
"""
}
params.trim_quality = "20"
params.trimming = "-q ${params.trim_quality},${params.trim_quality}"
params.trimming_out = ""
process trimming {
container = "${container_url}"
label "big_mem_mono_cpus"
tag "$file_id"
if (params.trimming_out != "") {
publishDir "results/${params.trimming_out}", mode: 'copy'
}
input:
tuple val(file_id), path(reads)
output:
tuple val(file_id), path("*_trim_*"), emit:fastq
path "*_report.txt", emit: report
script:
if (file_id instanceof List){
file_prefix = file_id[0]
} else {
file_prefix = file_id
}
if (reads.size() == 2)
"""
cutadapt ${params.trimming} \
-o ${file_prefix}_trim_R1.fastq.gz -p ${file_prefix}_trim_R2.fastq.gz \
${reads[0]} ${reads[1]} > ${file_prefix}_report.txt
"""
else
"""
cutadapt ${params.trimming} \
-o ${file_prefix}_trim.fastq.gz \
${reads} > ${file_prefix}_report.txt
"""
}
process 5pRACE {
container = "${container_url}"
label "big_mem_mono_cpus"tag "$file_id"
if (params.cutadapt_out != "") {
publishDir "results/${params.cutadapt_out}", mode: 'copy'
}
input:
tuple val(file_id), path(fastq)
output:
tuple val(file_id), path("*_cut_*"), emit: fastq
"""
cutadapt -e 0.2 -g CGACTGGAGCACGAGGACACTGACATGGACTGAAGGAGTAGAAA -g TTAGGCAGAGGTGAAAAAGTTG
-a TTTCTACTCCTTCAGTCCATGTCAGTGTCCTCGTGCTCCAGTCG -a CAACTTTTTCACCTCTGCCTAA
-o ${}
${fastq}
"""
}
\ No newline at end of file
./nextflow src/nf_modules/cutadapt/adaptor_removal_paired.nf \
-c src/nf_modules/cutadapt/adaptor_removal_paired.config \
-profile docker \
--fastq "data/tiny_dataset/fastq/tiny_R{1,2}.fastq"
./nextflow src/nf_modules/cutadapt/adaptor_removal_single.nf \
-c src/nf_modules/cutadapt/adaptor_removal_single.config \
-profile docker \
--fastq "data/tiny_dataset/fastq/tiny*_S.fastq"
./nextflow src/nf_modules/cutadapt/trimming_paired.nf \
-c src/nf_modules/cutadapt/trimming_paired.config \
-profile docker \
--fastq "data/tiny_dataset/fastq/tiny_R{1,2}.fastq"
./nextflow src/nf_modules/cutadapt/trimming_single.nf \
-c src/nf_modules/cutadapt/trimming_single.config \
-profile docker \
--fastq "data/tiny_dataset/fastq/tiny*_S.fastq"
profiles {
docker {
docker.temp = 'auto'
docker.enabled = true
process {
withName: trimming {
container = "cutadapt:1.14"
}
}
}
psmn {
process{
withName: trimming {
beforeScript = "source /usr/share/lmod/lmod/init/bash; module use ~/privatemodules"
module = "cutadapt/1.14"
executor = "sge"
clusterOptions = "-m e -cwd -V"
memory = "20GB"
time = "12h"
queue = 'monointeldeb128'
}
}
}
}
log.info "fastq files : ${params.fastq}"
Channel
.fromFilePairs( params.fastq )
.ifEmpty { error "Cannot find any fastq files matching: ${params.fastq}" }
.set { fastq_files }
process trimming {
tag "$pair_id"
publishDir "results/fastq/trimming/", mode: 'copy'
input:
set pair_id, file(reads) from fastq_files
output:
set pair_id, "*_trim_R{1,2}.fastq.gz" into fastq_files_trim
script:
"""
cutadapt -q 20,20 \
-o ${pair_id}_trim_R1.fastq.gz -p ${pair_id}_trim_R2.fastq.gz \
${reads[0]} ${reads[1]} > ${pair_id}_report.txt
"""
}
profiles {
docker {
docker.temp = 'auto'
docker.enabled = true
process {
withName: trimming {
container = "cutadapt:1.14"
}
}
}
psmn {
process{
withName: trimming {
beforeScript = "source /usr/share/lmod/lmod/init/bash; module use ~/privatemodules"
module = "cutadapt/1.14"
executor = "sge"
clusterOptions = "-m e -cwd -V"
memory = "20GB"
time = "12h"
queue = 'monointeldeb128'
}
}
}
}
log.info "fastq files : ${params.fastq}"
Channel
.fromPath( params.fastq )
.ifEmpty { error "Cannot find any fastq files matching: ${params.fastq}" }
.map { it -> [(it.baseName =~ /([^\.]*)/)[0][1], it]}
.set { fastq_files }
process trimming {
tag "$file_id"
input:
set file_id, file(reads) from fastq_files
output:
set file_id, "*_trim.fastq.gz" into fastq_files_cut
script:
"""
cutadapt -q 20,20 \
-o ${file_id}_trim.fastq.gz \
${reads} > ${file_id}_report.txt
"""
}
// SPDX-FileCopyrightText: 2022 Laurent Modolo <laurent.modolo@ens-lyon.fr>
//
// SPDX-License-Identifier: AGPL-3.0-or-later
version = "v2.2.2_cv3"
container_url = "biocontainers/danpos:${version}"
include {
bigwig2_to_wig2;
bigwig_to_wig;
wig_to_bedgraph;
wig2_to_bedgraph2
} from "./../ucsc/main.nf"
params.dpos = "--smooth_width 0 -n N "
params.dpos_out = ""
workflow dpos_bam_bg {
take:
fasta
fastq
bam
main:
dpos_bam(fastq, bam)
wig2_to_bedgraph2(fasta, dpos_bam.out.wig)
emit:
bg = wig2_to_bedgraph2.out.bg
wig = dpos_bam.out.wig
bed = dpos_bam.out.bed
}
process dpos_bam {
container = "${container_url}"
label "big_mem_mono_cpus"
tag "$file_id"
if (params.dpos_out != "") {
publishDir "results/${params.dpos_out}", mode: 'copy', overwrite: true
}
input:
val fastq
tuple val(file_id), path(bam_ip), path(bam_wce)
output:
tuple val(file_id), path("${file_prefix}/${bam_ip.simpleName}*.wig"), path("${file_prefix}/${bam_wce.simpleName}*.wig"), emit: wig
tuple val(file_id), path("${file_prefix}/*.positions.bed"), emit: bed
script:
switch(file_id) {
case {it instanceof List}:
file_prefix = file_id[0]
break
case {it instanceof Map}:
file_prefix = file_id.values()[0]
break
default:
file_prefix = file_id
break
}
m = 0
if (fastq[1].size() == 2){
m = 1
}
"""
danpos.py dpos -m ${m} \
${params.dpos} \
-b ${bam_wce} \
-o ${file_prefix} \
${bam_ip}
mv ${file_prefix}/pooled/* ${file_prefix}/
rm -R ${file_prefix}/pooled
awk -v FS='\t' -v OFS='\t' 'FNR > 1 { print \$1, \$2-1, \$3, "Interval_"NR-1, \$6, "+" }' ${file_prefix}/${bam_ip.simpleName}.bgsub.positions.xls > ${file_prefix}/${bam_ip.simpleName}.bgsub.positions.bed
"""
}
workflow dpos_bw {
take:
fasta
fastq
bw
main:
bigwig2_to_wig2(bw)
dpos_wig(fastq, bigwig2_to_wig2.out.wig)
wig_to_bedgraph(fasta, bigwig2_to_wig2.out.wig)
emit:
bg = wig_to_bedgraph.out.bg
wig = bigwig2_to_wig2.out.wig
bed = dpos_wig.out.bed
}
process dpos_wig {
container = "${container_url}"
label "big_mem_mono_cpus"
tag "$file_id"
if (params.dpos_out != "") {
publishDir "results/${params.dpos_out}", mode: 'copy', overwrite: true
}
input:
val fastq
tuple val(file_id), path(wig_ip), path(wig_wce)
output:
tuple val(file_id), path("${file_prefix}/*.positions.bed"), emit: bed
tuple val(file_id), path("${file_prefix}/${bam_ip.simpleName}*.wig"), path("${file_prefix}/${bam_wce.simpleName}*.wig"), emit: wig
script:
switch(file_id) {
case {it instanceof List}:
file_prefix = file_id[0]
break
case {it instanceof Map}:
file_prefix = file_id.values()[0]
break
default:
file_prefix = file_id
break
}
m = 0
if (fastq[1].size() == 2){
m = 1
}
"""
danpos.py dpos -m ${m} \
${params.dpos} \
-b ${wig_wce} \
-o ${file_prefix} \
${wig_ip}
mv ${file_prefix}/pooled/* ${file_prefix}/
rm -R ${file_prefix}/pooled
awk -v FS='\t' -v OFS='\t' 'FNR > 1 { print \$1, \$2-1, \$3, "Interval_"NR-1, \$6, "+" }' ${file_prefix}/${wig_ip.simpleName}.positions.xls > ${file_prefix}/${wig_ip.simpleName}.positions.bed
"""
}
workflow dpos_bw_no_b {
take:
fasta
fastq
bw
main:
bigwig_to_wig(bw)
dpos_wig_no_b(fastq, bigwig_to_wig.out.wig)
wig_to_bedgraph(fasta, bigwig_to_wig.out.wig)
emit:
bg = wig_to_bedgraph.out.bg
wig = bigwig_to_wig.out.wig
bed = dpos_wig_no_b.out.bed
}
process dpos_wig_no_b {
container = "${container_url}"
label "big_mem_mono_cpus"
tag "$file_id"
if (params.dpos_out != "") {
publishDir "results/${params.dpos_out}", mode: 'copy', overwrite: true
}
input:
val fastq
tuple val(file_id), path(wig_ip)
output:
tuple val(file_id), path("${file_prefix}/*.positions.bed"), emit: bed
script:
switch(file_id) {
case {it instanceof List}:
file_prefix = file_id[0]
break
case {it instanceof Map}:
file_prefix = file_id.values()[0]
break
default:
file_prefix = file_id
break
}
m = 0
if (fastq[1].size() == 2){
m = 1
}
"""
danpos.py dpos -m ${m} \
${params.dpos} \
-o ${file_prefix} \
${wig_ip}
mv ${file_prefix}/pooled/* ${file_prefix}/
rm -R ${file_prefix}/pooled
awk -v FS='\t' -v OFS='\t' 'FNR > 1 { print \$1, \$2-1, \$3, "Interval_"NR-1, \$6, "+" }' ${file_prefix}/${wig_ip.simpleName}.positions.xls > ${file_prefix}/${wig_ip.simpleName}.positions.bed
"""
}
workflow dwig_bwvsbw {
take:
fasta
fastq
bw_a
bw_b
main:
dpos_wigvswig(
fastq,
bigwig2_to_wig2(bw_a),
bigwig2_to_wig2(bw_b),
)
wig_to_bedgraph(fasta, dpos_wigvswig.out.wig)
emit:
bg = wig_to_bedgraph.out.bg
wig = dpeak_wig.out.wig
bed = dpeak_wig.out.bed
}
process dpos_wigvswig {
container = "${container_url}"
label "big_mem_mono_cpus"
tag "$file_id"
if (params.dpos_out != "") {
publishDir "results/${params.dpos_out}", mode: 'copy', overwrite: true
}
input:
val fastq
tuple val(file_id_a), path(wig_ip_a)
tuple val(file_id_b), path(wig_ip_b)
output:
tuple val(file_id), path("${file_prefix}/${wig_ip_a.simpleName}*.wig"), emit: wig
tuple val(file_id), path("${file_prefix}/*.positions.bed"), emit: bed
script:
switch(file_id_a) {
case {it instanceof List}:
file_prefix = file_id_a[0]
break
case {it instanceof Map}:
file_prefix = file_id_a.values()[0]
break
default:
file_prefix = file_id_a
break
}
m = 0
if (fastq[1].size() == 2){
m = 1
}
"""
danpos.py dpos -m ${m} \
${params.dpos} \
-b ${wig_ip_a},${wig_ip_b} \
-o ${file_prefix} \
${wig_ip_a}:${wig_ip_b}
mv ${file_prefix}/pooled/* ${file_prefix}/
rm -R ${file_prefix}/pooled
awk -v FS='\t' -v OFS='\t' 'FNR > 1 { print \$1, \$2-1, \$3, "Interval_"NR-1, \$6, "+" }' ${file_prefix}/${bam_ip.simpleName}.positions.xls > ${file_prefix}/${bam_ip.simpleName}.positions.bed
"""
}
params.dpeak = "--smooth_width 0 -n N "
params.dpeak_out = ""
process dpeak_bam {
container = "${container_url}"
label "big_mem_mono_cpus"
tag "$file_id"
if (params.dpeak_out != "") {
publishDir "results/${params.dpeak_out}", mode: 'copy', overwrite: true
}
input:
val fastq
tuple val(file_id), path(bam_ip), path(bam_wce)
output:
tuple val(file_id), path("${file_prefix}/${bam_ip.simpleName}*.wig"), path("${file_prefix}/${bam_wce.simpleName}*.wig"), emit: wig
tuple val(file_id), path("${file_prefix}/*.positions.bed"), path("${file_prefix}/*.summit.bed"), emit: bed
tuple val(file_id), path("${file_prefix}/*.bed"), emit: bed
script:
switch(file_id) {
case {it instanceof List}:
file_prefix = file_id[0]
break
case {it instanceof Map}:
file_prefix = file_id.values()[0]
break
default:
file_prefix = file_id
break
}
m = 0
if (fastq[1].size() == 2){
m = 1
}
"""
danpos.py dpeak -m ${m} \
${params.dpeak} \
-b ${bam_wce} \
-o ${file_prefix} \
${bam_ip}
mv ${file_prefix}/pooled/* ${file_prefix}/
rm -R ${file_prefix}/pooled
awk -v FS='\t' -v OFS='\t' 'FNR > 1 { print \$1, \$2-1, \$3, "Interval_"NR-1, \$6, "+" }' ${file_prefix}/${bam_ip.simpleName}.bgsub.peaks.xls > ${file_prefix}/${bam_ip.simpleName}.bgsub.positions.bed
awk -v FS='\t' -v OFS='\t' 'FNR > 1 { print \$1, \$4-1, \$4, "Interval_"NR-1, \$6, "+" }' ${file_prefix}/${bam_ip.simpleName}.bgsub.peaks.xls > ${file_prefix}/${bam_ip.simpleName}.bgsub.positions.summit.bed
"""
}
workflow dpeak_bw {
take:
fasta
fastq
bw
main:
dpeak_wig(fastq, bigwig2_to_wig2(bw))
wig2_to_bedgraph2(fasta, dpeak_wig.out.wig)
emit:
bg = wig2_to_bedgraph2.out.bg
wig = dpeak_wig.out.wig
bed = dpeak_wig.out.bed
}
process dpeak_wig {
container = "${container_url}"
label "big_mem_mono_cpus"
tag "$file_id"
if (params.dpeak_out != "") {
publishDir "results/${params.dpeak_out}", mode: 'copy', overwrite: true
}
input:
val fastq
tuple val(file_id), path(wig_ip), path(wig_wce)
output:
tuple val(file_id), path("${file_prefix}/${wig_ip.simpleName}.bgsub.wig"), path("${file_prefix}/${wig_wce.simpleName}.wig"), emit: wig
tuple val(file_id), path("${file_prefix}/*.positions.bed"), path("${file_prefix}/*.summit.bed"), emit: bed
script:
switch(file_id) {
case {it instanceof List}:
file_prefix = file_id[0]
break
case {it instanceof Map}:
file_prefix = file_id.values()[0]
break
default:
file_prefix = file_id
break
}
m = 0
if (fastq[1].size() == 2){
m = 1
}
"""
danpos.py dpeak -m ${m} \
${params.dpeak} \
-b ${wig_wce} \
-o ${file_prefix} \
${wig_ip}
mv ${file_prefix}/pooled/* ${file_prefix}/
rm -R ${file_prefix}/pooled
awk -v FS='\t' -v OFS='\t' 'FNR > 1 { print \$1, \$2-1, \$3, "Interval_"NR-1, \$6, "+" }' ${file_prefix}/${wig_ip.simpleName}.bgsub.peaks.xls > ${file_prefix}/${wig_ip.simpleName}.bgsub.positions.bed
awk -v FS='\t' -v OFS='\t' 'FNR > 1 { print \$1, \$4-1, \$4, "Interval_"NR-1, \$6, "+" }' ${file_prefix}/${wig_ip.simpleName}.bgsub.peaks.xls > ${file_prefix}/${wig_ip.simpleName}.bgsub.positions.summit.bed
"""
}
workflow dpeak_bwvsbw {
take:
fasta
fastq
bw_a
bw_b
main:
dpeak_wigvswig(
fastq,
bigwig2_to_wig2(bw_a),
bigwig2_to_wig2(bw_b),
)
wig2_to_bedgraph2(fasta, dpeak_wigvswig.out.wig)
emit:
bg = wig2_to_bedgraph2.out.bg
wig = dpeak_wig.out.wig
bed = dpeak_wig.out.bed
}
process dpeak_wigvswig {
container = "${container_url}"
label "big_mem_mono_cpus"
tag "$file_id"
if (params.dpeak_out != "") {
publishDir "results/${params.dpeak_out}", mode: 'copy', overwrite: true
}
input:
val fastq
tuple val(file_id_a), path(wig_ip_a), path(wig_wce_a)
tuple val(file_id_b), path(wig_ip_b), path(wig_wce_b)
output:
tuple val(file_id), path("${file_prefix}/${wig_ip_a.simpleName}.bgsub.wig"), path("${file_prefix}/${wig_wce_a.simpleName}.wig"), emit: wig
tuple val(file_id), path("${file_prefix}/*.positions.bed"), path("${file_prefix}/*.summit.bed"), emit: bed
script:
switch(file_id_a) {
case {it instanceof List}:
file_prefix = file_id_a[0]
break
case {it instanceof Map}:
file_prefix = file_id_a.values()[0]
break
default:
file_prefix = file_id_a
break
}
m = 0
if (fastq[1].size() == 2){
m = 1
}
"""
danpos.py dpeak -m ${m} \
${params.dpeak} \
-b ${wig_ip_a}:${wig_wce_a},${wig_ip_b}:${wig_wce_b} \
-o ${file_prefix} \
${wig_ip_a}:${wig_ip_b}
mv ${file_prefix}/pooled/* ${file_prefix}/
rm -R ${file_prefix}/pooled
awk -v FS='\t' -v OFS='\t' 'FNR > 1 { print \$1, \$2-1, \$3, "Interval_"NR-1, \$6, "+" }' ${file_prefix}/${bam_ip.simpleName}.bgsub.peaks.xls > ${file_prefix}/${bam_ip.simpleName}.bgsub.positions.bed
awk -v FS='\t' -v OFS='\t' 'FNR > 1 { print \$1, \$4-1, \$4, "Interval_"NR-1, \$6, "+" }' ${file_prefix}/${bam_ip.simpleName}.bgsub.peaks.xls > ${file_prefix}/${bam_ip.simpleName}.bgsub.positions.summit.bed
"""
}
\ No newline at end of file
profiles {
docker {
docker.temp = 'auto'
docker.enabled = true
process {
withName: index_bam {
container = "sambamba:0.6.7"
}
withName: bam_to_bigwig {
container = "deeptools:3.0.2"
}
}
}
psmn {
process{
withName: index_bam {
beforeScript = "source /usr/share/lmod/lmod/init/bash; module use ~/privatemodules"
module = "sambamba/0.6.7"
executor = "sge"
clusterOptions = "-m e -cwd -V"
memory = "30GB"
time = "24h"
queue = 'E5-2670deb128A,E5-2670deb128B,E5-2670deb128C,E5-2670deb128D,E5-2670deb128E,E5-2670deb128F'
penv = 'openmp16'
}
withName: bam_to_bigwig {
beforeScript = "source /usr/share/lmod/lmod/init/bash; module use ~/privatemodules"
module = "deepTools/3.0.2"
executor = "sge"
clusterOptions = "-m e -cwd -V"
memory = "30GB"
time = "24h"
queue = 'E5-2670deb128A,E5-2670deb128B,E5-2670deb128C,E5-2670deb128D,E5-2670deb128E,E5-2670deb128F'
penv = 'openmp16'
}
}
}
}
params.bam = "$baseDir/data/bam/*.bam"
log.info "bams files : ${params.bam}"
Channel
.fromPath( params.bam )
.ifEmpty { error "Cannot find any bam files matching: ${params.bam}" }
.map { it -> [(it.baseName =~ /([^\.]*)/)[0][1], it]}
.set { bam_files }
bam_files.into{
bam_files_index;
bam_files_bigwig
}
process index_bam {
tag "$file_id"
cpus 4
input:
set file_id, file(bam) from bam_files_index
output:
set file_id, "*.bam*" into indexed_bam_file
script:
"""
sambamba index -t ${task.cpus} ${bam}
"""
}
bam_files_indexed = bam_files_bigwig.join(indexed_bam_file, by: 0)
process bam_to_bigwig {
tag "$file_id"
cpus 4
publishDir "results/mapping/bigwig/", mode: 'copy'
input:
set file_id, file(bam), file(idx) from bam_files_indexed
output:
set file_id, "*.bw" into bw_files
script:
"""
bamCoverage -p ${task.cpus} --ignoreDuplicates -b ${bam} -o ${file_id}.bw
"""
}
profiles {
docker {
docker.temp = 'auto'
docker.enabled = true
process {
withName: compute_matrix {
container = "deeptools:3.0.2"
}
}
}
psmn {
process{
withName: compute_matrix {
beforeScript = "source /usr/share/lmod/lmod/init/bash; module use ~/privatemodules"
module = "deepTools/3.0.2"
executor = "sge"
clusterOptions = "-m e -cwd -V"
memory = "30GB"
time = "24h"
queue = 'E5-2670deb128A,E5-2670deb128B,E5-2670deb128C,E5-2670deb128D,E5-2670deb128E,E5-2670deb128F'
penv = 'openmp16'
}
}
}
}
params.bw = "$baseDir/data/bigwig/*.bw"
params.bed = "$baseDir/data/annot/*.bed"
log.info "bigwig files : ${params.bw}"
log.info "bed files : ${params.bed}"
Channel
.fromPath( params.bw )
.ifEmpty { error "Cannot find any bigwig files matching: ${params.bw}" }
.set { bw_files }
Channel
.fromPath( params.bed )
.ifEmpty { error "Cannot find any bed files matching: ${params.bed}" }
.map { it -> [(it.baseName =~ /([^\.]*)/)[0][1], it]}
.set { bed_files }
process compute_matrix {
tag "$bed_file_id"
cpus 4
publishDir "results/mapping/region_matrix/", mode: 'copy'
input:
file bw from bw_files.collect()
set bed_file_id, file(bed) from bed_files.collect()
output:
set bed_file_id, "*.mat.gz" into region_matrix
script:
"""
computeMatrix scale-regions -S ${bw} \
-p ${task.cpus} \
-R ${bed} \
--beforeRegionStartLength 100 \
--afterRegionStartLength 100 \
-o ${bed_file_id}.mat.gz
"""
}
profiles {
docker {
docker.temp = 'auto'
docker.enabled = true
process {
withName: plot_profile {
container = "deeptools:3.0.2"
}
}
}
psmn {
process{
withName: plot_profile {
beforeScript = "source /usr/share/lmod/lmod/init/bash; module use ~/privatemodules"
module = "deepTools/3.0.2"
executor = "sge"
clusterOptions = "-m e -cwd -V"
memory = "30GB"
time = "24h"
queue = 'E5-2670deb128A,E5-2670deb128B,E5-2670deb128C,E5-2670deb128D,E5-2670deb128E,E5-2670deb128F'
penv = 'openmp16'
}
}
}
}