diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 4a9bc5c79..4ecfbfe33 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -18,11 +18,11 @@ "python.linting.flake8Path": "/opt/conda/bin/flake8", "python.linting.pycodestylePath": "/opt/conda/bin/pycodestyle", "python.linting.pydocstylePath": "/opt/conda/bin/pydocstyle", - "python.linting.pylintPath": "/opt/conda/bin/pylint", + "python.linting.pylintPath": "/opt/conda/bin/pylint" }, // Add the IDs of extensions you want installed when the container is created. - "extensions": ["ms-python.python", "ms-python.vscode-pylance", "nf-core.nf-core-extensionpack"], - }, - }, + "extensions": ["ms-python.python", "ms-python.vscode-pylance", "nf-core.nf-core-extensionpack"] + } + } } diff --git a/conf/modules.config b/conf/modules.config deleted file mode 100644 index e6210ea0e..000000000 --- a/conf/modules.config +++ /dev/null @@ -1,1159 +0,0 @@ -/* -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Config file for defining DSL2 per module options and publishing paths -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Available keys to override module options: - ext.args = Additional arguments appended to command in module. - ext.args2 = Second set of arguments appended to command in module (multi-tool modules). - ext.args3 = Third set of arguments appended to command in module (multi-tool modules). - ext.prefix = File name prefix for output files. ----------------------------------------------------------------------------------------- -*/ - -def rseqc_modules = params.rseqc_modules ? params.rseqc_modules.split(',').collect{ it.trim().toLowerCase() } : [] - -// -// General configuration options -// - -process { - publishDir = [ - path: { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] -} - -// -// Genome preparation options -// - -process { - withName: 'GUNZIP_.*|MAKE_TRANSCRIPTS_FASTA' { - publishDir = [ - path: { params.save_reference ? "${params.outdir}/genome" : params.outdir }, - mode: params.publish_dir_mode, - saveAs: { filename -> (filename != 'versions.yml' && params.save_reference) ? filename : null } - ] - } - - withName: 'UNTAR_.*' { - ext.args2 = '--no-same-owner' - } - - withName: 'UNTAR_.*|STAR_GENOMEGENERATE|STAR_GENOMEGENERATE_IGENOMES|HISAT2_BUILD' { - publishDir = [ - path: { params.save_reference ? "${params.outdir}/genome/index" : params.outdir }, - mode: params.publish_dir_mode, - saveAs: { filename -> (filename != 'versions.yml' && params.save_reference) ? filename : null } - ] - } - - withName: 'GFFREAD' { - ext.args = '--keep-exon-attrs -F -T' - publishDir = [ - path: { params.save_reference ? "${params.outdir}/genome" : params.outdir }, - mode: params.publish_dir_mode, - saveAs: { filename -> (filename != 'versions.yml' && params.save_reference) ? filename : null } - ] - } - - withName: 'HISAT2_EXTRACTSPLICESITES' { - publishDir = [ - path: { params.save_reference ? "${params.outdir}/genome/index" : params.outdir }, - mode: params.publish_dir_mode, - saveAs: { filename -> (filename != 'versions.yml' && params.save_reference) ? filename : null } - ] - } - - withName: 'SALMON_INDEX' { - ext.args = { [ - params.gencode ? '--gencode' : '', - params.pseudo_aligner_kmer_size ? "-k ${params.pseudo_aligner_kmer_size}": '' - ].join(' ').trim() } - publishDir = [ - path: { params.save_reference ? "${params.outdir}/genome/index" : params.outdir }, - mode: params.publish_dir_mode, - saveAs: { filename -> (filename != 'versions.yml' && params.save_reference) ? filename : null } - ] - } - - withName: 'KALLISTO_INDEX' { - ext.args = params.pseudo_aligner_kmer_size ? "-k ${params.pseudo_aligner_kmer_size}" : '' - publishDir = [ - path: { params.save_reference ? "${params.outdir}/genome/index" : params.outdir }, - mode: params.publish_dir_mode, - saveAs: { filename -> (filename != 'versions.yml' && params.save_reference) ? filename : null } - ] - } - - withName: 'RSEM_PREPAREREFERENCE_GENOME' { - ext.args = '--star' - publishDir = [ - path: { params.save_reference ? "${params.outdir}/genome/index" : params.outdir }, - mode: params.publish_dir_mode, - saveAs: { filename -> (filename != 'versions.yml' && params.save_reference) ? filename : null } - ] - } - - withName: 'GTF2BED' { - publishDir = [ - path: { params.save_reference ? "${params.outdir}/genome" : params.outdir }, - mode: params.publish_dir_mode, - saveAs: { filename -> (filename != 'versions.yml' && params.save_reference) ? filename : null } - ] - } - - withName: 'CAT_ADDITIONAL_FASTA|PREPROCESS_TRANSCRIPTS_FASTA_GENCODE' { - publishDir = [ - path: { params.save_reference ? "${params.outdir}/genome" : params.outdir }, - mode: params.publish_dir_mode, - saveAs: { filename -> (filename != 'versions.yml' && params.save_reference) ? filename : null } - ] - } - - withName: 'GTF_FILTER' { - ext.args = { params.skip_gtf_transcript_filter ?: '--skip_transcript_id_check' } - publishDir = [ - path: { params.save_reference ? "${params.outdir}/genome" : params.outdir }, - mode: params.publish_dir_mode, - saveAs: { filename -> (filename != 'versions.yml' && params.save_reference) ? filename : null } - ] - } - - withName: 'CUSTOM_GETCHROMSIZES' { - publishDir = [ - path: { params.save_reference ? "${params.outdir}/genome" : params.outdir }, - mode: params.publish_dir_mode, - saveAs: { filename -> (filename != 'versions.yml' && params.save_reference) ? filename : null } - ] - } - - withName: 'CAT_FASTQ' { - publishDir = [ - path: { params.save_merged_fastq ? "${params.outdir}/fastq" : params.outdir }, - mode: params.publish_dir_mode, - saveAs: { filename -> (filename.endsWith('.fastq.gz') && params.save_merged_fastq) ? filename : null } - ] - } -} - -if (!params.skip_bbsplit && params.bbsplit_fasta_list) { - process { - withName: 'PREPARE_GENOME:BBMAP_BBSPLIT' { - ext.args = 'build=1' - publishDir = [ - path: { params.save_reference ? "${params.outdir}/genome/index" : params.outdir }, - mode: params.publish_dir_mode, - saveAs: { filename -> (filename != 'versions.yml' && params.save_reference) ? filename : null } - ] - } - } -} - -// -// Read subsampling and strand inferring options -// - -process { - withName: 'FQ_SUBSAMPLE' { - ext.args = '--record-count 1000000 --seed 1' - ext.prefix = { "${meta.id}.subsampled" } - publishDir = [ - enabled: false - ] - } - - withName: '.*:FASTQ_SUBSAMPLE_FQ_SALMON:SALMON_QUANT' { - ext.args = '--skipQuant' - publishDir = [ - enabled: false - ] - } -} - -// -// Read QC and trimming options -// - -if (!(params.skip_fastqc || params.skip_qc)) { - if (params.trimmer == 'trimgalore') { - process { - withName: '.*:FASTQ_FASTQC_UMITOOLS_TRIMGALORE:FASTQC' { - ext.args = '--quiet' - } - } - } - - if (params.trimmer == 'fastp') { - process { - withName: '.*:FASTQ_FASTQC_UMITOOLS_FASTP:FASTQC_RAW' { - ext.args = '--quiet' - } - - withName: '.*:FASTQ_FASTQC_UMITOOLS_FASTP:FASTQC_TRIM' { - ext.args = '--quiet' - publishDir = [ - path: { "${params.outdir}/${params.trimmer}/fastqc" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } - } - } -} - -if (!params.skip_trimming) { - if (params.trimmer == 'trimgalore') { - process { - withName: '.*:FASTQ_FASTQC_UMITOOLS_TRIMGALORE:TRIMGALORE' { - ext.args = { - [ - "--fastqc_args '-t ${task.cpus}'", - params.extra_trimgalore_args ? params.extra_trimgalore_args.split("\\s(?=--)") : '' - ].flatten().unique(false).join(' ').trim() - } - publishDir = [ - [ - path: { "${params.outdir}/${params.trimmer}/fastqc" }, - mode: params.publish_dir_mode, - pattern: "*.{html,zip}" - ], - [ - path: { params.save_trimmed ? "${params.outdir}/${params.trimmer}" : params.outdir }, - mode: params.publish_dir_mode, - pattern: "*.fq.gz", - saveAs: { params.save_trimmed ? it : null } - ], - [ - path: { "${params.outdir}/${params.trimmer}" }, - mode: params.publish_dir_mode, - pattern: "*.txt" - ] - ] - } - } - } - - if (params.trimmer == 'fastp') { - process { - withName: '.*:FASTQ_FASTQC_UMITOOLS_FASTP:FASTP' { - ext.args = { params.extra_fastp_args ?: '' } - publishDir = [ - [ - path: { "${params.outdir}/${params.trimmer}" }, - mode: params.publish_dir_mode, - pattern: "*.{json,html}" - ], - [ - path: { "${params.outdir}/${params.trimmer}/log" }, - mode: params.publish_dir_mode, - pattern: "*.log" - ], - [ - path: { params.save_trimmed ? "${params.outdir}/${params.trimmer}" : params.outdir }, - mode: params.publish_dir_mode, - pattern: "*.fastq.gz", - saveAs: { params.save_trimmed ? it : null } - ] - ] - } - } - } -} - -if (params.with_umi && !params.skip_umi_extract) { - process { - withName: 'UMITOOLS_EXTRACT' { - ext.args = { [ - params.umitools_extract_method ? "--extract-method=${params.umitools_extract_method}" : '', - params.umitools_bc_pattern ? "--bc-pattern='${params.umitools_bc_pattern}'" : '', - params.umitools_bc_pattern2 ? "--bc-pattern2='${params.umitools_bc_pattern2}'" : '', - params.umitools_umi_separator ? "--umi-separator='${params.umitools_umi_separator}'" : '' - ].join(' ').trim() } - publishDir = [ - [ - path: { "${params.outdir}/umitools" }, - mode: params.publish_dir_mode, - pattern: "*.log" - ], - [ - path: { params.save_umi_intermeds ? "${params.outdir}/umitools" : params.outdir }, - mode: params.publish_dir_mode, - pattern: "*.fastq.gz", - saveAs: { params.save_umi_intermeds ? it : null } - ] - ] - } - } -} - -// -// Contaminant removal options -// - -if (!params.skip_bbsplit) { - process { - withName: 'BBMAP_BBSPLIT' { - ext.args = 'build=1 ambiguous2=all maxindel=150000' - publishDir = [ - [ - path: { "${params.outdir}/bbsplit" }, - mode: params.publish_dir_mode, - pattern: '*.txt' - ], - [ - path: { params.save_bbsplit_reads ? "${params.outdir}/bbsplit" : params.outdir }, - mode: params.publish_dir_mode, - pattern: '*.fastq.gz', - saveAs: { params.save_bbsplit_reads ? it : null } - ] - ] - } - } -} - -if (params.remove_ribo_rna) { - process { - withName: 'SORTMERNA' { - ext.args = '--num_alignments 1 -v' - publishDir = [ - [ - path: { "${params.outdir}/sortmerna" }, - mode: params.publish_dir_mode, - pattern: "*.log" - ], - [ - path: { params.save_non_ribo_reads ? "${params.outdir}/sortmerna" : params.outdir }, - mode: params.publish_dir_mode, - pattern: "*.fastq.gz", - saveAs: { params.save_non_ribo_reads ? it : null } - ] - ] - } - } -} - -// -// General alignment options -// - -if (!params.skip_alignment) { - process { - withName: 'NFCORE_RNASEQ:.*:BAM_SORT_STATS_SAMTOOLS:BAM_STATS_SAMTOOLS:.*' { - ext.prefix = { "${meta.id}.sorted.bam" } - publishDir = [ - path: { "${params.outdir}/${params.aligner}/samtools_stats" }, - mode: params.publish_dir_mode, - pattern: "*.{stats,flagstat,idxstats}" - ] - } - - withName: 'NFCORE_RNASEQ:.*:BAM_SORT_STATS_SAMTOOLS:SAMTOOLS_SORT' { - ext.prefix = { "${meta.id}.sorted" } - publishDir = [ - path: { ( ['star_salmon','hisat2'].contains(params.aligner) && - ( params.save_align_intermeds || ( !params.with_umi && params.skip_markduplicates ) ) - ) || params.save_align_intermeds || params.skip_markduplicates ? "${params.outdir}/${params.aligner}" : params.outdir }, - mode: params.publish_dir_mode, - pattern: "*.bam", - saveAs: { ( ['star_salmon','hisat2'].contains(params.aligner) && - ( params.save_align_intermeds || ( !params.with_umi && params.skip_markduplicates ) ) - ) || params.save_align_intermeds || params.skip_markduplicates ? it : null } - ] - } - - withName: 'NFCORE_RNASEQ:.*:BAM_SORT_STATS_SAMTOOLS:SAMTOOLS_INDEX' { - ext.args = { params.bam_csi_index ? '-c' : '' } - publishDir = [ - path: { ( ['star_salmon','hisat2'].contains(params.aligner) && - ( params.save_align_intermeds || ( !params.with_umi && params.skip_markduplicates ) ) - ) || params.save_align_intermeds || params.skip_markduplicates ? "${params.outdir}/${params.aligner}" : params.outdir }, - mode: params.publish_dir_mode, - pattern: "*.{bai,csi}", - saveAs: { ( ['star_salmon','hisat2'].contains(params.aligner) && - ( params.save_align_intermeds || ( !params.with_umi && params.skip_markduplicates ) ) - ) || params.save_align_intermeds || params.skip_markduplicates ? it : null } - ] - } - } - - if (!params.skip_markduplicates && !params.with_umi) { - process { - withName: '.*:BAM_MARKDUPLICATES_PICARD:PICARD_MARKDUPLICATES' { - ext.args = '--ASSUME_SORTED true --REMOVE_DUPLICATES false --VALIDATION_STRINGENCY LENIENT --TMP_DIR tmp' - ext.prefix = { "${meta.id}.markdup.sorted" } - publishDir = [ - [ - path: { "${params.outdir}/${params.aligner}/picard_metrics" }, - mode: params.publish_dir_mode, - pattern: '*metrics.txt' - ], - [ - path: { "${params.outdir}/${params.aligner}" }, - mode: params.publish_dir_mode, - pattern: '*.bam' - ] - ] - } - - withName: '.*:BAM_MARKDUPLICATES_PICARD:SAMTOOLS_INDEX' { - ext.args = { params.bam_csi_index ? '-c' : '' } - ext.prefix = { "${meta.id}.markdup.sorted" } - publishDir = [ - path: { "${params.outdir}/${params.aligner}" }, - mode: params.publish_dir_mode, - pattern: '*.{bai,csi}' - ] - } - - withName: '.*:BAM_MARKDUPLICATES_PICARD:BAM_STATS_SAMTOOLS:.*' { - ext.prefix = { "${meta.id}.markdup.sorted.bam" } - publishDir = [ - path: { "${params.outdir}/${params.aligner}/samtools_stats" }, - mode: params.publish_dir_mode, - pattern: '*.{stats,flagstat,idxstats}' - ] - } - } - } - - if (params.with_umi && ['star_salmon','hisat2'].contains(params.aligner)) { - process { - withName: '.*:BAM_DEDUP_STATS_SAMTOOLS_UMITOOLS_GENOME:UMITOOLS_DEDUP' { - ext.args = { [ - meta.single_end ? '' : '--unpaired-reads=discard --chimeric-pairs=discard', - params.umitools_grouping_method ? "--method='${params.umitools_grouping_method}'" : '', - params.umitools_umi_separator ? "--umi-separator='${params.umitools_umi_separator}'" : '' - ].join(' ').trim() } - ext.prefix = { "${meta.id}.umi_dedup.sorted" } - publishDir = [ - [ - path: { "${params.outdir}/${params.aligner}/umitools" }, - mode: params.publish_dir_mode, - pattern: '*.tsv' - ], - [ - path: { params.save_align_intermeds || params.with_umi || params.save_umi_intermeds ? "${params.outdir}/${params.aligner}" : params.outdir }, - mode: params.publish_dir_mode, - pattern: '*.bam', - saveAs: { params.save_align_intermeds || params.with_umi || params.save_umi_intermeds ? it : null } - ] - ] - } - - withName: '.*:BAM_DEDUP_STATS_SAMTOOLS_UMITOOLS_GENOME:SAMTOOLS_INDEX' { - ext.args = { params.bam_csi_index ? '-c' : '' } - ext.prefix = { "${meta.id}.umi_dedup.sorted" } - publishDir = [ - path: { params.save_align_intermeds || params.with_umi || params.save_umi_intermeds ? "${params.outdir}/${params.aligner}" : params.outdir }, - mode: params.publish_dir_mode, - pattern: '*.{bai,csi}', - saveAs: { params.save_align_intermeds || params.with_umi || params.save_umi_intermeds ? it : null } - ] - } - - withName: '.*:BAM_DEDUP_STATS_SAMTOOLS_UMITOOLS_GENOME:BAM_STATS_SAMTOOLS:.*' { - ext.prefix = { "${meta.id}.umi_dedup.sorted.bam" } - publishDir = [ - path: { "${params.outdir}/${params.aligner}/samtools_stats" }, - mode: params.publish_dir_mode, - pattern: '*.{stats,flagstat,idxstats}' - ] - } - } - } - - if (!params.skip_bigwig) { - process { - withName: 'BEDTOOLS_GENOMECOV' { - ext.args = '-split -du' - publishDir = [ - enabled: false - ] - } - - withName: '.*:BEDGRAPH_BEDCLIP_BEDGRAPHTOBIGWIG_FORWARD:UCSC_BEDCLIP' { - ext.prefix = { "${meta.id}.clip.forward" } - publishDir = [ - enabled: false - ] - } - - withName: '.*:BEDGRAPH_BEDCLIP_BEDGRAPHTOBIGWIG_FORWARD:UCSC_BEDGRAPHTOBIGWIG' { - ext.prefix = { "${meta.id}.forward" } - publishDir = [ - path: { "${params.outdir}/${params.aligner}/bigwig" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } - - withName: '.*:BEDGRAPH_BEDCLIP_BEDGRAPHTOBIGWIG_REVERSE:UCSC_BEDCLIP' { - ext.prefix = { "${meta.id}.clip.reverse" } - publishDir = [ - enabled: false - ] - } - - withName: '.*:BEDGRAPH_BEDCLIP_BEDGRAPHTOBIGWIG_REVERSE:UCSC_BEDGRAPHTOBIGWIG' { - ext.prefix = { "${meta.id}.reverse" } - publishDir = [ - path: { "${params.outdir}/${params.aligner}/bigwig" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } - } - } - - if (!params.skip_stringtie) { - process { - withName: 'STRINGTIE_STRINGTIE' { - ext.args = { [ - '-v', - params.stringtie_ignore_gtf ? '' : '-e' - ].join(' ').trim() } - publishDir = [ - path: { "${params.outdir}/${params.aligner}/stringtie" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } - } - } -} - -// -// STAR Salmon alignment options -// - -if (!params.skip_alignment && params.aligner == 'star_salmon') { - process { - withName: '.*:ALIGN_STAR:STAR_ALIGN|.*:ALIGN_STAR:STAR_ALIGN_IGENOMES' { - ext.args = { [ - '--quantMode TranscriptomeSAM', - '--twopassMode Basic', - '--outSAMtype BAM Unsorted', - '--readFilesCommand zcat', - '--runRNGseed 0', - '--outFilterMultimapNmax 20', - '--alignSJDBoverhangMin 1', - '--outSAMattributes NH HI AS NM MD', - '--quantTranscriptomeBan Singleend', - '--outSAMstrandField intronMotif', - params.save_unaligned ? '--outReadsUnmapped Fastx' : '', - params.extra_star_align_args ? params.extra_star_align_args.split("\\s(?=--)") : '' - ].flatten().unique(false).join(' ').trim() } - publishDir = [ - [ - path: { "${params.outdir}/${params.aligner}/log" }, - mode: params.publish_dir_mode, - pattern: '*.{out,tab}' - ], - [ - path: { params.save_align_intermeds ? "${params.outdir}/${params.aligner}" : params.outdir }, - mode: params.publish_dir_mode, - pattern: '*.bam', - saveAs: { params.save_align_intermeds ? it : null } - ], - [ - path: { params.save_unaligned ? "${params.outdir}/${params.aligner}/unmapped" : params.outdir }, - mode: params.publish_dir_mode, - pattern: '*.fastq.gz', - saveAs: { params.save_unaligned ? it : null } - ] - ] - } - - withName: '.*:QUANTIFY_STAR_SALMON:SALMON_QUANT' { - ext.args = { params.extra_salmon_quant_args ?: '' } - publishDir = [ - path: { "${params.outdir}/${params.aligner}" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') || filename.endsWith('_meta_info.json') ? null : filename } - ] - } - - withName: '.*:QUANTIFY_STAR_SALMON:TX2GENE' { - publishDir = [ - path: { "${params.outdir}/${params.aligner}" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } - - withName: '.*:QUANTIFY_STAR_SALMON:TXIMPORT' { - ext.prefix = { "${quant_type}.merged" } - publishDir = [ - path: { "${params.outdir}/${params.aligner}" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } - - withName: '.*:QUANTIFY_STAR_SALMON:SE_.*' { - publishDir = [ - path: { "${params.outdir}/${params.aligner}" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } - } - - if (params.with_umi) { - process { - withName: 'NFCORE_RNASEQ:SAMTOOLS_SORT' { - ext.args = '-n' - ext.prefix = { "${meta.id}.umi_dedup.transcriptome" } - publishDir = [ - path: { params.save_align_intermeds || params.save_umi_intermeds ? "${params.outdir}/${params.aligner}" : params.outdir }, - mode: params.publish_dir_mode, - pattern: '*.bam', - saveAs: { params.save_align_intermeds || params.save_umi_intermeds ? it : null } - ] - } - - withName: 'NFCORE_RNASEQ:UMITOOLS_PREPAREFORSALMON' { - ext.prefix = { "${meta.id}.umi_dedup.transcriptome.filtered" } - publishDir = [ - [ - path: { "${params.outdir}/${params.aligner}/umitools/log" }, - mode: params.publish_dir_mode, - pattern: '*.log' - ], - [ - path: { params.save_align_intermeds || params.save_umi_intermeds ? "${params.outdir}/${params.aligner}" : params.outdir }, - mode: params.publish_dir_mode, - pattern: '*.bam', - saveAs: { params.save_align_intermeds || params.save_umi_intermeds ? it : null } - ] - ] - } - - withName: 'NFCORE_RNASEQ:BAM_SORT_STATS_SAMTOOLS:SAMTOOLS_SORT' { - ext.prefix = { "${meta.id}.transcriptome.sorted" } - publishDir = [ - path: { params.save_align_intermeds || params.save_umi_intermeds ? "${params.outdir}/${params.aligner}" : params.outdir }, - mode: params.publish_dir_mode, - pattern: '*.bam', - saveAs: { params.save_align_intermeds || params.save_umi_intermeds ? it : null } - ] - } - - withName: 'NFCORE_RNASEQ:BAM_SORT_STATS_SAMTOOLS:SAMTOOLS_INDEX' { - publishDir = [ - path: { params.save_align_intermeds || params.save_umi_intermeds ? "${params.outdir}/${params.aligner}" : params.outdir }, - mode: params.publish_dir_mode, - pattern: '*.bai', - saveAs: { params.save_align_intermeds || params.save_umi_intermeds ? it : null } - ] - } - - withName: 'NFCORE_RNASEQ:BAM_SORT_STATS_SAMTOOLS:BAM_STATS_SAMTOOLS:.*' { - ext.prefix = { "${meta.id}.transcriptome.sorted.bam" } - publishDir = [ - path: { params.save_align_intermeds || params.save_umi_intermeds ? "${params.outdir}/${params.aligner}/samtools_stats" : params.outdir }, - mode: params.publish_dir_mode, - pattern: '*.{stats,flagstat,idxstats}', - saveAs: { params.save_align_intermeds || params.save_umi_intermeds ? it : null } - ] - } - - withName: '.*:BAM_DEDUP_STATS_SAMTOOLS_UMITOOLS_TRANSCRIPTOME:UMITOOLS_DEDUP' { - ext.args = { [ - meta.single_end ? '' : '--unpaired-reads=discard --chimeric-pairs=discard', - params.umitools_grouping_method ? "--method='${params.umitools_grouping_method}'" : '', - params.umitools_umi_separator ? "--umi-separator='${params.umitools_umi_separator}'" : '' - ].join(' ').trim() } - ext.prefix = { "${meta.id}.umi_dedup.transcriptome.sorted" } - publishDir = [ - [ - path: { "${params.outdir}/${params.aligner}/umitools" }, - mode: params.publish_dir_mode, - pattern: '*.tsv' - ], - [ - path: { params.save_align_intermeds || params.save_umi_intermeds ? "${params.outdir}/${params.aligner}" : params.outdir }, - mode: params.publish_dir_mode, - pattern: '*.bam', - saveAs: { params.save_align_intermeds || params.save_umi_intermeds ? it : null } - ] - ] - } - - withName: '.*:BAM_DEDUP_STATS_SAMTOOLS_UMITOOLS_TRANSCRIPTOME:SAMTOOLS_INDEX' { - publishDir = [ - path: { params.save_align_intermeds || params.save_umi_intermeds ? "${params.outdir}/${params.aligner}" : params.outdir }, - mode: params.publish_dir_mode, - pattern: '*.bai', - saveAs: { params.save_align_intermeds || params.save_umi_intermeds ? it : null } - ] - } - - withName: '.*:BAM_DEDUP_STATS_SAMTOOLS_UMITOOLS_TRANSCRIPTOME:BAM_STATS_SAMTOOLS:.*' { - ext.prefix = { "${meta.id}.umi_dedup.transcriptome.sorted.bam" } - publishDir = [ - path: { "${params.outdir}/${params.aligner}/samtools_stats" }, - mode: params.publish_dir_mode, - pattern: '*.{stats,flagstat,idxstats}' - ] - } - } - } - - if (!params.skip_qc & !params.skip_deseq2_qc) { - process { - withName: 'DESEQ2_QC_STAR_SALMON' { - ext.args = { [ - "--id_col 1", - "--sample_suffix ''", - "--count_col 3", - params.deseq2_vst ? '--vst TRUE' : '' - ].join(' ').trim() } - ext.args2 = 'star_salmon' - publishDir = [ - path: { "${params.outdir}/${params.aligner}/deseq2_qc" }, - mode: params.publish_dir_mode, - pattern: "*{RData,pca.vals.txt,plots.pdf,sample.dists.txt,size_factors,log}" - ] - } - } - } -} - -// -// STAR RSEM alignment options -// - -if (!params.skip_alignment && params.aligner == 'star_rsem') { - process { - withName: '.*:QUANTIFY_RSEM:RSEM_CALCULATEEXPRESSION' { - ext.args = [ - '--star', - '--star-output-genome-bam', - '--star-gzipped-read-file', - '--estimate-rspd', - '--seed 1' - ].join(' ').trim() - publishDir = [ - [ - path: { "${params.outdir}/${params.aligner}" }, - mode: params.publish_dir_mode, - pattern: "*.{stat,results}" - ], - [ - path: { params.save_align_intermeds ? "${params.outdir}/${params.aligner}" : params.outdir }, - mode: params.publish_dir_mode, - pattern: "*.bam", - saveAs: { params.save_align_intermeds ? it : null } - ], - [ - path: { "${params.outdir}/${params.aligner}/log" }, - mode: params.publish_dir_mode, - pattern: "*.log" - ] - ] - } - - withName: '.*:QUANTIFY_RSEM:RSEM_MERGE_COUNTS' { - publishDir = [ - path: { "${params.outdir}/${params.aligner}" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } - } - - if (!params.skip_qc & !params.skip_deseq2_qc) { - process { - withName: 'DESEQ2_QC_RSEM' { - ext.args = { [ - "--id_col 1", - "--sample_suffix ''", - "--count_col 3", - params.deseq2_vst ? '--vst TRUE' : '' - ].join(' ').trim() } - ext.args2 = 'star_rsem' - publishDir = [ - path: { "${params.outdir}/${params.aligner}/deseq2_qc" }, - mode: params.publish_dir_mode, - pattern: "*{RData,pca.vals.txt,plots.pdf,sample.dists.txt,size_factors,log}" - ] - } - } - } -} - -// -// HISAT2 alignment options -// - -if (!params.skip_alignment && params.aligner == 'hisat2') { - process { - withName: '.*:FASTQ_ALIGN_HISAT2:HISAT2_ALIGN' { - ext.args = '--met-stderr --new-summary --dta' - publishDir = [ - [ - path: { "${params.outdir}/${params.aligner}/log" }, - mode: params.publish_dir_mode, - pattern: '*.log' - ], - [ - path: { params.save_align_intermeds ? "${params.outdir}/${params.aligner}" : params.outdir }, - mode: params.publish_dir_mode, - pattern: '*.bam', - saveAs: { params.save_align_intermeds ? it : null } - ], - [ - path: { params.save_unaligned ? "${params.outdir}/${params.aligner}/unmapped" : params.outdir }, - mode: params.publish_dir_mode, - pattern: '*.fastq.gz', - saveAs: { params.save_unaligned ? it : null } - ] - ] - } - } -} - -// -// Post-alignment QC options -// - -if (!params.skip_alignment && !params.skip_qc) { - if (!params.skip_preseq) { - process { - withName: 'PRESEQ_LCEXTRAP' { - ext.args = '-verbose -bam -seed 1 -seg_len 100000000' - publishDir = [ - [ - path: { "${params.outdir}/${params.aligner}/preseq" }, - mode: params.publish_dir_mode, - pattern: "*.txt" - ], - [ - path: { "${params.outdir}/${params.aligner}/preseq/log" }, - mode: params.publish_dir_mode, - pattern: "*.log" - ] - ] - } - } - } - - if (!params.skip_qualimap) { - process { - withName: 'QUALIMAP_RNASEQ' { - publishDir = [ - path: { "${params.outdir}/${params.aligner}/qualimap" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } - } - } - - if (!params.skip_dupradar) { - process { - withName: 'DUPRADAR' { - publishDir = [ - [ - path: { "${params.outdir}/${params.aligner}/dupradar/scatter_plot" }, - mode: params.publish_dir_mode, - pattern: "*Dens.pdf" - ], - [ - path: { "${params.outdir}/${params.aligner}/dupradar/box_plot" }, - mode: params.publish_dir_mode, - pattern: "*Boxplot.pdf" - ], - [ - path: { "${params.outdir}/${params.aligner}/dupradar/histogram" }, - mode: params.publish_dir_mode, - pattern: "*Hist.pdf" - ], - [ - path: { "${params.outdir}/${params.aligner}/dupradar/gene_data" }, - mode: params.publish_dir_mode, - pattern: "*Matrix.txt" - ], - [ - path: { "${params.outdir}/${params.aligner}/dupradar/intercepts_slope" }, - mode: params.publish_dir_mode, - pattern: "*slope.txt" - ] - ] - } - } - } - - if (!params.skip_biotype_qc && params.featurecounts_group_type) { - process { - withName: 'SUBREAD_FEATURECOUNTS' { - ext.args = { [ - '-B -C', - params.gencode ? "-g gene_type" : "-g $params.featurecounts_group_type", - "-t $params.featurecounts_feature_type" - ].join(' ').trim() } - publishDir = [ - path: { "${params.outdir}/${params.aligner}/featurecounts" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } - - withName: 'MULTIQC_CUSTOM_BIOTYPE' { - publishDir = [ - path: { "${params.outdir}/${params.aligner}/featurecounts" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } - } - } - - if (!params.skip_rseqc && 'bam_stat' in rseqc_modules) { - process { - withName: '.*:BAM_RSEQC:RSEQC_BAMSTAT' { - publishDir = [ - path: { "${params.outdir}/${params.aligner}/rseqc/bam_stat" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } - } - } - - if (!params.skip_rseqc && 'infer_experiment' in rseqc_modules) { - process { - withName: '.*:BAM_RSEQC:RSEQC_INFEREXPERIMENT' { - publishDir = [ - path: { "${params.outdir}/${params.aligner}/rseqc/infer_experiment" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } - } - } - - if (!params.skip_rseqc && 'junction_annotation' in rseqc_modules) { - process { - withName: '.*:BAM_RSEQC:RSEQC_JUNCTIONANNOTATION' { - publishDir = [ - [ - path: { "${params.outdir}/${params.aligner}/rseqc/junction_annotation/pdf" }, - mode: params.publish_dir_mode, - pattern: '*.pdf' - ], - [ - path: { "${params.outdir}/${params.aligner}/rseqc/junction_annotation/bed" }, - mode: params.publish_dir_mode, - pattern: '*.bed' - ], - [ - path: { "${params.outdir}/${params.aligner}/rseqc/junction_annotation/xls" }, - mode: params.publish_dir_mode, - pattern: '*.xls' - ], - [ - path: { "${params.outdir}/${params.aligner}/rseqc/junction_annotation/log" }, - mode: params.publish_dir_mode, - pattern: '*.log' - ], - [ - path: { "${params.outdir}/${params.aligner}/rseqc/junction_annotation/rscript" }, - mode: params.publish_dir_mode, - pattern: '*.r' - ] - ] - } - } - } - - if (!params.skip_rseqc && 'junction_saturation' in rseqc_modules) { - process { - withName: '.*:BAM_RSEQC:RSEQC_JUNCTIONSATURATION' { - publishDir = [ - [ - path: { "${params.outdir}/${params.aligner}/rseqc/junction_saturation/pdf" }, - mode: params.publish_dir_mode, - pattern: '*.pdf' - ], - [ - path: { "${params.outdir}/${params.aligner}/rseqc/junction_saturation/rscript" }, - mode: params.publish_dir_mode, - pattern: '*.r' - ] - ] - } - } - } - - if (!params.skip_rseqc && 'read_duplication' in rseqc_modules) { - process { - withName: '.*:BAM_RSEQC:RSEQC_READDUPLICATION' { - publishDir = [ - [ - path: { "${params.outdir}/${params.aligner}/rseqc/read_duplication/pdf" }, - mode: params.publish_dir_mode, - pattern: '*.pdf' - ], - [ - path: { "${params.outdir}/${params.aligner}/rseqc/read_duplication/xls" }, - mode: params.publish_dir_mode, - pattern: '*.xls' - ], - [ - path: { "${params.outdir}/${params.aligner}/rseqc/read_duplication/rscript" }, - mode: params.publish_dir_mode, - pattern: '*.r' - ] - ] - } - } - } - - if (!params.skip_rseqc && 'read_distribution' in rseqc_modules && !params.bam_csi_index) { - process { - withName: '.*:BAM_RSEQC:RSEQC_READDISTRIBUTION' { - publishDir = [ - path: { "${params.outdir}/${params.aligner}/rseqc/read_distribution" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } - } - } - - if (!params.skip_rseqc && 'inner_distance' in rseqc_modules && !params.bam_csi_index) { - process { - withName: '.*:BAM_RSEQC:RSEQC_INNERDISTANCE' { - publishDir = [ - [ - path: { "${params.outdir}/${params.aligner}/rseqc/inner_distance/txt" }, - mode: params.publish_dir_mode, - pattern: '*.txt', - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ], - [ - path: { "${params.outdir}/${params.aligner}/rseqc/inner_distance/pdf" }, - mode: params.publish_dir_mode, - pattern: '*.pdf' - ], - [ - path: { "${params.outdir}/${params.aligner}/rseqc/inner_distance/rscript" }, - mode: params.publish_dir_mode, - pattern: '*.r' - ] - ] - } - } - } - - if (!params.skip_rseqc && 'tin' in rseqc_modules && !params.bam_csi_index) { - process { - withName: '.*:BAM_RSEQC:RSEQC_TIN' { - publishDir = [ - path: { "${params.outdir}/${params.aligner}/rseqc/tin" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } - } - } -} - -if (!params.skip_multiqc) { - process { - withName: 'MULTIQC' { - ext.args = { params.multiqc_title ? "--title \"$params.multiqc_title\"" : '' } - ext.prefix = "multiqc_report" - publishDir = [ - path: { [ - "${params.outdir}/multiqc", - params.skip_alignment? '' : "/${params.aligner}" - ].join('') }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } - } -} - -// -// Salmon/ Kallisto pseudoalignment options -// - -if (!params.skip_pseudo_alignment && params.pseudo_aligner == 'salmon') { - process { - withName: '.*:QUANTIFY_PSEUDO_ALIGNMENT:SALMON_QUANT' { - ext.args = { params.extra_salmon_quant_args ?: '' } - publishDir = [ - path: { "${params.outdir}/${params.pseudo_aligner}" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') || filename.endsWith('_meta_info.json') ? null : filename } - ] - } - } -} - -if (!params.skip_pseudo_alignment && params.pseudo_aligner == 'kallisto') { - process { - withName: '.*:QUANTIFY_PSEUDO_ALIGNMENT:KALLISTO_QUANT' { - ext.args = params.extra_kallisto_quant_args ?: '' - publishDir = [ - path: { "${params.outdir}/${params.pseudo_aligner}" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') || filename.endsWith('.run_info.json') || filename.endsWith('.log') ? null : filename } - ] - } - } -} - -if (!params.skip_pseudo_alignment && params.pseudo_aligner) { - process { - withName: '.*:QUANTIFY_PSEUDO_ALIGNMENT:TX2GENE' { - publishDir = [ - path: { "${params.outdir}/${params.pseudo_aligner}" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } - - withName: '.*:QUANTIFY_PSEUDO_ALIGNMENT:TXIMPORT' { - ext.prefix = { "${quant_type}.merged" } - publishDir = [ - path: { "${params.outdir}/${params.pseudo_aligner}" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } - - withName: '.*:QUANTIFY_PSEUDO_ALIGNMENT:SE_.*' { - publishDir = [ - path: { "${params.outdir}/${params.pseudo_aligner}" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } - ] - } - } - - if (!params.skip_qc & !params.skip_deseq2_qc) { - process { - withName: 'DESEQ2_QC_PSEUDO' { - ext.args = { [ - "--id_col 1", - "--sample_suffix ''", - "--count_col 3", - params.deseq2_vst ? '--vst TRUE' : '' - ].join(' ').trim() } - ext.args2 = { params.pseudo_aligner } - publishDir = [ - path: { "${params.outdir}/${params.pseudo_aligner}/deseq2_qc" }, - mode: params.publish_dir_mode, - pattern: "*{RData,pca.vals.txt,plots.pdf,sample.dists.txt,size_factors,log}" - ] - } - } - } -} diff --git a/modules/local/bedtools_genomecov/nextflow.config b/modules/local/bedtools_genomecov/nextflow.config new file mode 100644 index 000000000..397b4b84b --- /dev/null +++ b/modules/local/bedtools_genomecov/nextflow.config @@ -0,0 +1,11 @@ + +if (!params.skip_alignment && !params.skip_bigwig) { + process { + withName: 'BEDTOOLS_GENOMECOV' { + ext.args = '-split -du' + publishDir = [ + enabled: false + ] + } + } +} \ No newline at end of file diff --git a/modules/local/dupradar/nextflow.config b/modules/local/dupradar/nextflow.config new file mode 100644 index 000000000..cff3fa401 --- /dev/null +++ b/modules/local/dupradar/nextflow.config @@ -0,0 +1,35 @@ +if (!params.skip_alignment && !params.skip_qc) { + if (!params.skip_dupradar) { + process { + withName: 'DUPRADAR' { + publishDir = [ + [ + path: { "${params.outdir}/${params.aligner}/dupradar/scatter_plot" }, + mode: params.publish_dir_mode, + pattern: "*Dens.pdf" + ], + [ + path: { "${params.outdir}/${params.aligner}/dupradar/box_plot" }, + mode: params.publish_dir_mode, + pattern: "*Boxplot.pdf" + ], + [ + path: { "${params.outdir}/${params.aligner}/dupradar/histogram" }, + mode: params.publish_dir_mode, + pattern: "*Hist.pdf" + ], + [ + path: { "${params.outdir}/${params.aligner}/dupradar/gene_data" }, + mode: params.publish_dir_mode, + pattern: "*Matrix.txt" + ], + [ + path: { "${params.outdir}/${params.aligner}/dupradar/intercepts_slope" }, + mode: params.publish_dir_mode, + pattern: "*slope.txt" + ] + ] + } + } + } +} \ No newline at end of file diff --git a/modules/local/multiqc_custom_biotype/nextflow.config b/modules/local/multiqc_custom_biotype/nextflow.config new file mode 100644 index 000000000..68fecaa66 --- /dev/null +++ b/modules/local/multiqc_custom_biotype/nextflow.config @@ -0,0 +1,13 @@ +if (!params.skip_alignment && !params.skip_qc) { + if (!params.skip_biotype_qc && params.featurecounts_group_type) { + process { + withName: 'MULTIQC_CUSTOM_BIOTYPE' { + publishDir = [ + path: { "${params.outdir}/${params.aligner}/featurecounts" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] + } + } + } +} diff --git a/modules/nf-core/bbmap/bbsplit/nextflow.config b/modules/nf-core/bbmap/bbsplit/nextflow.config new file mode 100644 index 000000000..da3ddaf31 --- /dev/null +++ b/modules/nf-core/bbmap/bbsplit/nextflow.config @@ -0,0 +1,20 @@ +if (!params.skip_bbsplit) { + process { + withName: 'BBMAP_BBSPLIT' { + ext.args = 'build=1 ambiguous2=all maxindel=150000' + publishDir = [ + [ + path: { "${params.outdir}/bbsplit" }, + mode: params.publish_dir_mode, + pattern: '*.txt' + ], + [ + path: { params.save_bbsplit_reads ? "${params.outdir}/bbsplit" : params.outdir }, + mode: params.publish_dir_mode, + pattern: '*.fastq.gz', + saveAs: { params.save_bbsplit_reads ? it : null } + ] + ] + } + } +} \ No newline at end of file diff --git a/modules/nf-core/cat/fastq/nextflow.config b/modules/nf-core/cat/fastq/nextflow.config new file mode 100644 index 000000000..9d4372756 --- /dev/null +++ b/modules/nf-core/cat/fastq/nextflow.config @@ -0,0 +1,9 @@ +process { + withName: 'CAT_FASTQ' { + publishDir = [ + path: { params.save_merged_fastq ? "${params.outdir}/fastq" : params.outdir }, + mode: params.publish_dir_mode, + saveAs: { filename -> (filename.endsWith('.fastq.gz') && params.save_merged_fastq) ? filename : null } + ] + } +} \ No newline at end of file diff --git a/modules/nf-core/multiqc/nextflow.config b/modules/nf-core/multiqc/nextflow.config new file mode 100644 index 000000000..ac178787c --- /dev/null +++ b/modules/nf-core/multiqc/nextflow.config @@ -0,0 +1,16 @@ +if (!params.skip_multiqc) { + process { + withName: 'MULTIQC' { + ext.args = { params.multiqc_title ? "--title \"$params.multiqc_title\"" : '' } + ext.prefix = "multiqc_report" + publishDir = [ + path: { [ + "${params.outdir}/multiqc", + params.skip_alignment? '' : "/${params.aligner}" + ].join('') }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] + } + } +} \ No newline at end of file diff --git a/modules/nf-core/preseq/lcextrap/nextflow.config b/modules/nf-core/preseq/lcextrap/nextflow.config new file mode 100644 index 000000000..e203e87e7 --- /dev/null +++ b/modules/nf-core/preseq/lcextrap/nextflow.config @@ -0,0 +1,21 @@ +if (!params.skip_alignment && !params.skip_qc) { + if (!params.skip_preseq) { + process { + withName: 'PRESEQ_LCEXTRAP' { + ext.args = '-verbose -bam -seed 1 -seg_len 100000000' + publishDir = [ + [ + path: { "${params.outdir}/${params.aligner}/preseq" }, + mode: params.publish_dir_mode, + pattern: "*.txt" + ], + [ + path: { "${params.outdir}/${params.aligner}/preseq/log" }, + mode: params.publish_dir_mode, + pattern: "*.log" + ] + ] + } + } + } +} \ No newline at end of file diff --git a/modules/nf-core/qualimap/rnaseq/nextflow.config b/modules/nf-core/qualimap/rnaseq/nextflow.config new file mode 100644 index 000000000..9c05fb25a --- /dev/null +++ b/modules/nf-core/qualimap/rnaseq/nextflow.config @@ -0,0 +1,13 @@ +if (!params.skip_alignment && !params.skip_qc) { + if (!params.skip_qualimap) { + process { + withName: 'QUALIMAP_RNASEQ' { + publishDir = [ + path: { "${params.outdir}/${params.aligner}/qualimap" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] + } + } + } +} diff --git a/modules/nf-core/sortmerna/nextflow.config b/modules/nf-core/sortmerna/nextflow.config new file mode 100644 index 000000000..8771660ce --- /dev/null +++ b/modules/nf-core/sortmerna/nextflow.config @@ -0,0 +1,20 @@ +if (params.remove_ribo_rna) { + process { + withName: 'SORTMERNA' { + ext.args = '--num_alignments 1 -v' + publishDir = [ + [ + path: { "${params.outdir}/sortmerna" }, + mode: params.publish_dir_mode, + pattern: "*.log" + ], + [ + path: { params.save_non_ribo_reads ? "${params.outdir}/sortmerna" : params.outdir }, + mode: params.publish_dir_mode, + pattern: "*.fastq.gz", + saveAs: { params.save_non_ribo_reads ? it : null } + ] + ] + } + } +} \ No newline at end of file diff --git a/modules/nf-core/stringtie/stringtie/nextflow.config b/modules/nf-core/stringtie/stringtie/nextflow.config new file mode 100644 index 000000000..dc0651458 --- /dev/null +++ b/modules/nf-core/stringtie/stringtie/nextflow.config @@ -0,0 +1,17 @@ +if (!params.skip_alignment) { + if (!params.skip_stringtie) { + process { + withName: 'STRINGTIE_STRINGTIE' { + ext.args = { [ + '-v', + params.stringtie_ignore_gtf ? '' : '-e' + ].join(' ').trim() } + publishDir = [ + path: { "${params.outdir}/${params.aligner}/stringtie" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] + } + } + } +} \ No newline at end of file diff --git a/modules/nf-core/subread/featurecounts/nextflow.config b/modules/nf-core/subread/featurecounts/nextflow.config new file mode 100644 index 000000000..3a796d101 --- /dev/null +++ b/modules/nf-core/subread/featurecounts/nextflow.config @@ -0,0 +1,26 @@ +if (!params.skip_alignment && !params.skip_qc) { + if (!params.skip_biotype_qc && params.featurecounts_group_type) { + process { + withName: 'SUBREAD_FEATURECOUNTS' { + ext.args = { [ + '-B -C', + params.gencode ? "-g gene_type" : "-g $params.featurecounts_group_type", + "-t $params.featurecounts_feature_type" + ].join(' ').trim() } + publishDir = [ + path: { "${params.outdir}/${params.aligner}/featurecounts" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] + } + + withName: 'MULTIQC_CUSTOM_BIOTYPE' { + publishDir = [ + path: { "${params.outdir}/${params.aligner}/featurecounts" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] + } + } + } +} diff --git a/nextflow.config b/nextflow.config index c4e5a8a30..d9e5e00b2 100644 --- a/nextflow.config +++ b/nextflow.config @@ -135,6 +135,15 @@ params { } +// Default publishing logic for pipeline +process { + publishDir = [ + path: { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] +} + // Load base.config by default for all pipelines includeConfig 'conf/base.config' @@ -324,8 +333,9 @@ manifest { doi = 'https://doi.org/10.5281/zenodo.1400710' } -// Load modules.config for DSL2 module specific options -includeConfig 'conf/modules.config' +// Workflow specific config +includeConfig "./subworkflows/local/prepare_genome/nextflow.config" +includeConfig './workflows/rnaseq/nextflow.config' // Function to ensure that resource requirements don't go beyond // a maximum limit diff --git a/subworkflows/local/align_star/nextflow.config b/subworkflows/local/align_star/nextflow.config new file mode 100644 index 000000000..328579da2 --- /dev/null +++ b/subworkflows/local/align_star/nextflow.config @@ -0,0 +1,39 @@ +if (!params.skip_alignment && params.aligner == 'star_salmon') { + process { + withName: '.*:ALIGN_STAR:STAR_ALIGN|.*:ALIGN_STAR:STAR_ALIGN_IGENOMES' { + ext.args = { [ + '--quantMode TranscriptomeSAM', + '--twopassMode Basic', + '--outSAMtype BAM Unsorted', + '--readFilesCommand zcat', + '--runRNGseed 0', + '--outFilterMultimapNmax 20', + '--alignSJDBoverhangMin 1', + '--outSAMattributes NH HI AS NM MD', + '--quantTranscriptomeBan Singleend', + '--outSAMstrandField intronMotif', + params.save_unaligned ? '--outReadsUnmapped Fastx' : '', + params.extra_star_align_args ? params.extra_star_align_args.split("\\s(?=--)") : '' + ].flatten().unique(false).join(' ').trim() } + publishDir = [ + [ + path: { "${params.outdir}/${params.aligner}/log" }, + mode: params.publish_dir_mode, + pattern: '*.{out,tab}' + ], + [ + path: { params.save_align_intermeds ? "${params.outdir}/${params.aligner}" : params.outdir }, + mode: params.publish_dir_mode, + pattern: '*.bam', + saveAs: { params.save_align_intermeds ? it : null } + ], + [ + path: { params.save_unaligned ? "${params.outdir}/${params.aligner}/unmapped" : params.outdir }, + mode: params.publish_dir_mode, + pattern: '*.fastq.gz', + saveAs: { params.save_unaligned ? it : null } + ] + ] + } + } +} \ No newline at end of file diff --git a/subworkflows/local/prepare_genome/nextflow.config b/subworkflows/local/prepare_genome/nextflow.config new file mode 100644 index 000000000..98a4b64fd --- /dev/null +++ b/subworkflows/local/prepare_genome/nextflow.config @@ -0,0 +1,114 @@ +process { + withName: 'GUNZIP_.*|MAKE_TRANSCRIPTS_FASTA' { + publishDir = [ + path: { params.save_reference ? "${params.outdir}/genome" : params.outdir }, + mode: params.publish_dir_mode, + saveAs: { filename -> (filename != 'versions.yml' && params.save_reference) ? filename : null } + ] + } + + withName: 'UNTAR_.*' { + ext.args2 = '--no-same-owner' + } + + withName: 'UNTAR_.*|STAR_GENOMEGENERATE|STAR_GENOMEGENERATE_IGENOMES|HISAT2_BUILD' { + publishDir = [ + path: { params.save_reference ? "${params.outdir}/genome/index" : params.outdir }, + mode: params.publish_dir_mode, + saveAs: { filename -> (filename != 'versions.yml' && params.save_reference) ? filename : null } + ] + } + + withName: 'GFFREAD' { + ext.args = '--keep-exon-attrs -F -T' + publishDir = [ + path: { params.save_reference ? "${params.outdir}/genome" : params.outdir }, + mode: params.publish_dir_mode, + saveAs: { filename -> (filename != 'versions.yml' && params.save_reference) ? filename : null } + ] + } + + withName: 'HISAT2_EXTRACTSPLICESITES' { + publishDir = [ + path: { params.save_reference ? "${params.outdir}/genome/index" : params.outdir }, + mode: params.publish_dir_mode, + saveAs: { filename -> (filename != 'versions.yml' && params.save_reference) ? filename : null } + ] + } + + withName: 'SALMON_INDEX' { + ext.args = { [ + params.gencode ? '--gencode' : '', + params.pseudo_aligner_kmer_size ? "-k ${params.pseudo_aligner_kmer_size}": '' + ].join(' ').trim() } + publishDir = [ + path: { params.save_reference ? "${params.outdir}/genome/index" : params.outdir }, + mode: params.publish_dir_mode, + saveAs: { filename -> (filename != 'versions.yml' && params.save_reference) ? filename : null } + ] + } + + withName: 'KALLISTO_INDEX' { + ext.args = params.pseudo_aligner_kmer_size ? "-k ${params.pseudo_aligner_kmer_size}" : '' + publishDir = [ + path: { params.save_reference ? "${params.outdir}/genome/index" : params.outdir }, + mode: params.publish_dir_mode, + saveAs: { filename -> (filename != 'versions.yml' && params.save_reference) ? filename : null } + ] + } + + withName: 'RSEM_PREPAREREFERENCE_GENOME' { + ext.args = '--star' + publishDir = [ + path: { params.save_reference ? "${params.outdir}/genome/index" : params.outdir }, + mode: params.publish_dir_mode, + saveAs: { filename -> (filename != 'versions.yml' && params.save_reference) ? filename : null } + ] + } + + withName: 'GTF2BED' { + publishDir = [ + path: { params.save_reference ? "${params.outdir}/genome" : params.outdir }, + mode: params.publish_dir_mode, + saveAs: { filename -> (filename != 'versions.yml' && params.save_reference) ? filename : null } + ] + } + + withName: 'CAT_ADDITIONAL_FASTA|PREPROCESS_TRANSCRIPTS_FASTA_GENCODE' { + publishDir = [ + path: { params.save_reference ? "${params.outdir}/genome" : params.outdir }, + mode: params.publish_dir_mode, + saveAs: { filename -> (filename != 'versions.yml' && params.save_reference) ? filename : null } + ] + } + + withName: 'GTF_FILTER' { + ext.args = { params.skip_gtf_transcript_filter ?: '--skip_transcript_id_check' } + publishDir = [ + path: { params.save_reference ? "${params.outdir}/genome" : params.outdir }, + mode: params.publish_dir_mode, + saveAs: { filename -> (filename != 'versions.yml' && params.save_reference) ? filename : null } + ] + } + + withName: 'CUSTOM_GETCHROMSIZES' { + publishDir = [ + path: { params.save_reference ? "${params.outdir}/genome" : params.outdir }, + mode: params.publish_dir_mode, + saveAs: { filename -> (filename != 'versions.yml' && params.save_reference) ? filename : null } + ] + } +} + +if (!params.skip_bbsplit && params.bbsplit_fasta_list) { + process { + withName: 'PREPARE_GENOME:BBMAP_BBSPLIT' { + ext.args = 'build=1' + publishDir = [ + path: { params.save_reference ? "${params.outdir}/genome/index" : params.outdir }, + mode: params.publish_dir_mode, + saveAs: { filename -> (filename != 'versions.yml' && params.save_reference) ? filename : null } + ] + } + } +} diff --git a/subworkflows/local/quantify_pseudo/main.nf b/subworkflows/local/quantify_pseudo_alignment/main.nf similarity index 100% rename from subworkflows/local/quantify_pseudo/main.nf rename to subworkflows/local/quantify_pseudo_alignment/main.nf diff --git a/subworkflows/local/quantify_pseudo_alignment/nextflow.config b/subworkflows/local/quantify_pseudo_alignment/nextflow.config new file mode 100644 index 000000000..3c3a245b4 --- /dev/null +++ b/subworkflows/local/quantify_pseudo_alignment/nextflow.config @@ -0,0 +1,54 @@ +if (!params.skip_pseudo_alignment && params.pseudo_aligner == 'salmon') { + process { + withName: '.*:QUANTIFY_PSEUDO_ALIGNMENT:SALMON_QUANT' { + ext.args = { params.extra_salmon_quant_args ?: '' } + publishDir = [ + path: { "${params.outdir}/${params.pseudo_aligner}" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') || filename.endsWith('_meta_info.json') ? null : filename } + ] + } + } +} + +if (!params.skip_pseudo_alignment && params.pseudo_aligner == 'kallisto') { + process { + withName: '.*:QUANTIFY_PSEUDO_ALIGNMENT:KALLISTO_QUANT' { + ext.args = params.extra_kallisto_quant_args ?: '' + publishDir = [ + path: { "${params.outdir}/${params.pseudo_aligner}" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') || filename.endsWith('.run_info.json') || filename.endsWith('.log') ? null : filename } + ] + } + } +} + +if (!params.skip_pseudo_alignment && params.pseudo_aligner) { + process { + withName: '.*:QUANTIFY_PSEUDO_ALIGNMENT:TX2GENE' { + publishDir = [ + path: { "${params.outdir}/${params.pseudo_aligner}" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] + } + + withName: '.*:QUANTIFY_PSEUDO_ALIGNMENT:TXIMPORT' { + ext.prefix = { "${quant_type}.merged" } + publishDir = [ + path: { "${params.outdir}/${params.pseudo_aligner}" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] + } + + withName: '.*:QUANTIFY_PSEUDO_ALIGNMENT:SE_.*' { + publishDir = [ + path: { "${params.outdir}/${params.pseudo_aligner}" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] + } + } +} \ No newline at end of file diff --git a/subworkflows/local/quantify_rsem/nextflow.config b/subworkflows/local/quantify_rsem/nextflow.config new file mode 100644 index 000000000..514177e32 --- /dev/null +++ b/subworkflows/local/quantify_rsem/nextflow.config @@ -0,0 +1,39 @@ +if (!params.skip_alignment && params.aligner == 'star_rsem') { + process { + withName: '.*:QUANTIFY_RSEM:RSEM_CALCULATEEXPRESSION' { + ext.args = [ + '--star', + '--star-output-genome-bam', + '--star-gzipped-read-file', + '--estimate-rspd', + '--seed 1' + ].join(' ').trim() + publishDir = [ + [ + path: { "${params.outdir}/${params.aligner}" }, + mode: params.publish_dir_mode, + pattern: "*.{stat,results}" + ], + [ + path: { params.save_align_intermeds ? "${params.outdir}/${params.aligner}" : params.outdir }, + mode: params.publish_dir_mode, + pattern: "*.bam", + saveAs: { params.save_align_intermeds ? it : null } + ], + [ + path: { "${params.outdir}/${params.aligner}/log" }, + mode: params.publish_dir_mode, + pattern: "*.log" + ] + ] + } + + withName: '.*:QUANTIFY_RSEM:RSEM_MERGE_COUNTS' { + publishDir = [ + path: { "${params.outdir}/${params.aligner}" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] + } + } +} \ No newline at end of file diff --git a/subworkflows/nf-core/bam_markduplicates_picard/nextflow.config b/subworkflows/nf-core/bam_markduplicates_picard/nextflow.config new file mode 100644 index 000000000..94a3e52b7 --- /dev/null +++ b/subworkflows/nf-core/bam_markduplicates_picard/nextflow.config @@ -0,0 +1,41 @@ +if (!params.skip_alignment) { + if (!params.skip_markduplicates && !params.with_umi) { + process { + withName: '.*:BAM_MARKDUPLICATES_PICARD:PICARD_MARKDUPLICATES' { + ext.args = '--ASSUME_SORTED true --REMOVE_DUPLICATES false --VALIDATION_STRINGENCY LENIENT --TMP_DIR tmp' + ext.prefix = { "${meta.id}.markdup.sorted" } + publishDir = [ + [ + path: { "${params.outdir}/${params.aligner}/picard_metrics" }, + mode: params.publish_dir_mode, + pattern: '*metrics.txt' + ], + [ + path: { "${params.outdir}/${params.aligner}" }, + mode: params.publish_dir_mode, + pattern: '*.bam' + ] + ] + } + + withName: '.*:BAM_MARKDUPLICATES_PICARD:SAMTOOLS_INDEX' { + ext.args = { params.bam_csi_index ? '-c' : '' } + ext.prefix = { "${meta.id}.markdup.sorted" } + publishDir = [ + path: { "${params.outdir}/${params.aligner}" }, + mode: params.publish_dir_mode, + pattern: '*.{bai,csi}' + ] + } + + withName: '.*:BAM_MARKDUPLICATES_PICARD:BAM_STATS_SAMTOOLS:.*' { + ext.prefix = { "${meta.id}.markdup.sorted.bam" } + publishDir = [ + path: { "${params.outdir}/${params.aligner}/samtools_stats" }, + mode: params.publish_dir_mode, + pattern: '*.{stats,flagstat,idxstats}' + ] + } + } + } +} \ No newline at end of file diff --git a/subworkflows/nf-core/bam_rseqc/nextflow.config b/subworkflows/nf-core/bam_rseqc/nextflow.config new file mode 100644 index 000000000..4fabc8e99 --- /dev/null +++ b/subworkflows/nf-core/bam_rseqc/nextflow.config @@ -0,0 +1,153 @@ +def rseqc_modules = params.rseqc_modules ? params.rseqc_modules.split(',').collect{ it.trim().toLowerCase() } : [] + +if (!params.skip_alignment && !params.skip_qc && !params.skip_rseqc) { + if ('bam_stat' in rseqc_modules) { + process { + withName: '.*:BAM_RSEQC:RSEQC_BAMSTAT' { + publishDir = [ + path: { "${params.outdir}/${params.aligner}/rseqc/bam_stat" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] + } + } + } + + if ('infer_experiment' in rseqc_modules) { + process { + withName: '.*:BAM_RSEQC:RSEQC_INFEREXPERIMENT' { + publishDir = [ + path: { "${params.outdir}/${params.aligner}/rseqc/infer_experiment" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] + } + } + } + + if ('junction_annotation' in rseqc_modules) { + process { + withName: '.*:BAM_RSEQC:RSEQC_JUNCTIONANNOTATION' { + publishDir = [ + [ + path: { "${params.outdir}/${params.aligner}/rseqc/junction_annotation/pdf" }, + mode: params.publish_dir_mode, + pattern: '*.pdf' + ], + [ + path: { "${params.outdir}/${params.aligner}/rseqc/junction_annotation/bed" }, + mode: params.publish_dir_mode, + pattern: '*.bed' + ], + [ + path: { "${params.outdir}/${params.aligner}/rseqc/junction_annotation/xls" }, + mode: params.publish_dir_mode, + pattern: '*.xls' + ], + [ + path: { "${params.outdir}/${params.aligner}/rseqc/junction_annotation/log" }, + mode: params.publish_dir_mode, + pattern: '*.log' + ], + [ + path: { "${params.outdir}/${params.aligner}/rseqc/junction_annotation/rscript" }, + mode: params.publish_dir_mode, + pattern: '*.r' + ] + ] + } + } + } + + if ('junction_saturation' in rseqc_modules) { + process { + withName: '.*:BAM_RSEQC:RSEQC_JUNCTIONSATURATION' { + publishDir = [ + [ + path: { "${params.outdir}/${params.aligner}/rseqc/junction_saturation/pdf" }, + mode: params.publish_dir_mode, + pattern: '*.pdf' + ], + [ + path: { "${params.outdir}/${params.aligner}/rseqc/junction_saturation/rscript" }, + mode: params.publish_dir_mode, + pattern: '*.r' + ] + ] + } + } + } + + if ('read_duplication' in rseqc_modules) { + process { + withName: '.*:BAM_RSEQC:RSEQC_READDUPLICATION' { + publishDir = [ + [ + path: { "${params.outdir}/${params.aligner}/rseqc/read_duplication/pdf" }, + mode: params.publish_dir_mode, + pattern: '*.pdf' + ], + [ + path: { "${params.outdir}/${params.aligner}/rseqc/read_duplication/xls" }, + mode: params.publish_dir_mode, + pattern: '*.xls' + ], + [ + path: { "${params.outdir}/${params.aligner}/rseqc/read_duplication/rscript" }, + mode: params.publish_dir_mode, + pattern: '*.r' + ] + ] + } + } + } + + if ('read_distribution' in rseqc_modules && !params.bam_csi_index) { + process { + withName: '.*:BAM_RSEQC:RSEQC_READDISTRIBUTION' { + publishDir = [ + path: { "${params.outdir}/${params.aligner}/rseqc/read_distribution" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] + } + } + } + + if ('inner_distance' in rseqc_modules && !params.bam_csi_index) { + process { + withName: '.*:BAM_RSEQC:RSEQC_INNERDISTANCE' { + publishDir = [ + [ + path: { "${params.outdir}/${params.aligner}/rseqc/inner_distance/txt" }, + mode: params.publish_dir_mode, + pattern: '*.txt', + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ], + [ + path: { "${params.outdir}/${params.aligner}/rseqc/inner_distance/pdf" }, + mode: params.publish_dir_mode, + pattern: '*.pdf' + ], + [ + path: { "${params.outdir}/${params.aligner}/rseqc/inner_distance/rscript" }, + mode: params.publish_dir_mode, + pattern: '*.r' + ] + ] + } + } + } + + if ('tin' in rseqc_modules && !params.bam_csi_index) { + process { + withName: '.*:BAM_RSEQC:RSEQC_TIN' { + publishDir = [ + path: { "${params.outdir}/${params.aligner}/rseqc/tin" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] + } + } + } +} diff --git a/subworkflows/nf-core/fastq_align_hisat2/nextflow.config b/subworkflows/nf-core/fastq_align_hisat2/nextflow.config new file mode 100644 index 000000000..94633dfa6 --- /dev/null +++ b/subworkflows/nf-core/fastq_align_hisat2/nextflow.config @@ -0,0 +1,26 @@ +if (!params.skip_alignment && params.aligner == 'hisat2') { + process { + withName: '.*:FASTQ_ALIGN_HISAT2:HISAT2_ALIGN' { + ext.args = '--met-stderr --new-summary --dta' + publishDir = [ + [ + path: { "${params.outdir}/${params.aligner}/log" }, + mode: params.publish_dir_mode, + pattern: '*.log' + ], + [ + path: { params.save_align_intermeds ? "${params.outdir}/${params.aligner}" : params.outdir }, + mode: params.publish_dir_mode, + pattern: '*.bam', + saveAs: { params.save_align_intermeds ? it : null } + ], + [ + path: { params.save_unaligned ? "${params.outdir}/${params.aligner}/unmapped" : params.outdir }, + mode: params.publish_dir_mode, + pattern: '*.fastq.gz', + saveAs: { params.save_unaligned ? it : null } + ] + ] + } + } +} \ No newline at end of file diff --git a/subworkflows/nf-core/fastq_fastqc_umitools_fastp/nextflow.config b/subworkflows/nf-core/fastq_fastqc_umitools_fastp/nextflow.config new file mode 100644 index 000000000..061689d5f --- /dev/null +++ b/subworkflows/nf-core/fastq_fastqc_umitools_fastp/nextflow.config @@ -0,0 +1,72 @@ +if (!(params.skip_fastqc || params.skip_qc)) { + if (params.trimmer == 'fastp') { + process { + withName: '.*:FASTQ_FASTQC_UMITOOLS_FASTP:FASTQC_RAW' { + ext.args = '--quiet' + } + + withName: '.*:FASTQ_FASTQC_UMITOOLS_FASTP:FASTQC_TRIM' { + ext.args = '--quiet' + publishDir = [ + path: { "${params.outdir}/${params.trimmer}/fastqc" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] + } + } + } +} + +if (!params.skip_trimming) { + if (params.trimmer == 'fastp') { + process { + withName: '.*:FASTQ_FASTQC_UMITOOLS_FASTP:FASTP' { + ext.args = { params.extra_fastp_args ?: '' } + publishDir = [ + [ + path: { "${params.outdir}/${params.trimmer}" }, + mode: params.publish_dir_mode, + pattern: "*.{json,html}" + ], + [ + path: { "${params.outdir}/${params.trimmer}/log" }, + mode: params.publish_dir_mode, + pattern: "*.log" + ], + [ + path: { params.save_trimmed ? "${params.outdir}/${params.trimmer}" : params.outdir }, + mode: params.publish_dir_mode, + pattern: "*.fastq.gz", + saveAs: { params.save_trimmed ? it : null } + ] + ] + } + } + } +} + +if (params.with_umi && !params.skip_umi_extract) { + process { + withName: '.*:FASTQ_FASTQC_UMITOOLS_FASTP:UMITOOLS_EXTRACT' { + ext.args = { [ + params.umitools_extract_method ? "--extract-method=${params.umitools_extract_method}" : '', + params.umitools_bc_pattern ? "--bc-pattern='${params.umitools_bc_pattern}'" : '', + params.umitools_bc_pattern2 ? "--bc-pattern2='${params.umitools_bc_pattern2}'" : '', + params.umitools_umi_separator ? "--umi-separator='${params.umitools_umi_separator}'" : '' + ].join(' ').trim() } + publishDir = [ + [ + path: { "${params.outdir}/umitools" }, + mode: params.publish_dir_mode, + pattern: "*.log" + ], + [ + path: { params.save_umi_intermeds ? "${params.outdir}/umitools" : params.outdir }, + mode: params.publish_dir_mode, + pattern: "*.fastq.gz", + saveAs: { params.save_umi_intermeds ? it : null } + ] + ] + } + } +} diff --git a/subworkflows/nf-core/fastq_fastqc_umitools_trimgalore/nextflow.config b/subworkflows/nf-core/fastq_fastqc_umitools_trimgalore/nextflow.config new file mode 100644 index 000000000..7279111e5 --- /dev/null +++ b/subworkflows/nf-core/fastq_fastqc_umitools_trimgalore/nextflow.config @@ -0,0 +1,68 @@ +if (!(params.skip_fastqc || params.skip_qc)) { + if (params.trimmer == 'trimgalore') { + process { + withName: '.*:FASTQ_FASTQC_UMITOOLS_TRIMGALORE:FASTQC' { + ext.args = '--quiet' + } + } + } +} + +if (!params.skip_trimming) { + if (params.trimmer == 'trimgalore') { + process { + withName: '.*:FASTQ_FASTQC_UMITOOLS_TRIMGALORE:TRIMGALORE' { + ext.args = { + [ + "--fastqc_args '-t ${task.cpus}'", + params.extra_trimgalore_args ? params.extra_trimgalore_args.split("\\s(?=--)") : '' + ].flatten().unique(false).join(' ').trim() + } + publishDir = [ + [ + path: { "${params.outdir}/${params.trimmer}/fastqc" }, + mode: params.publish_dir_mode, + pattern: "*.{html,zip}" + ], + [ + path: { params.save_trimmed ? "${params.outdir}/${params.trimmer}" : params.outdir }, + mode: params.publish_dir_mode, + pattern: "*.fq.gz", + saveAs: { params.save_trimmed ? it : null } + ], + [ + path: { "${params.outdir}/${params.trimmer}" }, + mode: params.publish_dir_mode, + pattern: "*.txt" + ] + ] + } + } + } +} + +if (params.with_umi && !params.skip_umi_extract) { + process { + withName: '.*:FASTQ_FASTQC_UMITOOLS_TRIMGALORE:UMITOOLS_EXTRACT' { + ext.args = { [ + params.umitools_extract_method ? "--extract-method=${params.umitools_extract_method}" : '', + params.umitools_bc_pattern ? "--bc-pattern='${params.umitools_bc_pattern}'" : '', + params.umitools_bc_pattern2 ? "--bc-pattern2='${params.umitools_bc_pattern2}'" : '', + params.umitools_umi_separator ? "--umi-separator='${params.umitools_umi_separator}'" : '' + ].join(' ').trim() } + publishDir = [ + [ + path: { "${params.outdir}/umitools" }, + mode: params.publish_dir_mode, + pattern: "*.log" + ], + [ + path: { params.save_umi_intermeds ? "${params.outdir}/umitools" : params.outdir }, + mode: params.publish_dir_mode, + pattern: "*.fastq.gz", + saveAs: { params.save_umi_intermeds ? it : null } + ] + ] + } + } +} diff --git a/subworkflows/nf-core/fastq_subsample_fq_salmon/nextflow.config b/subworkflows/nf-core/fastq_subsample_fq_salmon/nextflow.config new file mode 100644 index 000000000..5425935cd --- /dev/null +++ b/subworkflows/nf-core/fastq_subsample_fq_salmon/nextflow.config @@ -0,0 +1,16 @@ +process { + withName: '.*:FASTQ_SUBSAMPLE_FQ_SALMON:FQ_SUBSAMPLE' { + ext.args = '--record-count 1000000 --seed 1' + ext.prefix = { "${meta.id}.subsampled" } + publishDir = [ + enabled: false + ] + } + + withName: '.*:FASTQ_SUBSAMPLE_FQ_SALMON:SALMON_QUANT' { + ext.args = '--skipQuant' + publishDir = [ + enabled: false + ] + } +} \ No newline at end of file diff --git a/workflows/rnaseq/main.nf b/workflows/rnaseq/main.nf index e19ccbbf0..fb9a7e979 100755 --- a/workflows/rnaseq/main.nf +++ b/workflows/rnaseq/main.nf @@ -20,8 +20,8 @@ include { UMITOOLS_PREPAREFORRSEM as UMITOOLS_PREPAREFORSALMON } from '../../mod // include { ALIGN_STAR } from '../../subworkflows/local/align_star' include { QUANTIFY_RSEM } from '../../subworkflows/local/quantify_rsem' -include { QUANTIFY_PSEUDO_ALIGNMENT as QUANTIFY_STAR_SALMON } from '../../subworkflows/local/quantify_pseudo' -include { QUANTIFY_PSEUDO_ALIGNMENT } from '../../subworkflows/local/quantify_pseudo' +include { QUANTIFY_PSEUDO_ALIGNMENT as QUANTIFY_STAR_SALMON } from '../../subworkflows/local/quantify_pseudo_alignment' +include { QUANTIFY_PSEUDO_ALIGNMENT } from '../../subworkflows/local/quantify_pseudo_alignment' include { multiqcTsvFromList } from '../../subworkflows/local/utils_nfcore_rnaseq_pipeline' include { getSalmonInferredStrandedness } from '../../subworkflows/local/utils_nfcore_rnaseq_pipeline' diff --git a/workflows/rnaseq/nextflow.config b/workflows/rnaseq/nextflow.config new file mode 100644 index 000000000..fd4f1435d --- /dev/null +++ b/workflows/rnaseq/nextflow.config @@ -0,0 +1,391 @@ +includeConfig "../../modules/local/bedtools_genomecov/nextflow.config" +includeConfig "../../modules/local/dupradar/nextflow.config" +includeConfig "../../modules/local/multiqc_custom_biotype/nextflow.config" +includeConfig "../../modules/nf-core/bbmap/bbsplit/nextflow.config" +includeConfig "../../modules/nf-core/cat/fastq/nextflow.config" +includeConfig "../../modules/nf-core/multiqc/nextflow.config" +includeConfig "../../modules/nf-core/preseq/lcextrap/nextflow.config" +includeConfig "../../modules/nf-core/qualimap/rnaseq/nextflow.config" +includeConfig "../../modules/nf-core/sortmerna/nextflow.config" +includeConfig "../../modules/nf-core/stringtie/stringtie/nextflow.config" +includeConfig "../../modules/nf-core/subread/featurecounts/nextflow.config" +includeConfig "../../subworkflows/local/align_star/nextflow.config" +includeConfig "../../subworkflows/local/quantify_rsem/nextflow.config" +includeConfig "../../subworkflows/nf-core/bam_markduplicates_picard/nextflow.config" +includeConfig "../../subworkflows/nf-core/bam_rseqc/nextflow.config" +includeConfig "../../subworkflows/nf-core/fastq_align_hisat2/nextflow.config" +includeConfig "../../subworkflows/nf-core/fastq_fastqc_umitools_fastp/nextflow.config" +includeConfig "../../subworkflows/nf-core/fastq_fastqc_umitools_trimgalore/nextflow.config" +includeConfig "../../subworkflows/nf-core/fastq_subsample_fq_salmon/nextflow.config" + +// +// STAR Salmon alignment options +// + +if (!params.skip_alignment && params.aligner == 'star_salmon') { + process { + withName: '.*:QUANTIFY_STAR_SALMON:SALMON_QUANT' { + ext.args = { params.extra_salmon_quant_args ?: '' } + publishDir = [ + path: { "${params.outdir}/${params.aligner}" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') || filename.endsWith('_meta_info.json') ? null : filename } + ] + } + + withName: '.*:QUANTIFY_STAR_SALMON:TX2GENE' { + publishDir = [ + path: { "${params.outdir}/${params.aligner}" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] + } + + withName: '.*:QUANTIFY_STAR_SALMON:TXIMPORT' { + ext.prefix = { "${quant_type}.merged" } + publishDir = [ + path: { "${params.outdir}/${params.aligner}" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] + } + + withName: '.*:QUANTIFY_STAR_SALMON:SE_.*' { + publishDir = [ + path: { "${params.outdir}/${params.aligner}" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] + } + } + + if (params.with_umi) { + process { + withName: 'NFCORE_RNASEQ:SAMTOOLS_SORT' { + ext.args = '-n' + ext.prefix = { "${meta.id}.umi_dedup.transcriptome" } + publishDir = [ + path: { params.save_align_intermeds || params.save_umi_intermeds ? "${params.outdir}/${params.aligner}" : params.outdir }, + mode: params.publish_dir_mode, + pattern: '*.bam', + saveAs: { params.save_align_intermeds || params.save_umi_intermeds ? it : null } + ] + } + + withName: 'NFCORE_RNASEQ:UMITOOLS_PREPAREFORSALMON' { + ext.prefix = { "${meta.id}.umi_dedup.transcriptome.filtered" } + publishDir = [ + [ + path: { "${params.outdir}/${params.aligner}/umitools/log" }, + mode: params.publish_dir_mode, + pattern: '*.log' + ], + [ + path: { params.save_align_intermeds || params.save_umi_intermeds ? "${params.outdir}/${params.aligner}" : params.outdir }, + mode: params.publish_dir_mode, + pattern: '*.bam', + saveAs: { params.save_align_intermeds || params.save_umi_intermeds ? it : null } + ] + ] + } + + withName: 'NFCORE_RNASEQ:BAM_SORT_STATS_SAMTOOLS:SAMTOOLS_SORT' { + ext.prefix = { "${meta.id}.transcriptome.sorted" } + publishDir = [ + path: { params.save_align_intermeds || params.save_umi_intermeds ? "${params.outdir}/${params.aligner}" : params.outdir }, + mode: params.publish_dir_mode, + pattern: '*.bam', + saveAs: { params.save_align_intermeds || params.save_umi_intermeds ? it : null } + ] + } + + withName: 'NFCORE_RNASEQ:BAM_SORT_STATS_SAMTOOLS:SAMTOOLS_INDEX' { + publishDir = [ + path: { params.save_align_intermeds || params.save_umi_intermeds ? "${params.outdir}/${params.aligner}" : params.outdir }, + mode: params.publish_dir_mode, + pattern: '*.bai', + saveAs: { params.save_align_intermeds || params.save_umi_intermeds ? it : null } + ] + } + + withName: 'NFCORE_RNASEQ:BAM_SORT_STATS_SAMTOOLS:BAM_STATS_SAMTOOLS:.*' { + ext.prefix = { "${meta.id}.transcriptome.sorted.bam" } + publishDir = [ + path: { params.save_align_intermeds || params.save_umi_intermeds ? "${params.outdir}/${params.aligner}/samtools_stats" : params.outdir }, + mode: params.publish_dir_mode, + pattern: '*.{stats,flagstat,idxstats}', + saveAs: { params.save_align_intermeds || params.save_umi_intermeds ? it : null } + ] + } + + withName: '.*:BAM_DEDUP_STATS_SAMTOOLS_UMITOOLS_TRANSCRIPTOME:UMITOOLS_DEDUP' { + ext.args = { [ + meta.single_end ? '' : '--unpaired-reads=discard --chimeric-pairs=discard', + params.umitools_grouping_method ? "--method='${params.umitools_grouping_method}'" : '', + params.umitools_umi_separator ? "--umi-separator='${params.umitools_umi_separator}'" : '' + ].join(' ').trim() } + ext.prefix = { "${meta.id}.umi_dedup.transcriptome.sorted" } + publishDir = [ + [ + path: { "${params.outdir}/${params.aligner}/umitools" }, + mode: params.publish_dir_mode, + pattern: '*.tsv' + ], + [ + path: { params.save_align_intermeds || params.save_umi_intermeds ? "${params.outdir}/${params.aligner}" : params.outdir }, + mode: params.publish_dir_mode, + pattern: '*.bam', + saveAs: { params.save_align_intermeds || params.save_umi_intermeds ? it : null } + ] + ] + } + + withName: '.*:BAM_DEDUP_STATS_SAMTOOLS_UMITOOLS_TRANSCRIPTOME:SAMTOOLS_INDEX' { + publishDir = [ + path: { params.save_align_intermeds || params.save_umi_intermeds ? "${params.outdir}/${params.aligner}" : params.outdir }, + mode: params.publish_dir_mode, + pattern: '*.bai', + saveAs: { params.save_align_intermeds || params.save_umi_intermeds ? it : null } + ] + } + + withName: '.*:BAM_DEDUP_STATS_SAMTOOLS_UMITOOLS_TRANSCRIPTOME:BAM_STATS_SAMTOOLS:.*' { + ext.prefix = { "${meta.id}.umi_dedup.transcriptome.sorted.bam" } + publishDir = [ + path: { "${params.outdir}/${params.aligner}/samtools_stats" }, + mode: params.publish_dir_mode, + pattern: '*.{stats,flagstat,idxstats}' + ] + } + } + } +} + +// +// General alignment options +// + +if (!params.skip_alignment) { + process { + withName: 'NFCORE_RNASEQ:.*:BAM_SORT_STATS_SAMTOOLS:BAM_STATS_SAMTOOLS:.*' { + ext.prefix = { "${meta.id}.sorted.bam" } + publishDir = [ + path: { "${params.outdir}/${params.aligner}/samtools_stats" }, + mode: params.publish_dir_mode, + pattern: "*.{stats,flagstat,idxstats}" + ] + } + + withName: 'NFCORE_RNASEQ:.*:BAM_SORT_STATS_SAMTOOLS:SAMTOOLS_SORT' { + ext.prefix = { "${meta.id}.sorted" } + publishDir = [ + path: { ( ['star_salmon','hisat2'].contains(params.aligner) && + ( params.save_align_intermeds || ( !params.with_umi && params.skip_markduplicates ) ) + ) || params.save_align_intermeds || params.skip_markduplicates ? "${params.outdir}/${params.aligner}" : params.outdir }, + mode: params.publish_dir_mode, + pattern: "*.bam", + saveAs: { ( ['star_salmon','hisat2'].contains(params.aligner) && + ( params.save_align_intermeds || ( !params.with_umi && params.skip_markduplicates ) ) + ) || params.save_align_intermeds || params.skip_markduplicates ? it : null } + ] + } + + withName: 'NFCORE_RNASEQ:.*:BAM_SORT_STATS_SAMTOOLS:SAMTOOLS_INDEX' { + ext.args = { params.bam_csi_index ? '-c' : '' } + publishDir = [ + path: { ( ['star_salmon','hisat2'].contains(params.aligner) && + ( params.save_align_intermeds || ( !params.with_umi && params.skip_markduplicates ) ) + ) || params.save_align_intermeds || params.skip_markduplicates ? "${params.outdir}/${params.aligner}" : params.outdir }, + mode: params.publish_dir_mode, + pattern: "*.{bai,csi}", + saveAs: { ( ['star_salmon','hisat2'].contains(params.aligner) && + ( params.save_align_intermeds || ( !params.with_umi && params.skip_markduplicates ) ) + ) || params.save_align_intermeds || params.skip_markduplicates ? it : null } + ] + } + } + + if (params.with_umi && ['star_salmon','hisat2'].contains(params.aligner)) { + process { + withName: '.*:BAM_DEDUP_STATS_SAMTOOLS_UMITOOLS_GENOME:UMITOOLS_DEDUP' { + ext.args = { [ + meta.single_end ? '' : '--unpaired-reads=discard --chimeric-pairs=discard', + params.umitools_grouping_method ? "--method='${params.umitools_grouping_method}'" : '', + params.umitools_umi_separator ? "--umi-separator='${params.umitools_umi_separator}'" : '' + ].join(' ').trim() } + ext.prefix = { "${meta.id}.umi_dedup.sorted" } + publishDir = [ + [ + path: { "${params.outdir}/${params.aligner}/umitools" }, + mode: params.publish_dir_mode, + pattern: '*.tsv' + ], + [ + path: { params.save_align_intermeds || params.with_umi || params.save_umi_intermeds ? "${params.outdir}/${params.aligner}" : params.outdir }, + mode: params.publish_dir_mode, + pattern: '*.bam', + saveAs: { params.save_align_intermeds || params.with_umi || params.save_umi_intermeds ? it : null } + ] + ] + } + + withName: '.*:BAM_DEDUP_STATS_SAMTOOLS_UMITOOLS_GENOME:SAMTOOLS_INDEX' { + ext.args = { params.bam_csi_index ? '-c' : '' } + ext.prefix = { "${meta.id}.umi_dedup.sorted" } + publishDir = [ + path: { params.save_align_intermeds || params.with_umi || params.save_umi_intermeds ? "${params.outdir}/${params.aligner}" : params.outdir }, + mode: params.publish_dir_mode, + pattern: '*.{bai,csi}', + saveAs: { params.save_align_intermeds || params.with_umi || params.save_umi_intermeds ? it : null } + ] + } + + withName: '.*:BAM_DEDUP_STATS_SAMTOOLS_UMITOOLS_GENOME:BAM_STATS_SAMTOOLS:.*' { + ext.prefix = { "${meta.id}.umi_dedup.sorted.bam" } + publishDir = [ + path: { "${params.outdir}/${params.aligner}/samtools_stats" }, + mode: params.publish_dir_mode, + pattern: '*.{stats,flagstat,idxstats}' + ] + } + } + } +} + +// +// bigWig coverage options +// + +if (!params.skip_alignment && !params.skip_bigwig) { + process { + withName: '.*:BEDGRAPH_BEDCLIP_BEDGRAPHTOBIGWIG_FORWARD:UCSC_BEDCLIP' { + ext.prefix = { "${meta.id}.clip.forward" } + publishDir = [ + enabled: false + ] + } + + withName: '.*:BEDGRAPH_BEDCLIP_BEDGRAPHTOBIGWIG_FORWARD:UCSC_BEDGRAPHTOBIGWIG' { + ext.prefix = { "${meta.id}.forward" } + publishDir = [ + path: { "${params.outdir}/${params.aligner}/bigwig" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] + } + + withName: '.*:BEDGRAPH_BEDCLIP_BEDGRAPHTOBIGWIG_REVERSE:UCSC_BEDCLIP' { + ext.prefix = { "${meta.id}.clip.reverse" } + publishDir = [ + enabled: false + ] + } + + withName: '.*:BEDGRAPH_BEDCLIP_BEDGRAPHTOBIGWIG_REVERSE:UCSC_BEDGRAPHTOBIGWIG' { + ext.prefix = { "${meta.id}.reverse" } + publishDir = [ + path: { "${params.outdir}/${params.aligner}/bigwig" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] + } + } +} + +// +// DESeq2 QC options +// + +if (!params.skip_alignment && params.aligner == 'star_salmon') { + if (!params.skip_qc & !params.skip_deseq2_qc) { + process { + withName: 'DESEQ2_QC_STAR_SALMON' { + ext.args = { [ + "--id_col 1", + "--sample_suffix ''", + "--count_col 3", + params.deseq2_vst ? '--vst TRUE' : '' + ].join(' ').trim() } + ext.args2 = 'star_salmon' + publishDir = [ + path: { "${params.outdir}/${params.aligner}/deseq2_qc" }, + mode: params.publish_dir_mode, + pattern: "*{RData,pca.vals.txt,plots.pdf,sample.dists.txt,size_factors,log}" + ] + } + } + } +} + +if (!params.skip_alignment && params.aligner == 'star_rsem') { + if (!params.skip_qc & !params.skip_deseq2_qc) { + process { + withName: 'DESEQ2_QC_RSEM' { + ext.args = { [ + "--id_col 1", + "--sample_suffix ''", + "--count_col 3", + params.deseq2_vst ? '--vst TRUE' : '' + ].join(' ').trim() } + ext.args2 = 'star_rsem' + publishDir = [ + path: { "${params.outdir}/${params.aligner}/deseq2_qc" }, + mode: params.publish_dir_mode, + pattern: "*{RData,pca.vals.txt,plots.pdf,sample.dists.txt,size_factors,log}" + ] + } + } + } +} + +// +// Pseudo-alignment options +// + +if (!params.skip_pseudo_alignment && params.pseudo_aligner) { + process { + withName: '.*:QUANTIFY_PSEUDO_ALIGNMENT:TX2GENE' { + publishDir = [ + path: { "${params.outdir}/${params.pseudo_aligner}" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] + } + + withName: '.*:QUANTIFY_PSEUDO_ALIGNMENT:TXIMPORT' { + ext.prefix = { "${quant_type}.merged" } + publishDir = [ + path: { "${params.outdir}/${params.pseudo_aligner}" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] + } + + withName: '.*:QUANTIFY_PSEUDO_ALIGNMENT:SE_.*' { + publishDir = [ + path: { "${params.outdir}/${params.pseudo_aligner}" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] + } + } + + if (!params.skip_qc & !params.skip_deseq2_qc) { + process { + withName: 'DESEQ2_QC_PSEUDO' { + ext.args = { [ + "--id_col 1", + "--sample_suffix ''", + "--count_col 3", + params.deseq2_vst ? '--vst TRUE' : '' + ].join(' ').trim() } + ext.args2 = { params.pseudo_aligner } + publishDir = [ + path: { "${params.outdir}/${params.pseudo_aligner}/deseq2_qc" }, + mode: params.publish_dir_mode, + pattern: "*{RData,pca.vals.txt,plots.pdf,sample.dists.txt,size_factors,log}" + ] + } + } + } +}