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 1349 additions and 117 deletions
params.sam = "$baseDir/data/sam/*.bam"
log.info "bam 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 }
process dedup_sam {
tag "$file_id"
cpus 4
input:
set file_id, file(bam) from bam_files
output:
set file_id, "*_dedup.bam*" into dedup_bam_files
script:
"""
samtools view -h ${bam} | \
samblaster --addMateTags | \
samtools view -Sb - > ${file_id}_dedub.bam
"""
}
./nextflow src/nf_modules/samblaster/dedup_sams.nf \
-c src/nf_modules/samblaster/dedup_sams.config \
-profile docker \
--bam "data/tiny_dataset/map/tiny_v2.bam"
// SPDX-FileCopyrightText: 2022 Laurent Modolo <laurent.modolo@ens-lyon.fr>
//
// SPDX-License-Identifier: AGPL-3.0-or-later
version = "1.11"
container_url = "lbmc/samtools:${version}"
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("*.fai"), emit: index
script:
"""
if gzip -t ${fasta}; then
zcat ${fasta} > ${fasta.simpleName}.fasta
samtools faidx ${params.index_fasta} ${fasta.simpleName}.fasta
else
samtools faidx ${params.index_fasta} ${fasta}
fi
"""
}
params.filter_bam_quality_threshold = 30
params.filter_bam_quality = "-q ${params.filter_bam_quality_threshold}"
params.filter_bam_quality_out = ""
process filter_bam_quality {
container = "${container_url}"
label "big_mem_multi_cpus"
tag "$file_id"
if (params.filter_bam_quality_out != "") {
publishDir "results/${params.filter_bam_quality_out}", mode: 'copy'
}
input:
tuple val(file_id), path(bam)
output:
tuple val(file_id), path("*_filtered.bam"), emit: bam
script:
"""
samtools view -@ ${task.cpus} -hb ${bam} ${params.filter_bam_quality} > \
${bam.simpleName}_filtered.bam
"""
}
params.filter_bam = ""
params.filter_bam_out = ""
process filter_bam {
container = "${container_url}"
label "big_mem_multi_cpus"
tag "$file_id"
if (params.filter_bam_out != "") {
publishDir "results/${params.filter_bam_out}", mode: 'copy'
}
input:
tuple val(file_id), path(bam)
tuple val(bed_id), path(bed)
output:
tuple val(file_id), path("*_filtered.bam"), emit: bam
script:
"""
samtools view -@ ${task.cpus} -hb ${bam} -L ${bed} ${params.filter_bam} > \
${bam.simpleName}_filtered.bam
"""
}
params.rm_from_bam = ""
params.rm_from_bam_out = ""
process rm_from_bam {
container = "${container_url}"
label "big_mem_multi_cpus"
tag "$file_id"
if (params.rm_from_bam_out != "") {
publishDir "results/${params.rm_from_bam_out}", mode: 'copy'
}
input:
tuple val(file_id), path(bam)
tuple val(bed_id), path(bed)
output:
tuple val(file_id), path("*_filtered.bam"), emit: bam
script:
"""
samtools view -@ ${task.cpus} ${params.filter_bam} -hb -L ${bed} -U ${bam.simpleName}_filtered.bam ${bam} > /dev/null
"""
}
params.filter_bam_mapped = "-F 4"
params.filter_bam_mapped_out = ""
process filter_bam_mapped {
container = "${container_url}"
label "big_mem_multi_cpus"
tag "$file_id"
if (params.filter_bam_mapped_out != "") {
publishDir "results/${params.filter_bam_mapped_out}", mode: 'copy'
}
input:
tuple val(file_id), path(bam)
output:
tuple val(file_id), path("*_mapped.bam"), emit: bam
script:
"""
samtools view -@ ${task.cpus} ${params.filter_bam_mapped} -hb ${bam} > \
${bam.simpleName}_mapped.bam
"""
}
params.filter_bam_unmapped = "-f 4"
params.filter_bam_unmapped_out = ""
process filter_bam_unmapped {
container = "${container_url}"
label "big_mem_multi_cpus"
tag "$file_id"
if (params.filter_bam_unmapped_out != "") {
publishDir "results/${params.filter_bam_unmapped_out}", mode: 'copy'
}
input:
tuple val(file_id), path(bam)
output:
tuple val(file_id), path("*_unmapped.bam"), emit: bam
script:
"""
samtools view -@ ${task.cpus} ${params.filter_bam_unmapped} -hb ${bam} > ${bam.simpleName}_unmapped.bam
"""
}
params.index_bam = ""
params.index_bam_out = ""
process index_bam {
container = "${container_url}"
label "big_mem_mono_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.bai"), emit: bam_idx
script:
"""
samtools index ${params.index_bam} ${bam}
"""
}
params.sort_bam = ""
params.sort_bam_out = ""
process sort_bam {
container = "${container_url}"
label "big_mem_multi_cpus"
tag "$file_id"
if (params.sort_bam_out != "") {
publishDir "results/${params.sort_bam_out}", mode: 'copy'
}
input:
tuple val(file_id), path(bam)
output:
tuple val(file_id), path("*.bam*"), emit: bam
script:
"""
samtools sort -@ ${task.cpus} ${params.sort_bam} -O BAM -o ${bam.simpleName}_sorted.bam ${bam}
"""
}
params.split_bam = ""
params.split_bam_out = ""
process split_bam {
container = "${container_url}"
label "big_mem_multi_cpus"
tag "$file_id"
if (params.split_bam_out != "") {
publishDir "results/${params.split_bam_out}", mode: 'copy'
}
input:
tuple val(file_id), path(bam)
output:
tuple val(file_id), path("*_forward.bam*"), emit: bam_forward
tuple val(file_id), path("*_reverse.bam*"), emit: bam_reverse
script:
"""
samtools view -@ ${Math.round(task.cpus/2)} ${params.split_bam} \
-hb -F 0x10 ${bam} > ${bam.simpleName}_forward.bam &
samtools view -@ ${Math.round(task.cpus/2)} ${params.split_bam} \
-hb -f 0x10 ${bam} > ${bam.simpleName}_reverse.bam
"""
}
params.merge_bam = ""
params.merge_bam_out = ""
process merge_bam {
container = "${container_url}"
label "big_mem_multi_cpus"
tag "$file_id"
if (params.merge_bam_out != "") {
publishDir "results/${params.merge_bam_out}", mode: 'copy'
}
input:
tuple val(first_file_id), path(first_bam)
tuple val(second_file_id), path(second_bam)
output:
tuple val(file_id), path("*.bam*"), emit: bam
script:
"""
samtools merge -@ ${task.cpus} ${params.merge_bam} ${first_bam} ${second_bam} \
${first_bam.simpleName}_${second_file.simpleName}.bam
"""
}
params.merge_multi_bam = ""
params.merge_multi_bam_out = ""
process merge_multi_bam {
container = "${container_url}"
label "big_mem_multi_cpus"
tag "$file_id"
if (params.merge_multi_bam_out != "") {
publishDir "results/${params.merge_multi_bam_out}", mode: 'copy'
}
input:
tuple val(file_id), path(bams)
output:
tuple val(file_id), path("*_merged.bam*"), emit: bam
script:
"""
samtools merge -@ ${task.cpus} \
${params.merge_multi_bam} \
${bams[0].simpleName}_merged.bam \
${bams}
"""
}
params.stats_bam = ""
params.stats_bam_out = ""
process stats_bam {
container = "${container_url}"
label "big_mem_multi_cpus"
tag "$file_id"
if (params.stats_bam_out != "") {
publishDir "results/${params.stats_bam_out}", mode: 'copy'
}
input:
tuple val(file_id), path(bam)
output:
tuple val(file_id), path("*.tsv"), emit: tsv
path "*.flagstat.txt", emit: report
script:
"""
samtools flagstat -@ ${task.cpus} ${params.stats_bam} -O tsv ${bam} > ${bam.simpleName}.flagstat.txt
cp ${bam.simpleName}.flagstat.txt ${bam.simpleName}.tsv
"""
}
params.flagstat_2_multiqc = ""
params.flagstat_2_multiqc_out = ""
process flagstat_2_multiqc {
tag "$file_id"
if (params.flagstat_2_multiqc_out != "") {
publishDir "results/${params.flagstat_2_multiqc_out}", mode: 'copy'
}
input:
tuple val(file_id), path(tsv)
output:
tuple val(file_id), path("*.txt"), emit: report
"""
mv ${tsv} ${tsv.simpleName}.flagstat.txt
"""
}
params.idxstat_2_multiqc = ""
params.idxstat_2_multiqc_out = ""
process idxstat_2_multiqc {
tag "$file_id"
if (params.idxstat_2_multiqc_out != "") {
publishDir "results/${params.idxstat_2_multiqc_out}", mode: 'copy'
}
input:
tuple val(file_id), path(tsv)
output:
tuple val(file_id), path("*.txt"), emit: report
"""
mv ${tsv} ${tsv.simpleName}.idxstats.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
container_url="mlepetit/sanity:latest"
params.sanity_out=""
params.sanity=""
process normalization_sanity
{
container="${container_url}"
label "big_mem_multi_cpus"
if (params.sanity_out != "") {
publishDir "results/${params.sanity_out}", mode: 'copy'
}
else {
publishDir "results/normalize_matrix/", mode: 'copy'
}
input:
tuple val(id_mtx), path(raw_filtered_mtx)
output:
tuple val(id_mtx),path("log_transcription_quotients.txt"), emit: normalize_filtered_mtx
tuple val(id_mtx), path("ltq_error_bars.txt") ,emit: ltq_error
script:
"""
Sanity -f ${raw_filtered_mtx} -n ${task.cpus} ${params.sanity}
"""
}
SPDX-FileCopyrightText: 2022 Laurent Modolo <laurent.modolo@ens-lyon.fr>
SPDX-License-Identifier: CC-BY-SA-4.0
// SPDX-FileCopyrightText: 2022 Laurent Modolo <laurent.modolo@ens-lyon.fr>
//
// SPDX-License-Identifier: AGPL-3.0-or-later
version = "3.0.0"
container_url = "lbmc/sratoolkit:${version}"
params.fastq_dump = ""
params.fastq_dump_out = ""
process fastq_dump {
container = "${container_url}"
label "big_mem_mono_cpus"
tag "$sra"
if (params.fastq_dump_out != "") {
publishDir "results/${params.fastq_dump_out}", mode: 'copy'
}
input:
val sra
output:
tuple val(sra), path("*.fastq"), emit: fastq
script:
"""
fastq-dump ${params.fastq_dump} --split-files --gzip ${sra}
if [ -f ${sra}_1.fastq ]
then
mv ${sra}_1.fastq ${sra}_R1.fastq
fi
if [ -f ${sra}_2.fastq ]
then
mv ${sra}_2.fastq ${sra}_R2.fastq
fi
"""
}
// SPDX-FileCopyrightText: 2022 Laurent Modolo <laurent.modolo@ens-lyon.fr>
//
// SPDX-License-Identifier: AGPL-3.0-or-later
// STAR is an ultrafast universal RNA-seq aligner
//
// EXAMPLE:
/*
include {
index_with_gff as star_index_with_gff;
mapping_fastq as star_mapping_fastq
} from './nf_modules/star/main.nf'
addParams(
star_mapping_fastq_out: "star/"
)
star_index_with_gff(
genome_file,
gff_file
)
star_mapping_fastq(
star_index_with_gff.out.index,
reads
)
*/
version = "2.7.3a"
container_url = "lbmc/star:${version}"
params.star_mapping_fastq_out = ""
process gff3_2_gtf {
container = "dceoy/cufflinks"
label "small_mem_mono_cpus"
input:
tuple val(genome_id), path(gff3_file)
output:
path "${genome_id}.gtf", emit: gtf
script:
"""
gffread ${gff3_file} -T -o ${genome_id}.gtf
"""
}
process index_with_gtf {
container = "${container_url}"
label "big_mem_multi_cpus"
input:
tuple val(genome_id), path(genome_fasta)
path gtf_file
output:
tuple val(genome_id), path ("*"), emit: index
script:
"""
STAR --runThreadN ${task.cpus} --runMode genomeGenerate \
--genomeDir ./ \
--genomeFastaFiles ${genome_fasta} \
--sjdbGTFfile ${gtf_file} \
--genomeSAindexNbases 13 # min(14, log2(GenomeLength)/2 - 1)
"""
}
workflow index_with_gff {
take:
genome_fasta
gff_file
main:
gff3_2_gtf(gff_file)
index_with_gtf(genome_fasta,gff3_2_gtf.out.gtf)
emit:
report = index_with_gtf.out.index
}
process index_without_gff {
container = "${container_url}"
label "big_mem_multi_cpus"
input:
tuple val(genome_id), path(genome_fasta)
output:
tuple val(genome_id), path ("*"), emit: index
script:
"""
STAR --runThreadN ${task.cpus} --runMode genomeGenerate \
--genomeDir ./ \
--genomeFastaFiles ${genome_fasta} \
--genomeSAindexNbases 13 # min(14, log2(GenomeLength)/2 - 1)
"""
}
process mapping_fastq {
container = "${container_url}"
label "big_mem_multi_cpus"
if (params.star_mapping_fastq_out != "") {
publishDir "results/${params.star_mapping_fastq_out}", mode: 'copy'
}
input:
tuple val(index_id), path(index)
tuple val(reads_id), path(reads)
output:
path "*.Log.final.out", emit: report
tuple val(reads_id), path("*.bam"), emit: bam
script:
if (reads_id instanceof List){
file_prefix = reads_id[0]
} else {
file_prefix = reads_id
}
if (reads.size() == 2)
"""
mkdir -p index
mv ${index} index/
STAR --runThreadN ${task.cpus} \
--genomeDir index/ \
--readFilesCommand zcat \
--readFilesIn ${reads[0]} ${reads[1]} \
--outFileNamePrefix ${reads_id}. \
--alignIntronMax 10000 \
--outSAMtype BAM SortedByCoordinate \
--outSAMstrandField intronMotif
mv ${reads_id}.Aligned.sortedByCoord.out.bam ${reads_id}.bam
"""
else
"""
mkdir -p index
mv ${index} index/
STAR --runThreadN ${task.cpus} \
--genomeDir index/ \
--readFilesCommand zcat \
--readFilesIn ${reads} \
--outFileNamePrefix ${reads_id}. \
--alignIntronMax 10000 \
--outSAMtype BAM SortedByCoordinate \
--outSAMstrandField intronMotif
mv ${reads_id}.Aligned.sortedByCoord.out.bam ${reads_id}.bam
"""
}
\ 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 = "2.1.1"
container_url = "lbmc/stringtie2:${version}"
process jcount {
container = "${container_url}"
label "big_mem_multi_cpus"
tag "$file_id"
if (params.salmon_out != "") {
publishDir "results/${params.salmon_out}", mode: 'copy'
}
input:
tuple val(file_id), path(bam)
output:
tuple val(file_id), path("*.sf"), emit: quant
script:
"""
salmon quant -l A --noErrorModel -t XXXXXXXXXX -a ${bam} -p 4 -o ${params.salmon_out}
"""
}
\ 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 = "2.13.2"
container_url = "lbmc/trinity:${version}"
params.sample = 3
params.min_glue = 1
params.min_contig_length = 200
params.assembly_out = ""
workflow assembly {
take:
fastq
main:
complete_assembly(fastq)
super_transcript(complete_assembly.out.fasta)
emit:
fasta = complete_assembly.out.fasta
super_transcript = super_transcript.out.fasta
}
process complete_assembly {
container = "${container_url}"
label "big_mem_multi_cpus"
tag "$file_id"
if (params.assembly_out != "") {
publishDir "results/${params.assembly_out}", mode: 'copy'
}
input:
tuple val(file_id), path(fastq)
output:
tuple val(file_id), path("trinity_output_${file_prefix}/"), emit: folder
tuple val(file_id), path("trinity_output_${file_prefix}.Trinity.fasta"), emit: fasta
tuple val(file_id), path("trinity_output_${file_prefix}.Trinity.fasta.gene_trans_map"), emit: gene_map
tuple val(file_id), path("trinity_output_${file_prefix}/salmon_outdir/quant.sf"), emit: quant
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;
};
def memory = "${task.memory}" - ~/\s*GB/
if (fastq.size() == 2)
"""
mkdir trinity_output_${file_prefix}
Trinity \
--seqType fq \
--max_memory ${memory}G \
--left ${fastq[0]} \
--right ${fastq[1]} \
--CPU ${task.cpus} \
--min_glue ${params.min_glue} \
--min_contig_length ${params.min_contig_length} \
--output trinity_output_${file_prefix}
"""
else
"""
mkdir trinity_output_${file_prefix}
Trinity \
--seqType fq \
--max_memory ${memory}G \
--single ${fastq} \
--CPU ${task.cpus} \
--min_glue ${params.min_glue} \
--min_contig_length ${params.min_contig_length} \
--output trinity_output_${file_prefix}
"""
}
process super_transcript {
container = "${container_url}"
label "big_mem_mono_cpus"
tag "$file_id"
if (params.assembly_out != "") {
publishDir "results/${params.assembly_out}", mode: 'copy'
}
input:
tuple val(file_id), path(fasta)
output:
tuple val(file_id), path("trinity_genes.fasta"), path("trinity_genes.gtf"), emit: fasta
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;
};
def memory = "${task.memory}" - ~/\s*GB/
"""
Trinity_gene_splice_modeler.py \
--trinity_fasta ${fasta}
"""
}
// SPDX-FileCopyrightText: 2022 Laurent Modolo <laurent.modolo@ens-lyon.fr>
//
// SPDX-License-Identifier: AGPL-3.0-or-later
version = "407"
container_url = "lbmc/ucsc:${version}"
include {
index_fasta
} from './../samtools/main'
params.bedgraph_to_bigwig = ""
params.bedgraph_to_bigwig_out = ""
process bedgraph_to_bigwig {
container = "${container_url}"
label "big_mem_mono_cpus"
tag "${file_id}"
if (params.bedgraph_to_bigwig_out != "") {
publishDir "results/${params.bedgraph_to_bigwig_out}", mode: 'copy'
}
input:
tuple val(file_id), path(bg)
tuple val(file_id), path(bed)
output:
tuple val(file_id), path("*.bw"), emit: bw
script:
"""
LC_COLLATE=C
# transform bed file of start-stop chromosome size to stop chromosome size
awk -v OFS="\\t" '{print \$1, \$3}' ${bed} > chromsize.txt
sort -T ./ -k1,1 -k2,2n ${bg} > \
bedGraphToBigWig ${params.bedgraph_to_bigwig} - \
chromsize.txt \
${bg.simpleName}_norm.bw
"""
}
params.wig_to_bedgraph = ""
params.wig_to_bedgraph_out = ""
workflow wig_to_bedgraph {
take:
fasta
wig
main:
wig_to_bigwig(
fasta,
wig
)
bigwig_to_bedgraph(
wig_to_bigwig.out.bw
)
emit:
bg = bigwig_to_bedgraph.out.bg
}
workflow wig2_to_bedgraph2 {
take:
fasta
wig
main:
wig2_to_bigwig2(
fasta,
wig
)
bigwig2_to_bedgraph2(
wig2_to_bigwig2.out.bw
)
emit:
bg = bigwig2_to_bedgraph2.out.bg
}
params.bigwig_to_bedgraph = ""
params.bigwig_to_bedgraph_out = ""
process bigwig_to_bedgraph {
container = "${container_url}"
label "big_mem_mono_cpus"
tag "${file_id}"
if (params.bigwig_to_bedgraph_out != "") {
publishDir "results/${params.bigwig_to_bedgraph_out}", mode: 'copy'
}
input:
tuple val(file_id), path(bw)
output:
tuple val(file_id), path("*.bg"), emit: bg
script:
"""
bigWigToBedGraph ${bw} ${bw.simpleName}.bg
"""
}
params.bigwig2_to_bedgraph2 = ""
params.bigwig2_to_bedgraph2_out = ""
process bigwig2_to_bedgraph2 {
container = "${container_url}"
label "big_mem_mono_cpus"
tag "${file_id}"
if (params.bigwig_to_bedgraph_out != "") {
publishDir "results/${params.bigwig_to_bedgraph_out}", mode: 'copy'
}
input:
tuple val(file_id), path(bw_a), path(bw_b)
output:
tuple val(file_id), path("${bw_a.simpleName}.bg"), path("${bw_b.simpleName}.bg"), emit: bg
script:
"""
bigWigToBedGraph ${bw_a} ${bw_a.simpleName}.bg
bigWigToBedGraph ${bw_b} ${bw_b.simpleName}.bg
"""
}
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:
"""
bigWigToBedGraph ${bw} ${bw.simpleName}.bg
bedgraph_to_wig.pl --bedgraph ${bw.simpleName}.bg --wig ${bw.simpleName}.wig --step 10
"""
}
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:
"""
bigWigToBedGraph ${bw_a} ${bw_a.simpleName}.bg
bedgraph_to_wig.pl --bedgraph ${bw_a.simpleName}.bg --wig ${bw_a.simpleName}.wig --step 10
bigWigToBedGraph ${bw_b} ${bw_b.simpleName}.bg
bedgraph_to_wig.pl --bedgraph ${bw_b.simpleName}.bg --wig ${bw_b.simpleName}.wig --step 10
"""
}
params.wig_to_bigwig = ""
params.wig_to_bigwig_out = ""
workflow wig_to_bigwig {
take:
fasta
wig
main:
index_fasta(fasta)
wig_to_bigwig_sub(
wig,
index_fasta.out.index
)
emit:
bw = wig_to_bigwig_sub.out.bw
}
process wig_to_bigwig_sub {
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(w)
tuple val(idx_id), path(fasta_idx)
output:
tuple val(file_id), path("${w.simpleName}.bw"), emit: bw
script:
"""
cut -f 1,2 ${fasta_idx} > ${fasta_idx.simpleName}.sizes
wigToBigWig -clip ${w} ${fasta_idx.simpleName}.sizes ${w.simpleName}.bw
"""
}
params.wig2_to_bigwig2 = ""
params.wig2_to_bigwig2_out = ""
workflow wig2_to_bigwig2 {
take:
fasta
wigs
main:
index_fasta(fasta)
wig2_to_bigwig2_sub(
wigs,
index_fasta.out.index
)
emit:
bw = wig2_to_bigwig2_sub.out.bw
}
process wig2_to_bigwig2_sub {
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(w_a), path(w_b)
tuple val(idx_id), path(fasta_idx)
output:
tuple val(file_id), path("${w_a.simpleName}.bw"), path("${w_b.simpleName}.bw"), emit: bw
script:
"""
cut -f 1,2 ${fasta_idx} > ${fasta_idx.simpleName}.sizes
wigToBigWig -clip ${w_a} ${fasta_idx.simpleName}.sizes ${w_a.simpleName}.bw
wigToBigWig -clip ${w_b} ${fasta_idx.simpleName}.sizes ${w_b.simpleName}.bw
"""
}
\ 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 = "d62c1f8"
container_url = "lbmc/urqt:${version}"
trim_quality = "20"
params.trimming = "--t 20"
process trimming {
container = "${container_url}"
label "big_mem_multi_cpus"
tag "${file_id}"
input:
tuple val(file_id), path(reads)
output:
tuple val(pair_id), path("*_trim_R{1,2}.fastq.gz"), 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)
"""
UrQt ${params.trimming} --m ${task.cpus} --gz \
--in ${reads[0]} --inpair ${reads[1]} \
--out ${file_prefix}_trim_R1.fastq.gz --outpair ${file_prefix}_trim_R2.fastq.gz \
> ${pair_id}_trimming_report.txt
"""
else
"""
UrQt ${params.trimming} --m ${task.cpus} --gz \
--in ${reads[0]} \
--out ${file_prefix}_trim.fastq.gz \
> ${file_prefix}_trimming_report.txt
"""
}
\ No newline at end of file
psmn_modules @ 1d6cfb91
Subproject commit 1d6cfb91449b187b05a3a78df9a06ff3baaf5558
// SPDX-FileCopyrightText: 2022 Laurent Modolo <laurent.modolo@ens-lyon.fr>
//
// SPDX-License-Identifier: AGPL-3.0-or-later
nextflow.enable.dsl=2
include { fastp } from "./nf_modules/fastp/main.nf"
include { fasta_from_bed } from "./nf_modules/bedtools/main.nf"
include { index_fasta; mapping_fastq } from './nf_modules/kallisto/main.nf' addParams(mapping_fastq_out: "quantification/")
params.fastq = "data/fastq/*_{1,2}.fastq"
log.info "fastq files: ${params.fastq}"
log.info "fasta file : ${params.fasta}"
log.info "bed file : ${params.bed}"
channel
.fromFilePairs( params.fastq, size: -1)
.set { fastq_files }
channel
.fromPath( params.fasta )
.ifEmpty { error "Cannot find any fasta files matching: ${params.fasta}" }
.map { it -> [it.simpleName, it]}
.set { fasta_files }
channel
.fromPath( params.bed )
.ifEmpty { error "Cannot find any bed files matching: ${params.bed}" }
.map { it -> [it.simpleName, it]}
.set { bed_files }
workflow {
fastp(fastq_files)
fasta_from_bed(fasta_files, bed_files)
index_fasta(fasta_from_bed.out.fasta)
mapping_fastq(index_fasta.out.index.collect(), fastp.out.fastq)
}
# SPDX-FileCopyrightText: 2022 Laurent Modolo <laurent.modolo@ens-lyon.fr>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
profiles {
docker {
docker.temp = 'auto'
docker.temp = "auto"
docker.enabled = true
process {
withname: build_synthetic_bed {
container = "bedtools:2.25.0"
withName: build_synthetic_bed {
container = "lbmc/bedtools:2.25.0"
cpus = 1
}
withname: fasta_from_bed {
container = "bedtools:2.25.0"
withName: fasta_from_bed {
container = "lbmc/bedtools:2.25.0"
cpus = 1
}
withname: index_fasta {
container = "bowtie2:2.3.4.1"
withName: index_fasta {
container = "lbmc/bowtie2:2.3.4.1"
cpus = 4
}
withname: mapping_fastq_paired {
container = "bowtie2:2.3.4.1"
withName: mapping_fastq_paired {
container = "lbmc/bowtie2:2.3.4.1"
cpus = 4
}
withname: bam_2_fastq_paired {
container = "samtools:1.7"
withName: bam_2_fastq_paired {
container = "lbmc/samtools:1.7"
cpus = 4
}
withname: sort_bam_paired {
container = "samtools:1.7"
withName: filter_bam_paired {
container = "lbmc/samtools:1.7"
cpus = 4
}
withname: index_bam_paired {
container = "samtools:1.7"
withName: sort_bam_paired {
container = "lbmc/samtools:1.7"
cpus = 4
}
withname: mapping_fastq_single {
container = "bowtie2:2.3.4.1"
withName: index_bam_paired {
container = "lbmc/samtools:1.7"
cpus = 4
}
withname: bam_2_fastq_single {
container = "samtools:1.7"
withName: mapping_fastq_single {
container = "lbmc/bowtie2:2.3.4.1"
cpus = 4
}
withname: sort_bam_single {
container = "samtools:1.7"
withName: bam_2_fastq_single {
container = "lbmc/samtools:1.7"
cpus = 4
}
withname: index_bam_single {
container = "samtools:1.7"
withName: filter_bam_single {
container = "lbmc/samtools:1.7"
cpus = 4
}
withName: sort_bam_single {
container = "lbmc/samtools:1.7"
cpus = 4
}
withName: index_bam_single {
container = "lbmc/samtools:1.7"
cpus = 4
}
}
}
singularity {
singularity.enabled = true
singularity.cacheDir = "./bin/"
process {
withName: build_synthetic_bed {
container = "lbmc/bedtools:2.25.0"
cpus = 1
}
withName: fasta_from_bed {
container = "lbmc/bedtools:2.25.0"
cpus = 1
}
withName: index_fasta {
container = "lbmc/bowtie2:2.3.4.1"
cpus = 4
}
withName: mapping_fastq_single {
container = "lbmc/bowtie2:2.3.4.1"
cpus = 4
}
withName: mapping_fastq_paired {
container = "lbmc/bowtie2:2.3.4.1"
cpus = 4
}
withName: bam_2_fastq_paired {
container = "lbmc/samtools:1.7"
cpus = 4
}
withName: filter_bam_paired {
container = "lbmc/samtools:1.7"
cpus = 4
}
withName: sort_bam_paired {
container = "lbmc/samtools:1.7"
cpus = 4
}
withName: index_bam_paired {
container = "lbmc/samtools:1.7"
cpus = 4
}
withName: bam_2_fastq_single {
container = "lbmc/samtools:1.7"
cpus = 4
}
withName: filter_bam_single {
container = "lbmc/samtools:1.7"
cpus = 4
}
withName: sort_bam_single {
container = "lbmc/samtools:1.7"
cpus = 4
}
withName: index_bam_single {
container = "lbmc/samtools:1.7"
cpus = 4
}
}
}
psmn {
process{
withname: build_synthetic_bed {
beforeScript = "source /usr/share/lmod/lmod/init/bash; module use ~/privatemodules"
module = "BEDtools/2.25.0"
withName: build_synthetic_bed {
beforeScript = "source $baseDir/.conda_psmn.sh"
conda = "$baseDir/.conda_envs/bedtools_2.25.0"
executor = "sge"
clusterOptions = "-m be -cwd -V"
clusterOptions = "-m e -cwd -V"
cpus = 1
memory = "20GB"
time = "12h"
queue = 'monointeldeb128'
queue = "monointeldeb128"
}
withname: fasta_from_bed {
beforeScript = "source /usr/share/lmod/lmod/init/bash; module use ~/privatemodules"
module = "BEDtools/2.25.0"
withName: fasta_from_bed {
beforeScript = "source $baseDir/.conda_psmn.sh"
conda = "$baseDir/.conda_envs/bedtools_2.25.0"
executor = "sge"
clusterOptions = "-m be -cwd -V"
clusterOptions = "-m e -cwd -V"
cpus = 1
memory = "20GB"
time = "12h"
queue = 'monointeldeb128'
queue = "monointeldeb128"
}
withname: index_fasta {
beforeScript = "source /usr/share/lmod/lmod/init/bash; module use ~/privatemodules"
module = "Bowtie2/2.3.4.1"
withName: index_fasta {
beforeScript = "source $baseDir/.conda_psmn.sh"
conda = "$baseDir/.conda_envs/bowtie2_2.3.4.1"
executor = "sge"
clusterOptions = "-m e -cwd -V"
cpus = 32
memory = "20GB"
time = "12h"
queue = "CLG6242deb384A,CLG6242deb384C,CLG5218deb192A,CLG5218deb192B,CLG5218deb192C,CLG5218deb192D,SLG5118deb96,SLG6142deb384A,SLG6142deb384B,SLG6142deb384C,SLG6142deb384D"
penv = "openmp32"
}
withName: mapping_fastq_paired {
beforeScript = "source $baseDir/.conda_psmn.sh"
conda = "$baseDir/.conda_envs/bowtie2_2.3.4.1"
executor = "sge"
clusterOptions = "-m e -cwd -V"
cpus = 32
memory = "30GB"
time = "24h"
queue = 'E5-2670deb128A,E5-2670deb128B,E5-2670deb128C,E5-2670deb128D,E5-2670deb128E,E5-2670deb128F'
penv = 'openmp16'
queue = "CLG6242deb384A,CLG6242deb384C,CLG5218deb192A,CLG5218deb192B,CLG5218deb192C,CLG5218deb192D,SLG5118deb96,SLG6142deb384A,SLG6142deb384B,SLG6142deb384C,SLG6142deb384D"
penv = "openmp32"
}
withname: mapping_fastq_paired {
beforeScript = "source /usr/share/lmod/lmod/init/bash; module use ~/privatemodules"
module = "Bowtie2/2.3.4.1:SAMtools/1.7"
withName: bam_2_fastq_paired {
beforeScript = "source $baseDir/.conda_psmn.sh"
conda = "$baseDir/.conda_envs/samtools_1.7"
executor = "sge"
clusterOptions = "-m e -cwd -V"
cpus = 32
memory = "30GB"
time = "24h"
queue = 'E5-2670deb128A,E5-2670deb128B,E5-2670deb128C,E5-2670deb128D,E5-2670deb128E,E5-2670deb128F'
penv = 'openmp16'
queue = "CLG6242deb384A,CLG6242deb384C,CLG5218deb192A,CLG5218deb192B,CLG5218deb192C,CLG5218deb192D,SLG5118deb96,SLG6142deb384A,SLG6142deb384B,SLG6142deb384C,SLG6142deb384D"
penv = "openmp32"
}
withname: bam_2_fastq_paired {
beforeScript = "source /usr/share/lmod/lmod/init/bash; module use ~/privatemodules"
module = "SAMtools/1.7"
withName: sort_bam_paired {
beforeScript = "source $baseDir/.conda_psmn.sh"
conda = "$baseDir/.conda_envs/samtools_1.7"
executor = "sge"
memory = "20GB"
time = "12h"
queue = 'monointeldeb128'
clusterOptions = "-m e -cwd -V"
cpus = 32
memory = "30GB"
time = "24h"
queue = "CLG6242deb384A,CLG6242deb384C,CLG5218deb192A,CLG5218deb192B,CLG5218deb192C,CLG5218deb192D,SLG5118deb96,SLG6142deb384A,SLG6142deb384B,SLG6142deb384C,SLG6142deb384D"
penv = "openmp32"
}
withname: sort_bam_paired {
beforeScript = "source /usr/share/lmod/lmod/init/bash; module use ~/privatemodules"
module = "SAMtools/1.7"
withName: index_bam_paired {
beforeScript = "source $baseDir/.conda_psmn.sh"
conda = "$baseDir/.conda_envs/samtools_1.7"
executor = "sge"
memory = "20GB"
time = "12h"
queue = 'monointeldeb128'
clusterOptions = "-m e -cwd -V"
cpus = 32
memory = "30GB"
time = "24h"
queue = "CLG6242deb384A,CLG6242deb384C,CLG5218deb192A,CLG5218deb192B,CLG5218deb192C,CLG5218deb192D,SLG5118deb96,SLG6142deb384A,SLG6142deb384B,SLG6142deb384C,SLG6142deb384D"
penv = "openmp32"
}
withname: index_bam_paired {
beforeScript = "source /usr/share/lmod/lmod/init/bash; module use ~/privatemodules"
module = "SAMtools/1.7"
withName: mapping_fastq_single {
beforeScript = "source $baseDir/.conda_psmn.sh"
conda = "$baseDir/.conda_envs/bowtie2_2.3.4.1"
executor = "sge"
memory = "20GB"
time = "12h"
queue = 'monointeldeb128'
clusterOptions = "-m e -cwd -V"
cpus = 32
memory = "30GB"
time = "24h"
queue = "CLG6242deb384A,CLG6242deb384C,CLG5218deb192A,CLG5218deb192B,CLG5218deb192C,CLG5218deb192D,SLG5118deb96,SLG6142deb384A,SLG6142deb384B,SLG6142deb384C,SLG6142deb384D"
penv = "openmp32"
}
withname: mapping_fastq_single {
beforeScript = "source /usr/share/lmod/lmod/init/bash; module use ~/privatemodules"
module = "Bowtie2/2.3.4.1:SAMtools/1.7"
withName: bam_2_fastq_single {
beforeScript = "source $baseDir/.conda_psmn.sh"
conda = "$baseDir/.conda_envs/samtools_1.7"
executor = "sge"
clusterOptions = "-m e -cwd -V"
cpus = 32
memory = "30GB"
time = "24h"
queue = 'E5-2670deb128A,E5-2670deb128B,E5-2670deb128C,E5-2670deb128D,E5-2670deb128E,E5-2670deb128F'
penv = 'openmp16'
queue = "CLG6242deb384A,CLG6242deb384C,CLG5218deb192A,CLG5218deb192B,CLG5218deb192C,CLG5218deb192D,SLG5118deb96,SLG6142deb384A,SLG6142deb384B,SLG6142deb384C,SLG6142deb384D"
penv = "openmp32"
}
withname: bam_2_fastq_single {
beforeScript = "source /usr/share/lmod/lmod/init/bash; module use ~/privatemodules"
module = "SAMtools/1.7"
withName: sort_bam_single {
beforeScript = "source $baseDir/.conda_psmn.sh"
conda = "$baseDir/.conda_envs/samtools_1.7"
executor = "sge"
memory = "20GB"
time = "12h"
queue = 'monointeldeb128'
clusterOptions = "-m e -cwd -V"
cpus = 32
memory = "30GB"
time = "24h"
queue = "CLG6242deb384A,CLG6242deb384C,CLG5218deb192A,CLG5218deb192B,CLG5218deb192C,CLG5218deb192D,SLG5118deb96,SLG6142deb384A,SLG6142deb384B,SLG6142deb384C,SLG6142deb384D"
penv = "openmp32"
}
withname: sort_bam_single {
beforeScript = "source /usr/share/lmod/lmod/init/bash; module use ~/privatemodules"
module = "SAMtools/1.7"
withName: index_bam_single {
beforeScript = "source $baseDir/.conda_psmn.sh"
conda = "$baseDir/.conda_envs/samtools_1.7"
executor = "sge"
memory = "20GB"
time = "12h"
queue = 'monointeldeb128'
clusterOptions = "-m e -cwd -V"
cpus = 32
memory = "30GB"
time = "24h"
queue = "CLG6242deb384A,CLG6242deb384C,CLG5218deb192A,CLG5218deb192B,CLG5218deb192C,CLG5218deb192D,SLG5118deb96,SLG6142deb384A,SLG6142deb384B,SLG6142deb384C,SLG6142deb384D"
penv = "openmp32"
}
}
}
ccin2p3 {
singularity.enabled = true
singularity.cacheDir = "$baseDir/.singularity_in2p3/"
singularity.runOptions = "--bind /pbs,/sps,/scratch"
process{
withName: fasta_from_bed {
container = "lbmc/bedtools:2.25.0"
scratch = true
stageInMode = "copy"
stageOutMode = "rsync"
executor = "sge"
clusterOptions = "-P P_lbmc -l os=cl7 -l sps=1 -r n"
cpus = 1
queue = "huge"
}
withname: index_bam_single {
beforeScript = "source /usr/share/lmod/lmod/init/bash; module use ~/privatemodules"
module = "SAMtools/1.7"
}
process{
withName: build_synthetic_bed {
container = "lbmc/bedtools:2.25.0"
scratch = true
stageInMode = "copy"
stageOutMode = "rsync"
executor = "sge"
memory = "20GB"
time = "12h"
queue = 'monointeldeb128'
clusterOptions = "-P P_lbmc -l os=cl7 -l sps=1 -r n"
cpus = 1
queue = "huge"
}
withName: fasta_from_bed {
container = "lbmc/bedtools:2.25.0"
scratch = true
stageInMode = "copy"
stageOutMode = "rsync"
executor = "sge"
clusterOptions = "-P P_lbmc -l os=cl7 -l sps=1 -r n"
cpus = 1
queue = "huge"
}
withName: index_fasta {
container = "lbmc/bowtie2:2.3.4.1"
scratch = true
stageInMode = "copy"
stageOutMode = "rsync"
executor = "sge"
clusterOptions = "-P P_lbmc -l os=cl7 -l sps=1 -r n"
cpus = 1
queue = "huge"
}
withName: mapping_fastq_paired {
container = "lbmc/bowtie2:2.3.4.1"
scratch = true
stageInMode = "copy"
stageOutMode = "rsync"
executor = "sge"
clusterOptions = "-P P_lbmc -l os=cl7 -l sps=1 -r n"
cpus = 1
queue = "huge"
}
withName: bam_2_fastq_paired {
container = "lbmc/samtools:1.7"
scratch = true
stageInMode = "copy"
stageOutMode = "rsync"
executor = "sge"
clusterOptions = "-P P_lbmc -l os=cl7 -l sps=1 -r n"
cpus = 1
queue = "huge"
}
withName: sort_bam_paired {
container = "lbmc/samtools:1.7"
scratch = true
stageInMode = "copy"
stageOutMode = "rsync"
executor = "sge"
clusterOptions = "-P P_lbmc -l os=cl7 -l sps=1 -r n"
cpus = 1
queue = "huge"
}
withName: index_bam_paired {
container = "lbmc/samtools:1.7"
scratch = true
stageInMode = "copy"
stageOutMode = "rsync"
executor = "sge"
clusterOptions = "-P P_lbmc -l os=cl7 -l sps=1 -r n"
cpus = 1
queue = "huge"
}
withName: mapping_fastq_single {
container = "lbmc/bowtie2:2.3.4.1"
scratch = true
stageInMode = "copy"
stageOutMode = "rsync"
executor = "sge"
clusterOptions = "-P P_lbmc -l os=cl7 -l sps=1 -r n"
cpus = 1
queue = "huge"
}
withName: bam_2_fastq_single {
container = "lbmc/samtools:1.7"
scratch = true
stageInMode = "copy"
stageOutMode = "rsync"
executor = "sge"
clusterOptions = "-P P_lbmc -l os=cl7 -l sps=1 -r n"
cpus = 1
queue = "huge"
}
withName: sort_bam_single {
container = "lbmc/samtools:1.7"
scratch = true
stageInMode = "copy"
stageOutMode = "rsync"
executor = "sge"
clusterOptions = "-P P_lbmc -l os=cl7 -l sps=1 -r n"
cpus = 1
queue = "huge"
}
withName: index_bam_single {
container = "lbmc/samtools:1.7"
scratch = true
stageInMode = "copy"
stageOutMode = "rsync"
executor = "sge"
clusterOptions = "-P P_lbmc -l os=cl7 -l sps=1 -r n"
cpus = 1
queue = "huge"
}
}
}
......
// SPDX-FileCopyrightText: 2022 Laurent Modolo <laurent.modolo@ens-lyon.fr>
//
// SPDX-License-Identifier: AGPL-3.0-or-later
/*
small pipeline to build a training dataset from whole genome data
......