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

Target

Select target project
  • LBMC/RMI2/rmi2_pipelines
  • LBMC/Palladino/RNAseq_nextflow
  • rseraphi/nextflow
  • elabaron/nextflow
  • pberna01/nextflow
  • jblin/nextflow
  • cginevra/nextflow
  • carpin/nextflow
  • cfournea/nextflow
  • dtorresc/nextflow
  • LBMC/nextflow
  • nlecouvr/nextflow-nathan
  • lpicard/nextflow
  • vvanoost/nextflow
  • fmortreu/nextflow
  • hpolvech/nextflow
  • lanani/nextflow
  • mcariou/nextflow
  • fduveau/nextflow
  • jshapiro/nextflow
  • hregue/nextflow
  • yjia01/nextflow
  • acorbin/nextflow
  • ggirau03/nextflow
  • letien02/nextflow
  • ogandril/nextflow
  • jclaud01/nextflow
  • mshamjal/nextflow
  • mprieux/nextflow
  • z483801/nextflow
  • mparis/nextflow
  • alapendr/nextflow
  • cbourgeo/nextflow
  • jvalat/nextflow
  • z483800/nextflow
  • ecombe01/nextflow
  • dchalopi/nextflow
  • mherbett/nextflow
  • jprobin/nextflow
  • lestrada/nextflow
  • gyvert/nextflow
  • nfontrod/nextflow
  • gbenoit/nextflow
  • aguill09/nextflow
  • LBMC/regards/nextflow
  • mvilcot/nextflow
  • jkleine/nextflow
  • jseimand/nextflow
  • LBMC/Delattre/JU28_59vs17_SNP
  • mdjaffar/nextflow
  • pmarie01/nextflow
  • rhoury/nextflow
  • mlepetit/nextflow
  • lgely/nextflow
54 results
Show changes
Showing
with 849 additions and 283 deletions
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}" }
.set { bam_files }
process index_bam {
tag "$bam.baseName"
input:
file bam from bam_files
output:
file "*bam*" into indexed_bam_file
script:
"""
samtools index ${bam}
"""
}
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}" }
.set { bam_files }
process sort_bam {
tag "$bams.baseName"
cpus 4
input:
file bam from bam_files
output:
file "*_sorted.bam" into sorted_bam_files
script:
"""
samtools sort -@ ${task.cpus} -O BAM -o ${bam.baseName}_sorted.bam ${bam}
"""
}
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}" }
.set { bam_files }
process split_bam {
tag "$bam.baseName"
cpus 2
input:
file bam from bam_files
output:
file "*_forward.bam*" into forward_bam_files
file "*_reverse.bam*" into reverse_bam_files
script:
"""
samtools view -hb -F 0x10 ${bam} > ${bam}_forward.bam &
samtools view -hb -f 0x10 ${bam} > ${bam}_reverse.bam
"""
}
nextflow src/nf_modules/SAMtools/tests/sort_bams.nf \
-c src/nf_modules/SAMtools/samtools.config \
-profile docker \
--bam "data/tiny_dataset/map/tiny_v2.bam"
nextflow src/nf_modules/SAMtools/tests/index_bams.nf \
-c src/nf_modules/SAMtools/samtools.config \
-profile docker \
--bam "data/tiny_dataset/map/tiny_v2.sort.bam"
nextflow src/nf_modules/SAMtools/tests/split_bams.nf \
-c src/nf_modules/SAMtools/samtools.config \
-profile docker \
--bam "data/tiny_dataset/map/tiny_v2.bam"
nextflow src/nf_modules/SAMtools/tests/filter_bams.nf \
-c src/nf_modules/SAMtools/samtools.config \
-profile docker \
--bam "data/tiny_dataset/map/tiny_v2.bam" \
--bed "data/tiny_dataset/OLD/2genes.bed"
nextflow src/nf_modules/UrQt/tests/trimming_paired.nf \
-c src/nf_modules/UrQt/urqt.config \
-profile docker \
--fastq "data/tiny_dataset/fastq/tiny_R{1,2}.fastq"
nextflow src/nf_modules/UrQt/tests/trimming_single.nf \
-c src/nf_modules/UrQt/urqt.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"
cpus 4
input:
set pair_id, file(reads) from fastq_files
output:
file "*_trim_R{1,2}.fastq.gz" into fastq_files_cut
script:
"""
UrQt --t 20 --m ${task.cpus} --gz \
--in ${reads[0]} --inpair ${reads[1]} \
--out ${pair_id}_trim_R1.fastq.gz --outpair ${pair_id}_trim_R2.fastq.gz \
> ${pair_id}_trimming_report.txt
"""
}
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"
cpus 4
input:
file reads from fastq_files
output:
file "*_trim.fastq.gz" into fastq_files_trim
script:
"""
UrQt --t 20 --m ${task.cpus} --gz \
--in ${reads} \
--out ${reads.baseName}_trim.fastq.gz \
> ${reads.baseName}_trimming_report.txt
"""
}
profiles {
docker {
docker.temp = 'auto'
docker.enabled = true
process {
$trimming {
container = "urqt:d62c1f8"
}
}
}
sge {
process{
$trimming {
beforeScript = "module purge; module load UrQt/d62c1f8"
}
}
}
}
/*
* urqt :
* Imputs : fastq files
* Output : fastq files
*/
/* 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 "${reads}"
cpus 4
publishDir "results/fastq/trimming/", mode: 'copy'
input:
file reads from fastq_files
output:
file "*_trim_R{1,2}.fastq.gz" into fastq_files_trim
script:
"""
UrQt --t 20 --m ${task.cpus} --gz \
--in ${reads[0]} --inpair ${reads[1]} \
--out ${reads[0].baseName}_trim_R1.fastq.gz --outpair ${reads[1].baseName}_trim_R2.fastq.gz \
> ${reads[0].baseName}_trimming_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"
cpus 4
publishDir "results/fastq/trimming/", mode: 'copy'
input:
file reads from fastq_files
output:
file "*_trim.fastq.gz" into fastq_files_trim
script:
"""
UrQt --t 20 --m ${task.cpus} --gz \
--in ${reads} \
--out ${reads.baseName}_trim.fastq.gz \
> ${reads.baseName}_trimming_report.txt
"""
}
// SPDX-FileCopyrightText: 2022 Laurent Modolo <laurent.modolo@ens-lyon.fr>
//
// SPDX-License-Identifier: AGPL-3.0-or-later
version = "0.8.0"
container_url = "lbmc/agat:${version}"
params.gff_to_bed = ""
params.gff_to_bed_out = ""
process gff_to_bed {
container = "${container_url}"
label "big_mem_mono_cpus"
tag "$file_id"
if (params.gff_to_bed_out != "") {
publishDir "results/${params.gff_to_bed_out}", mode: 'copy'
}
input:
tuple val(file_id), path(gff)
output:
tuple val(file_id), path("*.bed"), emit: bed
script:
"""
zcat ${gff} > ${gff.baseName}.gff
agat_convert_sp_gff2bed.pl ${params.gff_to_bed} --gff ${gff.baseName}.gff -o ${gff.simpleName}.bed
"""
}
params.gff_to_gtf = ""
params.gff_to_gtf_out = ""
process gff_to_gtf {
container = "${container_url}"
label "big_mem_mono_cpus"
tag "$file_id"
if (params.gff_to_gtf_out != "") {
publishDir "results/${params.gff_to_gtf_out}", mode: 'copy'
}
input:
tuple val(file_id), path(gff)
output:
tuple val(file_id), path("*.gtf"), emit: gtf
script:
"""
zcat ${gff} > ${gff.baseName}.gff
agat_convert_sp_gff2gtf.pl ${params.gff_to_gtf} --gff ${gff.baseName}.gff -o ${gff.simpleName}.gtf
"""
}
\ 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 = "dd96682"
container_url = "lbmc/alntools:${version}"
params.bam2ec = ""
params.bam2ec_out = ""
process bam2ec {
container = "${container_url}"
label "big_mem_mono_cpus"
tag "$file_id"
if (params.bam2ec_out != "") {
publishDir "results/${params.bam2ec_out}", mode: 'copy'
}
input:
tuple val(file_id), path(bam), path(bam_idx)
tuple val(transcripts_lengths_id), path(transcripts_lengths)
output:
tuple val(file_id), path("${bam.simpleName}.bin"), emit: bin
tuple val(transcripts_lengths_id), path("${transcripts_lengths}"), emit: tsv
tuple val(file_id), path("${bam.simpleName}_bam2ec_report.txt"), emit: report
script:
"""
mkdir tmp
alntools bam2ec \
-c 1 ${params.bam2ec} \
-d ./tmp \
-t ${transcripts_lengths} \
-v \
${bam} ${bam.simpleName}.bin &> \
${bam.simpleName}_bam2ec_report.txt
"""
}
params.gtf_to_transcripts_lengths = ""
params.gtf_to_transcripts_lengths_out = ""
process gtf_to_transcripts_lengths {
container = "${container_url}"
label "big_mem_mono_cpus"
tag "$file_id"
if (params.gtf_to_transcripts_lengths != "") {
publishDir "results/${params.gtf_to_transcripts_lengths}", mode: 'copy'
}
input:
tuple val(file_id), path(gtf)
output:
tuple val(file_id), path("${gtf.simpleName}_transcripts_lengths.tsv"), emit: tsv
script:
"""
awk -F"[\\t;]" '
\$3=="exon" {
ID=gensub(/transcript_id \\"(.*)\\"/, "\\\\1", "g", \$11);
LEN[ID]+=\$5-\$4+1;
}
END{
for(i in LEN)
{print i"\\t"LEN[i]}
}
' ${gtf} > ${gtf.simpleName}_transcripts_lengths.tsv
"""
}
// SPDX-FileCopyrightText: 2022 Laurent Modolo <laurent.modolo@ens-lyon.fr>
//
// SPDX-License-Identifier: AGPL-3.0-or-later
version = "5.1_24Aug19.3e8--hdfd78af_1"
container_url = "quay.io/biocontainers/beagle::${version}"
params.phasing = ""
process phasing {
container = "${container_url}"
label "big_mem_multi_cpus"
tag "$file_id"
input:
tuple val(file_id), path(vcf)
tuple val(ref_id), path(ref_vcf)
output:
tuple val(file_id), path("*.bam*"), emit: bam
script:
"""
beagle nthread=${task.cpus} \
gtgl=${vcf} \
ref=${ref_vcf}
"""
}
// 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"
}
}
}
}
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"
}
}
}
}