diff --git a/conf/modules.config b/conf/modules.config index 06a1e5a6..6b67b9aa 100644 --- a/conf/modules.config +++ b/conf/modules.config @@ -21,7 +21,8 @@ process { saveAs: { filename -> filename.equals('versions.yml') ? null : filename } ] - withName: 'NFCORE_CHIPSEQ:CHIPSEQ:INPUT_CHECK:SAMPLESHEET_CHECK' { + withName: 'SAMPLESHEET_CHECK' { + ext.args = 'samplesheet.valid.csv' publishDir = [ path: { "${params.outdir}/pipeline_info" }, mode: params.publish_dir_mode, @@ -36,6 +37,10 @@ process { pattern: '*_versions.yml' ] } + + withName: 'KHMER_UNIQUEKMERS' { + publishDir = [ enabled: false ] + } } // @@ -71,15 +76,6 @@ process { ] } - withName: 'UNTAR_CHROMAP_INDEX|CHROMAP_INDEX' { - publishDir = [ - path: { "${params.outdir}/genome/index/chromap" }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename }, - enabled: params.save_reference - ] - } - withName: 'GFFREAD' { ext.args = '--keep-exon-attrs -F -T' publishDir = [ @@ -111,7 +107,8 @@ process { publishDir = [ path: { "${params.outdir}/genome" }, mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + saveAs: { filename -> filename.equals('versions.yml') ? null : filename }, + enabled: params.save_reference ] } } @@ -258,6 +255,14 @@ if (params.aligner == 'bowtie2') { if (params.aligner == 'chromap') { process { + withName: 'CHROMAP_INDEX' { + publishDir = [ + path: { "${params.outdir}/genome/index/${params.aligner}" }, + mode: params.publish_dir_mode, + saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + ] + } + withName: CHROMAP_CHROMAP { ext.args = '-l 2000 --low-mem --SAM' ext.prefix = { "${meta.id}.Lb" } @@ -311,7 +316,12 @@ process { withName: 'PICARD_MERGESAMFILES' { ext.args = '--SORT_ORDER coordinate --VALIDATION_STRINGENCY LENIENT --TMP_DIR tmp' ext.prefix = { "${meta.id}.mLb.sorted" } - publishDir = [ enabled: false ] + publishDir = [ + path: { "${params.outdir}/${params.aligner}/merged_library" }, + mode: params.publish_dir_mode, + pattern: '*.bam', + enabled: params.save_align_intermeds + ] } withName: '.*:BAM_MARKDUPLICATES_PICARD:PICARD_MARKDUPLICATES' { @@ -350,7 +360,6 @@ process { ] } - // Should only be published when paired end data is used and save_align_intermeds is true withName: 'BAMTOOLS_FILTER' { ext.args = { [ @@ -359,34 +368,41 @@ process { params.keep_multi_map ? '' : '-q 1' ].join(' ').trim() } - ext.prefix = { meta.single_end ? "${meta.id}.mLb.noPublish" : "${meta.id}.mLb.flT.sorted" } //TODO check with atacseq + ext.prefix = { meta.single_end ? "${meta.id}.mLb.clN.sorted" : "${meta.id}.mLb.flT.sorted" } publishDir = [ - path: { "${params.outdir}/${params.aligner}/mergedLibrary" }, + path: { "${params.outdir}/${params.aligner}/merged_library" }, mode: params.publish_dir_mode, - pattern: '*.mLb.flT.sorted.bam', - enabled: params.save_align_intermeds + pattern: '*.bam', + saveAs: { (meta.single_end || params.save_align_intermeds) ? "${it}" : null } ] } withName: 'BAM_REMOVE_ORPHANS' { ext.args = '--only_fr_pairs' ext.prefix = { "${meta.id}.mLb.clN" } - publishDir = [ enabled: false ] + publishDir = [ + path: { "${params.outdir}/${params.aligner}/merged_library" }, + mode: params.publish_dir_mode, + pattern: '*.bam', + enabled: params.save_align_intermeds + ] } withName: 'NFCORE_CHIPSEQ:CHIPSEQ:BAM_FILTER_BAMTOOLS:SAMTOOLS_SORT' { - ext.prefix = { "${meta.id}.mLb.clN.sorted" } + ext.args = '-n' + ext.prefix = { "${meta.id}.mLb.flT.name_sorted" } publishDir = [ path: { "${params.outdir}/${params.aligner}/mergedLibrary" }, mode: params.publish_dir_mode, - pattern: '*.bam' + pattern: '*.bam', + enabled: params.save_align_intermeds ] } withName: 'NFCORE_CHIPSEQ:CHIPSEQ:BAM_FILTER_BAMTOOLS:SAMTOOLS_INDEX' { ext.prefix = { "${meta.id}.mLb.clN.sorted" } publishDir = [ - path: { "${params.outdir}/${params.aligner}/mergedLibrary" }, + path: { "${params.outdir}/${params.aligner}/merged_library" }, mode: params.publish_dir_mode, pattern: '*.{bai,csi}' ] @@ -395,7 +411,7 @@ process { withName: 'NFCORE_CHIPSEQ:CHIPSEQ:BAM_FILTER_BAMTOOLS:BAM_STATS_SAMTOOLS:.*' { ext.prefix = { "${meta.id}.mLb.clN.sorted.bam" } publishDir = [ - path: { "${params.outdir}/${params.aligner}/mergedLibrary/samtools_stats" }, + path: { "${params.outdir}/${params.aligner}/merged_library/samtools_stats" }, mode: params.publish_dir_mode, pattern: "*.{stats,flagstat,idxstats}" ] @@ -404,7 +420,7 @@ process { withName: 'PHANTOMPEAKQUALTOOLS' { ext.args2 = { "-p=$task.cpus" } publishDir = [ - path: { "${params.outdir}/${params.aligner}/mergedLibrary/phantompeakqualtools" }, + path: { "${params.outdir}/${params.aligner}/merged_library/phantompeakqualtools" }, mode: params.publish_dir_mode, pattern: "*.{out,pdf}" ] @@ -412,25 +428,33 @@ process { withName: 'MULTIQC_CUSTOM_PHANTOMPEAKQUALTOOLS' { publishDir = [ - path: { "${params.outdir}/${params.aligner}/mergedLibrary/phantompeakqualtools" }, + path: { "${params.outdir}/${params.aligner}/merged_library/phantompeakqualtools" }, mode: params.publish_dir_mode, saveAs: { filename -> filename.equals('versions.yml') ? null : filename } ] } withName: 'BEDTOOLS_GENOMECOV' { - ext.prefix = { "${meta.id}" } + ext.args = { (meta.single_end && params.fragment_size > 0) ? "-fs ${params.fragment_size}" : '' } + ext.prefix = { "${meta.id}.mLB.clN" } publishDir = [ - path: { "${params.outdir}/${params.aligner}/mergedLibrary/bigwig/scale" }, - mode: params.publish_dir_mode, - pattern: "*.txt" + [ + path: { "${params.outdir}/${params.aligner}/merged_library/bigwig" }, + mode: params.publish_dir_mode, + pattern: "*.bigWig" + ], + [ + path: { "${params.outdir}/${params.aligner}/merged_library/bigwig/scale" }, + mode: params.publish_dir_mode, + pattern: "*.txt" + ] ] } withName: 'UCSC_BEDGRAPHTOBIGWIG' { - ext.prefix = { "${meta.id}" } + ext.prefix = { "${meta.id}.mLb.clN" } publishDir = [ - path: { "${params.outdir}/${params.aligner}/mergedLibrary/bigwig" }, + path: { "${params.outdir}/${params.aligner}/merged_library/bigwig" }, mode: params.publish_dir_mode, pattern: "*.bigWig" ] @@ -444,12 +468,12 @@ if (!params.skip_picard_metrics) { ext.prefix = { "${meta.id}.mLb.clN.sorted" } publishDir = [ [ - path: { "${params.outdir}/${params.aligner}/mergedLibrary/picard_metrics" }, + path: { "${params.outdir}/${params.aligner}/merged_library/picard_metrics" }, mode: params.publish_dir_mode, pattern: "*_metrics" ], [ - path: { "${params.outdir}/${params.aligner}/mergedLibrary/picard_metrics/pdf" }, + path: { "${params.outdir}/${params.aligner}/merged_library/picard_metrics/pdf" }, mode: params.publish_dir_mode, pattern: "*.pdf" ] @@ -462,9 +486,9 @@ if (!params.skip_preseq) { process { withName: 'PRESEQ_LCEXTRAP' { ext.args = '-verbose -bam -seed 1' - ext.prefix = { "${meta.id}.mLb.clN" } + ext.prefix = { "${meta.id}.mLb.mkD" } publishDir = [ - path: { "${params.outdir}/${params.aligner}/mergedLibrary/preseq" }, + path: { "${params.outdir}/${params.aligner}/merged_library/preseq" }, mode: params.publish_dir_mode, saveAs: { filename -> filename.equals('versions.yml') ? null : filename } ] @@ -475,10 +499,10 @@ if (!params.skip_preseq) { if (!params.skip_plot_profile) { process { withName: 'DEEPTOOLS_COMPUTEMATRIX' { - ext.args = 'scale-regions --regionBodyLength 1000 --beforeRegionStartLength 3000 --afterRegionStartLength 3000 --skipZeros --smartLabels' + ext.args = 'scale-regions --regionBodyLength 1000 --beforeRegionStartLength 3000 --afterRegionStartLength 3000 --missingDataAsZero --skipZeros --smartLabels' ext.prefix = { "${meta.id}.mLb.clN" } publishDir = [ - path: { "${params.outdir}/${params.aligner}/mergedLibrary/deepTools/plotProfile" }, + path: { "${params.outdir}/${params.aligner}/merged_library/deepTools/plotProfile" }, mode: params.publish_dir_mode, saveAs: { filename -> filename.equals('versions.yml') ? null : filename } ] @@ -487,7 +511,7 @@ if (!params.skip_plot_profile) { withName: 'DEEPTOOLS_PLOTPROFILE' { ext.prefix = { "${meta.id}.mLb.clN" } publishDir = [ - path: { "${params.outdir}/${params.aligner}/mergedLibrary/deepTools/plotProfile" }, + path: { "${params.outdir}/${params.aligner}/merged_library/deepTools/plotProfile" }, mode: params.publish_dir_mode, saveAs: { filename -> filename.equals('versions.yml') ? null : filename } ] @@ -496,7 +520,7 @@ if (!params.skip_plot_profile) { withName: 'DEEPTOOLS_PLOTHEATMAP' { ext.prefix = { "${meta.id}.mLb.clN" } publishDir = [ - path: { "${params.outdir}/${params.aligner}/mergedLibrary/deepTools/plotProfile" }, + path: { "${params.outdir}/${params.aligner}/merged_library/deepTools/plotProfile" }, mode: params.publish_dir_mode, saveAs: { filename -> filename.equals('versions.yml') ? null : filename } ] @@ -504,12 +528,6 @@ if (!params.skip_plot_profile) { } } -process { - withName: 'KHMER_UNIQUEKMERS' { - publishDir = [ enabled: false ] - } -} - if (!params.skip_plot_fingerprint) { process { withName: 'DEEPTOOLS_PLOTFINGERPRINT' { @@ -520,7 +538,7 @@ if (!params.skip_plot_fingerprint) { ].join(' ').trim() } ext.prefix = { "${meta.id}.mLb.clN" } publishDir = [ - path: { "${params.outdir}/${params.aligner}/mergedLibrary/deepTools/plotFingerprint" }, + path: { "${params.outdir}/${params.aligner}/merged_library/deepTools/plotFingerprint" }, mode: params.publish_dir_mode, saveAs: { filename -> filename.equals('versions.yml') ? null : filename } ] @@ -536,11 +554,11 @@ process { params.save_macs_pileup ? '--bdg --SPMR' : '', params.macs_fdr ? "--qvalue ${params.macs_fdr}" : '', params.macs_pvalue ? "--pvalue ${params.macs_pvalue}" : '', - params.aligner == "chromap" ? "--format BAM" : '' + params.aligner == "chromap" ? "--format BAM" : '' //TODO check if not needed anymore with new chromap versions ].join(' ').trim() publishDir = [ path: { [ - "${params.outdir}/${params.aligner}/mergedLibrary/macs2", + "${params.outdir}/${params.aligner}/merged_library/macs2", params.narrow_peak? '/narrowPeak' : '/broadPeak' ].join('') }, mode: params.publish_dir_mode, @@ -551,22 +569,14 @@ process { withName: 'FRIP_SCORE' { ext.args = '-bed -c -f 0.20' publishDir = [ - path: { [ - "${params.outdir}/${params.aligner}/mergedLibrary/macs2", - params.narrow_peak? '/narrowPeak' : '/broadPeak', - '/qc' - ].join('') }, + path: { "${params.outdir}/${params.aligner}/merged_library/macs2/${params.narrow_peak ? '/narrowPeak' : '/broadPeak'}/qc" }, enabled: false ] } withName: 'MULTIQC_CUSTOM_PEAKS' { publishDir = [ - path: { [ - "${params.outdir}/${params.aligner}/mergedLibrary/macs2", - params.narrow_peak? '/narrowPeak' : '/broadPeak', - '/qc' - ].join('') }, + path: { "${params.outdir}/${params.aligner}/merged_library/macs2/${params.narrow_peak} ? '/narrowPeak' : '/broadPeak'}/qc" }, mode: params.publish_dir_mode, saveAs: { filename -> filename.equals('versions.yml') ? null : filename } ] @@ -579,10 +589,7 @@ if (!params.skip_peak_annotation) { ext.args = '-gid' ext.prefix = { "${meta.id}_peaks" } publishDir = [ - path: { [ - "${params.outdir}/${params.aligner}/mergedLibrary/macs2", - params.narrow_peak? '/narrowPeak' : '/broadPeak' - ].join('') }, + path: { "${params.outdir}/${params.aligner}/merged_library/macs2/${params.narrow_peak ? '/narrowPeak' : '/broadPeak' }" }, mode: params.publish_dir_mode, saveAs: { filename -> filename.equals('versions.yml') ? null : filename } ] @@ -594,11 +601,7 @@ if (!params.skip_peak_annotation) { withName: 'PLOT_MACS2_QC' { ext.args = '-o ./ -p macs2_peak' publishDir = [ - path: { [ - "${params.outdir}/${params.aligner}/mergedLibrary/macs2", - params.narrow_peak? '/narrowPeak' : '/broadPeak', - '/qc' - ].join('') }, + path: { "${params.outdir}/${params.aligner}/merged_library/macs2/${params.narrow_peak ? '/narrow_peak' : '/broad_peak'}/qc" }, mode: params.publish_dir_mode, saveAs: { filename -> filename.equals('versions.yml') ? null : filename } ] @@ -608,11 +611,7 @@ if (!params.skip_peak_annotation) { ext.args = '-o ./' ext.prefix = 'macs2_annotatePeaks' publishDir = [ - path: { [ - "${params.outdir}/${params.aligner}/mergedLibrary/macs2", - params.narrow_peak? '/narrowPeak' : '/broadPeak', - '/qc' - ].join('') }, + path: { "${params.outdir}/${params.aligner}/merged_library/macs2/params.narrow_peak ? '/narrowPeak' : '/broadPeak'}/qc" }, mode: params.publish_dir_mode, saveAs: { filename -> filename.equals('versions.yml') ? null : filename } ] @@ -627,12 +626,7 @@ if (!params.skip_consensus_peaks) { ext.when = { meta.multiple_groups || meta.replicates_exist } ext.prefix = { "${meta.id}.consensus_peaks" } publishDir = [ - path: { [ - "${params.outdir}/${params.aligner}/mergedLibrary/macs2", - params.narrow_peak? '/narrowPeak' : '/broadPeak', - '/consensus', - "/${meta.id}" - ].join('') }, + path: { "${params.outdir}/${params.aligner}/merged_library/macs2/${params.narrow_peak ? '/narrowPeak' : '/broadPeak'}/consensus/${meta.id}" }, mode: params.publish_dir_mode, saveAs: { filename -> filename.equals('versions.yml') ? null : filename } ] @@ -642,12 +636,7 @@ if (!params.skip_consensus_peaks) { ext.args = '-F SAF -O --fracOverlap 0.2' ext.prefix = { "${meta.id}.consensus_peaks" } publishDir = [ - path: { [ - "${params.outdir}/${params.aligner}/mergedLibrary/macs2", - params.narrow_peak? '/narrowPeak' : '/broadPeak', - '/consensus', - "/${meta.id}" - ].join('') }, + path: { "${params.outdir}/${params.aligner}/merged_library/macs2/${params.narrow_peak? '/narrowPeak' : '/broadPeak'}/consensus/${meta.id}" }, mode: params.publish_dir_mode, saveAs: { filename -> filename.equals('versions.yml') ? null : filename } ] @@ -660,12 +649,7 @@ if (!params.skip_consensus_peaks) { ext.args = '-gid' ext.prefix = { "${meta.id}.consensus_peaks" } publishDir = [ - path: { [ - "${params.outdir}/${params.aligner}/mergedLibrary/macs2", - params.narrow_peak? '/narrowPeak' : '/broadPeak', - '/consensus', - "/${meta.id}" - ].join('') }, + path: { "${params.outdir}/${params.aligner}/merged_library/macs2/${params.narrow_peak ? '/narrowPeak' : '/broadPeak'}/consensus/${meta.id}" }, mode: params.publish_dir_mode, saveAs: { filename -> filename.equals('versions.yml') ? null : filename } ] @@ -674,12 +658,7 @@ if (!params.skip_consensus_peaks) { withName: 'ANNOTATE_BOOLEAN_PEAKS' { ext.prefix = { "${meta.id}.consensus_peaks" } publishDir = [ - path: { [ - "${params.outdir}/${params.aligner}/mergedLibrary/macs2", - params.narrow_peak? '/narrowPeak' : '/broadPeak', - '/consensus', - "/${meta.id}" - ].join('') }, + path: { "${params.outdir}/${params.aligner}/merged_library/macs2/${params.narrow_peak ? '/narrowPeak' : '/broadPeak'}/consensus/${meta.id}" }, mode: params.publish_dir_mode, saveAs: { filename -> filename.equals('versions.yml') ? null : filename } ] @@ -699,13 +678,7 @@ if (!params.skip_consensus_peaks) { ].join(' ').trim() ext.prefix = { "${meta.id}.consensus_peaks" } publishDir = [ - path: { [ - "${params.outdir}/${params.aligner}/mergedLibrary/macs2", - params.narrow_peak? '/narrowPeak' : '/broadPeak', - '/consensus', - "/${meta.id}", - '/deseq2' - ].join('') }, + path: { "${params.outdir}/${params.aligner}/merged_library/macs2/${params.narrow_peak ? '/narrowPeak' : '/broadPeak'}/consensus/${meta.id}/deseq2" }, mode: params.publish_dir_mode, saveAs: { filename -> filename.equals('versions.yml') ? null : filename } ] @@ -718,12 +691,16 @@ if (!params.skip_igv) { process { withName: 'IGV' { publishDir = [ - path: { [ - "${params.outdir}/igv", - params.narrow_peak? '/narrowPeak' : '/broadPeak' - ].join('') }, - mode: params.publish_dir_mode, - saveAs: { filename -> filename.equals('versions.yml') ? null : filename } + [ + path: { "${params.outdir}/igv/${params.narrow_peak? '/narrowPeak' : '/broadPeak' }" }, + mode: params.publish_dir_mode, + pattern: '*.{txt,xml}' + ], + [ + path: { "${params.outdir}/genome" }, + mode: params.publish_dir_mode, + pattern: '*.{fa,fasta}' + ] ] } } @@ -734,10 +711,7 @@ if (!params.skip_multiqc) { withName: 'MULTIQC' { ext.args = params.multiqc_title ? "--title \"$params.multiqc_title\"" : '' publishDir = [ - path: { [ - "${params.outdir}/multiqc", - params.narrow_peak? '/narrowPeak' : '/broadPeak' - ].join('') }, + path: { "${params.outdir}/multiqc/${params.narrow_peak ? '/narrowPeak' : '/broadPeak'}" }, mode: params.publish_dir_mode, saveAs: { filename -> filename.equals('versions.yml') ? null : filename } ] diff --git a/docs/output.md b/docs/output.md index b3198554..065dcfd3 100644 --- a/docs/output.md +++ b/docs/output.md @@ -108,19 +108,19 @@ The library-level alignments associated with the same sample are merged and subs
Output files -- `/mergedLibrary/` +- `/merged_library/` - `*.bam`: Merged library-level, coordinate sorted `*.bam` files after the marking of duplicates, and filtering based on various criteria. The file suffix for the final filtered files will be `*.mLb.clN.*`. If you specify the `--save_align_intermeds` parameter then two additional sets of files will be present. These represent the unfiltered alignments with duplicates marked (`*.mLb.mkD.*`), and in the case of paired-end datasets the filtered alignments before the removal of orphan read pairs (`*.mLb.flT.*`). -- `/mergedLibrary/samtools_stats/` +- `/merged_library/samtools_stats/` - SAMtools `*.flagstat`, `*.idxstats` and `*.stats` files generated from the alignment files. -- `/mergedLibrary/picard_metrics/` +- `/merged_library/picard_metrics/` - `*_metrics`: Alignment QC files from picard CollectMultipleMetrics. - `*.metrics.txt`: Metrics file from MarkDuplicates. -- `/mergedLibrary/picard_metrics/pdf/` +- `/merged_library/picard_metrics/pdf/` - `*.pdf`: Alignment QC plot files from picard CollectMultipleMetrics. -- `/mergedLibrary/preseq/` +- `/merged_library/preseq/` - `*.lc_extrap.txt`: Preseq expected future yield file. -> **NB:** File names in the resulting directory (i.e. `/mergedLibrary/`) will have the '`.mLb.`' suffix. +> **NB:** File names in the resulting directory (i.e. `/merged_library/`) will have the '`.mLb.`' suffix.
@@ -141,7 +141,7 @@ The [Preseq](http://smithlabresearch.org/software/preseq/) package is aimed at p
Output files -- `/mergedLibrary/bigwig/` +- `/merged_library/bigwig/` - `*.bigWig`: Normalised bigWig files scaled to 1 million mapped reads.
@@ -153,12 +153,12 @@ The [bigWig](https://genome.ucsc.edu/goldenpath/help/bigWig.html) format is in a
Output files -- `/mergedLibrary/phantompeakqualtools/` +- `/merged_library/phantompeakqualtools/` - `*.spp.out`, `*.spp.pdf`: phantompeakqualtools output files. - `*_mqc.tsv`: MultiQC custom content files. -- `/mergedLibrary/deepTools/plotFingerprint/` +- `/merged_library/deepTools/plotFingerprint/` - `*.plotFingerprint.pdf`, `*.plotFingerprint.qcmetrics.txt`, `*.plotFingerprint.raw.txt`: plotFingerprint output files. -- `/mergedLibrary/deepTools/plotProfile/` +- `/merged_library/deepTools/plotProfile/` - `*.computeMatrix.mat.gz`, `*.computeMatrix.vals.mat.tab`, `*.plotProfile.pdf`, `*.plotProfile.tab`, `*.plotHeatmap.pdf`, `*.plotHeatmap.mat.tab`: plotProfile output files.
@@ -188,10 +188,10 @@ The results from deepTools plotProfile gives you a quick visualisation for the g
Output files -- `/mergedLibrary/macs2//` +- `/merged_library/macs2//` - `*.xls`, `*.broadPeak` or `*.narrowPeak`, `*.gappedPeak`, `*summits.bed`: MACS2 output files - the files generated will depend on whether MACS2 has been run in _narrowPeak_ or _broadPeak_ mode. - `*.annotatePeaks.txt`: HOMER peak-to-gene annotation file. -- `/mergedLibrary/macs2//qc/` +- `/merged_library/macs2//qc/` - `macs2_peak.plots.pdf`: QC plots for MACS2 peaks. - `macs2_annotatePeaks.plots.pdf`: QC plots for peak-to-gene feature annotation. - `*.FRiP_mqc.tsv`, `*.peak_count_mqc.tsv`, `annotatepeaks.summary_mqc.tsv`: MultiQC custom-content files for FRiP score, peak count and peak-to-gene ratios. @@ -217,7 +217,7 @@ Various QC plots per sample including number of peaks, fold-change distribution,
Output files -- `/mergedLibrary/macs2//consensus//` +- `/merged_library/macs2//consensus//` - `*.bed`: Consensus peak-set across all samples in BED format. - `*.saf`: Consensus peak-set across all samples in SAF format. Required by featureCounts for read quantification. - `*.featureCounts.txt`: Read counts across all samples relative to consensus peak-set. @@ -245,7 +245,7 @@ The [featureCounts](http://bioinf.wehi.edu.au/featureCounts/) tool is used to co
Output files -- `/mergedLibrary/macs2//consensus//deseq2/` +- `/merged_library/macs2//consensus//deseq2/` - `*.sample.dists.txt`: Spreadsheet containing sample-to-sample distance across each consensus peak. - `*.plots.pdf`: File containing PCA and hierarchical clustering plots. - `*.dds.RData`: File containing R `DESeqDataSet` object generated by DESeq2, with either @@ -254,7 +254,7 @@ The [featureCounts](http://bioinf.wehi.edu.au/featureCounts/) tool is used to co `readRDS` to give user control of the eventual object name. - `*pca.vals.txt`: Matrix of values for the first 2 principal components. - `R_sessionInfo.log`: File containing information about R, the OS and attached or loaded packages. - - `/mergedLibrary/macs2//consensus//sizeFactors/` + - `/merged_library/macs2//consensus//sizeFactors/` - `*.txt`, `*.RData`: Files containing DESeq2 sizeFactors per sample.
diff --git a/modules/local/bam_remove_orphans.nf b/modules/local/bam_remove_orphans.nf index 95a56c60..d6e221aa 100644 --- a/modules/local/bam_remove_orphans.nf +++ b/modules/local/bam_remove_orphans.nf @@ -17,6 +17,9 @@ process BAM_REMOVE_ORPHANS { tuple val(meta), path("${prefix}.bam"), emit: bam path "versions.yml" , emit: versions + when: + task.ext.when == null || task.ext.when + script: // This script is bundled with the pipeline, in nf-core/chipseq/bin/ def args = task.ext.args ?: '' prefix = task.ext.prefix ?: "${meta.id}" diff --git a/modules/local/bedtools_genomecov.nf b/modules/local/bedtools_genomecov.nf index 2f38c06c..28dcc5dd 100644 --- a/modules/local/bedtools_genomecov.nf +++ b/modules/local/bedtools_genomecov.nf @@ -15,11 +15,13 @@ process BEDTOOLS_GENOMECOV { tuple val(meta), path("*.txt") , emit: scale_factor path "versions.yml" , emit: versions + when: + task.ext.when == null || task.ext.when + script: + def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" - def pe = meta.single_end ? '' : '-pc' - def extend = (meta.single_end && params.fragment_size > 0) ? "-fs ${params.fragment_size}" : '' """ SCALE_FACTOR=\$(grep '[0-9] mapped (' $flagstat | awk '{print 1000000/\$1}') echo \$SCALE_FACTOR > ${prefix}.scale_factor.txt @@ -30,7 +32,7 @@ process BEDTOOLS_GENOMECOV { -bg \\ -scale \$SCALE_FACTOR \\ $pe \\ - $extend \\ + $args \\ | sort -T '.' -k1,1 -k2,2n > ${prefix}.bedGraph cat <<-END_VERSIONS > versions.yml diff --git a/modules/local/deseq2_qc.nf b/modules/local/deseq2_qc.nf index fe389300..d9b96e11 100644 --- a/modules/local/deseq2_qc.nf +++ b/modules/local/deseq2_qc.nf @@ -26,10 +26,12 @@ process DESEQ2_QC { path "size_factors" , optional:true, emit: size_factors path "versions.yml" , emit: versions + when: + task.ext.when == null || task.ext.when + script: - def args = task.ext.args ?: '' - def peak_type = params.narrow_peak ? 'narrowPeak' : 'broadPeak' - def prefix = task.ext.prefix ?: "${meta.id}" + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" """ deseq2_qc.r \\ --count_file $counts \\ diff --git a/modules/local/frip_score.nf b/modules/local/frip_score.nf index ffcc6e2d..28133e0c 100644 --- a/modules/local/frip_score.nf +++ b/modules/local/frip_score.nf @@ -14,6 +14,9 @@ process FRIP_SCORE { tuple val(meta), path("*.txt"), emit: txt path "versions.yml" , emit: versions + when: + task.ext.when == null || task.ext.when + script: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" diff --git a/modules/local/genome_blacklist_regions.nf b/modules/local/genome_blacklist_regions.nf index 4421fb6c..fcb8451c 100644 --- a/modules/local/genome_blacklist_regions.nf +++ b/modules/local/genome_blacklist_regions.nf @@ -17,6 +17,9 @@ process GENOME_BLACKLIST_REGIONS { path '*.bed' , emit: bed path "versions.yml", emit: versions + when: + task.ext.when == null || task.ext.when + script: def file_out = "${sizes.simpleName}.include_regions.bed" if (blacklist) { diff --git a/modules/local/gtf2bed.nf b/modules/local/gtf2bed.nf index 91e29062..8a8e7bf9 100644 --- a/modules/local/gtf2bed.nf +++ b/modules/local/gtf2bed.nf @@ -14,6 +14,9 @@ process GTF2BED { path '*.bed' , emit: bed path "versions.yml", emit: versions + when: + task.ext.when == null || task.ext.when + script: // This script is bundled with the pipeline, in nf-core/chipseq/bin/ """ gtf2bed \\ diff --git a/modules/local/igv.nf b/modules/local/igv.nf index 59a2d2e8..cf02fd9e 100644 --- a/modules/local/igv.nf +++ b/modules/local/igv.nf @@ -20,8 +20,12 @@ process IGV { output: path "*files.txt" , emit: txt path "*.xml" , emit: xml + path fasta , emit: fasta path "versions.yml", emit: versions + when: + task.ext.when == null || task.ext.when + script: // scripts are bundled with the pipeline in nf-core/chipseq/bin/ def consensus_dir = "${aligner_dir}/mergedLibrary/macs2/${peak_dir}/consensus/*" """ diff --git a/modules/local/multiqc.nf b/modules/local/multiqc.nf index 31552551..d23d2cbe 100644 --- a/modules/local/multiqc.nf +++ b/modules/local/multiqc.nf @@ -56,6 +56,9 @@ process MULTIQC { path "*_plots" , optional:true, emit: plots path "versions.yml" , emit: versions + when: + task.ext.when == null || task.ext.when + script: def args = task.ext.args ?: '' def custom_config = params.multiqc_config ? "--config $mqc_custom_config" : '' diff --git a/modules/local/multiqc_custom_peaks.nf b/modules/local/multiqc_custom_peaks.nf index 8fabe949..c19d81a5 100644 --- a/modules/local/multiqc_custom_peaks.nf +++ b/modules/local/multiqc_custom_peaks.nf @@ -14,6 +14,9 @@ process MULTIQC_CUSTOM_PEAKS { tuple val(meta), path("*.peak_count_mqc.tsv"), emit: count tuple val(meta), path("*.FRiP_mqc.tsv") , emit: frip + when: + task.ext.when == null || task.ext.when + script: def prefix = task.ext.prefix ?: "${meta.id}" """ diff --git a/modules/local/multiqc_custom_phantompeakqualtools.nf b/modules/local/multiqc_custom_phantompeakqualtools.nf index c7f4127f..9e59d057 100644 --- a/modules/local/multiqc_custom_phantompeakqualtools.nf +++ b/modules/local/multiqc_custom_phantompeakqualtools.nf @@ -16,6 +16,9 @@ process MULTIQC_CUSTOM_PHANTOMPEAKQUALTOOLS { tuple val(meta), path("*.spp_rsc_mqc.tsv") , emit: rsc tuple val(meta), path("*.spp_correlation_mqc.tsv"), emit: correlation + when: + task.ext.when == null || task.ext.when + script: def prefix = task.ext.prefix ?: "${meta.id}" """ diff --git a/modules/local/plot_homer_annotatepeaks.nf b/modules/local/plot_homer_annotatepeaks.nf index eed17949..36c4730e 100644 --- a/modules/local/plot_homer_annotatepeaks.nf +++ b/modules/local/plot_homer_annotatepeaks.nf @@ -17,6 +17,9 @@ process PLOT_HOMER_ANNOTATEPEAKS { path '*.tsv' , emit: tsv path "versions.yml", emit: versions + when: + task.ext.when == null || task.ext.when + script: // This script is bundled with the pipeline, in nf-core/chipseq/bin/ def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "annotatepeaks" diff --git a/modules/local/plot_macs2_qc.nf b/modules/local/plot_macs2_qc.nf index 92f400d5..7599c9f8 100644 --- a/modules/local/plot_macs2_qc.nf +++ b/modules/local/plot_macs2_qc.nf @@ -8,15 +8,19 @@ process PLOT_MACS2_QC { input: path peaks + val is_narrow_peak output: path '*.txt' , emit: txt path '*.pdf' , emit: pdf path "versions.yml", emit: versions + when: + task.ext.when == null || task.ext.when + script: // This script is bundled with the pipeline, in nf-core/chipseq/bin/ def args = task.ext.args ?: '' - def peak_type = params.narrow_peak ? 'narrowPeak' : 'broadPeak' + def peak_type = is_narrow_peak ? 'narrowPeak' : 'broadPeak' """ plot_macs2_qc.r \\ -i ${peaks.join(',')} \\ diff --git a/modules/local/samplesheet_check.nf b/modules/local/samplesheet_check.nf index c28658f5..216e9fb7 100644 --- a/modules/local/samplesheet_check.nf +++ b/modules/local/samplesheet_check.nf @@ -18,10 +18,11 @@ process SAMPLESHEET_CHECK { task.ext.when == null || task.ext.when script: // This script is bundled with the pipeline, in nf-core/chipseq/bin/ + def args = task.ext.args ?: '' """ check_samplesheet.py \\ $samplesheet \\ - samplesheet.valid.csv + $args cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/local/star_genomegenerate.nf b/modules/local/star_genomegenerate.nf index 904b0714..285df97c 100644 --- a/modules/local/star_genomegenerate.nf +++ b/modules/local/star_genomegenerate.nf @@ -16,6 +16,9 @@ process STAR_GENOMEGENERATE { path "star" , emit: index path "versions.yml", emit: versions + when: + task.ext.when == null || task.ext.when + script: def args = (task.ext.args ?: '').tokenize() def memory = task.memory ? "--limitGenomeGenerateRAM ${task.memory.toBytes() - 100000000}" : '' diff --git a/subworkflows/local/prepare_genome.nf b/subworkflows/local/prepare_genome.nf index dd16e1f5..bd7033cb 100644 --- a/subworkflows/local/prepare_genome.nf +++ b/subworkflows/local/prepare_genome.nf @@ -41,13 +41,7 @@ workflow PREPARE_GENOME { ch_fasta = GUNZIP_FASTA ( [ [:], params.fasta ] ).gunzip.map{ it[1] } ch_versions = ch_versions.mix(GUNZIP_FASTA.out.versions) } else { - ch_fasta = file(params.fasta) - } - - // Make fasta file available if reference saved or IGV is run - if (params.save_reference || !params.skip_igv) { - file("${params.outdir}/genome/").mkdirs() - ch_fasta.copyTo("${params.outdir}/genome/") + ch_fasta = Channel.value(file(params.fasta)) } // @@ -107,14 +101,15 @@ workflow PREPARE_GENOME { ch_gene_bed = GUNZIP_GENE_BED ( [ [:], params.gene_bed ] ).gunzip.map{ it[1] } ch_versions = ch_versions.mix(GUNZIP_GENE_BED.out.versions) } else { - ch_gene_bed = file(params.gene_bed) + ch_gene_bed = Channel.value(file(params.gene_bed)) } } // // Create chromosome sizes file // - ch_chrom_sizes = CUSTOM_GETCHROMSIZES ( [ [:], ch_fasta ] ).sizes.map{ it[1] } + CUSTOM_GETCHROMSIZES ( ch_fasta.map { [ [:], it ] } ) + ch_chrom_sizes = CUSTOM_GETCHROMSIZES.out.sizes.map { it[1] } ch_fai = CUSTOM_GETCHROMSIZES.out.fai.map{ it[1] } ch_versions = ch_versions.mix(CUSTOM_GETCHROMSIZES.out.versions) @@ -144,7 +139,7 @@ workflow PREPARE_GENOME { ch_bwa_index = file(params.bwa_index) } } else { - ch_bwa_index = BWA_INDEX ( [ [:], ch_fasta ] ).index + ch_bwa_index = BWA_INDEX ( ch_fasta.map { [ [:], it ] } ).index ch_versions = ch_versions.mix(BWA_INDEX.out.versions) } } @@ -162,7 +157,7 @@ workflow PREPARE_GENOME { ch_bowtie2_index = [ [:], file(params.bowtie2_index) ] } } else { - ch_bowtie2_index = BOWTIE2_BUILD ( [ [:], ch_fasta ] ).index + ch_bowtie2_index = BOWTIE2_BUILD ( ch_fasta.map { [ [:], it ] } ).index ch_versions = ch_versions.mix(BOWTIE2_BUILD.out.versions) } } @@ -180,7 +175,7 @@ workflow PREPARE_GENOME { ch_chromap_index = [ [:], file(params.chromap_index) ] } } else { - ch_chromap_index = CHROMAP_INDEX ( [ [:], ch_fasta ] ).index + ch_chromap_index = CHROMAP_INDEX ( ch_fasta.map { [ [:], it ] } ).index ch_versions = ch_versions.mix(CHROMAP_INDEX.out.versions) } } @@ -195,7 +190,7 @@ workflow PREPARE_GENOME { ch_star_index = UNTAR_STAR_INDEX ( [ [:], params.star_index ] ).untar.map{ it[1] } ch_versions = ch_versions.mix(UNTAR_STAR_INDEX.out.versions) } else { - ch_star_index = file(params.star_index) + ch_star_index = Channel.value(file(params.star_index)) } } else { ch_star_index = STAR_GENOMEGENERATE ( ch_fasta, ch_gtf ).index diff --git a/workflows/chipseq.nf b/workflows/chipseq.nf index fc914a51..01ff8545 100644 --- a/workflows/chipseq.nf +++ b/workflows/chipseq.nf @@ -205,7 +205,7 @@ workflow CHIPSEQ { ch_samtools_stats = FASTQ_ALIGN_BOWTIE2.out.stats ch_samtools_flagstat = FASTQ_ALIGN_BOWTIE2.out.flagstat ch_samtools_idxstats = FASTQ_ALIGN_BOWTIE2.out.idxstats - ch_versions = ch_versions.mix(FASTQ_ALIGN_BOWTIE2.out.versions.first()) + ch_versions = ch_versions.mix(FASTQ_ALIGN_BOWTIE2.out.versions) } // @@ -229,7 +229,7 @@ workflow CHIPSEQ { ch_samtools_stats = FASTQ_ALIGN_CHROMAP.out.stats ch_samtools_flagstat = FASTQ_ALIGN_CHROMAP.out.flagstat ch_samtools_idxstats = FASTQ_ALIGN_CHROMAP.out.idxstats - ch_versions = ch_versions.mix(FASTQ_ALIGN_CHROMAP.out.versions.first()) + ch_versions = ch_versions.mix(FASTQ_ALIGN_CHROMAP.out.versions) } // @@ -274,7 +274,7 @@ workflow CHIPSEQ { PICARD_MERGESAMFILES ( ch_sort_bam ) - ch_versions = ch_versions.mix(PICARD_MERGESAMFILES.out.versions.first().ifEmpty(null)) + ch_versions = ch_versions.mix(PICARD_MERGESAMFILES.out.versions.first()) // // SUBWORKFLOW: Mark duplicates & filter BAM files after merging @@ -549,7 +549,8 @@ workflow CHIPSEQ { // MODULE: MACS2 QC plots with R // PLOT_MACS2_QC ( - ch_macs2_peaks.collect{it[1]} + ch_macs2_peaks.collect{it[1]}, + params.narrow_peak ) ch_versions = ch_versions.mix(PLOT_MACS2_QC.out.versions)