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
  • dev
  • master
  • revert-0d3ded33
3 results
Show changes
Showing
with 1613 additions and 302 deletions
// SPDX-FileCopyrightText: 2022 Laurent Modolo <laurent.modolo@ens-lyon.fr>
//
// SPDX-License-Identifier: AGPL-3.0-or-later
version = "2.25.0"
container_url = "lbmc/bedtools:${version}"
params.fasta_from_bed = "-name"
params.fasta_from_bed_out = ""
process fasta_from_bed {
container = "${container_url}"
label "big_mem_mono_cpus"
tag "${file_id}"
if (params.fasta_from_bed_out != "") {
publishDir "results/${params.fasta_from_bed_out}", mode: 'copy'
}
input:
tuple val(fasta_id), path(fasta)
tuple val(file_id), path(bed)
output:
tuple val(file_id), path("*_extracted.fasta"), emit: fasta
script:
"""
bedtools getfasta ${params.fasta_from_bed} \
-fi ${fasta} -bed ${bed} -fo ${bed.baseName}_extracted.fasta
"""
}
params.merge_bed = ""
params.merge_bed_out = ""
process merge_bed {
container = "${container_url}"
label "big_mem_mono_cpus"
tag "${file_id}"
if (params.merge_bed_out != "") {
publishDir "results/${params.merge_bed_out}", mode: 'copy'
}
input:
tuple val(file_id), path(bed)
output:
tuple val(file_id), path("*_merged.fasta"), emit: bed
script:
"""
bedtools merge ${params.merge_bed} -i ${bed} > ${bed[0].simpleName}_merged.bed
"""
}
params.bam_to_fastq_singleend = ""
params.bam_to_fastq_singleend_out = ""
process bam_to_fastq_singleend {
container = "${container_url}"
label "big_mem_mono_cpus"
tag "${bam_id}"
if (params.bam_to_fastq_singleend_out != "") {
publishDir "results/${params.bam_to_fastq_singleend_out}", mode: 'copy'
}
input:
tuple val(bam_id), path(bam)
output:
tuple val(bam_id), path("*.fastq"), emit: fastq
script:
"""
bedtools bamtofastq \
${params.bam_to_fastq_singleend} \
-i ${bam} -fq ${bam.baseName}.fastq
"""
}
params.bam_to_fastq_pairedend = ""
params.bam_to_fastq_pairedend_out = ""
process bam_to_fastq_pairedend {
container = "${container_url}"
label "big_mem_mono_cpus"
tag "${bam_id}"
if (params.bam_to_fastq_pairedend_out != "") {
publishDir "results/${params.bam_to_fastq_pairedend_out}", mode: 'copy'
}
input:
tuple val(bam_id), path(bam)
output:
tuple val(bam_id), path("*.fastq"), emit: fastq
script:
"""
bedtools bamtofastq \
${params.bam_to_fastq_pairedend} \
-i ${bam} -fq ${bam.baseName}_R1.fastq -fq2 ${bam.baseName}_R2.fastq
"""
}
params.bam_to_bedgraph = ""
params.bam_to_bedgraph_out = ""
process bam_to_bedgraph {
container = "${container_url}"
label "big_mem_mono_cpus"
tag "${bam_id}"
if (params.bam_to_bedgraph_out != "") {
publishDir "results/${params.bam_to_bedgraph_out}", mode: 'copy'
}
input:
tuple val(bam_id), path(bam)
output:
tuple val(bam_id), path("*.bed"), emit: bed
script:
"""
bedtools genomecov \
${params.bam_to_bedgraph} \
-ibam ${bam} \
-bg > ${bam.simpleName}.bed
"""
}
// SPDX-FileCopyrightText: 2022 Laurent Modolo <laurent.modolo@ens-lyon.fr>
//
// SPDX-License-Identifier: AGPL-3.0-or-later
version = "1.0"
container_url = "lbmc/bioawk:${version}"
params.fasta_to_transcripts_lengths = ""
params.fasta_to_transcripts_lengths_out = ""
process fasta_to_transcripts_lengths {
container = "${container_url}"
label "big_mem_mono_cpus"
tag "$file_id"
if (params.fasta_to_transcripts_lengths_out != "") {
publishDir "results/${params.fasta_to_transcripts_lengths_out}", mode: 'copy'
}
input:
tuple val(file_id), path(fasta)
output:
tuple val(file_id), path("${fasta.simpleName}_transcripts_lengths.tsv"), emit: tsv
script:
"""
bioawk -c fastx '{print(\$name" "length(\$seq))}' ${fasta} > ${fasta.simpleName}_transcripts_lengths.tsv
"""
}
\ No newline at end of file
// SPDX-FileCopyrightText: 2022 Laurent Modolo <laurent.modolo@ens-lyon.fr>
//
// SPDX-License-Identifier: AGPL-3.0-or-later
version = "0.4.0"
container_url = "lbmc/bioconvert:${version}"
params.bigwig_to_wig = ""
params.bigwig_to_wig_out = ""
process bigwig_to_wig {
container = "${container_url}"
label "big_mem_mono_cpus"
tag "${file_id}"
if (params.bigwig_to_wig_out != "") {
publishDir "results/${params.bigwig_to_wig_out}", mode: 'copy'
}
input:
tuple val(file_id) path(bw)
output:
tuple val(file_id), path("*.wig"), emit: wig
script:
"""
bioconvert bigwig2wiggle ${bw} ${bw.simpleName}.wig
"""
}
params.bigwig2_to_wig2 = ""
params.bigwig2_to_wig2_out = ""
process bigwig2_to_wig2 {
container = "${container_url}"
label "big_mem_mono_cpus"
tag "${file_id}"
if (params.bigwig_to_wig_out != "") {
publishDir "results/${params.bigwig_to_wig_out}", mode: 'copy'
}
input:
tuple val(file_id), path(bw_a), path(bw_b)
output:
tuple val(file_id), path("${bw_a.simpleName}.wig"), path("${bw_b.simpleName}.wig"), emit: wig
script:
"""
bioconvert bigwig2wiggle ${bw_a} ${bw_a.simpleName}.wig
bioconvert bigwig2wiggle ${bw_b} ${bw_b.simpleName}.wig
"""
}
\ No newline at end of file
// 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 {
$adaptor_removal {
container = "cutadapt:1.14"
}
}
}
sge {
process{
$adaptor_removal {
beforeScript = "module purge; module load cutadapt/1.14"
executor = "sge"
cpus = 1
memory = "5GB"
time = "6h"
queueSize = 1000
pollInterval = '60sec'
queue = 'h6-E5-2667v4deb128'
penv = 'openmp8'
}
}
}
}
profiles {
docker {
docker.temp = 'auto'
docker.enabled = true
process {
$trimming {
container = "cutadapt:1.14"
}
}
}
sge {
process{
$trimming {
beforeScript = "module purge; module load cutadapt/1.14"
executor = "sge"
cpus = 1
memory = "5GB"
time = "6h"
queueSize = 1000
pollInterval = '60sec'
queue = 'h6-E5-2667v4deb128'
penv = 'openmp8'
}
}
}
}
/*
* cutadapt :
* Imputs : fastq files
* Output : fastq files
*/
/* Illumina adaptor removal */
/*
* for paired-end data
*/
params.fastq = "$baseDir/data/fastq/*_{1,2}.fastq"
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
"""
}
/*
* for single-end data
*/
params.fastq = "$baseDir/data/fastq/*.fastq"
log.info "fastq files : ${params.fastq}"
Channel
.fromPath( params.fastq )
.ifEmpty { error "Cannot find any fastq files matching: ${params.fastq}" }
.set { fastq_files }
process adaptor_removal {
tag "$reads.baseName"
publishDir "results/fastq/adaptor_removal/", mode: 'copy'
input:
file reads from fastq_files
output:
file "*_cut.fastq.gz" into fastq_files_cut
script:
"""
cutadapt -a AGATCGGAAGAG -g CTCTTCCGATCT\
-o ${reads.baseName}_cut.fastq.gz \
${reads} > ${reads.baseName}_report.txt
"""
}
/* quality trimming */
/*
* for paired-end data
*/
params.fastq = "$baseDir/data/fastq/*_{1,2}.fastq"
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
"""
}
/*
* for single-end data
*/
params.fastq = "$baseDir/data/fastq/*.fastq"
log.info "fastq files : ${params.fastq}"
Channel
.fromPath( params.fastq )
.ifEmpty { error "Cannot find any fastq files matching: ${params.fastq}" }
.set { fastq_files }
process trimming {
tag "$reads.baseName"
publishDir "results/fastq/trimming/", mode: 'copy'
input:
file reads from fastq_files
output:
file "*_trim.fastq.gz" into fastq_files_trim
script:
"""
cutadapt -q 20,20 \
-o ${reads.baseName}_trim.fastq.gz \
${reads} > ${reads.baseName}_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
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
"""
}
log.info "fastq files : ${params.fastq}"
Channel
.fromPath( params.fastq )
.ifEmpty { error "Cannot find any fastq files matching: ${params.fastq}" }
.set { fastq_files }
process adaptor_removal {
tag "$reads.baseName"
input:
file reads from fastq_files
output:
file "*_cut.fastq.gz" into fastq_files_cut
script:
"""
cutadapt -a AGATCGGAAGAG -g CTCTTCCGATCT\
-o ${reads.baseName}_cut.fastq.gz \
${reads} > ${reads.baseName}_report.txt
"""
}
nextflow src/nf_modules/cutadapt/tests/adaptor_removal_paired.nf \
-c src/nf_modules/cutadapt/cutadapt.config \
-profile docker \
--fastq "data/tiny_dataset/fastq/tiny_R{1,2}.fastq"
nextflow src/nf_modules/cutadapt/tests/adaptor_removal_single.nf \
-c src/nf_modules/cutadapt/cutadapt.config \
-profile docker \
--fastq "data/tiny_dataset/fastq/tiny_R{1,2}.fastq"
nextflow src/nf_modules/cutadapt/tests/trimming_paired.nf \
-c src/nf_modules/cutadapt/cutadapt.config \
-profile docker \
--fastq "data/tiny_dataset/fastq/tiny_R{1,2}.fastq"
nextflow src/nf_modules/cutadapt/tests/trimming_single.nf \
-c src/nf_modules/cutadapt/cutadapt.config \
-profile docker \
--fastq "data/tiny_dataset/fastq/tiny_R{1,2}.fastq"
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
"""
}
log.info "fastq files : ${params.fastq}"
Channel
.fromPath( params.fastq )
.ifEmpty { error "Cannot find any fastq files matching: ${params.fastq}" }
.set { fastq_files }
process trimming {
tag "$reads.baseName"
input:
file reads from fastq_files
output:
file "*_trim.fastq.gz" into fastq_files_cut
script:
"""
cutadapt -q 20,20 \
-o ${reads.baseName}_trim.fastq.gz \
${reads} > ${reads.baseName}_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
// SPDX-FileCopyrightText: 2022 Laurent Modolo <laurent.modolo@ens-lyon.fr>
//
// SPDX-License-Identifier: AGPL-3.0-or-later
version = "3.5.1"
container_url = "lbmc/deeptools:${version}"
params.index_bam = ""
params.index_bam_out = ""
process index_bam {
container = "${container_url}"
label "big_mem_multi_cpus"
tag "$file_id"
if (params.index_bam_out != "") {
publishDir "results/${params.index_bam_out}", mode: 'copy'
}
input:
tuple val(file_id), path(bam)
output:
tuple val(file_id), path("${bam}"), path("*.bam*"), emit: bam_idx
script:
"""
sambamba index -t ${task.cpus} ${bam}
"""
}
params.bam_to_bigwig = ""
params.bam_to_bigwig_out = ""
process bam_to_bigwig {
container = "${container_url}"
label "big_mem_multi_cpus"
tag "$file_id"
if (params.bam_to_bigwig_out != "") {
publishDir "results/${params.bam_to_bigwig_out}", mode: 'copy'
}
input:
tuple val(file_id), path(bam), path(idx)
output:
tuple val(file_id), path("*.bw"), emit: bw
script:
"""
bamCoverage -p ${task.cpus} --ignoreDuplicates -b ${bam} \
-o ${bam.simpleName}.bw
"""
}
params.compute_matrix = ""
params.compute_matrix_out = ""
process compute_matrix {
container = "${container_url}"
label "big_mem_multi_cpus"
tag "${bed_file_id}"
if (params.compute_matrix_out != "") {
publishDir "results/${params.compute_matrix_out}", mode: 'copy'
}
input:
tuple val(file_id), path(bw)
tuple val(bed_file_id), path(bed)
output:
tuple val(bed_file_id), path("*.mat.gz"), emit: matrix
script:
"""
computeMatrix scale-regions -S ${bw} \
-p ${task.cpus} \
-R ${bed} \
--beforeRegionStartLength 100 \
--afterRegionStartLength 100 \
-o ${bed.simpleName}.mat.gz
"""
}
params.plot_profile = ""
params.plot_profile_out = ""
process plot_profile {
container = "${container_url}"
label "big_mem_mono_cpus"
tag "$file_id"
if (params.compute_matrix_out != "") {
publishDir "results/${params.compute_matrix_out}", mode: 'copy'
}
input:
tuple val(file_id), path(matrix)
output:
tuple val(file_id), path("*.pdf"), emit: pdf
script:
/*
see more option at
https://deeptools.readthedocs.io/en/develop/content/tools/plotProfile.html
*/
"""
plotProfile -m ${matrix} \
--plotFileFormat=pdf \
-out ${matrix.simpleName}.pdf \
--plotType=fill \
--perGroup \
--plotTitle "${params.title}"
"""
}
// SPDX-FileCopyrightText: 2022 Laurent Modolo <laurent.modolo@ens-lyon.fr>
//
// SPDX-License-Identifier: AGPL-3.0-or-later
version = "0.3.1"
container_url = "lbmc/emase-zero:${version}"
include { g2tr } from "./../kb/main.nf"
include { bam2ec } from "./../alntools/main.nf"
include { fasta_to_transcripts_lengths } from "./../bioawk/main.nf"
params.count = "-m 2"
params.count_out = ""
workflow count {
take:
bam_idx
fasta
gtf
main:
g2tr(gtf)
fasta_to_transcripts_lengths(fasta)
bam2ec(bam_idx, fasta_to_transcripts_lengths.out.tsv.collect())
emase(bam2ec.out.bin, fasta.collect(), bam2ec.out.tsv, g2tr.out.g2t.collect())
emit:
count = emase.out.count
}
process emase {
container = "${container_url}"
label "big_mem_mono_cpus"
tag "$file_id"
if (params.count_out != "") {
publishDir "results/${params.count_out}", mode: 'copy'
}
input:
tuple val(file_id), path(bin)
tuple val(fasta_id), path(fasta)
tuple val(transcript_length_id), path(transcript_length)
tuple val(gene_to_transcript_id), path(gene_to_transcript)
output:
tuple val(file_id), path("${bin.simpleName}.quantified*"), emit: count
path "*_report.txt", emit: report
script:
"""
grep ">" ${fasta} | sed 's/>//' > tr_list.txt
emase-zero ${params.count} \
-o ${bin.simpleName}.quantified \
-l ${transcript_length} \
-g ${gene_to_transcript} \
${bin} &> ${file_id}_emase-zero_report.txt
"""
}
\ No newline at end of file
// SPDX-FileCopyrightText: 2022 Laurent Modolo <laurent.modolo@ens-lyon.fr>
//
// SPDX-License-Identifier: AGPL-3.0-or-later
version = "0.10.16"
container_url = "lbmc/emase:${version}"
params.diploid_genome = "-x"
params.diploid_genome_out = "-x"
process diploid_genome {
container = "${container_url}"
label "big_mem_mono_cpus"
tag "${genome_a}-${genome_b}"
if (params.diploid_genome_out != "") {
publishDir "results/${params.diploid_genome_out}", mode: 'copy'
}
input:
tuple val(genome_a), path(fasta_a), val(genome_b), path(fasta_b)
output:
tuple val("${genome_a}_${genome_b}"), path(".fa"), emit: fasta
script:
"""
prepare-emase -G ${fasta_a},${fasta_b} -s ${genome_a},${genome_b} ${params.diploid_genome}
"""
}
\ No newline at end of file
// SPDX-FileCopyrightText: 2022 Laurent Modolo <laurent.modolo@ens-lyon.fr>
//
// SPDX-License-Identifier: AGPL-3.0-or-later
version = "0.23.2"
container_url = "lbmc/fastp:${version}"
params.fastp_protocol = ""
params.fastp = ""
params.fastp_out = ""
workflow fastp {
take:
fastq
main:
switch(params.fastp_protocol) {
case "accel_1splus":
fastp_accel_1splus(fastq)
fastp_accel_1splus.out.fastq.set{res_fastq}
fastp_accel_1splus.out.report.set{res_report}
break;
default:
fastp_default(fastq)
fastp_default.out.fastq.set{res_fastq}
fastp_default.out.report.set{res_report}
break;
}
emit:
fastq = res_fastq
report = res_report
}
process fastp_default {
container = "${container_url}"
label "big_mem_multi_cpus"
tag "$file_prefix"
if (params.fastp_out != "") {
publishDir "results/${params.fastp_out}", mode: 'copy'
}
input:
tuple val(file_id), path(reads)
output:
tuple val(file_id), path("*_trim.fastq.gz"), emit: fastq
tuple val(file_id), path("${file_prefix}.html"), emit: html
tuple val(file_id), path("${file_prefix}_fastp.json"), emit: report
script:
if (file_id instanceof List){
file_prefix = file_id[0]
} else {
file_prefix = file_id
}
if (reads.size() == 2)
"""
fastp --thread ${task.cpus} \
--qualified_quality_phred 20 \
--disable_length_filtering \
--detect_adapter_for_pe \
${params.fastp} \
--in1 ${reads[0]} \
--in2 ${reads[1]} \
--out1 ${file_prefix}_R1_trim.fastq.gz \
--out2 ${file_prefix}_R2_trim.fastq.gz \
--html ${file_prefix}.html \
--json ${file_prefix}_fastp.json \
--report_title ${file_prefix}
"""
else
"""
fastp --thread ${task.cpus} \
--qualified_quality_phred 20 \
--disable_length_filtering \
--detect_adapter_for_pe \
${params.fastp} \
--in1 ${reads[0]} \
--out1 ${file_prefix}_trim.fastq.gz \
--html ${file_prefix}.html \
--json ${file_prefix}_fastp.json \
--report_title ${file_prefix}
"""
}
process fastp_accel_1splus {
container = "${container_url}"
label "big_mem_multi_cpus"
tag "$file_prefix"
if (params.fastp_out != "") {
publishDir "results/${params.fastp_out}", mode: 'copy'
}
input:
tuple val(file_id), path(reads)
output:
tuple val(file_id), path("*_trim.fastq.gz"), emit: fastq
tuple val(file_id), path("${file_prefix}.html"), emit: html
tuple val(file_id), path("${file_prefix}_fastp.json"), emit: report
script:
if (file_id instanceof List){
file_prefix = file_id[0]
} else {
file_prefix = file_id
}
if (reads.size() == 2)
"""
fastp --thread ${task.cpus} \
--disable_quality_filtering \
--disable_length_filtering \
--disable_trim_poly_g \
--detect_adapter_for_pe \
--stdout \
--in1 ${reads[0]} \
--in2 ${reads[1]} 2> /dev/null | \
fastp --thread ${task.cpus} \
--stdin \
--interleaved_in \
--trim_front1=10 \
--trim_front2=10 \
--disable_adapter_trimming \
--qualified_quality_phred 20 \
--disable_length_filtering \
--detect_adapter_for_pe \
${params.fastp} \
--out1 ${file_prefix}_R1_trim.fastq.gz \
--out2 ${file_prefix}_R2_trim.fastq.gz \
--html ${file_prefix}.html \
--json ${file_prefix}_fastp.json \
--report_title ${file_prefix}
"""
else
"""
fastp --thread ${task.cpus} \
--disable_quality_filtering \
--disable_length_filtering \
--disable_trim_poly_g \
--detect_adapter_for_pe \
--stdout \
--in1 ${reads[0]} 2> /dev/null | \
fastp --thread ${task.cpus} \
--disable_adapter_trimming \
--stdin \
--trim_front1=10 \
--qualified_quality_phred 20 \
--disable_length_filtering \
--detect_adapter_for_pe \
${params.fastp} \
--out1 ${file_prefix}_trim.fastq.gz \
--html ${file_prefix}.html \
--json ${file_prefix}_fastp.json \
--report_title ${file_prefix}
"""
}