Skip to content

Commit

Permalink
Merge pull request #701 from mahesh-panchal/use_publishDir
Browse files Browse the repository at this point in the history
Proposal: Use publishDir from config instead of current method
  • Loading branch information
drpatelh authored Oct 29, 2021
2 parents a6882e8 + 0ad0307 commit 0ecc9a1
Show file tree
Hide file tree
Showing 111 changed files with 1,333 additions and 4,133 deletions.
1,079 changes: 836 additions & 243 deletions conf/modules.config

Large diffs are not rendered by default.

18 changes: 12 additions & 6 deletions conf/test.config
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,16 @@ params {
pseudo_aligner = 'salmon'
umitools_bc_pattern = 'NNNN'

// When using RSEM, remove warning from STAR whilst building tiny indices
modules {
'rsem_preparereference' {
args2 = "--genomeSAindexNbases 7"
}
}
}

// When using RSEM, remove warning from STAR whilst building tiny indices
process {
withName: 'RSEM_PREPAREREFERENCE' {
ext.args2 = "--genomeSAindexNbases 7"
}
// modules {
// 'rsem_preparereference' {
// args2 = "--genomeSAindexNbases 7"
// }
// }
}
20 changes: 6 additions & 14 deletions modules/local/bedtools_genomecov.nf
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'

params.options = [:]
options = initOptions(params.options)

process BEDTOOLS_GENOMECOV {
tag "$meta.id"
label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }

conda (params.enable_conda ? "bioconda::bedtools=2.30.0" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
Expand All @@ -27,7 +18,8 @@ process BEDTOOLS_GENOMECOV {
path "versions.yml" , emit: versions

script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
def prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}"
def args = task.ext.args ?: ''

def prefix_forward = "${prefix}.forward"
def prefix_reverse = "${prefix}.reverse"
Expand All @@ -41,20 +33,20 @@ process BEDTOOLS_GENOMECOV {
-ibam $bam \\
-bg \\
-strand + \\
$options.args \\
$args \\
| bedtools sort > ${prefix_forward}.bedGraph
bedtools \\
genomecov \\
-ibam $bam \\
-bg \\
-strand - \\
$options.args \\
$args \\
| bedtools sort > ${prefix_reverse}.bedGraph
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$(bedtools --version | sed -e "s/bedtools v//g")
${task.process.tokenize(':').last()}:
bedtools: \$(bedtools --version | sed -e "s/bedtools v//g")
END_VERSIONS
"""
}
10 changes: 1 addition & 9 deletions modules/local/cat_additional_fasta.nf
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
// Import generic module functions
include { saveFiles; getProcessName } from './functions'

params.options = [:]

process CAT_ADDITIONAL_FASTA {
tag "$add_fasta"
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:'genome', meta:[:], publish_by_meta:[]) }

conda (params.enable_conda ? "conda-forge::python=3.8.3" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
Expand Down Expand Up @@ -42,7 +34,7 @@ process CAT_ADDITIONAL_FASTA {
cat $gtf ${add_fasta.baseName}.gtf > ${name}.gtf
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${task.process.tokenize(':').last()}:
python: \$(python --version | sed 's/Python //g')
END_VERSIONS
"""
Expand Down
13 changes: 3 additions & 10 deletions modules/local/deseq2_qc.nf
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'

params.options = [:]
params.multiqc_label = ''
options = initOptions(params.options)

process DESEQ2_QC {
label "process_medium"
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:[:], publish_by_meta:[]) }

// (Bio)conda packages have intentionally not been pinned to a specific version
// This was to avoid the pipeline failing due to package conflicts whilst creating the environment when using -profile conda
Expand Down Expand Up @@ -39,12 +31,13 @@ process DESEQ2_QC {
script:
def label_lower = params.multiqc_label.toLowerCase()
def label_upper = params.multiqc_label.toUpperCase()
def args = task.ext.args?: ''
"""
deseq2_qc.r \\
--count_file $counts \\
--outdir ./ \\
--cores $task.cpus \\
$options.args
$args
if [ -f "R_sessionInfo.log" ]; then
sed "s/deseq2_pca/${label_lower}_deseq2_pca/g" <$pca_header_multiqc >tmp.txt
Expand All @@ -57,7 +50,7 @@ process DESEQ2_QC {
fi
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${task.process.tokenize(':').last()}:
r-base: \$(echo \$(R --version 2>&1) | sed 's/^.*R version //; s/ .*\$//')
bioconductor-deseq2: \$(Rscript -e "library(DESeq2); cat(as.character(packageVersion('DESeq2')))")
END_VERSIONS
Expand Down
13 changes: 2 additions & 11 deletions modules/local/dupradar.nf
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'

params.options = [:]
options = initOptions(params.options)

process DUPRADAR {
tag "$meta.id"
label 'process_long'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }

conda (params.enable_conda ? "bioconda::bioconductor-dupradar=1.18.0" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
Expand All @@ -29,7 +20,7 @@ process DUPRADAR {
path "versions.yml" , emit: versions

script: // This script is bundled with the pipeline, in nf-core/rnaseq/bin/
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
def prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}"

def strandedness = 0
if (meta.strandedness == 'forward') {
Expand All @@ -48,7 +39,7 @@ process DUPRADAR {
$task.cpus
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${task.process.tokenize(':').last()}:
r-base: \$(echo \$(R --version 2>&1) | sed 's/^.*R version //; s/ .*\$//')
bioconductor-dupradar: \$(Rscript -e "library(dupRadar); cat(as.character(packageVersion('dupRadar')))")
END_VERSIONS
Expand Down
78 changes: 0 additions & 78 deletions modules/local/functions.nf

This file was deleted.

10 changes: 1 addition & 9 deletions modules/local/get_chrom_sizes.nf
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
// Import generic module functions
include { saveFiles; getProcessName } from './functions'

params.options = [:]

process GET_CHROM_SIZES {
tag "$fasta"
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:'genome', meta:[:], publish_by_meta:[]) }

conda (params.enable_conda ? "bioconda::samtools=1.10" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
Expand All @@ -33,7 +25,7 @@ process GET_CHROM_SIZES {
cut -f 1,2 ${fasta}.fai > ${fasta}.sizes
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${task.process.tokenize(':').last()}:
samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
END_VERSIONS
"""
Expand Down
10 changes: 1 addition & 9 deletions modules/local/gtf2bed.nf
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
// Import generic module functions
include { saveFiles; getProcessName } from './functions'

params.options = [:]

process GTF2BED {
tag "$gtf"
label 'process_low'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:'genome', meta:[:], publish_by_meta:[]) }

conda (params.enable_conda ? "conda-forge::perl=5.26.2" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
Expand All @@ -31,7 +23,7 @@ process GTF2BED {
> ${gtf.baseName}.bed
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${task.process.tokenize(':').last()}:
perl: \$(echo \$(perl --version 2>&1) | sed 's/.*v\\(.*\\)) built.*/\\1/')
END_VERSIONS
"""
Expand Down
10 changes: 1 addition & 9 deletions modules/local/gtf_gene_filter.nf
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
// Import generic module functions
include { saveFiles; getProcessName } from './functions'

params.options = [:]

process GTF_GENE_FILTER {
tag "$fasta"
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:'genome', meta:[:], publish_by_meta:[]) }

conda (params.enable_conda ? "conda-forge::python=3.8.3" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
Expand All @@ -32,7 +24,7 @@ process GTF_GENE_FILTER {
-o ${fasta.baseName}_genes.gtf
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${task.process.tokenize(':').last()}:
python: \$(python --version | sed 's/Python //g')
END_VERSIONS
"""
Expand Down
16 changes: 4 additions & 12 deletions modules/local/multiqc.nf
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'

params.options = [:]
options = initOptions(params.options)

process MULTIQC {
label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:[:], publish_by_meta:[]) }

conda (params.enable_conda ? "bioconda::multiqc=1.10.1" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
Expand Down Expand Up @@ -60,16 +51,17 @@ process MULTIQC {

script:
def custom_config = params.multiqc_config ? "--config $multiqc_custom_config" : ''
def args = task.ext.args?: ''
"""
multiqc \\
-f \\
$options.args \\
$args \\
$custom_config \\
.
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$( multiqc --version | sed -e "s/multiqc, version //g" )
${task.process.tokenize(':').last()}:
multiqc: \$( multiqc --version | sed -e "s/multiqc, version //g" )
END_VERSIONS
"""
}
13 changes: 2 additions & 11 deletions modules/local/multiqc_custom_biotype.nf
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'

params.options = [:]
options = initOptions(params.options)

process MULTIQC_CUSTOM_BIOTYPE {
tag "$meta.id"
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }

conda (params.enable_conda ? "conda-forge::python=3.8.3" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
Expand All @@ -26,7 +17,7 @@ process MULTIQC_CUSTOM_BIOTYPE {
path "versions.yml" , emit: versions

script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
def prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}"
"""
cut -f 1,7 $count | tail -n +3 | cat $header - >> ${prefix}.biotype_counts_mqc.tsv
Expand All @@ -37,7 +28,7 @@ process MULTIQC_CUSTOM_BIOTYPE {
-o ${prefix}.biotype_counts_rrna_mqc.tsv
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${task.process.tokenize(':').last()}:
python: \$(python --version | sed 's/Python //g')
END_VERSIONS
"""
Expand Down
Loading

0 comments on commit 0ecc9a1

Please sign in to comment.