From 508761e05c04c47e7b3557c8b654032e69d212d3 Mon Sep 17 00:00:00 2001 From: kevinmenden Date: Tue, 8 Dec 2020 12:57:00 +0100 Subject: [PATCH 01/29] Added bowtie index and align modules --- software/bowtie/align/functions.nf | 59 ++++++++++++++++++++++++++++++ software/bowtie/align/main.nf | 40 ++++++++++++++++++++ software/bowtie/align/meta.yml | 0 software/bowtie/index/functions.nf | 59 ++++++++++++++++++++++++++++++ software/bowtie/index/main.nf | 32 ++++++++++++++++ software/bowtie/index/meta.yml | 0 6 files changed, 190 insertions(+) create mode 100644 software/bowtie/align/functions.nf create mode 100644 software/bowtie/align/main.nf create mode 100644 software/bowtie/align/meta.yml create mode 100644 software/bowtie/index/functions.nf create mode 100644 software/bowtie/index/main.nf create mode 100644 software/bowtie/index/meta.yml diff --git a/software/bowtie/align/functions.nf b/software/bowtie/align/functions.nf new file mode 100644 index 00000000..b3ac3801 --- /dev/null +++ b/software/bowtie/align/functions.nf @@ -0,0 +1,59 @@ +/* + * ----------------------------------------------------- + * Utility functions used in nf-core DSL2 module files + * ----------------------------------------------------- + */ + +/* + * Extract name of software tool from process name using $task.process + */ +def getSoftwareName(task_process) { + return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() +} + +/* + * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules + */ +def initOptions(Map args) { + def Map options = [:] + options.args = args.args ?: '' + options.args2 = args.args2 ?: '' + options.publish_by_id = args.publish_by_id ?: false + options.publish_dir = args.publish_dir ?: '' + options.publish_files = args.publish_files + options.suffix = args.suffix ?: '' + return options +} + +/* + * Tidy up and join elements of a list to return a path string + */ +def getPathFromList(path_list) { + def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries + paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes + return paths.join('/') +} + +/* + * Function to save/publish module results + */ +def saveFiles(Map args) { + if (!args.filename.endsWith('.version.txt')) { + def ioptions = initOptions(args.options) + def path_list = [ ioptions.publish_dir ?: args.publish_dir ] + if (ioptions.publish_by_id) { + path_list.add(args.publish_id) + } + if (ioptions.publish_files instanceof Map) { + for (ext in ioptions.publish_files) { + if (args.filename.endsWith(ext.key)) { + def ext_list = path_list.collect() + ext_list.add(ext.value) + return "${getPathFromList(ext_list)}/$args.filename" + } + } + } else if (ioptions.publish_files == null) { + return "${getPathFromList(path_list)}/$args.filename" + } + } +} diff --git a/software/bowtie/align/main.nf b/software/bowtie/align/main.nf new file mode 100644 index 00000000..18ee4705 --- /dev/null +++ b/software/bowtie/align/main.nf @@ -0,0 +1,40 @@ +// Import generic module functions +include { initOptions; saveFiles; getSoftwareName } from './functions' + +params.options = [:] +def options = initOptions(params.options) + +process BOWTIE_ALIGN { + tag "$meta.id" + label 'process_high' + publishDir "${params.outdir}", + mode: params.publish_dir_mode, + saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) } + + conda (params.enable_conda ? "bioconda::bowtie=1.3.0" : null) + container "quay.io/biocontainers/bowtie:1.3.0--py38hed8969a_1" + + input: + tuple val(meta), path(reads) + path index + path gtf + + output: + tuple val(meta), path("*.sam") , emit: sam + tuple val(meta), path("*.out") , emit: log + path "bowtie.version.txt" , emit: version + + script: + def software = getSoftwareName(task.process) + def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" + index_array = index.collect() + index = index_array[0].baseName - ~/.\d$/ + """ + bowtie $options.args \\ + --threads $task.cpus \\ + ${index} \\ + -q ${reads} \\ + --un ${prefix}.unAl > ${prefix}.sam 2> ${prefix}.out + bowtie --version | head -n 1 | cut -d" " -f3 > ${software}.version.txt + """ +} \ No newline at end of file diff --git a/software/bowtie/align/meta.yml b/software/bowtie/align/meta.yml new file mode 100644 index 00000000..e69de29b diff --git a/software/bowtie/index/functions.nf b/software/bowtie/index/functions.nf new file mode 100644 index 00000000..b3ac3801 --- /dev/null +++ b/software/bowtie/index/functions.nf @@ -0,0 +1,59 @@ +/* + * ----------------------------------------------------- + * Utility functions used in nf-core DSL2 module files + * ----------------------------------------------------- + */ + +/* + * Extract name of software tool from process name using $task.process + */ +def getSoftwareName(task_process) { + return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() +} + +/* + * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules + */ +def initOptions(Map args) { + def Map options = [:] + options.args = args.args ?: '' + options.args2 = args.args2 ?: '' + options.publish_by_id = args.publish_by_id ?: false + options.publish_dir = args.publish_dir ?: '' + options.publish_files = args.publish_files + options.suffix = args.suffix ?: '' + return options +} + +/* + * Tidy up and join elements of a list to return a path string + */ +def getPathFromList(path_list) { + def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries + paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes + return paths.join('/') +} + +/* + * Function to save/publish module results + */ +def saveFiles(Map args) { + if (!args.filename.endsWith('.version.txt')) { + def ioptions = initOptions(args.options) + def path_list = [ ioptions.publish_dir ?: args.publish_dir ] + if (ioptions.publish_by_id) { + path_list.add(args.publish_id) + } + if (ioptions.publish_files instanceof Map) { + for (ext in ioptions.publish_files) { + if (args.filename.endsWith(ext.key)) { + def ext_list = path_list.collect() + ext_list.add(ext.value) + return "${getPathFromList(ext_list)}/$args.filename" + } + } + } else if (ioptions.publish_files == null) { + return "${getPathFromList(path_list)}/$args.filename" + } + } +} diff --git a/software/bowtie/index/main.nf b/software/bowtie/index/main.nf new file mode 100644 index 00000000..36f88451 --- /dev/null +++ b/software/bowtie/index/main.nf @@ -0,0 +1,32 @@ +// Import generic module functions +include { initOptions; saveFiles; getSoftwareName } from './functions' + +params.options = [:] +def options = initOptions(params.options) + +process BOWTIE_INDEX { + tag "$fasta" + label 'process_high' + publishDir "${params.outdir}", + mode: params.publish_dir_mode, + saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:'') } + + conda (params.enable_conda ? "bioconda::bowtie=1.3.0" : null) + container "quay.io/biocontainers/bowtie:1.3.0--py38hed8969a_1" + + + input: + path fasta + path gtf + + output: + path "*.index*" , emit: index + path "*.version.txt" , emit: version + + script: + def software = getSoftwareName(task.process) + """ + bowtie-build --threads $task.cpus ${fasta} ${fasta.baseName}.index + bowtie --version | head -n 1 | cut -d" " -f3 > ${software}.version.txt + """ +} \ No newline at end of file diff --git a/software/bowtie/index/meta.yml b/software/bowtie/index/meta.yml new file mode 100644 index 00000000..e69de29b From 9d67da2b2ccbbc2fb44daa23421022e6a38ea45c Mon Sep 17 00:00:00 2001 From: kevinmenden Date: Tue, 8 Dec 2020 13:40:32 +0100 Subject: [PATCH 02/29] added module yml files --- software/bowtie/align/main.nf | 1 - software/bowtie/align/meta.yml | 57 ++++++++++++++++++++++++++++++++++ software/bowtie/index/main.nf | 1 - software/bowtie/index/meta.yml | 46 +++++++++++++++++++++++++++ tests/software/bowtie/main.nf | 26 ++++++++++++++++ tests/software/bowtie/test.yml | 32 +++++++++++++++++++ 6 files changed, 161 insertions(+), 2 deletions(-) create mode 100644 tests/software/bowtie/main.nf create mode 100644 tests/software/bowtie/test.yml diff --git a/software/bowtie/align/main.nf b/software/bowtie/align/main.nf index 18ee4705..3885ecbe 100644 --- a/software/bowtie/align/main.nf +++ b/software/bowtie/align/main.nf @@ -17,7 +17,6 @@ process BOWTIE_ALIGN { input: tuple val(meta), path(reads) path index - path gtf output: tuple val(meta), path("*.sam") , emit: sam diff --git a/software/bowtie/align/meta.yml b/software/bowtie/align/meta.yml index e69de29b..5b604289 100644 --- a/software/bowtie/align/meta.yml +++ b/software/bowtie/align/meta.yml @@ -0,0 +1,57 @@ +name: bowtie_align +description: Align reads to a reference genome using bowtie +keywords: + - align + - fasta + - genome + - reference +tools: + - bowtie: + description: | + bowtie is a software package for mapping DNA sequences against + a large reference genome, such as the human genome. + homepage: http://bowtie-bio.sourceforge.net/index.shtml + documentation: http://bowtie-bio.sourceforge.net/manual.shtml + arxiv: arXiv:1303.3997 +params: + - outdir: + type: string + description: | + The pipeline's output directory. By default, the module will + output files into `$params.outdir/` + - publish_dir_mode: + type: string + description: | + Value for the Nextflow `publishDir` mode parameter. + Available: symlink, rellink, link, copy, copyNoFollow, move. + - enable_conda: + type: boolean + description: | + Run the module with Conda using the software specified + via the `conda` directive +input: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - reads: + type: file + description: | + List of input FastQ files of size 1 and 2 for single-end and paired-end data, + respectively. + - index: + type: file + description: Bowtie genome index files + pattern: "*.ebwt" +output: + - index: + type: file + description: Bowtie genome index files + pattern: "*.ebwt" + - version: + type: file + description: File containing software version + pattern: "*.{version.txt}" +authors: + - "@kevinmenden" diff --git a/software/bowtie/index/main.nf b/software/bowtie/index/main.nf index 36f88451..553651d5 100644 --- a/software/bowtie/index/main.nf +++ b/software/bowtie/index/main.nf @@ -17,7 +17,6 @@ process BOWTIE_INDEX { input: path fasta - path gtf output: path "*.index*" , emit: index diff --git a/software/bowtie/index/meta.yml b/software/bowtie/index/meta.yml index e69de29b..0a8c23f7 100644 --- a/software/bowtie/index/meta.yml +++ b/software/bowtie/index/meta.yml @@ -0,0 +1,46 @@ +name: bowtie_index +description: Create bowtie index for reference genome +keywords: + - index + - fasta + - genome + - reference +tools: + - bowtie: + description: | + bowtie is a software package for mapping DNA sequences against + a large reference genome, such as the human genome. + homepage: http://bowtie-bio.sourceforge.net/index.shtml + documentation: http://bowtie-bio.sourceforge.net/manual.shtml + arxiv: arXiv:1303.3997 +params: + - outdir: + type: string + description: | + The pipeline's output directory. By default, the module will + output files into `$params.outdir/` + - publish_dir_mode: + type: string + description: | + Value for the Nextflow `publishDir` mode parameter. + Available: symlink, rellink, link, copy, copyNoFollow, move. + - enable_conda: + type: boolean + description: | + Run the module with Conda using the software specified + via the `conda` directive +input: + - fasta: + type: file + description: Input genome fasta file +output: + - index: + type: file + description: Bowtie genome index files + pattern: "*.ebwt" + - version: + type: file + description: File containing software version + pattern: "*.{version.txt}" +authors: + - "@kevinmenden" diff --git a/tests/software/bowtie/main.nf b/tests/software/bowtie/main.nf new file mode 100644 index 00000000..1f6a54ff --- /dev/null +++ b/tests/software/bowtie/main.nf @@ -0,0 +1,26 @@ +#!/usr/bin/env nextflow + +nextflow.enable.dsl = 2 + +include { BOWTIE_INDEX } from '../../../software/bowtie/index/main.nf' addParams( options: [:] ) +include { BOWTIE_ALIGN } from '../../../software/bowtie/align/main.nf' addParams( options: [:] ) + + + +workflow test_bowtie_index { + fasta = file("${launchDir}/tests/data/fasta/E_coli/NC_010473.fa", checkIfExists: true) + BOWTIE_INDEX ( fasta ) +} + +workflow test_bowtie_alignment_single_end { + + fasta = file("${launchDir}/tests/data/fasta/E_coli/NC_010473.fa", checkIfExists: true) + BOWTIE_INDEX ( fasta ) +} + + def input = [] + input = [ [ id:'test', single_end:true ], // meta map + [ file("${launchDir}/tests/data/fastq/dna/Ecoli_DNA_R1.fastq.gz", checkIfExists: true) ] ] + BOWTIE_ALIGN ( input, BOWTIE_INDEX.index ) +} + diff --git a/tests/software/bowtie/test.yml b/tests/software/bowtie/test.yml new file mode 100644 index 00000000..f1bd09fd --- /dev/null +++ b/tests/software/bowtie/test.yml @@ -0,0 +1,32 @@ +- name: Run bowtie index + command: nextflow run ./tests/software/bwa -profile docker -entry test_bwa_index -c tests/config/nextflow.config + tags: + - bwa + - bwa_index + files: + - path: output/bwa/NC_010473.fa.amb + md5sum: 942a990ae872f1c0b8d72dda2db405d5 + - path: output/bwa/NC_010473.fa.bwt + md5sum: 7301b52e2ecb893d429a49fa692447ae + - path: output/bwa/NC_010473.fa.pac + md5sum: 4d5e6fc45bbc968f7f859e9ca2cc89ad + - path: output/bwa/NC_010473.fa.sa + md5sum: a47dcc92e750e2f16fbd979b8ff9538e + +- name: Run bwa mem single-end + command: nextflow run ./tests/software/bwa -profile docker -entry test_bwa_mem_single_end -c tests/config/nextflow.config + tags: + - bwa + - bwa_mem + files: + - path: output/test_single_end/test.bam + md5sum: 3ee21210bac387e0335008146e4728bc + +- name: Run bwa mem paired-end + command: nextflow run ./tests/software/bwa -profile docker -entry test_bwa_mem_paired_end -c tests/config/nextflow.config + tags: + - bwa + - bwa_mem + files: + - path: output/test_paired_end/test.bam + md5sum: 510d8acc6448c07cdacce8e64ec0904c From 6660a597a3b19ee0f0e7fbe32540b4d77e60b034 Mon Sep 17 00:00:00 2001 From: kevinmenden Date: Tue, 8 Dec 2020 13:59:14 +0100 Subject: [PATCH 03/29] added tests for bowtie module --- tests/software/bowtie/main.nf | 3 +- tests/software/bowtie/test.yml | 60 ++++++++++++++++++++-------------- 2 files changed, 36 insertions(+), 27 deletions(-) diff --git a/tests/software/bowtie/main.nf b/tests/software/bowtie/main.nf index 1f6a54ff..8a64cd34 100644 --- a/tests/software/bowtie/main.nf +++ b/tests/software/bowtie/main.nf @@ -16,11 +16,10 @@ workflow test_bowtie_alignment_single_end { fasta = file("${launchDir}/tests/data/fasta/E_coli/NC_010473.fa", checkIfExists: true) BOWTIE_INDEX ( fasta ) -} def input = [] input = [ [ id:'test', single_end:true ], // meta map [ file("${launchDir}/tests/data/fastq/dna/Ecoli_DNA_R1.fastq.gz", checkIfExists: true) ] ] - BOWTIE_ALIGN ( input, BOWTIE_INDEX.index ) + BOWTIE_ALIGN ( input, BOWTIE_INDEX.out.index ) } diff --git a/tests/software/bowtie/test.yml b/tests/software/bowtie/test.yml index f1bd09fd..13b7b1fd 100644 --- a/tests/software/bowtie/test.yml +++ b/tests/software/bowtie/test.yml @@ -1,32 +1,42 @@ - name: Run bowtie index - command: nextflow run ./tests/software/bwa -profile docker -entry test_bwa_index -c tests/config/nextflow.config + command: nextflow run ./tests/software/bowtie -profile docker -entry test_bowtie_index -c tests/config/nextflow.config tags: - - bwa - - bwa_index + - bowtie + - bowtie_index files: - - path: output/bwa/NC_010473.fa.amb - md5sum: 942a990ae872f1c0b8d72dda2db405d5 - - path: output/bwa/NC_010473.fa.bwt - md5sum: 7301b52e2ecb893d429a49fa692447ae - - path: output/bwa/NC_010473.fa.pac - md5sum: 4d5e6fc45bbc968f7f859e9ca2cc89ad - - path: output/bwa/NC_010473.fa.sa - md5sum: a47dcc92e750e2f16fbd979b8ff9538e + - path: output/bowtie/NC_010473.index.1.ebwt + md5sum: 90f0b7aa5bbaeaaa999839ac13ad203c + - path: output/bowtie/NC_010473.index.2.ebwt + md5sum: bfd10c5319c6a0dbc540fd789254a5dd + - path: output/bowtie/NC_010473.index.3.ebwt + md5sum: cd201e81724f3099131aec16ef2cc53b + - path: output/bowtie/NC_010473.index.4.ebwt + md5sum: bbb9d6d21ad765d135f95290204e8433 + - path: output/bowtie/NC_010473.index.rev.1.ebwt + md5sum: 44f719c2fe42e1f35d54e798775846d1 + - path: output/bowtie/NC_010473.index.rev.2.ebwt + md5sum: f3c398bba5158f4039334a932d79c051 -- name: Run bwa mem single-end - command: nextflow run ./tests/software/bwa -profile docker -entry test_bwa_mem_single_end -c tests/config/nextflow.config +- name: Run bowtie index and align signle-end + command: nextflow run ./tests/software/bowtie -profile docker -entry test_bowtie_alignment_single_end -c tests/config/nextflow.config tags: - - bwa - - bwa_mem + - bowtie + - bwa_align files: - - path: output/test_single_end/test.bam - md5sum: 3ee21210bac387e0335008146e4728bc + - path: output/bowtie/NC_010473.index.1.ebwt + md5sum: 90f0b7aa5bbaeaaa999839ac13ad203c + - path: output/bowtie/NC_010473.index.2.ebwt + md5sum: bfd10c5319c6a0dbc540fd789254a5dd + - path: output/bowtie/NC_010473.index.3.ebwt + md5sum: cd201e81724f3099131aec16ef2cc53b + - path: output/bowtie/NC_010473.index.4.ebwt + md5sum: bbb9d6d21ad765d135f95290204e8433 + - path: output/bowtie/NC_010473.index.rev.1.ebwt + md5sum: 44f719c2fe42e1f35d54e798775846d1 + - path: output/bowtie/NC_010473.index.rev.2.ebwt + md5sum: f3c398bba5158f4039334a932d79c051 + - path: output/bowtie/test.out + md5sum: 6edce9d0d8ad7f5ce837a5be7e0d7fbe + - path: output/bowtie/test.sam + md5sum: acdb36ea915ac2ac71b69a0b704d9d8a -- name: Run bwa mem paired-end - command: nextflow run ./tests/software/bwa -profile docker -entry test_bwa_mem_paired_end -c tests/config/nextflow.config - tags: - - bwa - - bwa_mem - files: - - path: output/test_paired_end/test.bam - md5sum: 510d8acc6448c07cdacce8e64ec0904c From 73530e8df73af05d91b463bfb0863a4673e438be Mon Sep 17 00:00:00 2001 From: kevinmenden Date: Tue, 8 Dec 2020 14:13:30 +0100 Subject: [PATCH 04/29] added bowtie index test github workflow --- .github/workflows/bowtie_index.yml | 36 ++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/bowtie_index.yml diff --git a/.github/workflows/bowtie_index.yml b/.github/workflows/bowtie_index.yml new file mode 100644 index 00000000..80ff13c9 --- /dev/null +++ b/.github/workflows/bowtie_index.yml @@ -0,0 +1,36 @@ +name: bowtie_index +on: + push: + paths: + - software/bowtie/index/** + - .github/workflows/bowtie_index.yml + - tests/software/bowtie/** + pull_request: + paths: + - software/bowtie/index/** + - .github/workflows/bowtie_index.yml + - tests/software/bowtie/** + +jobs: + ci_test: + runs-on: ubuntu-latest + env: + NXF_ANSI_LOG: false + steps: + - uses: actions/checkout@v2 + + - name: Install Nextflow + run: | + export NXF_VER="20.07.1" + wget -qO- get.nextflow.io | bash + sudo mv nextflow /usr/local/bin/ + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: "3.x" + - name: Install dependencies + run: python -m pip install --upgrade pip pytest-workflow + + # Test the module + - run: pytest --tag bowtie_index --symlink --wt 2 From fee0707af1d3450780aa33f9d730f8f949fae10a Mon Sep 17 00:00:00 2001 From: kevinmenden Date: Tue, 8 Dec 2020 14:19:34 +0100 Subject: [PATCH 05/29] added bowtie_align workflow test --- .github/workflows/bowtie_align.yml | 38 ++++++++++++++++++++++++++++++ tests/software/bowtie/test.yml | 2 +- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/bowtie_align.yml diff --git a/.github/workflows/bowtie_align.yml b/.github/workflows/bowtie_align.yml new file mode 100644 index 00000000..796b3389 --- /dev/null +++ b/.github/workflows/bowtie_align.yml @@ -0,0 +1,38 @@ +name: bowtie_align +on: + push: + paths: + - software/bowtie/align/** + - software/bowtie/index/** + - .github/workflows/bowtie_align.yml + - tests/software/bowtie/** + pull_request: + paths: + - software/bowtie/align/** + - software/bowtie/index/** + - .github/workflows/bowtie_align.yml + - tests/software/bowtie/** + +jobs: + ci_test: + runs-on: ubuntu-latest + env: + NXF_ANSI_LOG: false + steps: + - uses: actions/checkout@v2 + + - name: Install Nextflow + run: | + export NXF_VER="20.07.1" + wget -qO- get.nextflow.io | bash + sudo mv nextflow /usr/local/bin/ + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: "3.x" + - name: Install dependencies + run: python -m pip install --upgrade pip pytest-workflow + + # Test the module + - run: pytest --tag bowtie_align --symlink --wt 2 diff --git a/tests/software/bowtie/test.yml b/tests/software/bowtie/test.yml index 13b7b1fd..fb58b089 100644 --- a/tests/software/bowtie/test.yml +++ b/tests/software/bowtie/test.yml @@ -21,7 +21,7 @@ command: nextflow run ./tests/software/bowtie -profile docker -entry test_bowtie_alignment_single_end -c tests/config/nextflow.config tags: - bowtie - - bwa_align + - bowtie_align files: - path: output/bowtie/NC_010473.index.1.ebwt md5sum: 90f0b7aa5bbaeaaa999839ac13ad203c From 560a6a578ba0b06521b05bcb8478a0b71f55c88b Mon Sep 17 00:00:00 2001 From: Kevin Menden Date: Wed, 9 Dec 2020 15:45:05 +0100 Subject: [PATCH 06/29] Apply suggestions from code review Co-authored-by: Harshil Patel --- software/bowtie/align/main.nf | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/software/bowtie/align/main.nf b/software/bowtie/align/main.nf index 3885ecbe..d2a00831 100644 --- a/software/bowtie/align/main.nf +++ b/software/bowtie/align/main.nf @@ -19,21 +19,24 @@ process BOWTIE_ALIGN { path index output: - tuple val(meta), path("*.sam") , emit: sam - tuple val(meta), path("*.out") , emit: log + tuple val(meta), path("*.sam"), emit: sam + tuple val(meta), path("*.out"), emit: log path "bowtie.version.txt" , emit: version script: - def software = getSoftwareName(task.process) - def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" - index_array = index.collect() - index = index_array[0].baseName - ~/.\d$/ + def software = getSoftwareName(task.process) + def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" + def unaligned = params.save_unaligned ? "--un ${prefix}.unmapped" : '' """ - bowtie $options.args \\ - --threads $task.cpus \\ - ${index} \\ - -q ${reads} \\ - --un ${prefix}.unAl > ${prefix}.sam 2> ${prefix}.out + INDEX=`find -L ./ -name "*.1.ebwt" | sed 's/.1.ebwt//'` + bowtie \\ + --threads $task.cpus \\ + $options.args \\ + $INDEX \\ + -q ${reads} \\ + $unaligned \\ + > ${prefix}.sam 2> ${prefix}.out + bowtie --version | head -n 1 | cut -d" " -f3 > ${software}.version.txt """ -} \ No newline at end of file +} From cc72028d3de786900f711a6749c6f21027314ffb Mon Sep 17 00:00:00 2001 From: kevinmenden Date: Wed, 9 Dec 2020 15:58:56 +0100 Subject: [PATCH 07/29] output index as directory --- software/bowtie/align/main.nf | 2 +- software/bowtie/align/meta.yml | 9 ++++++--- software/bowtie/index/main.nf | 7 ++++--- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/software/bowtie/align/main.nf b/software/bowtie/align/main.nf index d2a00831..30e5a55a 100644 --- a/software/bowtie/align/main.nf +++ b/software/bowtie/align/main.nf @@ -21,7 +21,7 @@ process BOWTIE_ALIGN { output: tuple val(meta), path("*.sam"), emit: sam tuple val(meta), path("*.out"), emit: log - path "bowtie.version.txt" , emit: version + path "bowtie.version.txt", emit: version script: def software = getSoftwareName(task.process) diff --git a/software/bowtie/align/meta.yml b/software/bowtie/align/meta.yml index 5b604289..fc18a2c9 100644 --- a/software/bowtie/align/meta.yml +++ b/software/bowtie/align/meta.yml @@ -29,6 +29,9 @@ params: description: | Run the module with Conda using the software specified via the `conda` directive + - save_unaligned: + type: boolean + description: Save unaligned reads input: - meta: type: map @@ -45,10 +48,10 @@ input: description: Bowtie genome index files pattern: "*.ebwt" output: - - index: + - sam: type: file - description: Bowtie genome index files - pattern: "*.ebwt" + description: Output SAM file containing read alignments + pattern: "*.{sam}" - version: type: file description: File containing software version diff --git a/software/bowtie/index/main.nf b/software/bowtie/index/main.nf index 553651d5..5a0e18e5 100644 --- a/software/bowtie/index/main.nf +++ b/software/bowtie/index/main.nf @@ -19,13 +19,14 @@ process BOWTIE_INDEX { path fasta output: - path "*.index*" , emit: index - path "*.version.txt" , emit: version + path "bowtie", emit: index + path "*.version.txt", emit: version script: def software = getSoftwareName(task.process) """ - bowtie-build --threads $task.cpus ${fasta} ${fasta.baseName}.index + mkdir bowtie + bowtie-build --threads $task.cpus ${fasta} bowtie/${fasta.baseName}.index bowtie --version | head -n 1 | cut -d" " -f3 > ${software}.version.txt """ } \ No newline at end of file From 42020ce5ac45c30603e926a33cd9d4ace725e842 Mon Sep 17 00:00:00 2001 From: kevinmenden Date: Wed, 9 Dec 2020 16:39:05 +0100 Subject: [PATCH 08/29] added tests for bowtie paired-end alignment; resolved index bug --- software/bowtie/align/main.nf | 6 +++--- tests/software/bowtie/main.nf | 11 +++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/software/bowtie/align/main.nf b/software/bowtie/align/main.nf index 30e5a55a..c35508d2 100644 --- a/software/bowtie/align/main.nf +++ b/software/bowtie/align/main.nf @@ -28,13 +28,13 @@ process BOWTIE_ALIGN { def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def unaligned = params.save_unaligned ? "--un ${prefix}.unmapped" : '' """ - INDEX=`find -L ./ -name "*.1.ebwt" | sed 's/.1.ebwt//'` + INDEX=`find -L ./ -name "*.3.ebwt" | sed 's/.3.ebwt//'` bowtie \\ --threads $task.cpus \\ $options.args \\ - $INDEX \\ + \$INDEX \\ -q ${reads} \\ - $unaligned \\ + $unaligned \\ > ${prefix}.sam 2> ${prefix}.out bowtie --version | head -n 1 | cut -d" " -f3 > ${software}.version.txt diff --git a/tests/software/bowtie/main.nf b/tests/software/bowtie/main.nf index 8a64cd34..b5668bd1 100644 --- a/tests/software/bowtie/main.nf +++ b/tests/software/bowtie/main.nf @@ -23,3 +23,14 @@ workflow test_bowtie_alignment_single_end { BOWTIE_ALIGN ( input, BOWTIE_INDEX.out.index ) } +workflow test_bowtie_alignment_paired_end { + fasta = file("${launchDir}/tests/data/fasta/E_coli/NC_010473.fa", checkIfExists: true) + BOWTIE_INDEX ( fasta ) + + def input = [] + input = [ [ id:'test', single_end:false ], // meta map + [ file("${launchDir}/tests/data/fastq/dna/Ecoli_DNA_R1.fastq.gz", checkIfExists: true), + file("${launchDir}/tests/data/fastq/dna/Ecoli_DNA_R2.fastq.gz", checkIfExists: true) ] ] + BOWTIE_ALIGN ( input, BOWTIE_INDEX.out.index ) +} + From 0d7c8276b73fb07be1dde82ac115f5769687b7ca Mon Sep 17 00:00:00 2001 From: kevinmenden Date: Wed, 9 Dec 2020 16:54:11 +0100 Subject: [PATCH 09/29] added test yml and md5s --- tests/software/bowtie/test.yml | 48 +++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 12 deletions(-) diff --git a/tests/software/bowtie/test.yml b/tests/software/bowtie/test.yml index fb58b089..02ec5e50 100644 --- a/tests/software/bowtie/test.yml +++ b/tests/software/bowtie/test.yml @@ -4,17 +4,17 @@ - bowtie - bowtie_index files: - - path: output/bowtie/NC_010473.index.1.ebwt + - path: output/bowtie/bowtie/NC_010473.index.1.ebwt md5sum: 90f0b7aa5bbaeaaa999839ac13ad203c - - path: output/bowtie/NC_010473.index.2.ebwt + - path: output/bowtie/bowtie/NC_010473.index.2.ebwt md5sum: bfd10c5319c6a0dbc540fd789254a5dd - - path: output/bowtie/NC_010473.index.3.ebwt + - path: output/bowtie/bowtie/NC_010473.index.3.ebwt md5sum: cd201e81724f3099131aec16ef2cc53b - - path: output/bowtie/NC_010473.index.4.ebwt + - path: output/bowtie/bowtie/NC_010473.index.4.ebwt md5sum: bbb9d6d21ad765d135f95290204e8433 - - path: output/bowtie/NC_010473.index.rev.1.ebwt + - path: output/bowtie/bowtie/NC_010473.index.rev.1.ebwt md5sum: 44f719c2fe42e1f35d54e798775846d1 - - path: output/bowtie/NC_010473.index.rev.2.ebwt + - path: output/bowtie/bowtie/NC_010473.index.rev.2.ebwt md5sum: f3c398bba5158f4039334a932d79c051 - name: Run bowtie index and align signle-end @@ -23,20 +23,44 @@ - bowtie - bowtie_align files: - - path: output/bowtie/NC_010473.index.1.ebwt + - path: output/bowtie/bowtie/NC_010473.index.1.ebwt md5sum: 90f0b7aa5bbaeaaa999839ac13ad203c - - path: output/bowtie/NC_010473.index.2.ebwt + - path: output/bowtie/bowtie/NC_010473.index.2.ebwt md5sum: bfd10c5319c6a0dbc540fd789254a5dd - - path: output/bowtie/NC_010473.index.3.ebwt + - path: output/bowtie/bowtie/NC_010473.index.3.ebwt md5sum: cd201e81724f3099131aec16ef2cc53b - - path: output/bowtie/NC_010473.index.4.ebwt + - path: output/bowtie/bowtie/NC_010473.index.4.ebwt md5sum: bbb9d6d21ad765d135f95290204e8433 - - path: output/bowtie/NC_010473.index.rev.1.ebwt + - path: output/bowtie/bowtie/NC_010473.index.rev.1.ebwt md5sum: 44f719c2fe42e1f35d54e798775846d1 - - path: output/bowtie/NC_010473.index.rev.2.ebwt + - path: output/bowtie/bowtie/NC_010473.index.rev.2.ebwt md5sum: f3c398bba5158f4039334a932d79c051 - path: output/bowtie/test.out md5sum: 6edce9d0d8ad7f5ce837a5be7e0d7fbe - path: output/bowtie/test.sam md5sum: acdb36ea915ac2ac71b69a0b704d9d8a + +- name: Run bowtie index and align paired_end + command: nextflow run ./tests/software/bowtie -profile docker -entry test_bowtie_alignment_paired_end -c tests/config/nextflow.config + tags: + - bowtie + - bowtie_align + files: + - path: output/bowtie/bowtie/NC_010473.index.1.ebwt + md5sum: 90f0b7aa5bbaeaaa999839ac13ad203c + - path: output/bowtie/bowtie/NC_010473.index.2.ebwt + md5sum: bfd10c5319c6a0dbc540fd789254a5dd + - path: output/bowtie/bowtie/NC_010473.index.3.ebwt + md5sum: cd201e81724f3099131aec16ef2cc53b + - path: output/bowtie/bowtie/NC_010473.index.4.ebwt + md5sum: bbb9d6d21ad765d135f95290204e8433 + - path: output/bowtie/bowtie/NC_010473.index.rev.1.ebwt + md5sum: 44f719c2fe42e1f35d54e798775846d1 + - path: output/bowtie/bowtie/NC_010473.index.rev.2.ebwt + md5sum: f3c398bba5158f4039334a932d79c051 + - path: output/bowtie/test.out + md5sum: 6edce9d0d8ad7f5ce837a5be7e0d7fbe + - path: output/bowtie/test.sam + md5sum: d41d8cd98f00b204e9800998ecf8427e + From f35850bf14f312a14f1edc60d9cb861b09527b83 Mon Sep 17 00:00:00 2001 From: kevinmenden Date: Wed, 16 Dec 2020 11:02:58 +0100 Subject: [PATCH 10/29] bowtie bam output --- software/bowtie/align/main.nf | 18 +++++++++++------- tests/software/bowtie/main.nf | 8 +++----- tests/software/bowtie/test.yml | 12 ++++++------ 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/software/bowtie/align/main.nf b/software/bowtie/align/main.nf index c35508d2..6a7ea8d8 100644 --- a/software/bowtie/align/main.nf +++ b/software/bowtie/align/main.nf @@ -11,15 +11,15 @@ process BOWTIE_ALIGN { mode: params.publish_dir_mode, saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) } - conda (params.enable_conda ? "bioconda::bowtie=1.3.0" : null) - container "quay.io/biocontainers/bowtie:1.3.0--py38hed8969a_1" + conda (params.enable_conda ? "bioconda::bowtie=1.3.0 bioconda::samtools=1.10" : null) + container "quay.io/biocontainers/mulled-v2-ffbf83a6b0ab6ec567a336cf349b80637135bca3:9e14e16c284d6860574cf5b624bbc44c793cb024-0" input: tuple val(meta), path(reads) path index output: - tuple val(meta), path("*.sam"), emit: sam + tuple val(meta), path("*.bam"), emit: bam tuple val(meta), path("*.out"), emit: log path "bowtie.version.txt", emit: version @@ -27,15 +27,19 @@ process BOWTIE_ALIGN { def software = getSoftwareName(task.process) def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def unaligned = params.save_unaligned ? "--un ${prefix}.unmapped" : '' + def endedness = meta.single_end ? "$reads" : "-1 ${reads[0]} -2 ${reads[1]}" """ INDEX=`find -L ./ -name "*.3.ebwt" | sed 's/.3.ebwt//'` bowtie \\ --threads $task.cpus \\ - $options.args \\ - \$INDEX \\ - -q ${reads} \\ + --sam \\ + -x \$INDEX \\ + -q \\ $unaligned \\ - > ${prefix}.sam 2> ${prefix}.out + $options.args \\ + $endedness \\ + 2> ${prefix}.out \\ + | samtools view $options.args2 -@ $task.cpus -bS -o ${prefix}.bam - bowtie --version | head -n 1 | cut -d" " -f3 > ${software}.version.txt """ diff --git a/tests/software/bowtie/main.nf b/tests/software/bowtie/main.nf index b5668bd1..6b4e24e6 100644 --- a/tests/software/bowtie/main.nf +++ b/tests/software/bowtie/main.nf @@ -5,8 +5,6 @@ nextflow.enable.dsl = 2 include { BOWTIE_INDEX } from '../../../software/bowtie/index/main.nf' addParams( options: [:] ) include { BOWTIE_ALIGN } from '../../../software/bowtie/align/main.nf' addParams( options: [:] ) - - workflow test_bowtie_index { fasta = file("${launchDir}/tests/data/fasta/E_coli/NC_010473.fa", checkIfExists: true) BOWTIE_INDEX ( fasta ) @@ -19,7 +17,7 @@ workflow test_bowtie_alignment_single_end { def input = [] input = [ [ id:'test', single_end:true ], // meta map - [ file("${launchDir}/tests/data/fastq/dna/Ecoli_DNA_R1.fastq.gz", checkIfExists: true) ] ] + [ file("${launchDir}/tests/data/fastq/rna/test_R1.fastq.gz", checkIfExists: true) ] ] BOWTIE_ALIGN ( input, BOWTIE_INDEX.out.index ) } @@ -29,8 +27,8 @@ workflow test_bowtie_alignment_paired_end { def input = [] input = [ [ id:'test', single_end:false ], // meta map - [ file("${launchDir}/tests/data/fastq/dna/Ecoli_DNA_R1.fastq.gz", checkIfExists: true), - file("${launchDir}/tests/data/fastq/dna/Ecoli_DNA_R2.fastq.gz", checkIfExists: true) ] ] + [ file("${launchDir}/tests/data/fastq/rna/test_R1.fastq.gz", checkIfExists: true), + file("${launchDir}/tests/data/fastq/rna/test_R2.fastq.gz", checkIfExists: true) ] ] BOWTIE_ALIGN ( input, BOWTIE_INDEX.out.index ) } diff --git a/tests/software/bowtie/test.yml b/tests/software/bowtie/test.yml index 02ec5e50..6a28578d 100644 --- a/tests/software/bowtie/test.yml +++ b/tests/software/bowtie/test.yml @@ -36,9 +36,9 @@ - path: output/bowtie/bowtie/NC_010473.index.rev.2.ebwt md5sum: f3c398bba5158f4039334a932d79c051 - path: output/bowtie/test.out - md5sum: 6edce9d0d8ad7f5ce837a5be7e0d7fbe - - path: output/bowtie/test.sam - md5sum: acdb36ea915ac2ac71b69a0b704d9d8a + md5sum: a81cb18024616415a6cec3108a36fccd + - path: output/bowtie/test.bam + md5sum: 8179c68a819accbc9137dc881736106f - name: Run bowtie index and align paired_end @@ -60,7 +60,7 @@ - path: output/bowtie/bowtie/NC_010473.index.rev.2.ebwt md5sum: f3c398bba5158f4039334a932d79c051 - path: output/bowtie/test.out - md5sum: 6edce9d0d8ad7f5ce837a5be7e0d7fbe - - path: output/bowtie/test.sam - md5sum: d41d8cd98f00b204e9800998ecf8427e + md5sum: a23e9a2a76e949aeb3693bcfae41a615 + - path: output/bowtie/test.bam + md5sum: 9ce5aebf37128f4bb1d24e9548e22009 From d75cb751119dce05534ae7c8321e7eeec98f5e05 Mon Sep 17 00:00:00 2001 From: kevinmenden Date: Thu, 17 Dec 2020 07:33:44 +0100 Subject: [PATCH 11/29] added singularity; edge NXF version --- .github/workflows/bowtie_align.yml | 10 +++++++--- .github/workflows/bowtie_index.yml | 11 ++++++++--- software/bowtie/align/main.nf | 8 ++++++-- software/bowtie/align/meta.yml | 5 +++++ software/bowtie/index/main.nf | 9 ++++++--- software/bowtie/index/meta.yml | 5 +++++ 6 files changed, 37 insertions(+), 11 deletions(-) diff --git a/.github/workflows/bowtie_align.yml b/.github/workflows/bowtie_align.yml index 796b3389..e3b645c8 100644 --- a/.github/workflows/bowtie_align.yml +++ b/.github/workflows/bowtie_align.yml @@ -16,16 +16,20 @@ on: jobs: ci_test: runs-on: ubuntu-latest + strategy: + matrix: + nxf_version: [20.11.0-edge] env: NXF_ANSI_LOG: false steps: - uses: actions/checkout@v2 - name: Install Nextflow + env: + NXF_VER: ${{ matrix.nxf_version }} run: | - export NXF_VER="20.07.1" - wget -qO- get.nextflow.io | bash - sudo mv nextflow /usr/local/bin/ + wget -qO- get.nextflow.io | bash + sudo mv nextflow /usr/local/bin/ - name: Set up Python uses: actions/setup-python@v2 diff --git a/.github/workflows/bowtie_index.yml b/.github/workflows/bowtie_index.yml index 80ff13c9..9f5aa8ac 100644 --- a/.github/workflows/bowtie_index.yml +++ b/.github/workflows/bowtie_index.yml @@ -14,16 +14,21 @@ on: jobs: ci_test: runs-on: ubuntu-latest + strategy: + matrix: + nxf_version: [20.11.0-edge] env: NXF_ANSI_LOG: false steps: - uses: actions/checkout@v2 - name: Install Nextflow + env: + NXF_VER: ${{ matrix.nxf_version }} run: | - export NXF_VER="20.07.1" - wget -qO- get.nextflow.io | bash - sudo mv nextflow /usr/local/bin/ + wget -qO- get.nextflow.io | bash + sudo mv nextflow /usr/local/bin/ + - name: Set up Python uses: actions/setup-python@v2 diff --git a/software/bowtie/align/main.nf b/software/bowtie/align/main.nf index 6a7ea8d8..58906d61 100644 --- a/software/bowtie/align/main.nf +++ b/software/bowtie/align/main.nf @@ -11,8 +11,12 @@ process BOWTIE_ALIGN { mode: params.publish_dir_mode, saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) } - conda (params.enable_conda ? "bioconda::bowtie=1.3.0 bioconda::samtools=1.10" : null) - container "quay.io/biocontainers/mulled-v2-ffbf83a6b0ab6ec567a336cf349b80637135bca3:9e14e16c284d6860574cf5b624bbc44c793cb024-0" + conda (params.enable_conda ? "bioconda::bowtie=1.3.0 bioconda::samtools=1.10" : null) + if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { + container "https://depot.galaxyproject.org/singularity/mulled-v2-ffbf83a6b0ab6ec567a336cf349b80637135bca3:9e14e16c284d6860574cf5b624bbc44c793cb024-0" + } else { + container "quay.io/biocontainers/mulled-v2-ffbf83a6b0ab6ec567a336cf349b80637135bca3:9e14e16c284d6860574cf5b624bbc44c793cb024-0" + } input: tuple val(meta), path(reads) diff --git a/software/bowtie/align/meta.yml b/software/bowtie/align/meta.yml index fc18a2c9..633ef56a 100644 --- a/software/bowtie/align/meta.yml +++ b/software/bowtie/align/meta.yml @@ -29,6 +29,11 @@ params: description: | Run the module with Conda using the software specified via the `conda` directive + - singularity_pull_docker_container: + type: boolean + description: | + Instead of directly downloading Singularity images for use with Singularity, + force the workflow to pull and convert Docker containers instead. - save_unaligned: type: boolean description: Save unaligned reads diff --git a/software/bowtie/index/main.nf b/software/bowtie/index/main.nf index 5a0e18e5..1a3801b6 100644 --- a/software/bowtie/index/main.nf +++ b/software/bowtie/index/main.nf @@ -11,9 +11,12 @@ process BOWTIE_INDEX { mode: params.publish_dir_mode, saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:'') } - conda (params.enable_conda ? "bioconda::bowtie=1.3.0" : null) - container "quay.io/biocontainers/bowtie:1.3.0--py38hed8969a_1" - + conda (params.enable_conda ? "bioconda::bowtie=1.3.0" : null) + if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { + container "https://depot.galaxyproject.org/singularity/bowtie:1.3.0--py38hed8969a_1" + } else { + container "quay.io/biocontainers/bowtie:1.3.0--py38hed8969a_1" + } input: path fasta diff --git a/software/bowtie/index/meta.yml b/software/bowtie/index/meta.yml index 0a8c23f7..db781a0a 100644 --- a/software/bowtie/index/meta.yml +++ b/software/bowtie/index/meta.yml @@ -29,6 +29,11 @@ params: description: | Run the module with Conda using the software specified via the `conda` directive + - singularity_pull_docker_container: + type: boolean + description: | + Instead of directly downloading Singularity images for use with Singularity, + force the workflow to pull and convert Docker containers instead. input: - fasta: type: file From 8d3fc30eb3d6d649f376f886c6f835186e06663e Mon Sep 17 00:00:00 2001 From: kevinmenden Date: Thu, 17 Dec 2020 07:39:34 +0100 Subject: [PATCH 12/29] fixed yml formatting --- .github/workflows/bowtie_align.yml | 6 +-- .github/workflows/bowtie_index.yml | 67 +++++++++++++++--------------- 2 files changed, 36 insertions(+), 37 deletions(-) diff --git a/.github/workflows/bowtie_align.yml b/.github/workflows/bowtie_align.yml index e3b645c8..8b9a19fe 100644 --- a/.github/workflows/bowtie_align.yml +++ b/.github/workflows/bowtie_align.yml @@ -26,10 +26,10 @@ jobs: - name: Install Nextflow env: - NXF_VER: ${{ matrix.nxf_version }} + NXF_VER: ${{ matrix.nxf_version }} run: | - wget -qO- get.nextflow.io | bash - sudo mv nextflow /usr/local/bin/ + wget -qO- get.nextflow.io | bash + sudo mv nextflow /usr/local/bin/ - name: Set up Python uses: actions/setup-python@v2 diff --git a/.github/workflows/bowtie_index.yml b/.github/workflows/bowtie_index.yml index 9f5aa8ac..291d04f5 100644 --- a/.github/workflows/bowtie_index.yml +++ b/.github/workflows/bowtie_index.yml @@ -1,41 +1,40 @@ name: bowtie_index on: - push: - paths: - - software/bowtie/index/** - - .github/workflows/bowtie_index.yml - - tests/software/bowtie/** - pull_request: - paths: - - software/bowtie/index/** - - .github/workflows/bowtie_index.yml - - tests/software/bowtie/** + push: + paths: + - software/bowtie/index/** + - .github/workflows/bowtie_index.yml + - tests/software/bowtie/** + pull_request: + paths: + - software/bowtie/index/** + - .github/workflows/bowtie_index.yml + - tests/software/bowtie/** jobs: - ci_test: - runs-on: ubuntu-latest - strategy: - matrix: - nxf_version: [20.11.0-edge] + ci_test: + runs-on: ubuntu-latest + strategy: + matrix: + nxf_version: [20.11.0-edge] + env: + NXF_ANSI_LOG: false + steps: + - uses: actions/checkout@v2 + + - name: Install Nextflow env: - NXF_ANSI_LOG: false - steps: - - uses: actions/checkout@v2 + NXF_VER: ${{ matrix.nxf_version }} + run: | + wget -qO- get.nextflow.io | bash + sudo mv nextflow /usr/local/bin/ - - name: Install Nextflow - env: - NXF_VER: ${{ matrix.nxf_version }} - run: | - wget -qO- get.nextflow.io | bash - sudo mv nextflow /usr/local/bin/ + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: "3.x" + - name: Install dependencies + run: python -m pip install --upgrade pip pytest-workflow - - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: "3.x" - - name: Install dependencies - run: python -m pip install --upgrade pip pytest-workflow - - # Test the module - - run: pytest --tag bowtie_index --symlink --wt 2 + # Test the module + - run: pytest --tag bowtie_index --symlink --wt 2 From 57ab6dbcbf6e891c08133130c337cade188aefd8 Mon Sep 17 00:00:00 2001 From: kevinmenden Date: Thu, 17 Dec 2020 10:24:48 +0100 Subject: [PATCH 13/29] groovy formatting --- software/bowtie/align/main.nf | 18 +++++++++--------- software/bowtie/index/main.nf | 12 ++++++------ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/software/bowtie/align/main.nf b/software/bowtie/align/main.nf index 58906d61..4271d33a 100644 --- a/software/bowtie/align/main.nf +++ b/software/bowtie/align/main.nf @@ -11,21 +11,21 @@ process BOWTIE_ALIGN { mode: params.publish_dir_mode, saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) } - conda (params.enable_conda ? "bioconda::bowtie=1.3.0 bioconda::samtools=1.10" : null) + conda (params.enable_conda ? 'bioconda::bowtie=1.3.0 bioconda::samtools=1.10' : null) if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { - container "https://depot.galaxyproject.org/singularity/mulled-v2-ffbf83a6b0ab6ec567a336cf349b80637135bca3:9e14e16c284d6860574cf5b624bbc44c793cb024-0" + container 'https://depot.galaxyproject.org/singularity/mulled-v2-ffbf83a6b0ab6ec567a336cf349b80637135bca3:9e14e16c284d6860574cf5b624bbc44c793cb024-0' } else { - container "quay.io/biocontainers/mulled-v2-ffbf83a6b0ab6ec567a336cf349b80637135bca3:9e14e16c284d6860574cf5b624bbc44c793cb024-0" + container 'quay.io/biocontainers/mulled-v2-ffbf83a6b0ab6ec567a336cf349b80637135bca3:9e14e16c284d6860574cf5b624bbc44c793cb024-0' } input: tuple val(meta), path(reads) path index - + output: - tuple val(meta), path("*.bam"), emit: bam - tuple val(meta), path("*.out"), emit: log - path "bowtie.version.txt", emit: version + tuple val(meta), path('*.bam'), emit: bam + tuple val(meta), path('*.out'), emit: log + path 'bowtie.version.txt', emit: version script: def software = getSoftwareName(task.process) @@ -39,10 +39,10 @@ process BOWTIE_ALIGN { --sam \\ -x \$INDEX \\ -q \\ - $unaligned \\ + $unaligned \\ $options.args \\ $endedness \\ - 2> ${prefix}.out \\ + 2> ${prefix}.out \\ | samtools view $options.args2 -@ $task.cpus -bS -o ${prefix}.bam - bowtie --version | head -n 1 | cut -d" " -f3 > ${software}.version.txt diff --git a/software/bowtie/index/main.nf b/software/bowtie/index/main.nf index 1a3801b6..38f1c289 100644 --- a/software/bowtie/index/main.nf +++ b/software/bowtie/index/main.nf @@ -11,19 +11,19 @@ process BOWTIE_INDEX { mode: params.publish_dir_mode, saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:'') } - conda (params.enable_conda ? "bioconda::bowtie=1.3.0" : null) + conda (params.enable_conda ? 'bioconda::bowtie=1.3.0' : null) if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { - container "https://depot.galaxyproject.org/singularity/bowtie:1.3.0--py38hed8969a_1" + container 'https://depot.galaxyproject.org/singularity/bowtie:1.3.0--py38hed8969a_1' } else { - container "quay.io/biocontainers/bowtie:1.3.0--py38hed8969a_1" + container 'quay.io/biocontainers/bowtie:1.3.0--py38hed8969a_1' } input: path fasta output: - path "bowtie", emit: index - path "*.version.txt", emit: version + path 'bowtie', emit: index + path '*.version.txt', emit: version script: def software = getSoftwareName(task.process) @@ -32,4 +32,4 @@ process BOWTIE_INDEX { bowtie-build --threads $task.cpus ${fasta} bowtie/${fasta.baseName}.index bowtie --version | head -n 1 | cut -d" " -f3 > ${software}.version.txt """ -} \ No newline at end of file +} From 0b6f117d2a6070596b352a99dfde717cba47c532 Mon Sep 17 00:00:00 2001 From: Edmund Miller Date: Tue, 17 Nov 2020 09:48:46 -0600 Subject: [PATCH 14/29] ci(#77): eclint => editorconfig-checker --- .github/workflows/linting.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index 62a6125c..bd429fa3 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -17,20 +17,20 @@ jobs: - name: Run Markdownlint run: markdownlint ${GITHUB_WORKSPACE} -c ${GITHUB_WORKSPACE}/.markdownlint.yml - # EditorConfig: - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v2 + EditorConfig: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 - # - uses: actions/setup-node@v1 - # with: - # node-version: "10" + - uses: actions/setup-node@v1 + with: + node-version: "10" - # - name: Install ECLint - # run: npm install -g eclint + - name: Install editorconfig-checker + run: npm install -g editorconfig-checker - # - name: Run ECLint check - # run: eclint check $(git ls-files | grep -v test) + - name: Run ECLint check + run: ec check $(git ls-files | grep -v test) YAML: runs-on: ubuntu-latest From c6cf653f25c9afdc12245d132f106e44eabc7ca7 Mon Sep 17 00:00:00 2001 From: Edmund Miller Date: Tue, 17 Nov 2020 10:42:48 -0600 Subject: [PATCH 15/29] ci(#77): Ignore README for editorconfig Because of the nf-core examples it throws errors. --- .github/workflows/linting.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index bd429fa3..d64017ee 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -30,7 +30,7 @@ jobs: run: npm install -g editorconfig-checker - name: Run ECLint check - run: ec check $(git ls-files | grep -v test) + run: ec -exclude README.md $(git ls-files | grep -v test) YAML: runs-on: ubuntu-latest From eb61638501519e84cee0e76bc5f9d69fa71204e0 Mon Sep 17 00:00:00 2001 From: Edmund Miller Date: Thu, 17 Dec 2020 17:20:30 -0600 Subject: [PATCH 16/29] ci: Use verbose name for editorconfig-check I was getting confused myself with eclint --- .github/workflows/linting.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml index d64017ee..f20e7a61 100644 --- a/.github/workflows/linting.yml +++ b/.github/workflows/linting.yml @@ -30,7 +30,7 @@ jobs: run: npm install -g editorconfig-checker - name: Run ECLint check - run: ec -exclude README.md $(git ls-files | grep -v test) + run: editorconfig-checker -exclude README.md $(git ls-files | grep -v test) YAML: runs-on: ubuntu-latest From d76638d6f8e7df263d83431fc559ca352a661801 Mon Sep 17 00:00:00 2001 From: Edmund Miller Date: Thu, 17 Dec 2020 17:50:24 -0600 Subject: [PATCH 17/29] style(#77): Fix editorconfig errors --- deprecated/bedtools/intersect/main.nf | 1 - software/SOFTWARE/TOOL/functions.nf | 118 +++++++------- software/SOFTWARE/TOOL/main.nf | 4 +- software/bwa/index/functions.nf | 118 +++++++------- software/bwa/index/main.nf | 2 +- software/bwa/mem/functions.nf | 118 +++++++------- software/bwa/mem/main.nf | 4 +- software/deeptools/computematrix/functions.nf | 118 +++++++------- software/deeptools/computematrix/main.nf | 2 +- .../deeptools/plotfingerprint/functions.nf | 118 +++++++------- software/deeptools/plotfingerprint/main.nf | 2 +- software/deeptools/plotheatmap/functions.nf | 118 +++++++------- software/deeptools/plotheatmap/main.nf | 2 +- software/deeptools/plotprofile/functions.nf | 118 +++++++------- software/deeptools/plotprofile/main.nf | 2 +- software/fastqc/functions.nf | 118 +++++++------- software/fastqc/main.nf | 4 +- software/gffread/functions.nf | 118 +++++++------- software/gffread/main.nf | 66 ++++---- software/hisat2/align/functions.nf | 118 +++++++------- software/hisat2/align/main.nf | 4 +- software/hisat2/build/functions.nf | 118 +++++++------- software/hisat2/build/main.nf | 134 ++++++++-------- .../hisat2/extractsplicesites/functions.nf | 118 +++++++------- software/hisat2/extractsplicesites/main.nf | 2 +- software/homer/annotatepeaks/functions.nf | 118 +++++++------- software/lib/functions.nf | 118 +++++++------- software/macs2/callpeak/functions.nf | 118 +++++++------- software/macs2/callpeak/main.nf | 4 +- software/phantompeakqualtools/functions.nf | 118 +++++++------- software/phantompeakqualtools/main.nf | 4 +- .../collectmultiplemetrics/functions.nf | 118 +++++++------- software/picard/markduplicates/functions.nf | 118 +++++++------- software/picard/markduplicates/main.nf | 4 +- software/picard/mergesamfiles/functions.nf | 118 +++++++------- software/picard/mergesamfiles/main.nf | 2 +- software/preseq/lcextrap/functions.nf | 118 +++++++------- software/preseq/lcextrap/main.nf | 4 +- software/qualimap/rnaseq/functions.nf | 118 +++++++------- software/qualimap/rnaseq/main.nf | 2 +- .../rsem/calculateexpression/functions.nf | 118 +++++++------- software/rsem/calculateexpression/main.nf | 122 +++++++-------- software/rsem/preparereference/functions.nf | 118 +++++++------- software/rsem/preparereference/main.nf | 136 ++++++++-------- software/rseqc/bamstat/functions.nf | 118 +++++++------- software/rseqc/bamstat/main.nf | 78 +++++----- software/rseqc/inferexperiment/functions.nf | 118 +++++++------- software/rseqc/inferexperiment/main.nf | 82 +++++----- software/rseqc/innerdistance/functions.nf | 118 +++++++------- software/rseqc/innerdistance/main.nf | 106 ++++++------- .../rseqc/junctionannotation/functions.nf | 118 +++++++------- software/rseqc/junctionannotation/main.nf | 96 ++++++------ .../rseqc/junctionsaturation/functions.nf | 118 +++++++------- software/rseqc/junctionsaturation/main.nf | 84 +++++----- software/rseqc/readdistribution/functions.nf | 118 +++++++------- software/rseqc/readdistribution/main.nf | 80 +++++----- software/rseqc/readduplication/functions.nf | 118 +++++++------- software/rseqc/readduplication/main.nf | 84 +++++----- software/salmon/index/functions.nf | 118 +++++++------- software/salmon/index/main.nf | 102 ++++++------ software/salmon/quant/functions.nf | 118 +++++++------- software/salmon/quant/main.nf | 4 +- software/samtools/flagstat/functions.nf | 118 +++++++------- software/samtools/flagstat/main.nf | 64 ++++---- software/samtools/idxstats/functions.nf | 118 +++++++------- software/samtools/idxstats/main.nf | 64 ++++---- software/samtools/index/functions.nf | 118 +++++++------- software/samtools/index/main.nf | 64 ++++---- software/samtools/sort/functions.nf | 118 +++++++------- software/samtools/sort/main.nf | 70 ++++----- software/samtools/stats/functions.nf | 118 +++++++------- software/samtools/stats/main.nf | 64 ++++---- software/sortmerna/functions.nf | 118 +++++++------- software/sortmerna/main.nf | 146 +++++++++--------- software/star/align/functions.nf | 118 +++++++------- software/star/align/main.nf | 132 ++++++++-------- software/star/genomegenerate/functions.nf | 118 +++++++------- software/stringtie/functions.nf | 118 +++++++------- software/stringtie/main.nf | 110 ++++++------- software/subread/featurecounts/functions.nf | 118 +++++++------- software/subread/featurecounts/main.nf | 2 +- software/trimgalore/functions.nf | 118 +++++++------- software/ucsc/bedgraphtobigwig/functions.nf | 118 +++++++------- software/ucsc/bedgraphtobigwig/main.nf | 4 +- software/umitools/dedup/functions.nf | 118 +++++++------- software/umitools/dedup/main.nf | 82 +++++----- software/umitools/extract/functions.nf | 118 +++++++------- software/umitools/extract/main.nf | 114 +++++++------- 88 files changed, 3783 insertions(+), 3784 deletions(-) diff --git a/deprecated/bedtools/intersect/main.nf b/deprecated/bedtools/intersect/main.nf index ab1366e2..fd2d8af1 100644 --- a/deprecated/bedtools/intersect/main.nf +++ b/deprecated/bedtools/intersect/main.nf @@ -34,4 +34,3 @@ process INTERSECT_BED { bedtools --version | sed -n "s/.*\\(v.*\$\\)/\\1/p" > bedtools.version.txt """ } - diff --git a/software/SOFTWARE/TOOL/functions.nf b/software/SOFTWARE/TOOL/functions.nf index b3ac3801..d25eea86 100644 --- a/software/SOFTWARE/TOOL/functions.nf +++ b/software/SOFTWARE/TOOL/functions.nf @@ -1,59 +1,59 @@ -/* - * ----------------------------------------------------- - * Utility functions used in nf-core DSL2 module files - * ----------------------------------------------------- - */ - -/* - * Extract name of software tool from process name using $task.process - */ -def getSoftwareName(task_process) { - return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() -} - -/* - * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules - */ -def initOptions(Map args) { - def Map options = [:] - options.args = args.args ?: '' - options.args2 = args.args2 ?: '' - options.publish_by_id = args.publish_by_id ?: false - options.publish_dir = args.publish_dir ?: '' - options.publish_files = args.publish_files - options.suffix = args.suffix ?: '' - return options -} - -/* - * Tidy up and join elements of a list to return a path string - */ -def getPathFromList(path_list) { - def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries - paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes - return paths.join('/') -} - -/* - * Function to save/publish module results - */ -def saveFiles(Map args) { - if (!args.filename.endsWith('.version.txt')) { - def ioptions = initOptions(args.options) - def path_list = [ ioptions.publish_dir ?: args.publish_dir ] - if (ioptions.publish_by_id) { - path_list.add(args.publish_id) - } - if (ioptions.publish_files instanceof Map) { - for (ext in ioptions.publish_files) { - if (args.filename.endsWith(ext.key)) { - def ext_list = path_list.collect() - ext_list.add(ext.value) - return "${getPathFromList(ext_list)}/$args.filename" - } - } - } else if (ioptions.publish_files == null) { - return "${getPathFromList(path_list)}/$args.filename" - } - } -} +/* + * ----------------------------------------------------- + * Utility functions used in nf-core DSL2 module files + * ----------------------------------------------------- + */ + +/* + * Extract name of software tool from process name using $task.process + */ +def getSoftwareName(task_process) { + return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() +} + +/* + * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules + */ +def initOptions(Map args) { + def Map options = [:] + options.args = args.args ?: '' + options.args2 = args.args2 ?: '' + options.publish_by_id = args.publish_by_id ?: false + options.publish_dir = args.publish_dir ?: '' + options.publish_files = args.publish_files + options.suffix = args.suffix ?: '' + return options +} + +/* + * Tidy up and join elements of a list to return a path string + */ +def getPathFromList(path_list) { + def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries + paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes + return paths.join('/') +} + +/* + * Function to save/publish module results + */ +def saveFiles(Map args) { + if (!args.filename.endsWith('.version.txt')) { + def ioptions = initOptions(args.options) + def path_list = [ ioptions.publish_dir ?: args.publish_dir ] + if (ioptions.publish_by_id) { + path_list.add(args.publish_id) + } + if (ioptions.publish_files instanceof Map) { + for (ext in ioptions.publish_files) { + if (args.filename.endsWith(ext.key)) { + def ext_list = path_list.collect() + ext_list.add(ext.value) + return "${getPathFromList(ext_list)}/$args.filename" + } + } + } else if (ioptions.publish_files == null) { + return "${getPathFromList(path_list)}/$args.filename" + } + } +} diff --git a/software/SOFTWARE/TOOL/main.nf b/software/SOFTWARE/TOOL/main.nf index 4c00cc27..455b4e9e 100644 --- a/software/SOFTWARE/TOOL/main.nf +++ b/software/SOFTWARE/TOOL/main.nf @@ -50,7 +50,7 @@ process SOFTWARE_TOOL { } else { container "quay.io/biocontainers/samtools:1.10--h9402c20_2" } - + input: // TODO nf-core: Where applicable all sample-specific information e.g. "id", "single_end", "read_group" // MUST be provided as an input via a Groovy Map called "meta". @@ -59,7 +59,7 @@ process SOFTWARE_TOOL { // TODO nf-core: Where applicable please provide/convert compressed files as input/output // e.g. "*.fastq.gz" and NOT "*.fastq", "*.bam" and NOT "*.sam" etc. tuple val(meta), path(reads) - + output: // TODO nf-core: Named file extensions MUST be emitted for ALL output channels // TODO nf-core: If meta is provided in "input:" section then it MUST be added to ALL output channels (except version) diff --git a/software/bwa/index/functions.nf b/software/bwa/index/functions.nf index b3ac3801..d25eea86 100644 --- a/software/bwa/index/functions.nf +++ b/software/bwa/index/functions.nf @@ -1,59 +1,59 @@ -/* - * ----------------------------------------------------- - * Utility functions used in nf-core DSL2 module files - * ----------------------------------------------------- - */ - -/* - * Extract name of software tool from process name using $task.process - */ -def getSoftwareName(task_process) { - return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() -} - -/* - * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules - */ -def initOptions(Map args) { - def Map options = [:] - options.args = args.args ?: '' - options.args2 = args.args2 ?: '' - options.publish_by_id = args.publish_by_id ?: false - options.publish_dir = args.publish_dir ?: '' - options.publish_files = args.publish_files - options.suffix = args.suffix ?: '' - return options -} - -/* - * Tidy up and join elements of a list to return a path string - */ -def getPathFromList(path_list) { - def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries - paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes - return paths.join('/') -} - -/* - * Function to save/publish module results - */ -def saveFiles(Map args) { - if (!args.filename.endsWith('.version.txt')) { - def ioptions = initOptions(args.options) - def path_list = [ ioptions.publish_dir ?: args.publish_dir ] - if (ioptions.publish_by_id) { - path_list.add(args.publish_id) - } - if (ioptions.publish_files instanceof Map) { - for (ext in ioptions.publish_files) { - if (args.filename.endsWith(ext.key)) { - def ext_list = path_list.collect() - ext_list.add(ext.value) - return "${getPathFromList(ext_list)}/$args.filename" - } - } - } else if (ioptions.publish_files == null) { - return "${getPathFromList(path_list)}/$args.filename" - } - } -} +/* + * ----------------------------------------------------- + * Utility functions used in nf-core DSL2 module files + * ----------------------------------------------------- + */ + +/* + * Extract name of software tool from process name using $task.process + */ +def getSoftwareName(task_process) { + return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() +} + +/* + * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules + */ +def initOptions(Map args) { + def Map options = [:] + options.args = args.args ?: '' + options.args2 = args.args2 ?: '' + options.publish_by_id = args.publish_by_id ?: false + options.publish_dir = args.publish_dir ?: '' + options.publish_files = args.publish_files + options.suffix = args.suffix ?: '' + return options +} + +/* + * Tidy up and join elements of a list to return a path string + */ +def getPathFromList(path_list) { + def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries + paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes + return paths.join('/') +} + +/* + * Function to save/publish module results + */ +def saveFiles(Map args) { + if (!args.filename.endsWith('.version.txt')) { + def ioptions = initOptions(args.options) + def path_list = [ ioptions.publish_dir ?: args.publish_dir ] + if (ioptions.publish_by_id) { + path_list.add(args.publish_id) + } + if (ioptions.publish_files instanceof Map) { + for (ext in ioptions.publish_files) { + if (args.filename.endsWith(ext.key)) { + def ext_list = path_list.collect() + ext_list.add(ext.value) + return "${getPathFromList(ext_list)}/$args.filename" + } + } + } else if (ioptions.publish_files == null) { + return "${getPathFromList(path_list)}/$args.filename" + } + } +} diff --git a/software/bwa/index/main.nf b/software/bwa/index/main.nf index 7b1e6ff9..ec4079ab 100644 --- a/software/bwa/index/main.nf +++ b/software/bwa/index/main.nf @@ -20,7 +20,7 @@ process BWA_INDEX { input: path fasta - + output: path "${fasta}.*" , emit: index path "*.version.txt", emit: version diff --git a/software/bwa/mem/functions.nf b/software/bwa/mem/functions.nf index b3ac3801..d25eea86 100644 --- a/software/bwa/mem/functions.nf +++ b/software/bwa/mem/functions.nf @@ -1,59 +1,59 @@ -/* - * ----------------------------------------------------- - * Utility functions used in nf-core DSL2 module files - * ----------------------------------------------------- - */ - -/* - * Extract name of software tool from process name using $task.process - */ -def getSoftwareName(task_process) { - return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() -} - -/* - * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules - */ -def initOptions(Map args) { - def Map options = [:] - options.args = args.args ?: '' - options.args2 = args.args2 ?: '' - options.publish_by_id = args.publish_by_id ?: false - options.publish_dir = args.publish_dir ?: '' - options.publish_files = args.publish_files - options.suffix = args.suffix ?: '' - return options -} - -/* - * Tidy up and join elements of a list to return a path string - */ -def getPathFromList(path_list) { - def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries - paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes - return paths.join('/') -} - -/* - * Function to save/publish module results - */ -def saveFiles(Map args) { - if (!args.filename.endsWith('.version.txt')) { - def ioptions = initOptions(args.options) - def path_list = [ ioptions.publish_dir ?: args.publish_dir ] - if (ioptions.publish_by_id) { - path_list.add(args.publish_id) - } - if (ioptions.publish_files instanceof Map) { - for (ext in ioptions.publish_files) { - if (args.filename.endsWith(ext.key)) { - def ext_list = path_list.collect() - ext_list.add(ext.value) - return "${getPathFromList(ext_list)}/$args.filename" - } - } - } else if (ioptions.publish_files == null) { - return "${getPathFromList(path_list)}/$args.filename" - } - } -} +/* + * ----------------------------------------------------- + * Utility functions used in nf-core DSL2 module files + * ----------------------------------------------------- + */ + +/* + * Extract name of software tool from process name using $task.process + */ +def getSoftwareName(task_process) { + return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() +} + +/* + * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules + */ +def initOptions(Map args) { + def Map options = [:] + options.args = args.args ?: '' + options.args2 = args.args2 ?: '' + options.publish_by_id = args.publish_by_id ?: false + options.publish_dir = args.publish_dir ?: '' + options.publish_files = args.publish_files + options.suffix = args.suffix ?: '' + return options +} + +/* + * Tidy up and join elements of a list to return a path string + */ +def getPathFromList(path_list) { + def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries + paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes + return paths.join('/') +} + +/* + * Function to save/publish module results + */ +def saveFiles(Map args) { + if (!args.filename.endsWith('.version.txt')) { + def ioptions = initOptions(args.options) + def path_list = [ ioptions.publish_dir ?: args.publish_dir ] + if (ioptions.publish_by_id) { + path_list.add(args.publish_id) + } + if (ioptions.publish_files instanceof Map) { + for (ext in ioptions.publish_files) { + if (args.filename.endsWith(ext.key)) { + def ext_list = path_list.collect() + ext_list.add(ext.value) + return "${getPathFromList(ext_list)}/$args.filename" + } + } + } else if (ioptions.publish_files == null) { + return "${getPathFromList(path_list)}/$args.filename" + } + } +} diff --git a/software/bwa/mem/main.nf b/software/bwa/mem/main.nf index 2bf3b932..4ce1c578 100644 --- a/software/bwa/mem/main.nf +++ b/software/bwa/mem/main.nf @@ -17,12 +17,12 @@ process BWA_MEM { } else { container "quay.io/biocontainers/mulled-v2-fe8faa35dbf6dc65a0f7f5d4ea12e31a79f73e40:eabfac3657eda5818bae4090db989e3d41b01542-0" } - + input: tuple val(meta), path(reads) path index path fasta - + output: tuple val(meta), path("*.bam"), emit: bam path "*.version.txt" , emit: version diff --git a/software/deeptools/computematrix/functions.nf b/software/deeptools/computematrix/functions.nf index b3ac3801..d25eea86 100644 --- a/software/deeptools/computematrix/functions.nf +++ b/software/deeptools/computematrix/functions.nf @@ -1,59 +1,59 @@ -/* - * ----------------------------------------------------- - * Utility functions used in nf-core DSL2 module files - * ----------------------------------------------------- - */ - -/* - * Extract name of software tool from process name using $task.process - */ -def getSoftwareName(task_process) { - return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() -} - -/* - * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules - */ -def initOptions(Map args) { - def Map options = [:] - options.args = args.args ?: '' - options.args2 = args.args2 ?: '' - options.publish_by_id = args.publish_by_id ?: false - options.publish_dir = args.publish_dir ?: '' - options.publish_files = args.publish_files - options.suffix = args.suffix ?: '' - return options -} - -/* - * Tidy up and join elements of a list to return a path string - */ -def getPathFromList(path_list) { - def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries - paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes - return paths.join('/') -} - -/* - * Function to save/publish module results - */ -def saveFiles(Map args) { - if (!args.filename.endsWith('.version.txt')) { - def ioptions = initOptions(args.options) - def path_list = [ ioptions.publish_dir ?: args.publish_dir ] - if (ioptions.publish_by_id) { - path_list.add(args.publish_id) - } - if (ioptions.publish_files instanceof Map) { - for (ext in ioptions.publish_files) { - if (args.filename.endsWith(ext.key)) { - def ext_list = path_list.collect() - ext_list.add(ext.value) - return "${getPathFromList(ext_list)}/$args.filename" - } - } - } else if (ioptions.publish_files == null) { - return "${getPathFromList(path_list)}/$args.filename" - } - } -} +/* + * ----------------------------------------------------- + * Utility functions used in nf-core DSL2 module files + * ----------------------------------------------------- + */ + +/* + * Extract name of software tool from process name using $task.process + */ +def getSoftwareName(task_process) { + return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() +} + +/* + * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules + */ +def initOptions(Map args) { + def Map options = [:] + options.args = args.args ?: '' + options.args2 = args.args2 ?: '' + options.publish_by_id = args.publish_by_id ?: false + options.publish_dir = args.publish_dir ?: '' + options.publish_files = args.publish_files + options.suffix = args.suffix ?: '' + return options +} + +/* + * Tidy up and join elements of a list to return a path string + */ +def getPathFromList(path_list) { + def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries + paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes + return paths.join('/') +} + +/* + * Function to save/publish module results + */ +def saveFiles(Map args) { + if (!args.filename.endsWith('.version.txt')) { + def ioptions = initOptions(args.options) + def path_list = [ ioptions.publish_dir ?: args.publish_dir ] + if (ioptions.publish_by_id) { + path_list.add(args.publish_id) + } + if (ioptions.publish_files instanceof Map) { + for (ext in ioptions.publish_files) { + if (args.filename.endsWith(ext.key)) { + def ext_list = path_list.collect() + ext_list.add(ext.value) + return "${getPathFromList(ext_list)}/$args.filename" + } + } + } else if (ioptions.publish_files == null) { + return "${getPathFromList(path_list)}/$args.filename" + } + } +} diff --git a/software/deeptools/computematrix/main.nf b/software/deeptools/computematrix/main.nf index 9c51282f..18f9c248 100644 --- a/software/deeptools/computematrix/main.nf +++ b/software/deeptools/computematrix/main.nf @@ -21,7 +21,7 @@ process DEEPTOOLS_COMPUTEMATRIX { input: tuple val(meta), path(bigwig) path bed - + output: tuple val(meta), path("*.mat.gz") , emit: matrix tuple val(meta), path("*.mat.tab"), emit: table diff --git a/software/deeptools/plotfingerprint/functions.nf b/software/deeptools/plotfingerprint/functions.nf index b3ac3801..d25eea86 100644 --- a/software/deeptools/plotfingerprint/functions.nf +++ b/software/deeptools/plotfingerprint/functions.nf @@ -1,59 +1,59 @@ -/* - * ----------------------------------------------------- - * Utility functions used in nf-core DSL2 module files - * ----------------------------------------------------- - */ - -/* - * Extract name of software tool from process name using $task.process - */ -def getSoftwareName(task_process) { - return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() -} - -/* - * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules - */ -def initOptions(Map args) { - def Map options = [:] - options.args = args.args ?: '' - options.args2 = args.args2 ?: '' - options.publish_by_id = args.publish_by_id ?: false - options.publish_dir = args.publish_dir ?: '' - options.publish_files = args.publish_files - options.suffix = args.suffix ?: '' - return options -} - -/* - * Tidy up and join elements of a list to return a path string - */ -def getPathFromList(path_list) { - def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries - paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes - return paths.join('/') -} - -/* - * Function to save/publish module results - */ -def saveFiles(Map args) { - if (!args.filename.endsWith('.version.txt')) { - def ioptions = initOptions(args.options) - def path_list = [ ioptions.publish_dir ?: args.publish_dir ] - if (ioptions.publish_by_id) { - path_list.add(args.publish_id) - } - if (ioptions.publish_files instanceof Map) { - for (ext in ioptions.publish_files) { - if (args.filename.endsWith(ext.key)) { - def ext_list = path_list.collect() - ext_list.add(ext.value) - return "${getPathFromList(ext_list)}/$args.filename" - } - } - } else if (ioptions.publish_files == null) { - return "${getPathFromList(path_list)}/$args.filename" - } - } -} +/* + * ----------------------------------------------------- + * Utility functions used in nf-core DSL2 module files + * ----------------------------------------------------- + */ + +/* + * Extract name of software tool from process name using $task.process + */ +def getSoftwareName(task_process) { + return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() +} + +/* + * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules + */ +def initOptions(Map args) { + def Map options = [:] + options.args = args.args ?: '' + options.args2 = args.args2 ?: '' + options.publish_by_id = args.publish_by_id ?: false + options.publish_dir = args.publish_dir ?: '' + options.publish_files = args.publish_files + options.suffix = args.suffix ?: '' + return options +} + +/* + * Tidy up and join elements of a list to return a path string + */ +def getPathFromList(path_list) { + def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries + paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes + return paths.join('/') +} + +/* + * Function to save/publish module results + */ +def saveFiles(Map args) { + if (!args.filename.endsWith('.version.txt')) { + def ioptions = initOptions(args.options) + def path_list = [ ioptions.publish_dir ?: args.publish_dir ] + if (ioptions.publish_by_id) { + path_list.add(args.publish_id) + } + if (ioptions.publish_files instanceof Map) { + for (ext in ioptions.publish_files) { + if (args.filename.endsWith(ext.key)) { + def ext_list = path_list.collect() + ext_list.add(ext.value) + return "${getPathFromList(ext_list)}/$args.filename" + } + } + } else if (ioptions.publish_files == null) { + return "${getPathFromList(path_list)}/$args.filename" + } + } +} diff --git a/software/deeptools/plotfingerprint/main.nf b/software/deeptools/plotfingerprint/main.nf index 72a0e596..c3d4c33b 100644 --- a/software/deeptools/plotfingerprint/main.nf +++ b/software/deeptools/plotfingerprint/main.nf @@ -20,7 +20,7 @@ process DEEPTOOLS_PLOTFINGERPRINT { input: tuple val(meta), path(bams), path(bais) - + output: tuple val(meta), path("*.pdf") , emit: pdf tuple val(meta), path("*.raw.txt") , emit: matrix diff --git a/software/deeptools/plotheatmap/functions.nf b/software/deeptools/plotheatmap/functions.nf index b3ac3801..d25eea86 100644 --- a/software/deeptools/plotheatmap/functions.nf +++ b/software/deeptools/plotheatmap/functions.nf @@ -1,59 +1,59 @@ -/* - * ----------------------------------------------------- - * Utility functions used in nf-core DSL2 module files - * ----------------------------------------------------- - */ - -/* - * Extract name of software tool from process name using $task.process - */ -def getSoftwareName(task_process) { - return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() -} - -/* - * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules - */ -def initOptions(Map args) { - def Map options = [:] - options.args = args.args ?: '' - options.args2 = args.args2 ?: '' - options.publish_by_id = args.publish_by_id ?: false - options.publish_dir = args.publish_dir ?: '' - options.publish_files = args.publish_files - options.suffix = args.suffix ?: '' - return options -} - -/* - * Tidy up and join elements of a list to return a path string - */ -def getPathFromList(path_list) { - def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries - paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes - return paths.join('/') -} - -/* - * Function to save/publish module results - */ -def saveFiles(Map args) { - if (!args.filename.endsWith('.version.txt')) { - def ioptions = initOptions(args.options) - def path_list = [ ioptions.publish_dir ?: args.publish_dir ] - if (ioptions.publish_by_id) { - path_list.add(args.publish_id) - } - if (ioptions.publish_files instanceof Map) { - for (ext in ioptions.publish_files) { - if (args.filename.endsWith(ext.key)) { - def ext_list = path_list.collect() - ext_list.add(ext.value) - return "${getPathFromList(ext_list)}/$args.filename" - } - } - } else if (ioptions.publish_files == null) { - return "${getPathFromList(path_list)}/$args.filename" - } - } -} +/* + * ----------------------------------------------------- + * Utility functions used in nf-core DSL2 module files + * ----------------------------------------------------- + */ + +/* + * Extract name of software tool from process name using $task.process + */ +def getSoftwareName(task_process) { + return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() +} + +/* + * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules + */ +def initOptions(Map args) { + def Map options = [:] + options.args = args.args ?: '' + options.args2 = args.args2 ?: '' + options.publish_by_id = args.publish_by_id ?: false + options.publish_dir = args.publish_dir ?: '' + options.publish_files = args.publish_files + options.suffix = args.suffix ?: '' + return options +} + +/* + * Tidy up and join elements of a list to return a path string + */ +def getPathFromList(path_list) { + def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries + paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes + return paths.join('/') +} + +/* + * Function to save/publish module results + */ +def saveFiles(Map args) { + if (!args.filename.endsWith('.version.txt')) { + def ioptions = initOptions(args.options) + def path_list = [ ioptions.publish_dir ?: args.publish_dir ] + if (ioptions.publish_by_id) { + path_list.add(args.publish_id) + } + if (ioptions.publish_files instanceof Map) { + for (ext in ioptions.publish_files) { + if (args.filename.endsWith(ext.key)) { + def ext_list = path_list.collect() + ext_list.add(ext.value) + return "${getPathFromList(ext_list)}/$args.filename" + } + } + } else if (ioptions.publish_files == null) { + return "${getPathFromList(path_list)}/$args.filename" + } + } +} diff --git a/software/deeptools/plotheatmap/main.nf b/software/deeptools/plotheatmap/main.nf index d245922f..624b4b9e 100644 --- a/software/deeptools/plotheatmap/main.nf +++ b/software/deeptools/plotheatmap/main.nf @@ -20,7 +20,7 @@ process DEEPTOOLS_PLOTHEATMAP { input: tuple val(meta), path(matrix) - + output: tuple val(meta), path("*.pdf"), emit: pdf tuple val(meta), path("*.tab"), emit: table diff --git a/software/deeptools/plotprofile/functions.nf b/software/deeptools/plotprofile/functions.nf index b3ac3801..d25eea86 100644 --- a/software/deeptools/plotprofile/functions.nf +++ b/software/deeptools/plotprofile/functions.nf @@ -1,59 +1,59 @@ -/* - * ----------------------------------------------------- - * Utility functions used in nf-core DSL2 module files - * ----------------------------------------------------- - */ - -/* - * Extract name of software tool from process name using $task.process - */ -def getSoftwareName(task_process) { - return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() -} - -/* - * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules - */ -def initOptions(Map args) { - def Map options = [:] - options.args = args.args ?: '' - options.args2 = args.args2 ?: '' - options.publish_by_id = args.publish_by_id ?: false - options.publish_dir = args.publish_dir ?: '' - options.publish_files = args.publish_files - options.suffix = args.suffix ?: '' - return options -} - -/* - * Tidy up and join elements of a list to return a path string - */ -def getPathFromList(path_list) { - def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries - paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes - return paths.join('/') -} - -/* - * Function to save/publish module results - */ -def saveFiles(Map args) { - if (!args.filename.endsWith('.version.txt')) { - def ioptions = initOptions(args.options) - def path_list = [ ioptions.publish_dir ?: args.publish_dir ] - if (ioptions.publish_by_id) { - path_list.add(args.publish_id) - } - if (ioptions.publish_files instanceof Map) { - for (ext in ioptions.publish_files) { - if (args.filename.endsWith(ext.key)) { - def ext_list = path_list.collect() - ext_list.add(ext.value) - return "${getPathFromList(ext_list)}/$args.filename" - } - } - } else if (ioptions.publish_files == null) { - return "${getPathFromList(path_list)}/$args.filename" - } - } -} +/* + * ----------------------------------------------------- + * Utility functions used in nf-core DSL2 module files + * ----------------------------------------------------- + */ + +/* + * Extract name of software tool from process name using $task.process + */ +def getSoftwareName(task_process) { + return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() +} + +/* + * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules + */ +def initOptions(Map args) { + def Map options = [:] + options.args = args.args ?: '' + options.args2 = args.args2 ?: '' + options.publish_by_id = args.publish_by_id ?: false + options.publish_dir = args.publish_dir ?: '' + options.publish_files = args.publish_files + options.suffix = args.suffix ?: '' + return options +} + +/* + * Tidy up and join elements of a list to return a path string + */ +def getPathFromList(path_list) { + def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries + paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes + return paths.join('/') +} + +/* + * Function to save/publish module results + */ +def saveFiles(Map args) { + if (!args.filename.endsWith('.version.txt')) { + def ioptions = initOptions(args.options) + def path_list = [ ioptions.publish_dir ?: args.publish_dir ] + if (ioptions.publish_by_id) { + path_list.add(args.publish_id) + } + if (ioptions.publish_files instanceof Map) { + for (ext in ioptions.publish_files) { + if (args.filename.endsWith(ext.key)) { + def ext_list = path_list.collect() + ext_list.add(ext.value) + return "${getPathFromList(ext_list)}/$args.filename" + } + } + } else if (ioptions.publish_files == null) { + return "${getPathFromList(path_list)}/$args.filename" + } + } +} diff --git a/software/deeptools/plotprofile/main.nf b/software/deeptools/plotprofile/main.nf index 0657408b..d4326434 100644 --- a/software/deeptools/plotprofile/main.nf +++ b/software/deeptools/plotprofile/main.nf @@ -20,7 +20,7 @@ process DEEPTOOLS_PLOTPROFILE { input: tuple val(meta), path(matrix) - + output: tuple val(meta), path("*.pdf"), emit: pdf tuple val(meta), path("*.tab"), emit: table diff --git a/software/fastqc/functions.nf b/software/fastqc/functions.nf index b3ac3801..d25eea86 100644 --- a/software/fastqc/functions.nf +++ b/software/fastqc/functions.nf @@ -1,59 +1,59 @@ -/* - * ----------------------------------------------------- - * Utility functions used in nf-core DSL2 module files - * ----------------------------------------------------- - */ - -/* - * Extract name of software tool from process name using $task.process - */ -def getSoftwareName(task_process) { - return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() -} - -/* - * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules - */ -def initOptions(Map args) { - def Map options = [:] - options.args = args.args ?: '' - options.args2 = args.args2 ?: '' - options.publish_by_id = args.publish_by_id ?: false - options.publish_dir = args.publish_dir ?: '' - options.publish_files = args.publish_files - options.suffix = args.suffix ?: '' - return options -} - -/* - * Tidy up and join elements of a list to return a path string - */ -def getPathFromList(path_list) { - def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries - paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes - return paths.join('/') -} - -/* - * Function to save/publish module results - */ -def saveFiles(Map args) { - if (!args.filename.endsWith('.version.txt')) { - def ioptions = initOptions(args.options) - def path_list = [ ioptions.publish_dir ?: args.publish_dir ] - if (ioptions.publish_by_id) { - path_list.add(args.publish_id) - } - if (ioptions.publish_files instanceof Map) { - for (ext in ioptions.publish_files) { - if (args.filename.endsWith(ext.key)) { - def ext_list = path_list.collect() - ext_list.add(ext.value) - return "${getPathFromList(ext_list)}/$args.filename" - } - } - } else if (ioptions.publish_files == null) { - return "${getPathFromList(path_list)}/$args.filename" - } - } -} +/* + * ----------------------------------------------------- + * Utility functions used in nf-core DSL2 module files + * ----------------------------------------------------- + */ + +/* + * Extract name of software tool from process name using $task.process + */ +def getSoftwareName(task_process) { + return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() +} + +/* + * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules + */ +def initOptions(Map args) { + def Map options = [:] + options.args = args.args ?: '' + options.args2 = args.args2 ?: '' + options.publish_by_id = args.publish_by_id ?: false + options.publish_dir = args.publish_dir ?: '' + options.publish_files = args.publish_files + options.suffix = args.suffix ?: '' + return options +} + +/* + * Tidy up and join elements of a list to return a path string + */ +def getPathFromList(path_list) { + def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries + paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes + return paths.join('/') +} + +/* + * Function to save/publish module results + */ +def saveFiles(Map args) { + if (!args.filename.endsWith('.version.txt')) { + def ioptions = initOptions(args.options) + def path_list = [ ioptions.publish_dir ?: args.publish_dir ] + if (ioptions.publish_by_id) { + path_list.add(args.publish_id) + } + if (ioptions.publish_files instanceof Map) { + for (ext in ioptions.publish_files) { + if (args.filename.endsWith(ext.key)) { + def ext_list = path_list.collect() + ext_list.add(ext.value) + return "${getPathFromList(ext_list)}/$args.filename" + } + } + } else if (ioptions.publish_files == null) { + return "${getPathFromList(path_list)}/$args.filename" + } + } +} diff --git a/software/fastqc/main.nf b/software/fastqc/main.nf index 3cb510ac..cce410a0 100644 --- a/software/fastqc/main.nf +++ b/software/fastqc/main.nf @@ -17,10 +17,10 @@ process FASTQC { } else { container "quay.io/biocontainers/fastqc:0.11.9--0" } - + input: tuple val(meta), path(reads) - + output: tuple val(meta), path("*.html"), emit: html tuple val(meta), path("*.zip") , emit: zip diff --git a/software/gffread/functions.nf b/software/gffread/functions.nf index b3ac3801..d25eea86 100644 --- a/software/gffread/functions.nf +++ b/software/gffread/functions.nf @@ -1,59 +1,59 @@ -/* - * ----------------------------------------------------- - * Utility functions used in nf-core DSL2 module files - * ----------------------------------------------------- - */ - -/* - * Extract name of software tool from process name using $task.process - */ -def getSoftwareName(task_process) { - return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() -} - -/* - * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules - */ -def initOptions(Map args) { - def Map options = [:] - options.args = args.args ?: '' - options.args2 = args.args2 ?: '' - options.publish_by_id = args.publish_by_id ?: false - options.publish_dir = args.publish_dir ?: '' - options.publish_files = args.publish_files - options.suffix = args.suffix ?: '' - return options -} - -/* - * Tidy up and join elements of a list to return a path string - */ -def getPathFromList(path_list) { - def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries - paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes - return paths.join('/') -} - -/* - * Function to save/publish module results - */ -def saveFiles(Map args) { - if (!args.filename.endsWith('.version.txt')) { - def ioptions = initOptions(args.options) - def path_list = [ ioptions.publish_dir ?: args.publish_dir ] - if (ioptions.publish_by_id) { - path_list.add(args.publish_id) - } - if (ioptions.publish_files instanceof Map) { - for (ext in ioptions.publish_files) { - if (args.filename.endsWith(ext.key)) { - def ext_list = path_list.collect() - ext_list.add(ext.value) - return "${getPathFromList(ext_list)}/$args.filename" - } - } - } else if (ioptions.publish_files == null) { - return "${getPathFromList(path_list)}/$args.filename" - } - } -} +/* + * ----------------------------------------------------- + * Utility functions used in nf-core DSL2 module files + * ----------------------------------------------------- + */ + +/* + * Extract name of software tool from process name using $task.process + */ +def getSoftwareName(task_process) { + return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() +} + +/* + * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules + */ +def initOptions(Map args) { + def Map options = [:] + options.args = args.args ?: '' + options.args2 = args.args2 ?: '' + options.publish_by_id = args.publish_by_id ?: false + options.publish_dir = args.publish_dir ?: '' + options.publish_files = args.publish_files + options.suffix = args.suffix ?: '' + return options +} + +/* + * Tidy up and join elements of a list to return a path string + */ +def getPathFromList(path_list) { + def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries + paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes + return paths.join('/') +} + +/* + * Function to save/publish module results + */ +def saveFiles(Map args) { + if (!args.filename.endsWith('.version.txt')) { + def ioptions = initOptions(args.options) + def path_list = [ ioptions.publish_dir ?: args.publish_dir ] + if (ioptions.publish_by_id) { + path_list.add(args.publish_id) + } + if (ioptions.publish_files instanceof Map) { + for (ext in ioptions.publish_files) { + if (args.filename.endsWith(ext.key)) { + def ext_list = path_list.collect() + ext_list.add(ext.value) + return "${getPathFromList(ext_list)}/$args.filename" + } + } + } else if (ioptions.publish_files == null) { + return "${getPathFromList(path_list)}/$args.filename" + } + } +} diff --git a/software/gffread/main.nf b/software/gffread/main.nf index 0e446ac8..3d81a125 100644 --- a/software/gffread/main.nf +++ b/software/gffread/main.nf @@ -1,33 +1,33 @@ -// Import generic module functions -include { initOptions; saveFiles; getSoftwareName } from './functions' - -params.options = [:] -def options = initOptions(params.options) - -process GFFREAD { - tag "$gff" - publishDir "${params.outdir}", - mode: params.publish_dir_mode, - saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:'') } - - conda (params.enable_conda ? "bioconda::gffread=0.12.1" : null) - if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { - container "https://depot.galaxyproject.org/singularity/gffread:0.12.1--h8b12597_0" - } else { - container "quay.io/biocontainers/gffread:0.12.1--h8b12597_0" - } - - input: - path gff - - output: - path "*.gtf" , emit: gtf - path "*.version.txt", emit: version - - script: - def software = getSoftwareName(task.process) - """ - gffread $gff $options.args -o ${gff.baseName}.gtf - echo \$(gffread --version 2>&1) > ${software}.version.txt - """ -} +// Import generic module functions +include { initOptions; saveFiles; getSoftwareName } from './functions' + +params.options = [:] +def options = initOptions(params.options) + +process GFFREAD { + tag "$gff" + publishDir "${params.outdir}", + mode: params.publish_dir_mode, + saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:'') } + + conda (params.enable_conda ? "bioconda::gffread=0.12.1" : null) + if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { + container "https://depot.galaxyproject.org/singularity/gffread:0.12.1--h8b12597_0" + } else { + container "quay.io/biocontainers/gffread:0.12.1--h8b12597_0" + } + + input: + path gff + + output: + path "*.gtf" , emit: gtf + path "*.version.txt", emit: version + + script: + def software = getSoftwareName(task.process) + """ + gffread $gff $options.args -o ${gff.baseName}.gtf + echo \$(gffread --version 2>&1) > ${software}.version.txt + """ +} diff --git a/software/hisat2/align/functions.nf b/software/hisat2/align/functions.nf index b3ac3801..d25eea86 100644 --- a/software/hisat2/align/functions.nf +++ b/software/hisat2/align/functions.nf @@ -1,59 +1,59 @@ -/* - * ----------------------------------------------------- - * Utility functions used in nf-core DSL2 module files - * ----------------------------------------------------- - */ - -/* - * Extract name of software tool from process name using $task.process - */ -def getSoftwareName(task_process) { - return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() -} - -/* - * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules - */ -def initOptions(Map args) { - def Map options = [:] - options.args = args.args ?: '' - options.args2 = args.args2 ?: '' - options.publish_by_id = args.publish_by_id ?: false - options.publish_dir = args.publish_dir ?: '' - options.publish_files = args.publish_files - options.suffix = args.suffix ?: '' - return options -} - -/* - * Tidy up and join elements of a list to return a path string - */ -def getPathFromList(path_list) { - def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries - paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes - return paths.join('/') -} - -/* - * Function to save/publish module results - */ -def saveFiles(Map args) { - if (!args.filename.endsWith('.version.txt')) { - def ioptions = initOptions(args.options) - def path_list = [ ioptions.publish_dir ?: args.publish_dir ] - if (ioptions.publish_by_id) { - path_list.add(args.publish_id) - } - if (ioptions.publish_files instanceof Map) { - for (ext in ioptions.publish_files) { - if (args.filename.endsWith(ext.key)) { - def ext_list = path_list.collect() - ext_list.add(ext.value) - return "${getPathFromList(ext_list)}/$args.filename" - } - } - } else if (ioptions.publish_files == null) { - return "${getPathFromList(path_list)}/$args.filename" - } - } -} +/* + * ----------------------------------------------------- + * Utility functions used in nf-core DSL2 module files + * ----------------------------------------------------- + */ + +/* + * Extract name of software tool from process name using $task.process + */ +def getSoftwareName(task_process) { + return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() +} + +/* + * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules + */ +def initOptions(Map args) { + def Map options = [:] + options.args = args.args ?: '' + options.args2 = args.args2 ?: '' + options.publish_by_id = args.publish_by_id ?: false + options.publish_dir = args.publish_dir ?: '' + options.publish_files = args.publish_files + options.suffix = args.suffix ?: '' + return options +} + +/* + * Tidy up and join elements of a list to return a path string + */ +def getPathFromList(path_list) { + def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries + paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes + return paths.join('/') +} + +/* + * Function to save/publish module results + */ +def saveFiles(Map args) { + if (!args.filename.endsWith('.version.txt')) { + def ioptions = initOptions(args.options) + def path_list = [ ioptions.publish_dir ?: args.publish_dir ] + if (ioptions.publish_by_id) { + path_list.add(args.publish_id) + } + if (ioptions.publish_files instanceof Map) { + for (ext in ioptions.publish_files) { + if (args.filename.endsWith(ext.key)) { + def ext_list = path_list.collect() + ext_list.add(ext.value) + return "${getPathFromList(ext_list)}/$args.filename" + } + } + } else if (ioptions.publish_files == null) { + return "${getPathFromList(path_list)}/$args.filename" + } + } +} diff --git a/software/hisat2/align/main.nf b/software/hisat2/align/main.nf index ef37b7b7..4af22d6d 100644 --- a/software/hisat2/align/main.nf +++ b/software/hisat2/align/main.nf @@ -19,12 +19,12 @@ process HISAT2_ALIGN { } else { container "quay.io/biocontainers/mulled-v2-a97e90b3b802d1da3d6958e0867610c718cb5eb1:2880dd9d8ad0a7b221d4eacda9a818e92983128d-0" } - + input: tuple val(meta), path(reads) path index path splicesites - + output: tuple val(meta), path("*.bam"), emit: bam tuple val(meta), path("*.log"), emit: summary diff --git a/software/hisat2/build/functions.nf b/software/hisat2/build/functions.nf index b3ac3801..d25eea86 100644 --- a/software/hisat2/build/functions.nf +++ b/software/hisat2/build/functions.nf @@ -1,59 +1,59 @@ -/* - * ----------------------------------------------------- - * Utility functions used in nf-core DSL2 module files - * ----------------------------------------------------- - */ - -/* - * Extract name of software tool from process name using $task.process - */ -def getSoftwareName(task_process) { - return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() -} - -/* - * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules - */ -def initOptions(Map args) { - def Map options = [:] - options.args = args.args ?: '' - options.args2 = args.args2 ?: '' - options.publish_by_id = args.publish_by_id ?: false - options.publish_dir = args.publish_dir ?: '' - options.publish_files = args.publish_files - options.suffix = args.suffix ?: '' - return options -} - -/* - * Tidy up and join elements of a list to return a path string - */ -def getPathFromList(path_list) { - def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries - paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes - return paths.join('/') -} - -/* - * Function to save/publish module results - */ -def saveFiles(Map args) { - if (!args.filename.endsWith('.version.txt')) { - def ioptions = initOptions(args.options) - def path_list = [ ioptions.publish_dir ?: args.publish_dir ] - if (ioptions.publish_by_id) { - path_list.add(args.publish_id) - } - if (ioptions.publish_files instanceof Map) { - for (ext in ioptions.publish_files) { - if (args.filename.endsWith(ext.key)) { - def ext_list = path_list.collect() - ext_list.add(ext.value) - return "${getPathFromList(ext_list)}/$args.filename" - } - } - } else if (ioptions.publish_files == null) { - return "${getPathFromList(path_list)}/$args.filename" - } - } -} +/* + * ----------------------------------------------------- + * Utility functions used in nf-core DSL2 module files + * ----------------------------------------------------- + */ + +/* + * Extract name of software tool from process name using $task.process + */ +def getSoftwareName(task_process) { + return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() +} + +/* + * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules + */ +def initOptions(Map args) { + def Map options = [:] + options.args = args.args ?: '' + options.args2 = args.args2 ?: '' + options.publish_by_id = args.publish_by_id ?: false + options.publish_dir = args.publish_dir ?: '' + options.publish_files = args.publish_files + options.suffix = args.suffix ?: '' + return options +} + +/* + * Tidy up and join elements of a list to return a path string + */ +def getPathFromList(path_list) { + def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries + paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes + return paths.join('/') +} + +/* + * Function to save/publish module results + */ +def saveFiles(Map args) { + if (!args.filename.endsWith('.version.txt')) { + def ioptions = initOptions(args.options) + def path_list = [ ioptions.publish_dir ?: args.publish_dir ] + if (ioptions.publish_by_id) { + path_list.add(args.publish_id) + } + if (ioptions.publish_files instanceof Map) { + for (ext in ioptions.publish_files) { + if (args.filename.endsWith(ext.key)) { + def ext_list = path_list.collect() + ext_list.add(ext.value) + return "${getPathFromList(ext_list)}/$args.filename" + } + } + } else if (ioptions.publish_files == null) { + return "${getPathFromList(path_list)}/$args.filename" + } + } +} diff --git a/software/hisat2/build/main.nf b/software/hisat2/build/main.nf index 5d83118c..c703fd48 100644 --- a/software/hisat2/build/main.nf +++ b/software/hisat2/build/main.nf @@ -1,67 +1,67 @@ -// Import generic module functions -include { initOptions; saveFiles; getSoftwareName } from './functions' - -params.options = [:] -def options = initOptions(params.options) - -def VERSION = '2.2.0' - -process HISAT2_BUILD { - tag "$fasta" - publishDir "${params.outdir}", - mode: params.publish_dir_mode, - saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:'') } - - conda (params.enable_conda ? "bioconda::hisat2=2.2.0" : null) - if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { - container "https://depot.galaxyproject.org/singularity/hisat2:2.2.0--py37hfa133b6_4" - } else { - container "quay.io/biocontainers/hisat2:2.2.0--py37hfa133b6_4" - } - - input: - path fasta - path gtf - path splicesites - - output: - path "hisat2", emit: index - path "*.version.txt", emit: version - - script: - def avail_mem = 0 - if (!task.memory) { - log.info "[HISAT2 index build] Available memory not known - defaulting to 0. Specify process memory requirements to change this." - } else { - log.info "[HISAT2 index build] Available memory: ${task.memory}" - avail_mem = task.memory.toGiga() - } - - def extract_exons = '' - def ss = '' - def exon = '' - if (avail_mem > params.hisat_build_memory) { - log.info "[HISAT2 index build] Over ${params.hisat_build_memory} GB available, so using splice sites and exons in HISAT2 index" - extract_exons = "hisat2_extract_exons.py $gtf > ${gtf.baseName}.exons.txt" - ss = "--ss $splicesites" - exon = "--exon ${gtf.baseName}.exons.txt" - } else { - log.info "[HISAT2 index build] Less than ${params.hisat_build_memory} GB available, so NOT using splice sites and exons in HISAT2 index." - log.info "[HISAT2 index build] Use --hisat_build_memory [small number] to skip this check." - } - - def software = getSoftwareName(task.process) - """ - mkdir hisat2 - $extract_exons - hisat2-build \\ - -p $task.cpus \\ - $ss \\ - $exon \\ - $options.args \\ - $fasta \\ - hisat2/${fasta.baseName} - - echo $VERSION > ${software}.version.txt - """ -} +// Import generic module functions +include { initOptions; saveFiles; getSoftwareName } from './functions' + +params.options = [:] +def options = initOptions(params.options) + +def VERSION = '2.2.0' + +process HISAT2_BUILD { + tag "$fasta" + publishDir "${params.outdir}", + mode: params.publish_dir_mode, + saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:'') } + + conda (params.enable_conda ? "bioconda::hisat2=2.2.0" : null) + if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { + container "https://depot.galaxyproject.org/singularity/hisat2:2.2.0--py37hfa133b6_4" + } else { + container "quay.io/biocontainers/hisat2:2.2.0--py37hfa133b6_4" + } + + input: + path fasta + path gtf + path splicesites + + output: + path "hisat2", emit: index + path "*.version.txt", emit: version + + script: + def avail_mem = 0 + if (!task.memory) { + log.info "[HISAT2 index build] Available memory not known - defaulting to 0. Specify process memory requirements to change this." + } else { + log.info "[HISAT2 index build] Available memory: ${task.memory}" + avail_mem = task.memory.toGiga() + } + + def extract_exons = '' + def ss = '' + def exon = '' + if (avail_mem > params.hisat_build_memory) { + log.info "[HISAT2 index build] Over ${params.hisat_build_memory} GB available, so using splice sites and exons in HISAT2 index" + extract_exons = "hisat2_extract_exons.py $gtf > ${gtf.baseName}.exons.txt" + ss = "--ss $splicesites" + exon = "--exon ${gtf.baseName}.exons.txt" + } else { + log.info "[HISAT2 index build] Less than ${params.hisat_build_memory} GB available, so NOT using splice sites and exons in HISAT2 index." + log.info "[HISAT2 index build] Use --hisat_build_memory [small number] to skip this check." + } + + def software = getSoftwareName(task.process) + """ + mkdir hisat2 + $extract_exons + hisat2-build \\ + -p $task.cpus \\ + $ss \\ + $exon \\ + $options.args \\ + $fasta \\ + hisat2/${fasta.baseName} + + echo $VERSION > ${software}.version.txt + """ +} diff --git a/software/hisat2/extractsplicesites/functions.nf b/software/hisat2/extractsplicesites/functions.nf index b3ac3801..d25eea86 100644 --- a/software/hisat2/extractsplicesites/functions.nf +++ b/software/hisat2/extractsplicesites/functions.nf @@ -1,59 +1,59 @@ -/* - * ----------------------------------------------------- - * Utility functions used in nf-core DSL2 module files - * ----------------------------------------------------- - */ - -/* - * Extract name of software tool from process name using $task.process - */ -def getSoftwareName(task_process) { - return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() -} - -/* - * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules - */ -def initOptions(Map args) { - def Map options = [:] - options.args = args.args ?: '' - options.args2 = args.args2 ?: '' - options.publish_by_id = args.publish_by_id ?: false - options.publish_dir = args.publish_dir ?: '' - options.publish_files = args.publish_files - options.suffix = args.suffix ?: '' - return options -} - -/* - * Tidy up and join elements of a list to return a path string - */ -def getPathFromList(path_list) { - def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries - paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes - return paths.join('/') -} - -/* - * Function to save/publish module results - */ -def saveFiles(Map args) { - if (!args.filename.endsWith('.version.txt')) { - def ioptions = initOptions(args.options) - def path_list = [ ioptions.publish_dir ?: args.publish_dir ] - if (ioptions.publish_by_id) { - path_list.add(args.publish_id) - } - if (ioptions.publish_files instanceof Map) { - for (ext in ioptions.publish_files) { - if (args.filename.endsWith(ext.key)) { - def ext_list = path_list.collect() - ext_list.add(ext.value) - return "${getPathFromList(ext_list)}/$args.filename" - } - } - } else if (ioptions.publish_files == null) { - return "${getPathFromList(path_list)}/$args.filename" - } - } -} +/* + * ----------------------------------------------------- + * Utility functions used in nf-core DSL2 module files + * ----------------------------------------------------- + */ + +/* + * Extract name of software tool from process name using $task.process + */ +def getSoftwareName(task_process) { + return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() +} + +/* + * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules + */ +def initOptions(Map args) { + def Map options = [:] + options.args = args.args ?: '' + options.args2 = args.args2 ?: '' + options.publish_by_id = args.publish_by_id ?: false + options.publish_dir = args.publish_dir ?: '' + options.publish_files = args.publish_files + options.suffix = args.suffix ?: '' + return options +} + +/* + * Tidy up and join elements of a list to return a path string + */ +def getPathFromList(path_list) { + def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries + paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes + return paths.join('/') +} + +/* + * Function to save/publish module results + */ +def saveFiles(Map args) { + if (!args.filename.endsWith('.version.txt')) { + def ioptions = initOptions(args.options) + def path_list = [ ioptions.publish_dir ?: args.publish_dir ] + if (ioptions.publish_by_id) { + path_list.add(args.publish_id) + } + if (ioptions.publish_files instanceof Map) { + for (ext in ioptions.publish_files) { + if (args.filename.endsWith(ext.key)) { + def ext_list = path_list.collect() + ext_list.add(ext.value) + return "${getPathFromList(ext_list)}/$args.filename" + } + } + } else if (ioptions.publish_files == null) { + return "${getPathFromList(path_list)}/$args.filename" + } + } +} diff --git a/software/hisat2/extractsplicesites/main.nf b/software/hisat2/extractsplicesites/main.nf index 665f4703..2ff846a3 100644 --- a/software/hisat2/extractsplicesites/main.nf +++ b/software/hisat2/extractsplicesites/main.nf @@ -17,7 +17,7 @@ process HISAT2_EXTRACTSPLICESITES { } else { container "quay.io/biocontainers/hisat2:2.2.0--py37hfa133b6_4" } - + input: path gtf diff --git a/software/homer/annotatepeaks/functions.nf b/software/homer/annotatepeaks/functions.nf index b3ac3801..d25eea86 100644 --- a/software/homer/annotatepeaks/functions.nf +++ b/software/homer/annotatepeaks/functions.nf @@ -1,59 +1,59 @@ -/* - * ----------------------------------------------------- - * Utility functions used in nf-core DSL2 module files - * ----------------------------------------------------- - */ - -/* - * Extract name of software tool from process name using $task.process - */ -def getSoftwareName(task_process) { - return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() -} - -/* - * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules - */ -def initOptions(Map args) { - def Map options = [:] - options.args = args.args ?: '' - options.args2 = args.args2 ?: '' - options.publish_by_id = args.publish_by_id ?: false - options.publish_dir = args.publish_dir ?: '' - options.publish_files = args.publish_files - options.suffix = args.suffix ?: '' - return options -} - -/* - * Tidy up and join elements of a list to return a path string - */ -def getPathFromList(path_list) { - def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries - paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes - return paths.join('/') -} - -/* - * Function to save/publish module results - */ -def saveFiles(Map args) { - if (!args.filename.endsWith('.version.txt')) { - def ioptions = initOptions(args.options) - def path_list = [ ioptions.publish_dir ?: args.publish_dir ] - if (ioptions.publish_by_id) { - path_list.add(args.publish_id) - } - if (ioptions.publish_files instanceof Map) { - for (ext in ioptions.publish_files) { - if (args.filename.endsWith(ext.key)) { - def ext_list = path_list.collect() - ext_list.add(ext.value) - return "${getPathFromList(ext_list)}/$args.filename" - } - } - } else if (ioptions.publish_files == null) { - return "${getPathFromList(path_list)}/$args.filename" - } - } -} +/* + * ----------------------------------------------------- + * Utility functions used in nf-core DSL2 module files + * ----------------------------------------------------- + */ + +/* + * Extract name of software tool from process name using $task.process + */ +def getSoftwareName(task_process) { + return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() +} + +/* + * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules + */ +def initOptions(Map args) { + def Map options = [:] + options.args = args.args ?: '' + options.args2 = args.args2 ?: '' + options.publish_by_id = args.publish_by_id ?: false + options.publish_dir = args.publish_dir ?: '' + options.publish_files = args.publish_files + options.suffix = args.suffix ?: '' + return options +} + +/* + * Tidy up and join elements of a list to return a path string + */ +def getPathFromList(path_list) { + def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries + paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes + return paths.join('/') +} + +/* + * Function to save/publish module results + */ +def saveFiles(Map args) { + if (!args.filename.endsWith('.version.txt')) { + def ioptions = initOptions(args.options) + def path_list = [ ioptions.publish_dir ?: args.publish_dir ] + if (ioptions.publish_by_id) { + path_list.add(args.publish_id) + } + if (ioptions.publish_files instanceof Map) { + for (ext in ioptions.publish_files) { + if (args.filename.endsWith(ext.key)) { + def ext_list = path_list.collect() + ext_list.add(ext.value) + return "${getPathFromList(ext_list)}/$args.filename" + } + } + } else if (ioptions.publish_files == null) { + return "${getPathFromList(path_list)}/$args.filename" + } + } +} diff --git a/software/lib/functions.nf b/software/lib/functions.nf index b3ac3801..d25eea86 100644 --- a/software/lib/functions.nf +++ b/software/lib/functions.nf @@ -1,59 +1,59 @@ -/* - * ----------------------------------------------------- - * Utility functions used in nf-core DSL2 module files - * ----------------------------------------------------- - */ - -/* - * Extract name of software tool from process name using $task.process - */ -def getSoftwareName(task_process) { - return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() -} - -/* - * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules - */ -def initOptions(Map args) { - def Map options = [:] - options.args = args.args ?: '' - options.args2 = args.args2 ?: '' - options.publish_by_id = args.publish_by_id ?: false - options.publish_dir = args.publish_dir ?: '' - options.publish_files = args.publish_files - options.suffix = args.suffix ?: '' - return options -} - -/* - * Tidy up and join elements of a list to return a path string - */ -def getPathFromList(path_list) { - def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries - paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes - return paths.join('/') -} - -/* - * Function to save/publish module results - */ -def saveFiles(Map args) { - if (!args.filename.endsWith('.version.txt')) { - def ioptions = initOptions(args.options) - def path_list = [ ioptions.publish_dir ?: args.publish_dir ] - if (ioptions.publish_by_id) { - path_list.add(args.publish_id) - } - if (ioptions.publish_files instanceof Map) { - for (ext in ioptions.publish_files) { - if (args.filename.endsWith(ext.key)) { - def ext_list = path_list.collect() - ext_list.add(ext.value) - return "${getPathFromList(ext_list)}/$args.filename" - } - } - } else if (ioptions.publish_files == null) { - return "${getPathFromList(path_list)}/$args.filename" - } - } -} +/* + * ----------------------------------------------------- + * Utility functions used in nf-core DSL2 module files + * ----------------------------------------------------- + */ + +/* + * Extract name of software tool from process name using $task.process + */ +def getSoftwareName(task_process) { + return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() +} + +/* + * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules + */ +def initOptions(Map args) { + def Map options = [:] + options.args = args.args ?: '' + options.args2 = args.args2 ?: '' + options.publish_by_id = args.publish_by_id ?: false + options.publish_dir = args.publish_dir ?: '' + options.publish_files = args.publish_files + options.suffix = args.suffix ?: '' + return options +} + +/* + * Tidy up and join elements of a list to return a path string + */ +def getPathFromList(path_list) { + def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries + paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes + return paths.join('/') +} + +/* + * Function to save/publish module results + */ +def saveFiles(Map args) { + if (!args.filename.endsWith('.version.txt')) { + def ioptions = initOptions(args.options) + def path_list = [ ioptions.publish_dir ?: args.publish_dir ] + if (ioptions.publish_by_id) { + path_list.add(args.publish_id) + } + if (ioptions.publish_files instanceof Map) { + for (ext in ioptions.publish_files) { + if (args.filename.endsWith(ext.key)) { + def ext_list = path_list.collect() + ext_list.add(ext.value) + return "${getPathFromList(ext_list)}/$args.filename" + } + } + } else if (ioptions.publish_files == null) { + return "${getPathFromList(path_list)}/$args.filename" + } + } +} diff --git a/software/macs2/callpeak/functions.nf b/software/macs2/callpeak/functions.nf index 6fa66a28..85ebd767 100644 --- a/software/macs2/callpeak/functions.nf +++ b/software/macs2/callpeak/functions.nf @@ -1,59 +1,59 @@ -/* - * ----------------------------------------------------- - * Utility functions used in nf-core DSL2 module files - * ----------------------------------------------------- - */ - -/* - * Extract name of software tool from process name using $task.process - */ -def getSoftwareName(task_process) { - return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() -} - -/* - * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules - */ -def initOptions(Map args) { - def Map options = [:] - options.args = args.args ?: '' - options.args2 = args.args2 ?: '' - options.publish_by_id = args.publish_by_id ?: false - options.publish_dir = args.publish_dir ?: '' - options.publish_files = (args.publish_files instanceof Map) ? args.publish_files : null - options.suffix = args.suffix ?: '' - return options -} - -/* - * Tidy up and join elements of a list to return a path string - */ -def getPathFromList(path_list) { - def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries - paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes - return paths.join('/') -} - -/* - * Function to save/publish module results - */ -def saveFiles(Map args) { - if (!args.filename.endsWith('.version.txt')) { - def ioptions = initOptions(args.options) - def path_list = [ ioptions.publish_dir ?: args.publish_dir ] - if (ioptions.publish_by_id) { - path_list.add(args.publish_id) - } - if (ioptions.publish_files instanceof Map) { - for (ext in ioptions.publish_files) { - if (args.filename.endsWith(ext.key)) { - def ext_list = path_list.collect() - ext_list.add(ext.value) - return "${getPathFromList(ext_list)}/$args.filename" - } - } - } else { - return "${getPathFromList(path_list)}/$args.filename" - } - } -} +/* + * ----------------------------------------------------- + * Utility functions used in nf-core DSL2 module files + * ----------------------------------------------------- + */ + +/* + * Extract name of software tool from process name using $task.process + */ +def getSoftwareName(task_process) { + return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() +} + +/* + * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules + */ +def initOptions(Map args) { + def Map options = [:] + options.args = args.args ?: '' + options.args2 = args.args2 ?: '' + options.publish_by_id = args.publish_by_id ?: false + options.publish_dir = args.publish_dir ?: '' + options.publish_files = (args.publish_files instanceof Map) ? args.publish_files : null + options.suffix = args.suffix ?: '' + return options +} + +/* + * Tidy up and join elements of a list to return a path string + */ +def getPathFromList(path_list) { + def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries + paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes + return paths.join('/') +} + +/* + * Function to save/publish module results + */ +def saveFiles(Map args) { + if (!args.filename.endsWith('.version.txt')) { + def ioptions = initOptions(args.options) + def path_list = [ ioptions.publish_dir ?: args.publish_dir ] + if (ioptions.publish_by_id) { + path_list.add(args.publish_id) + } + if (ioptions.publish_files instanceof Map) { + for (ext in ioptions.publish_files) { + if (args.filename.endsWith(ext.key)) { + def ext_list = path_list.collect() + ext_list.add(ext.value) + return "${getPathFromList(ext_list)}/$args.filename" + } + } + } else { + return "${getPathFromList(path_list)}/$args.filename" + } + } +} diff --git a/software/macs2/callpeak/main.nf b/software/macs2/callpeak/main.nf index 0206fe85..de518669 100644 --- a/software/macs2/callpeak/main.nf +++ b/software/macs2/callpeak/main.nf @@ -21,7 +21,7 @@ process MACS2_CALLPEAK { input: tuple val(meta), path(ipbam), path(controlbam) val macs2_gsize - + output: tuple val(meta), path("*.{narrowPeak,broadPeak}"), emit: peak tuple val(meta), path("*.xls") , emit: xls @@ -44,7 +44,7 @@ process MACS2_CALLPEAK { --format $format \\ --name $prefix \\ --treatment $ipbam \\ - $control + $control macs2 --version | sed -e "s/macs2 //g" > ${software}.version.txt """ diff --git a/software/phantompeakqualtools/functions.nf b/software/phantompeakqualtools/functions.nf index b3ac3801..d25eea86 100644 --- a/software/phantompeakqualtools/functions.nf +++ b/software/phantompeakqualtools/functions.nf @@ -1,59 +1,59 @@ -/* - * ----------------------------------------------------- - * Utility functions used in nf-core DSL2 module files - * ----------------------------------------------------- - */ - -/* - * Extract name of software tool from process name using $task.process - */ -def getSoftwareName(task_process) { - return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() -} - -/* - * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules - */ -def initOptions(Map args) { - def Map options = [:] - options.args = args.args ?: '' - options.args2 = args.args2 ?: '' - options.publish_by_id = args.publish_by_id ?: false - options.publish_dir = args.publish_dir ?: '' - options.publish_files = args.publish_files - options.suffix = args.suffix ?: '' - return options -} - -/* - * Tidy up and join elements of a list to return a path string - */ -def getPathFromList(path_list) { - def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries - paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes - return paths.join('/') -} - -/* - * Function to save/publish module results - */ -def saveFiles(Map args) { - if (!args.filename.endsWith('.version.txt')) { - def ioptions = initOptions(args.options) - def path_list = [ ioptions.publish_dir ?: args.publish_dir ] - if (ioptions.publish_by_id) { - path_list.add(args.publish_id) - } - if (ioptions.publish_files instanceof Map) { - for (ext in ioptions.publish_files) { - if (args.filename.endsWith(ext.key)) { - def ext_list = path_list.collect() - ext_list.add(ext.value) - return "${getPathFromList(ext_list)}/$args.filename" - } - } - } else if (ioptions.publish_files == null) { - return "${getPathFromList(path_list)}/$args.filename" - } - } -} +/* + * ----------------------------------------------------- + * Utility functions used in nf-core DSL2 module files + * ----------------------------------------------------- + */ + +/* + * Extract name of software tool from process name using $task.process + */ +def getSoftwareName(task_process) { + return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() +} + +/* + * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules + */ +def initOptions(Map args) { + def Map options = [:] + options.args = args.args ?: '' + options.args2 = args.args2 ?: '' + options.publish_by_id = args.publish_by_id ?: false + options.publish_dir = args.publish_dir ?: '' + options.publish_files = args.publish_files + options.suffix = args.suffix ?: '' + return options +} + +/* + * Tidy up and join elements of a list to return a path string + */ +def getPathFromList(path_list) { + def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries + paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes + return paths.join('/') +} + +/* + * Function to save/publish module results + */ +def saveFiles(Map args) { + if (!args.filename.endsWith('.version.txt')) { + def ioptions = initOptions(args.options) + def path_list = [ ioptions.publish_dir ?: args.publish_dir ] + if (ioptions.publish_by_id) { + path_list.add(args.publish_id) + } + if (ioptions.publish_files instanceof Map) { + for (ext in ioptions.publish_files) { + if (args.filename.endsWith(ext.key)) { + def ext_list = path_list.collect() + ext_list.add(ext.value) + return "${getPathFromList(ext_list)}/$args.filename" + } + } + } else if (ioptions.publish_files == null) { + return "${getPathFromList(path_list)}/$args.filename" + } + } +} diff --git a/software/phantompeakqualtools/main.nf b/software/phantompeakqualtools/main.nf index 1e9e1740..19a7c388 100644 --- a/software/phantompeakqualtools/main.nf +++ b/software/phantompeakqualtools/main.nf @@ -19,10 +19,10 @@ process PHANTOMPEAKQUALTOOLS { } else { container "quay.io/biocontainers/phantompeakqualtools:1.2.2--0" } - + input: tuple val(meta), path(bam) - + output: tuple val(meta), path("*.out") , emit: spp tuple val(meta), path("*.pdf") , emit: pdf diff --git a/software/picard/collectmultiplemetrics/functions.nf b/software/picard/collectmultiplemetrics/functions.nf index b3ac3801..d25eea86 100644 --- a/software/picard/collectmultiplemetrics/functions.nf +++ b/software/picard/collectmultiplemetrics/functions.nf @@ -1,59 +1,59 @@ -/* - * ----------------------------------------------------- - * Utility functions used in nf-core DSL2 module files - * ----------------------------------------------------- - */ - -/* - * Extract name of software tool from process name using $task.process - */ -def getSoftwareName(task_process) { - return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() -} - -/* - * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules - */ -def initOptions(Map args) { - def Map options = [:] - options.args = args.args ?: '' - options.args2 = args.args2 ?: '' - options.publish_by_id = args.publish_by_id ?: false - options.publish_dir = args.publish_dir ?: '' - options.publish_files = args.publish_files - options.suffix = args.suffix ?: '' - return options -} - -/* - * Tidy up and join elements of a list to return a path string - */ -def getPathFromList(path_list) { - def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries - paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes - return paths.join('/') -} - -/* - * Function to save/publish module results - */ -def saveFiles(Map args) { - if (!args.filename.endsWith('.version.txt')) { - def ioptions = initOptions(args.options) - def path_list = [ ioptions.publish_dir ?: args.publish_dir ] - if (ioptions.publish_by_id) { - path_list.add(args.publish_id) - } - if (ioptions.publish_files instanceof Map) { - for (ext in ioptions.publish_files) { - if (args.filename.endsWith(ext.key)) { - def ext_list = path_list.collect() - ext_list.add(ext.value) - return "${getPathFromList(ext_list)}/$args.filename" - } - } - } else if (ioptions.publish_files == null) { - return "${getPathFromList(path_list)}/$args.filename" - } - } -} +/* + * ----------------------------------------------------- + * Utility functions used in nf-core DSL2 module files + * ----------------------------------------------------- + */ + +/* + * Extract name of software tool from process name using $task.process + */ +def getSoftwareName(task_process) { + return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() +} + +/* + * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules + */ +def initOptions(Map args) { + def Map options = [:] + options.args = args.args ?: '' + options.args2 = args.args2 ?: '' + options.publish_by_id = args.publish_by_id ?: false + options.publish_dir = args.publish_dir ?: '' + options.publish_files = args.publish_files + options.suffix = args.suffix ?: '' + return options +} + +/* + * Tidy up and join elements of a list to return a path string + */ +def getPathFromList(path_list) { + def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries + paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes + return paths.join('/') +} + +/* + * Function to save/publish module results + */ +def saveFiles(Map args) { + if (!args.filename.endsWith('.version.txt')) { + def ioptions = initOptions(args.options) + def path_list = [ ioptions.publish_dir ?: args.publish_dir ] + if (ioptions.publish_by_id) { + path_list.add(args.publish_id) + } + if (ioptions.publish_files instanceof Map) { + for (ext in ioptions.publish_files) { + if (args.filename.endsWith(ext.key)) { + def ext_list = path_list.collect() + ext_list.add(ext.value) + return "${getPathFromList(ext_list)}/$args.filename" + } + } + } else if (ioptions.publish_files == null) { + return "${getPathFromList(path_list)}/$args.filename" + } + } +} diff --git a/software/picard/markduplicates/functions.nf b/software/picard/markduplicates/functions.nf index b3ac3801..d25eea86 100644 --- a/software/picard/markduplicates/functions.nf +++ b/software/picard/markduplicates/functions.nf @@ -1,59 +1,59 @@ -/* - * ----------------------------------------------------- - * Utility functions used in nf-core DSL2 module files - * ----------------------------------------------------- - */ - -/* - * Extract name of software tool from process name using $task.process - */ -def getSoftwareName(task_process) { - return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() -} - -/* - * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules - */ -def initOptions(Map args) { - def Map options = [:] - options.args = args.args ?: '' - options.args2 = args.args2 ?: '' - options.publish_by_id = args.publish_by_id ?: false - options.publish_dir = args.publish_dir ?: '' - options.publish_files = args.publish_files - options.suffix = args.suffix ?: '' - return options -} - -/* - * Tidy up and join elements of a list to return a path string - */ -def getPathFromList(path_list) { - def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries - paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes - return paths.join('/') -} - -/* - * Function to save/publish module results - */ -def saveFiles(Map args) { - if (!args.filename.endsWith('.version.txt')) { - def ioptions = initOptions(args.options) - def path_list = [ ioptions.publish_dir ?: args.publish_dir ] - if (ioptions.publish_by_id) { - path_list.add(args.publish_id) - } - if (ioptions.publish_files instanceof Map) { - for (ext in ioptions.publish_files) { - if (args.filename.endsWith(ext.key)) { - def ext_list = path_list.collect() - ext_list.add(ext.value) - return "${getPathFromList(ext_list)}/$args.filename" - } - } - } else if (ioptions.publish_files == null) { - return "${getPathFromList(path_list)}/$args.filename" - } - } -} +/* + * ----------------------------------------------------- + * Utility functions used in nf-core DSL2 module files + * ----------------------------------------------------- + */ + +/* + * Extract name of software tool from process name using $task.process + */ +def getSoftwareName(task_process) { + return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() +} + +/* + * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules + */ +def initOptions(Map args) { + def Map options = [:] + options.args = args.args ?: '' + options.args2 = args.args2 ?: '' + options.publish_by_id = args.publish_by_id ?: false + options.publish_dir = args.publish_dir ?: '' + options.publish_files = args.publish_files + options.suffix = args.suffix ?: '' + return options +} + +/* + * Tidy up and join elements of a list to return a path string + */ +def getPathFromList(path_list) { + def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries + paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes + return paths.join('/') +} + +/* + * Function to save/publish module results + */ +def saveFiles(Map args) { + if (!args.filename.endsWith('.version.txt')) { + def ioptions = initOptions(args.options) + def path_list = [ ioptions.publish_dir ?: args.publish_dir ] + if (ioptions.publish_by_id) { + path_list.add(args.publish_id) + } + if (ioptions.publish_files instanceof Map) { + for (ext in ioptions.publish_files) { + if (args.filename.endsWith(ext.key)) { + def ext_list = path_list.collect() + ext_list.add(ext.value) + return "${getPathFromList(ext_list)}/$args.filename" + } + } + } else if (ioptions.publish_files == null) { + return "${getPathFromList(path_list)}/$args.filename" + } + } +} diff --git a/software/picard/markduplicates/main.nf b/software/picard/markduplicates/main.nf index 33245e0a..958f4502 100644 --- a/software/picard/markduplicates/main.nf +++ b/software/picard/markduplicates/main.nf @@ -10,7 +10,7 @@ process PICARD_MARKDUPLICATES { publishDir "${params.outdir}", mode: params.publish_dir_mode, saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) } - + conda (params.enable_conda ? "bioconda::picard=2.23.9" : null) if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { container "https://depot.galaxyproject.org/singularity/picard:2.23.9--0" @@ -20,7 +20,7 @@ process PICARD_MARKDUPLICATES { input: tuple val(meta), path(bam) - + output: tuple val(meta), path("*.bam") , emit: bam tuple val(meta), path("*.metrics.txt"), emit: metrics diff --git a/software/picard/mergesamfiles/functions.nf b/software/picard/mergesamfiles/functions.nf index b3ac3801..d25eea86 100644 --- a/software/picard/mergesamfiles/functions.nf +++ b/software/picard/mergesamfiles/functions.nf @@ -1,59 +1,59 @@ -/* - * ----------------------------------------------------- - * Utility functions used in nf-core DSL2 module files - * ----------------------------------------------------- - */ - -/* - * Extract name of software tool from process name using $task.process - */ -def getSoftwareName(task_process) { - return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() -} - -/* - * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules - */ -def initOptions(Map args) { - def Map options = [:] - options.args = args.args ?: '' - options.args2 = args.args2 ?: '' - options.publish_by_id = args.publish_by_id ?: false - options.publish_dir = args.publish_dir ?: '' - options.publish_files = args.publish_files - options.suffix = args.suffix ?: '' - return options -} - -/* - * Tidy up and join elements of a list to return a path string - */ -def getPathFromList(path_list) { - def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries - paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes - return paths.join('/') -} - -/* - * Function to save/publish module results - */ -def saveFiles(Map args) { - if (!args.filename.endsWith('.version.txt')) { - def ioptions = initOptions(args.options) - def path_list = [ ioptions.publish_dir ?: args.publish_dir ] - if (ioptions.publish_by_id) { - path_list.add(args.publish_id) - } - if (ioptions.publish_files instanceof Map) { - for (ext in ioptions.publish_files) { - if (args.filename.endsWith(ext.key)) { - def ext_list = path_list.collect() - ext_list.add(ext.value) - return "${getPathFromList(ext_list)}/$args.filename" - } - } - } else if (ioptions.publish_files == null) { - return "${getPathFromList(path_list)}/$args.filename" - } - } -} +/* + * ----------------------------------------------------- + * Utility functions used in nf-core DSL2 module files + * ----------------------------------------------------- + */ + +/* + * Extract name of software tool from process name using $task.process + */ +def getSoftwareName(task_process) { + return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() +} + +/* + * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules + */ +def initOptions(Map args) { + def Map options = [:] + options.args = args.args ?: '' + options.args2 = args.args2 ?: '' + options.publish_by_id = args.publish_by_id ?: false + options.publish_dir = args.publish_dir ?: '' + options.publish_files = args.publish_files + options.suffix = args.suffix ?: '' + return options +} + +/* + * Tidy up and join elements of a list to return a path string + */ +def getPathFromList(path_list) { + def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries + paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes + return paths.join('/') +} + +/* + * Function to save/publish module results + */ +def saveFiles(Map args) { + if (!args.filename.endsWith('.version.txt')) { + def ioptions = initOptions(args.options) + def path_list = [ ioptions.publish_dir ?: args.publish_dir ] + if (ioptions.publish_by_id) { + path_list.add(args.publish_id) + } + if (ioptions.publish_files instanceof Map) { + for (ext in ioptions.publish_files) { + if (args.filename.endsWith(ext.key)) { + def ext_list = path_list.collect() + ext_list.add(ext.value) + return "${getPathFromList(ext_list)}/$args.filename" + } + } + } else if (ioptions.publish_files == null) { + return "${getPathFromList(path_list)}/$args.filename" + } + } +} diff --git a/software/picard/mergesamfiles/main.nf b/software/picard/mergesamfiles/main.nf index 2c356dff..400fecde 100644 --- a/software/picard/mergesamfiles/main.nf +++ b/software/picard/mergesamfiles/main.nf @@ -20,7 +20,7 @@ process PICARD_MERGESAMFILES { input: tuple val(meta), path(bams) - + output: tuple val(meta), path("*.bam"), emit: bam path "*.version.txt" , emit: version diff --git a/software/preseq/lcextrap/functions.nf b/software/preseq/lcextrap/functions.nf index b3ac3801..d25eea86 100644 --- a/software/preseq/lcextrap/functions.nf +++ b/software/preseq/lcextrap/functions.nf @@ -1,59 +1,59 @@ -/* - * ----------------------------------------------------- - * Utility functions used in nf-core DSL2 module files - * ----------------------------------------------------- - */ - -/* - * Extract name of software tool from process name using $task.process - */ -def getSoftwareName(task_process) { - return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() -} - -/* - * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules - */ -def initOptions(Map args) { - def Map options = [:] - options.args = args.args ?: '' - options.args2 = args.args2 ?: '' - options.publish_by_id = args.publish_by_id ?: false - options.publish_dir = args.publish_dir ?: '' - options.publish_files = args.publish_files - options.suffix = args.suffix ?: '' - return options -} - -/* - * Tidy up and join elements of a list to return a path string - */ -def getPathFromList(path_list) { - def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries - paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes - return paths.join('/') -} - -/* - * Function to save/publish module results - */ -def saveFiles(Map args) { - if (!args.filename.endsWith('.version.txt')) { - def ioptions = initOptions(args.options) - def path_list = [ ioptions.publish_dir ?: args.publish_dir ] - if (ioptions.publish_by_id) { - path_list.add(args.publish_id) - } - if (ioptions.publish_files instanceof Map) { - for (ext in ioptions.publish_files) { - if (args.filename.endsWith(ext.key)) { - def ext_list = path_list.collect() - ext_list.add(ext.value) - return "${getPathFromList(ext_list)}/$args.filename" - } - } - } else if (ioptions.publish_files == null) { - return "${getPathFromList(path_list)}/$args.filename" - } - } -} +/* + * ----------------------------------------------------- + * Utility functions used in nf-core DSL2 module files + * ----------------------------------------------------- + */ + +/* + * Extract name of software tool from process name using $task.process + */ +def getSoftwareName(task_process) { + return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() +} + +/* + * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules + */ +def initOptions(Map args) { + def Map options = [:] + options.args = args.args ?: '' + options.args2 = args.args2 ?: '' + options.publish_by_id = args.publish_by_id ?: false + options.publish_dir = args.publish_dir ?: '' + options.publish_files = args.publish_files + options.suffix = args.suffix ?: '' + return options +} + +/* + * Tidy up and join elements of a list to return a path string + */ +def getPathFromList(path_list) { + def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries + paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes + return paths.join('/') +} + +/* + * Function to save/publish module results + */ +def saveFiles(Map args) { + if (!args.filename.endsWith('.version.txt')) { + def ioptions = initOptions(args.options) + def path_list = [ ioptions.publish_dir ?: args.publish_dir ] + if (ioptions.publish_by_id) { + path_list.add(args.publish_id) + } + if (ioptions.publish_files instanceof Map) { + for (ext in ioptions.publish_files) { + if (args.filename.endsWith(ext.key)) { + def ext_list = path_list.collect() + ext_list.add(ext.value) + return "${getPathFromList(ext_list)}/$args.filename" + } + } + } else if (ioptions.publish_files == null) { + return "${getPathFromList(path_list)}/$args.filename" + } + } +} diff --git a/software/preseq/lcextrap/main.nf b/software/preseq/lcextrap/main.nf index 56645274..7be82eb8 100644 --- a/software/preseq/lcextrap/main.nf +++ b/software/preseq/lcextrap/main.nf @@ -18,10 +18,10 @@ process PRESEQ_LCEXTRAP { } else { container "quay.io/biocontainers/preseq:2.0.3--hf53bd2b_3" } - + input: tuple val(meta), path(bam) - + output: tuple val(meta), path("*.ccurve.txt"), emit: ccurve tuple val(meta), path("*.log") , emit: log diff --git a/software/qualimap/rnaseq/functions.nf b/software/qualimap/rnaseq/functions.nf index b3ac3801..d25eea86 100644 --- a/software/qualimap/rnaseq/functions.nf +++ b/software/qualimap/rnaseq/functions.nf @@ -1,59 +1,59 @@ -/* - * ----------------------------------------------------- - * Utility functions used in nf-core DSL2 module files - * ----------------------------------------------------- - */ - -/* - * Extract name of software tool from process name using $task.process - */ -def getSoftwareName(task_process) { - return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() -} - -/* - * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules - */ -def initOptions(Map args) { - def Map options = [:] - options.args = args.args ?: '' - options.args2 = args.args2 ?: '' - options.publish_by_id = args.publish_by_id ?: false - options.publish_dir = args.publish_dir ?: '' - options.publish_files = args.publish_files - options.suffix = args.suffix ?: '' - return options -} - -/* - * Tidy up and join elements of a list to return a path string - */ -def getPathFromList(path_list) { - def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries - paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes - return paths.join('/') -} - -/* - * Function to save/publish module results - */ -def saveFiles(Map args) { - if (!args.filename.endsWith('.version.txt')) { - def ioptions = initOptions(args.options) - def path_list = [ ioptions.publish_dir ?: args.publish_dir ] - if (ioptions.publish_by_id) { - path_list.add(args.publish_id) - } - if (ioptions.publish_files instanceof Map) { - for (ext in ioptions.publish_files) { - if (args.filename.endsWith(ext.key)) { - def ext_list = path_list.collect() - ext_list.add(ext.value) - return "${getPathFromList(ext_list)}/$args.filename" - } - } - } else if (ioptions.publish_files == null) { - return "${getPathFromList(path_list)}/$args.filename" - } - } -} +/* + * ----------------------------------------------------- + * Utility functions used in nf-core DSL2 module files + * ----------------------------------------------------- + */ + +/* + * Extract name of software tool from process name using $task.process + */ +def getSoftwareName(task_process) { + return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() +} + +/* + * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules + */ +def initOptions(Map args) { + def Map options = [:] + options.args = args.args ?: '' + options.args2 = args.args2 ?: '' + options.publish_by_id = args.publish_by_id ?: false + options.publish_dir = args.publish_dir ?: '' + options.publish_files = args.publish_files + options.suffix = args.suffix ?: '' + return options +} + +/* + * Tidy up and join elements of a list to return a path string + */ +def getPathFromList(path_list) { + def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries + paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes + return paths.join('/') +} + +/* + * Function to save/publish module results + */ +def saveFiles(Map args) { + if (!args.filename.endsWith('.version.txt')) { + def ioptions = initOptions(args.options) + def path_list = [ ioptions.publish_dir ?: args.publish_dir ] + if (ioptions.publish_by_id) { + path_list.add(args.publish_id) + } + if (ioptions.publish_files instanceof Map) { + for (ext in ioptions.publish_files) { + if (args.filename.endsWith(ext.key)) { + def ext_list = path_list.collect() + ext_list.add(ext.value) + return "${getPathFromList(ext_list)}/$args.filename" + } + } + } else if (ioptions.publish_files == null) { + return "${getPathFromList(path_list)}/$args.filename" + } + } +} diff --git a/software/qualimap/rnaseq/main.nf b/software/qualimap/rnaseq/main.nf index adbc7865..c649bb50 100644 --- a/software/qualimap/rnaseq/main.nf +++ b/software/qualimap/rnaseq/main.nf @@ -21,7 +21,7 @@ process QUALIMAP_RNASEQ { input: tuple val(meta), path(bam) path gtf - + output: tuple val(meta), path("${prefix}"), emit: results path "*.version.txt" , emit: version diff --git a/software/rsem/calculateexpression/functions.nf b/software/rsem/calculateexpression/functions.nf index b3ac3801..d25eea86 100644 --- a/software/rsem/calculateexpression/functions.nf +++ b/software/rsem/calculateexpression/functions.nf @@ -1,59 +1,59 @@ -/* - * ----------------------------------------------------- - * Utility functions used in nf-core DSL2 module files - * ----------------------------------------------------- - */ - -/* - * Extract name of software tool from process name using $task.process - */ -def getSoftwareName(task_process) { - return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() -} - -/* - * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules - */ -def initOptions(Map args) { - def Map options = [:] - options.args = args.args ?: '' - options.args2 = args.args2 ?: '' - options.publish_by_id = args.publish_by_id ?: false - options.publish_dir = args.publish_dir ?: '' - options.publish_files = args.publish_files - options.suffix = args.suffix ?: '' - return options -} - -/* - * Tidy up and join elements of a list to return a path string - */ -def getPathFromList(path_list) { - def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries - paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes - return paths.join('/') -} - -/* - * Function to save/publish module results - */ -def saveFiles(Map args) { - if (!args.filename.endsWith('.version.txt')) { - def ioptions = initOptions(args.options) - def path_list = [ ioptions.publish_dir ?: args.publish_dir ] - if (ioptions.publish_by_id) { - path_list.add(args.publish_id) - } - if (ioptions.publish_files instanceof Map) { - for (ext in ioptions.publish_files) { - if (args.filename.endsWith(ext.key)) { - def ext_list = path_list.collect() - ext_list.add(ext.value) - return "${getPathFromList(ext_list)}/$args.filename" - } - } - } else if (ioptions.publish_files == null) { - return "${getPathFromList(path_list)}/$args.filename" - } - } -} +/* + * ----------------------------------------------------- + * Utility functions used in nf-core DSL2 module files + * ----------------------------------------------------- + */ + +/* + * Extract name of software tool from process name using $task.process + */ +def getSoftwareName(task_process) { + return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() +} + +/* + * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules + */ +def initOptions(Map args) { + def Map options = [:] + options.args = args.args ?: '' + options.args2 = args.args2 ?: '' + options.publish_by_id = args.publish_by_id ?: false + options.publish_dir = args.publish_dir ?: '' + options.publish_files = args.publish_files + options.suffix = args.suffix ?: '' + return options +} + +/* + * Tidy up and join elements of a list to return a path string + */ +def getPathFromList(path_list) { + def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries + paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes + return paths.join('/') +} + +/* + * Function to save/publish module results + */ +def saveFiles(Map args) { + if (!args.filename.endsWith('.version.txt')) { + def ioptions = initOptions(args.options) + def path_list = [ ioptions.publish_dir ?: args.publish_dir ] + if (ioptions.publish_by_id) { + path_list.add(args.publish_id) + } + if (ioptions.publish_files instanceof Map) { + for (ext in ioptions.publish_files) { + if (args.filename.endsWith(ext.key)) { + def ext_list = path_list.collect() + ext_list.add(ext.value) + return "${getPathFromList(ext_list)}/$args.filename" + } + } + } else if (ioptions.publish_files == null) { + return "${getPathFromList(path_list)}/$args.filename" + } + } +} diff --git a/software/rsem/calculateexpression/main.nf b/software/rsem/calculateexpression/main.nf index dd0f2f90..6f8c54a0 100644 --- a/software/rsem/calculateexpression/main.nf +++ b/software/rsem/calculateexpression/main.nf @@ -1,61 +1,61 @@ -// Import generic module functions -include { initOptions; saveFiles; getSoftwareName } from './functions' - -params.options = [:] -def options = initOptions(params.options) - -process RSEM_CALCULATEEXPRESSION { - tag "$meta.id" - label 'process_high' - publishDir "${params.outdir}", - mode: params.publish_dir_mode, - saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) } - - conda (params.enable_conda ? "bioconda::rsem=1.3.3 bioconda::star=2.7.6a" : null) - if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { - container "https://depot.galaxyproject.org/singularity/mulled-v2-cf0123ef83b3c38c13e3b0696a3f285d3f20f15b:606b713ec440e799d53a2b51a6e79dbfd28ecf3e-0" - } else { - container "quay.io/biocontainers/mulled-v2-cf0123ef83b3c38c13e3b0696a3f285d3f20f15b:606b713ec440e799d53a2b51a6e79dbfd28ecf3e-0" - } - - input: - tuple val(meta), path(reads) - path index - - output: - tuple val(meta), path("*.genes.results") , emit: counts_gene - tuple val(meta), path("*.isoforms.results"), emit: counts_transcript - tuple val(meta), path("*.stat") , emit: stat - tuple val(meta), path("*.log") , emit: logs - path "*.version.txt" , emit: version - - tuple val(meta), path("*.STAR.genome.bam") , optional:true, emit: bam_star - tuple val(meta), path("${prefix}.genome.bam") , optional:true, emit: bam_genome - tuple val(meta), path("${prefix}.transcript.bam"), optional:true, emit: bam_transcript - - script: - def software = getSoftwareName(task.process) - prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" - - def strandedness = '' - if (meta.strandedness == 'forward') { - strandedness = '--strandedness forward' - } else if (meta.strandedness == 'reverse') { - strandedness = '--strandedness reverse' - } - def paired_end = meta.single_end ? "" : "--paired-end" - """ - INDEX=`find -L ./ -name "*.grp" | sed 's/.grp//'` - rsem-calculate-expression \\ - --num-threads $task.cpus \\ - --temporary-folder ./tmp/ \\ - $strandedness \\ - $paired_end \\ - $options.args \\ - $reads \\ - \$INDEX \\ - $prefix - - rsem-calculate-expression --version | sed -e "s/Current version: RSEM v//g" > ${software}.version.txt - """ -} +// Import generic module functions +include { initOptions; saveFiles; getSoftwareName } from './functions' + +params.options = [:] +def options = initOptions(params.options) + +process RSEM_CALCULATEEXPRESSION { + tag "$meta.id" + label 'process_high' + publishDir "${params.outdir}", + mode: params.publish_dir_mode, + saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) } + + conda (params.enable_conda ? "bioconda::rsem=1.3.3 bioconda::star=2.7.6a" : null) + if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { + container "https://depot.galaxyproject.org/singularity/mulled-v2-cf0123ef83b3c38c13e3b0696a3f285d3f20f15b:606b713ec440e799d53a2b51a6e79dbfd28ecf3e-0" + } else { + container "quay.io/biocontainers/mulled-v2-cf0123ef83b3c38c13e3b0696a3f285d3f20f15b:606b713ec440e799d53a2b51a6e79dbfd28ecf3e-0" + } + + input: + tuple val(meta), path(reads) + path index + + output: + tuple val(meta), path("*.genes.results") , emit: counts_gene + tuple val(meta), path("*.isoforms.results"), emit: counts_transcript + tuple val(meta), path("*.stat") , emit: stat + tuple val(meta), path("*.log") , emit: logs + path "*.version.txt" , emit: version + + tuple val(meta), path("*.STAR.genome.bam") , optional:true, emit: bam_star + tuple val(meta), path("${prefix}.genome.bam") , optional:true, emit: bam_genome + tuple val(meta), path("${prefix}.transcript.bam"), optional:true, emit: bam_transcript + + script: + def software = getSoftwareName(task.process) + prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" + + def strandedness = '' + if (meta.strandedness == 'forward') { + strandedness = '--strandedness forward' + } else if (meta.strandedness == 'reverse') { + strandedness = '--strandedness reverse' + } + def paired_end = meta.single_end ? "" : "--paired-end" + """ + INDEX=`find -L ./ -name "*.grp" | sed 's/.grp//'` + rsem-calculate-expression \\ + --num-threads $task.cpus \\ + --temporary-folder ./tmp/ \\ + $strandedness \\ + $paired_end \\ + $options.args \\ + $reads \\ + \$INDEX \\ + $prefix + + rsem-calculate-expression --version | sed -e "s/Current version: RSEM v//g" > ${software}.version.txt + """ +} diff --git a/software/rsem/preparereference/functions.nf b/software/rsem/preparereference/functions.nf index b3ac3801..d25eea86 100644 --- a/software/rsem/preparereference/functions.nf +++ b/software/rsem/preparereference/functions.nf @@ -1,59 +1,59 @@ -/* - * ----------------------------------------------------- - * Utility functions used in nf-core DSL2 module files - * ----------------------------------------------------- - */ - -/* - * Extract name of software tool from process name using $task.process - */ -def getSoftwareName(task_process) { - return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() -} - -/* - * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules - */ -def initOptions(Map args) { - def Map options = [:] - options.args = args.args ?: '' - options.args2 = args.args2 ?: '' - options.publish_by_id = args.publish_by_id ?: false - options.publish_dir = args.publish_dir ?: '' - options.publish_files = args.publish_files - options.suffix = args.suffix ?: '' - return options -} - -/* - * Tidy up and join elements of a list to return a path string - */ -def getPathFromList(path_list) { - def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries - paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes - return paths.join('/') -} - -/* - * Function to save/publish module results - */ -def saveFiles(Map args) { - if (!args.filename.endsWith('.version.txt')) { - def ioptions = initOptions(args.options) - def path_list = [ ioptions.publish_dir ?: args.publish_dir ] - if (ioptions.publish_by_id) { - path_list.add(args.publish_id) - } - if (ioptions.publish_files instanceof Map) { - for (ext in ioptions.publish_files) { - if (args.filename.endsWith(ext.key)) { - def ext_list = path_list.collect() - ext_list.add(ext.value) - return "${getPathFromList(ext_list)}/$args.filename" - } - } - } else if (ioptions.publish_files == null) { - return "${getPathFromList(path_list)}/$args.filename" - } - } -} +/* + * ----------------------------------------------------- + * Utility functions used in nf-core DSL2 module files + * ----------------------------------------------------- + */ + +/* + * Extract name of software tool from process name using $task.process + */ +def getSoftwareName(task_process) { + return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() +} + +/* + * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules + */ +def initOptions(Map args) { + def Map options = [:] + options.args = args.args ?: '' + options.args2 = args.args2 ?: '' + options.publish_by_id = args.publish_by_id ?: false + options.publish_dir = args.publish_dir ?: '' + options.publish_files = args.publish_files + options.suffix = args.suffix ?: '' + return options +} + +/* + * Tidy up and join elements of a list to return a path string + */ +def getPathFromList(path_list) { + def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries + paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes + return paths.join('/') +} + +/* + * Function to save/publish module results + */ +def saveFiles(Map args) { + if (!args.filename.endsWith('.version.txt')) { + def ioptions = initOptions(args.options) + def path_list = [ ioptions.publish_dir ?: args.publish_dir ] + if (ioptions.publish_by_id) { + path_list.add(args.publish_id) + } + if (ioptions.publish_files instanceof Map) { + for (ext in ioptions.publish_files) { + if (args.filename.endsWith(ext.key)) { + def ext_list = path_list.collect() + ext_list.add(ext.value) + return "${getPathFromList(ext_list)}/$args.filename" + } + } + } else if (ioptions.publish_files == null) { + return "${getPathFromList(path_list)}/$args.filename" + } + } +} diff --git a/software/rsem/preparereference/main.nf b/software/rsem/preparereference/main.nf index 3aceed8c..d82e4270 100644 --- a/software/rsem/preparereference/main.nf +++ b/software/rsem/preparereference/main.nf @@ -1,68 +1,68 @@ -// Import generic module functions -include { initOptions; saveFiles; getSoftwareName } from './functions' - -params.options = [:] -def options = initOptions(params.options) - -process RSEM_PREPAREREFERENCE { - tag "$fasta" - label 'process_high' - publishDir "${params.outdir}", - mode: params.publish_dir_mode, - saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:'') } - - conda (params.enable_conda ? "bioconda::rsem=1.3.3 bioconda::star=2.7.6a" : null) - if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { - container "https://depot.galaxyproject.org/singularity/mulled-v2-cf0123ef83b3c38c13e3b0696a3f285d3f20f15b:606b713ec440e799d53a2b51a6e79dbfd28ecf3e-0" - } else { - container "quay.io/biocontainers/mulled-v2-cf0123ef83b3c38c13e3b0696a3f285d3f20f15b:606b713ec440e799d53a2b51a6e79dbfd28ecf3e-0" - } - - input: - path fasta - path gtf - - output: - path "rsem" , emit: index - path "*.version.txt", emit: version - - script: - def software = getSoftwareName(task.process) - def args = options.args.tokenize() - if (args.contains('--star')) { - args.removeIf { it.contains('--star') } - def memory = task.memory ? "--limitGenomeGenerateRAM ${task.memory.toBytes() - 100000000}" : '' - """ - mkdir rsem - STAR \\ - --runMode genomeGenerate \\ - --genomeDir rsem/ \\ - --genomeFastaFiles $fasta \\ - --sjdbGTFfile $gtf \\ - --runThreadN $task.cpus \\ - $memory \\ - $options.args2 - - rsem-prepare-reference \\ - --gtf $gtf \\ - --num-threads $task.cpus \\ - ${args.join(' ')} \\ - $fasta \\ - rsem/genome - - rsem-calculate-expression --version | sed -e "s/Current version: RSEM v//g" > ${software}.version.txt - """ - } else { - """ - mkdir rsem - rsem-prepare-reference \\ - --gtf $gtf \\ - --num-threads $task.cpus \\ - $options.args \\ - $fasta \\ - rsem/genome - - rsem-calculate-expression --version | sed -e "s/Current version: RSEM v//g" > ${software}.version.txt - """ - } -} +// Import generic module functions +include { initOptions; saveFiles; getSoftwareName } from './functions' + +params.options = [:] +def options = initOptions(params.options) + +process RSEM_PREPAREREFERENCE { + tag "$fasta" + label 'process_high' + publishDir "${params.outdir}", + mode: params.publish_dir_mode, + saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:'') } + + conda (params.enable_conda ? "bioconda::rsem=1.3.3 bioconda::star=2.7.6a" : null) + if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { + container "https://depot.galaxyproject.org/singularity/mulled-v2-cf0123ef83b3c38c13e3b0696a3f285d3f20f15b:606b713ec440e799d53a2b51a6e79dbfd28ecf3e-0" + } else { + container "quay.io/biocontainers/mulled-v2-cf0123ef83b3c38c13e3b0696a3f285d3f20f15b:606b713ec440e799d53a2b51a6e79dbfd28ecf3e-0" + } + + input: + path fasta + path gtf + + output: + path "rsem" , emit: index + path "*.version.txt", emit: version + + script: + def software = getSoftwareName(task.process) + def args = options.args.tokenize() + if (args.contains('--star')) { + args.removeIf { it.contains('--star') } + def memory = task.memory ? "--limitGenomeGenerateRAM ${task.memory.toBytes() - 100000000}" : '' + """ + mkdir rsem + STAR \\ + --runMode genomeGenerate \\ + --genomeDir rsem/ \\ + --genomeFastaFiles $fasta \\ + --sjdbGTFfile $gtf \\ + --runThreadN $task.cpus \\ + $memory \\ + $options.args2 + + rsem-prepare-reference \\ + --gtf $gtf \\ + --num-threads $task.cpus \\ + ${args.join(' ')} \\ + $fasta \\ + rsem/genome + + rsem-calculate-expression --version | sed -e "s/Current version: RSEM v//g" > ${software}.version.txt + """ + } else { + """ + mkdir rsem + rsem-prepare-reference \\ + --gtf $gtf \\ + --num-threads $task.cpus \\ + $options.args \\ + $fasta \\ + rsem/genome + + rsem-calculate-expression --version | sed -e "s/Current version: RSEM v//g" > ${software}.version.txt + """ + } +} diff --git a/software/rseqc/bamstat/functions.nf b/software/rseqc/bamstat/functions.nf index b3ac3801..d25eea86 100644 --- a/software/rseqc/bamstat/functions.nf +++ b/software/rseqc/bamstat/functions.nf @@ -1,59 +1,59 @@ -/* - * ----------------------------------------------------- - * Utility functions used in nf-core DSL2 module files - * ----------------------------------------------------- - */ - -/* - * Extract name of software tool from process name using $task.process - */ -def getSoftwareName(task_process) { - return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() -} - -/* - * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules - */ -def initOptions(Map args) { - def Map options = [:] - options.args = args.args ?: '' - options.args2 = args.args2 ?: '' - options.publish_by_id = args.publish_by_id ?: false - options.publish_dir = args.publish_dir ?: '' - options.publish_files = args.publish_files - options.suffix = args.suffix ?: '' - return options -} - -/* - * Tidy up and join elements of a list to return a path string - */ -def getPathFromList(path_list) { - def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries - paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes - return paths.join('/') -} - -/* - * Function to save/publish module results - */ -def saveFiles(Map args) { - if (!args.filename.endsWith('.version.txt')) { - def ioptions = initOptions(args.options) - def path_list = [ ioptions.publish_dir ?: args.publish_dir ] - if (ioptions.publish_by_id) { - path_list.add(args.publish_id) - } - if (ioptions.publish_files instanceof Map) { - for (ext in ioptions.publish_files) { - if (args.filename.endsWith(ext.key)) { - def ext_list = path_list.collect() - ext_list.add(ext.value) - return "${getPathFromList(ext_list)}/$args.filename" - } - } - } else if (ioptions.publish_files == null) { - return "${getPathFromList(path_list)}/$args.filename" - } - } -} +/* + * ----------------------------------------------------- + * Utility functions used in nf-core DSL2 module files + * ----------------------------------------------------- + */ + +/* + * Extract name of software tool from process name using $task.process + */ +def getSoftwareName(task_process) { + return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() +} + +/* + * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules + */ +def initOptions(Map args) { + def Map options = [:] + options.args = args.args ?: '' + options.args2 = args.args2 ?: '' + options.publish_by_id = args.publish_by_id ?: false + options.publish_dir = args.publish_dir ?: '' + options.publish_files = args.publish_files + options.suffix = args.suffix ?: '' + return options +} + +/* + * Tidy up and join elements of a list to return a path string + */ +def getPathFromList(path_list) { + def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries + paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes + return paths.join('/') +} + +/* + * Function to save/publish module results + */ +def saveFiles(Map args) { + if (!args.filename.endsWith('.version.txt')) { + def ioptions = initOptions(args.options) + def path_list = [ ioptions.publish_dir ?: args.publish_dir ] + if (ioptions.publish_by_id) { + path_list.add(args.publish_id) + } + if (ioptions.publish_files instanceof Map) { + for (ext in ioptions.publish_files) { + if (args.filename.endsWith(ext.key)) { + def ext_list = path_list.collect() + ext_list.add(ext.value) + return "${getPathFromList(ext_list)}/$args.filename" + } + } + } else if (ioptions.publish_files == null) { + return "${getPathFromList(path_list)}/$args.filename" + } + } +} diff --git a/software/rseqc/bamstat/main.nf b/software/rseqc/bamstat/main.nf index f6525cd0..1ee570e7 100644 --- a/software/rseqc/bamstat/main.nf +++ b/software/rseqc/bamstat/main.nf @@ -1,39 +1,39 @@ -// Import generic module functions -include { initOptions; saveFiles; getSoftwareName } from './functions' - -params.options = [:] -def options = initOptions(params.options) - -process RSEQC_BAMSTAT { - 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), publish_id:meta.id) } - - conda (params.enable_conda ? "bioconda::rseqc=3.0.1" : null) - if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { - container "https://depot.galaxyproject.org/singularity/rseqc:3.0.1--py37h516909a_1" - } else { - container "quay.io/biocontainers/rseqc:3.0.1--py37h516909a_1" - } - - input: - tuple val(meta), path(bam) - - output: - tuple val(meta), path("*.bam_stat.txt"), emit: txt - path "*.version.txt" , emit: version - - script: - def software = getSoftwareName(task.process) - def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" - """ - bam_stat.py \\ - -i $bam \\ - $options.args \\ - > ${prefix}.bam_stat.txt - - bam_stat.py --version | sed -e "s/bam_stat.py //g" > ${software}.version.txt - """ -} +// Import generic module functions +include { initOptions; saveFiles; getSoftwareName } from './functions' + +params.options = [:] +def options = initOptions(params.options) + +process RSEQC_BAMSTAT { + 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), publish_id:meta.id) } + + conda (params.enable_conda ? "bioconda::rseqc=3.0.1" : null) + if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { + container "https://depot.galaxyproject.org/singularity/rseqc:3.0.1--py37h516909a_1" + } else { + container "quay.io/biocontainers/rseqc:3.0.1--py37h516909a_1" + } + + input: + tuple val(meta), path(bam) + + output: + tuple val(meta), path("*.bam_stat.txt"), emit: txt + path "*.version.txt" , emit: version + + script: + def software = getSoftwareName(task.process) + def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" + """ + bam_stat.py \\ + -i $bam \\ + $options.args \\ + > ${prefix}.bam_stat.txt + + bam_stat.py --version | sed -e "s/bam_stat.py //g" > ${software}.version.txt + """ +} diff --git a/software/rseqc/inferexperiment/functions.nf b/software/rseqc/inferexperiment/functions.nf index b3ac3801..d25eea86 100644 --- a/software/rseqc/inferexperiment/functions.nf +++ b/software/rseqc/inferexperiment/functions.nf @@ -1,59 +1,59 @@ -/* - * ----------------------------------------------------- - * Utility functions used in nf-core DSL2 module files - * ----------------------------------------------------- - */ - -/* - * Extract name of software tool from process name using $task.process - */ -def getSoftwareName(task_process) { - return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() -} - -/* - * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules - */ -def initOptions(Map args) { - def Map options = [:] - options.args = args.args ?: '' - options.args2 = args.args2 ?: '' - options.publish_by_id = args.publish_by_id ?: false - options.publish_dir = args.publish_dir ?: '' - options.publish_files = args.publish_files - options.suffix = args.suffix ?: '' - return options -} - -/* - * Tidy up and join elements of a list to return a path string - */ -def getPathFromList(path_list) { - def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries - paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes - return paths.join('/') -} - -/* - * Function to save/publish module results - */ -def saveFiles(Map args) { - if (!args.filename.endsWith('.version.txt')) { - def ioptions = initOptions(args.options) - def path_list = [ ioptions.publish_dir ?: args.publish_dir ] - if (ioptions.publish_by_id) { - path_list.add(args.publish_id) - } - if (ioptions.publish_files instanceof Map) { - for (ext in ioptions.publish_files) { - if (args.filename.endsWith(ext.key)) { - def ext_list = path_list.collect() - ext_list.add(ext.value) - return "${getPathFromList(ext_list)}/$args.filename" - } - } - } else if (ioptions.publish_files == null) { - return "${getPathFromList(path_list)}/$args.filename" - } - } -} +/* + * ----------------------------------------------------- + * Utility functions used in nf-core DSL2 module files + * ----------------------------------------------------- + */ + +/* + * Extract name of software tool from process name using $task.process + */ +def getSoftwareName(task_process) { + return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() +} + +/* + * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules + */ +def initOptions(Map args) { + def Map options = [:] + options.args = args.args ?: '' + options.args2 = args.args2 ?: '' + options.publish_by_id = args.publish_by_id ?: false + options.publish_dir = args.publish_dir ?: '' + options.publish_files = args.publish_files + options.suffix = args.suffix ?: '' + return options +} + +/* + * Tidy up and join elements of a list to return a path string + */ +def getPathFromList(path_list) { + def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries + paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes + return paths.join('/') +} + +/* + * Function to save/publish module results + */ +def saveFiles(Map args) { + if (!args.filename.endsWith('.version.txt')) { + def ioptions = initOptions(args.options) + def path_list = [ ioptions.publish_dir ?: args.publish_dir ] + if (ioptions.publish_by_id) { + path_list.add(args.publish_id) + } + if (ioptions.publish_files instanceof Map) { + for (ext in ioptions.publish_files) { + if (args.filename.endsWith(ext.key)) { + def ext_list = path_list.collect() + ext_list.add(ext.value) + return "${getPathFromList(ext_list)}/$args.filename" + } + } + } else if (ioptions.publish_files == null) { + return "${getPathFromList(path_list)}/$args.filename" + } + } +} diff --git a/software/rseqc/inferexperiment/main.nf b/software/rseqc/inferexperiment/main.nf index 4f35d3e3..834a01a5 100644 --- a/software/rseqc/inferexperiment/main.nf +++ b/software/rseqc/inferexperiment/main.nf @@ -1,41 +1,41 @@ -// Import generic module functions -include { initOptions; saveFiles; getSoftwareName } from './functions' - -params.options = [:] -def options = initOptions(params.options) - -process RSEQC_INFEREXPERIMENT { - 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), publish_id:meta.id) } - - conda (params.enable_conda ? "bioconda::rseqc=3.0.1" : null) - if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { - container "https://depot.galaxyproject.org/singularity/rseqc:3.0.1--py37h516909a_1" - } else { - container "quay.io/biocontainers/rseqc:3.0.1--py37h516909a_1" - } - - input: - tuple val(meta), path(bam) - path bed - - output: - tuple val(meta), path("*.infer_experiment.txt"), emit: txt - path "*.version.txt" , emit: version - - script: - def software = getSoftwareName(task.process) - def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" - """ - infer_experiment.py \\ - -i $bam \\ - -r $bed \\ - $options.args \\ - > ${prefix}.infer_experiment.txt - - infer_experiment.py --version | sed -e "s/infer_experiment.py //g" > ${software}.version.txt - """ -} +// Import generic module functions +include { initOptions; saveFiles; getSoftwareName } from './functions' + +params.options = [:] +def options = initOptions(params.options) + +process RSEQC_INFEREXPERIMENT { + 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), publish_id:meta.id) } + + conda (params.enable_conda ? "bioconda::rseqc=3.0.1" : null) + if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { + container "https://depot.galaxyproject.org/singularity/rseqc:3.0.1--py37h516909a_1" + } else { + container "quay.io/biocontainers/rseqc:3.0.1--py37h516909a_1" + } + + input: + tuple val(meta), path(bam) + path bed + + output: + tuple val(meta), path("*.infer_experiment.txt"), emit: txt + path "*.version.txt" , emit: version + + script: + def software = getSoftwareName(task.process) + def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" + """ + infer_experiment.py \\ + -i $bam \\ + -r $bed \\ + $options.args \\ + > ${prefix}.infer_experiment.txt + + infer_experiment.py --version | sed -e "s/infer_experiment.py //g" > ${software}.version.txt + """ +} diff --git a/software/rseqc/innerdistance/functions.nf b/software/rseqc/innerdistance/functions.nf index b3ac3801..d25eea86 100644 --- a/software/rseqc/innerdistance/functions.nf +++ b/software/rseqc/innerdistance/functions.nf @@ -1,59 +1,59 @@ -/* - * ----------------------------------------------------- - * Utility functions used in nf-core DSL2 module files - * ----------------------------------------------------- - */ - -/* - * Extract name of software tool from process name using $task.process - */ -def getSoftwareName(task_process) { - return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() -} - -/* - * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules - */ -def initOptions(Map args) { - def Map options = [:] - options.args = args.args ?: '' - options.args2 = args.args2 ?: '' - options.publish_by_id = args.publish_by_id ?: false - options.publish_dir = args.publish_dir ?: '' - options.publish_files = args.publish_files - options.suffix = args.suffix ?: '' - return options -} - -/* - * Tidy up and join elements of a list to return a path string - */ -def getPathFromList(path_list) { - def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries - paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes - return paths.join('/') -} - -/* - * Function to save/publish module results - */ -def saveFiles(Map args) { - if (!args.filename.endsWith('.version.txt')) { - def ioptions = initOptions(args.options) - def path_list = [ ioptions.publish_dir ?: args.publish_dir ] - if (ioptions.publish_by_id) { - path_list.add(args.publish_id) - } - if (ioptions.publish_files instanceof Map) { - for (ext in ioptions.publish_files) { - if (args.filename.endsWith(ext.key)) { - def ext_list = path_list.collect() - ext_list.add(ext.value) - return "${getPathFromList(ext_list)}/$args.filename" - } - } - } else if (ioptions.publish_files == null) { - return "${getPathFromList(path_list)}/$args.filename" - } - } -} +/* + * ----------------------------------------------------- + * Utility functions used in nf-core DSL2 module files + * ----------------------------------------------------- + */ + +/* + * Extract name of software tool from process name using $task.process + */ +def getSoftwareName(task_process) { + return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() +} + +/* + * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules + */ +def initOptions(Map args) { + def Map options = [:] + options.args = args.args ?: '' + options.args2 = args.args2 ?: '' + options.publish_by_id = args.publish_by_id ?: false + options.publish_dir = args.publish_dir ?: '' + options.publish_files = args.publish_files + options.suffix = args.suffix ?: '' + return options +} + +/* + * Tidy up and join elements of a list to return a path string + */ +def getPathFromList(path_list) { + def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries + paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes + return paths.join('/') +} + +/* + * Function to save/publish module results + */ +def saveFiles(Map args) { + if (!args.filename.endsWith('.version.txt')) { + def ioptions = initOptions(args.options) + def path_list = [ ioptions.publish_dir ?: args.publish_dir ] + if (ioptions.publish_by_id) { + path_list.add(args.publish_id) + } + if (ioptions.publish_files instanceof Map) { + for (ext in ioptions.publish_files) { + if (args.filename.endsWith(ext.key)) { + def ext_list = path_list.collect() + ext_list.add(ext.value) + return "${getPathFromList(ext_list)}/$args.filename" + } + } + } else if (ioptions.publish_files == null) { + return "${getPathFromList(path_list)}/$args.filename" + } + } +} diff --git a/software/rseqc/innerdistance/main.nf b/software/rseqc/innerdistance/main.nf index 8273b353..df6d1fd1 100644 --- a/software/rseqc/innerdistance/main.nf +++ b/software/rseqc/innerdistance/main.nf @@ -1,53 +1,53 @@ -// Import generic module functions -include { initOptions; saveFiles; getSoftwareName } from './functions' - -params.options = [:] -def options = initOptions(params.options) - -process RSEQC_INNERDISTANCE { - 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), publish_id:meta.id) } - - conda (params.enable_conda ? "bioconda::rseqc=3.0.1" : null) - if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { - container "https://depot.galaxyproject.org/singularity/rseqc:3.0.1--py37h516909a_1" - } else { - container "quay.io/biocontainers/rseqc:3.0.1--py37h516909a_1" - } - - input: - tuple val(meta), path(bam) - path bed - - output: - tuple val(meta), path("*distance.txt"), optional:true, emit: distance - tuple val(meta), path("*freq.txt") , optional:true, emit: freq - tuple val(meta), path("*mean.txt") , optional:true, emit: mean - tuple val(meta), path("*.pdf") , optional:true, emit: pdf - tuple val(meta), path("*.r") , optional:true, emit: rscript - path "*.version.txt" , emit: version - - script: - def software = getSoftwareName(task.process) - def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" - if (!meta.single_end) { - """ - inner_distance.py \\ - -i $bam \\ - -r $bed \\ - -o $prefix \\ - $options.args \\ - > stdout.txt - head -n 2 stdout.txt > ${prefix}.inner_distance_mean.txt - - inner_distance.py --version | sed -e "s/inner_distance.py //g" > ${software}.version.txt - """ - } else { - """ - inner_distance.py --version | sed -e "s/inner_distance.py //g" > ${software}.version.txt - """ - } -} +// Import generic module functions +include { initOptions; saveFiles; getSoftwareName } from './functions' + +params.options = [:] +def options = initOptions(params.options) + +process RSEQC_INNERDISTANCE { + 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), publish_id:meta.id) } + + conda (params.enable_conda ? "bioconda::rseqc=3.0.1" : null) + if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { + container "https://depot.galaxyproject.org/singularity/rseqc:3.0.1--py37h516909a_1" + } else { + container "quay.io/biocontainers/rseqc:3.0.1--py37h516909a_1" + } + + input: + tuple val(meta), path(bam) + path bed + + output: + tuple val(meta), path("*distance.txt"), optional:true, emit: distance + tuple val(meta), path("*freq.txt") , optional:true, emit: freq + tuple val(meta), path("*mean.txt") , optional:true, emit: mean + tuple val(meta), path("*.pdf") , optional:true, emit: pdf + tuple val(meta), path("*.r") , optional:true, emit: rscript + path "*.version.txt" , emit: version + + script: + def software = getSoftwareName(task.process) + def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" + if (!meta.single_end) { + """ + inner_distance.py \\ + -i $bam \\ + -r $bed \\ + -o $prefix \\ + $options.args \\ + > stdout.txt + head -n 2 stdout.txt > ${prefix}.inner_distance_mean.txt + + inner_distance.py --version | sed -e "s/inner_distance.py //g" > ${software}.version.txt + """ + } else { + """ + inner_distance.py --version | sed -e "s/inner_distance.py //g" > ${software}.version.txt + """ + } +} diff --git a/software/rseqc/junctionannotation/functions.nf b/software/rseqc/junctionannotation/functions.nf index b3ac3801..d25eea86 100644 --- a/software/rseqc/junctionannotation/functions.nf +++ b/software/rseqc/junctionannotation/functions.nf @@ -1,59 +1,59 @@ -/* - * ----------------------------------------------------- - * Utility functions used in nf-core DSL2 module files - * ----------------------------------------------------- - */ - -/* - * Extract name of software tool from process name using $task.process - */ -def getSoftwareName(task_process) { - return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() -} - -/* - * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules - */ -def initOptions(Map args) { - def Map options = [:] - options.args = args.args ?: '' - options.args2 = args.args2 ?: '' - options.publish_by_id = args.publish_by_id ?: false - options.publish_dir = args.publish_dir ?: '' - options.publish_files = args.publish_files - options.suffix = args.suffix ?: '' - return options -} - -/* - * Tidy up and join elements of a list to return a path string - */ -def getPathFromList(path_list) { - def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries - paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes - return paths.join('/') -} - -/* - * Function to save/publish module results - */ -def saveFiles(Map args) { - if (!args.filename.endsWith('.version.txt')) { - def ioptions = initOptions(args.options) - def path_list = [ ioptions.publish_dir ?: args.publish_dir ] - if (ioptions.publish_by_id) { - path_list.add(args.publish_id) - } - if (ioptions.publish_files instanceof Map) { - for (ext in ioptions.publish_files) { - if (args.filename.endsWith(ext.key)) { - def ext_list = path_list.collect() - ext_list.add(ext.value) - return "${getPathFromList(ext_list)}/$args.filename" - } - } - } else if (ioptions.publish_files == null) { - return "${getPathFromList(path_list)}/$args.filename" - } - } -} +/* + * ----------------------------------------------------- + * Utility functions used in nf-core DSL2 module files + * ----------------------------------------------------- + */ + +/* + * Extract name of software tool from process name using $task.process + */ +def getSoftwareName(task_process) { + return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() +} + +/* + * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules + */ +def initOptions(Map args) { + def Map options = [:] + options.args = args.args ?: '' + options.args2 = args.args2 ?: '' + options.publish_by_id = args.publish_by_id ?: false + options.publish_dir = args.publish_dir ?: '' + options.publish_files = args.publish_files + options.suffix = args.suffix ?: '' + return options +} + +/* + * Tidy up and join elements of a list to return a path string + */ +def getPathFromList(path_list) { + def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries + paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes + return paths.join('/') +} + +/* + * Function to save/publish module results + */ +def saveFiles(Map args) { + if (!args.filename.endsWith('.version.txt')) { + def ioptions = initOptions(args.options) + def path_list = [ ioptions.publish_dir ?: args.publish_dir ] + if (ioptions.publish_by_id) { + path_list.add(args.publish_id) + } + if (ioptions.publish_files instanceof Map) { + for (ext in ioptions.publish_files) { + if (args.filename.endsWith(ext.key)) { + def ext_list = path_list.collect() + ext_list.add(ext.value) + return "${getPathFromList(ext_list)}/$args.filename" + } + } + } else if (ioptions.publish_files == null) { + return "${getPathFromList(path_list)}/$args.filename" + } + } +} diff --git a/software/rseqc/junctionannotation/main.nf b/software/rseqc/junctionannotation/main.nf index a12782f0..9d39ccc8 100644 --- a/software/rseqc/junctionannotation/main.nf +++ b/software/rseqc/junctionannotation/main.nf @@ -1,48 +1,48 @@ -// Import generic module functions -include { initOptions; saveFiles; getSoftwareName } from './functions' - -params.options = [:] -def options = initOptions(params.options) - -process RSEQC_JUNCTIONANNOTATION { - 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), publish_id:meta.id) } - - conda (params.enable_conda ? "bioconda::rseqc=3.0.1" : null) - if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { - container "https://depot.galaxyproject.org/singularity/rseqc:3.0.1--py37h516909a_1" - } else { - container "quay.io/biocontainers/rseqc:3.0.1--py37h516909a_1" - } - - input: - tuple val(meta), path(bam) - path bed - - output: - tuple val(meta), path("*.junction.bed"), emit: bed - tuple val(meta), path("*.Interact.bed"), emit: interact_bed - tuple val(meta), path("*.xls") , emit: xls - tuple val(meta), path("*junction.pdf") , emit: pdf - tuple val(meta), path("*events.pdf") , emit: events_pdf - tuple val(meta), path("*.r") , emit: rscript - tuple val(meta), path("*.log") , emit: log - path "*.version.txt" , emit: version - - script: - def software = getSoftwareName(task.process) - def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" - """ - junction_annotation.py \\ - -i $bam \\ - -r $bed \\ - -o $prefix \\ - $options.args \\ - 2> ${prefix}.junction_annotation.log - - junction_annotation.py --version | sed -e "s/junction_annotation.py //g" > ${software}.version.txt - """ -} +// Import generic module functions +include { initOptions; saveFiles; getSoftwareName } from './functions' + +params.options = [:] +def options = initOptions(params.options) + +process RSEQC_JUNCTIONANNOTATION { + 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), publish_id:meta.id) } + + conda (params.enable_conda ? "bioconda::rseqc=3.0.1" : null) + if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { + container "https://depot.galaxyproject.org/singularity/rseqc:3.0.1--py37h516909a_1" + } else { + container "quay.io/biocontainers/rseqc:3.0.1--py37h516909a_1" + } + + input: + tuple val(meta), path(bam) + path bed + + output: + tuple val(meta), path("*.junction.bed"), emit: bed + tuple val(meta), path("*.Interact.bed"), emit: interact_bed + tuple val(meta), path("*.xls") , emit: xls + tuple val(meta), path("*junction.pdf") , emit: pdf + tuple val(meta), path("*events.pdf") , emit: events_pdf + tuple val(meta), path("*.r") , emit: rscript + tuple val(meta), path("*.log") , emit: log + path "*.version.txt" , emit: version + + script: + def software = getSoftwareName(task.process) + def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" + """ + junction_annotation.py \\ + -i $bam \\ + -r $bed \\ + -o $prefix \\ + $options.args \\ + 2> ${prefix}.junction_annotation.log + + junction_annotation.py --version | sed -e "s/junction_annotation.py //g" > ${software}.version.txt + """ +} diff --git a/software/rseqc/junctionsaturation/functions.nf b/software/rseqc/junctionsaturation/functions.nf index b3ac3801..d25eea86 100644 --- a/software/rseqc/junctionsaturation/functions.nf +++ b/software/rseqc/junctionsaturation/functions.nf @@ -1,59 +1,59 @@ -/* - * ----------------------------------------------------- - * Utility functions used in nf-core DSL2 module files - * ----------------------------------------------------- - */ - -/* - * Extract name of software tool from process name using $task.process - */ -def getSoftwareName(task_process) { - return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() -} - -/* - * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules - */ -def initOptions(Map args) { - def Map options = [:] - options.args = args.args ?: '' - options.args2 = args.args2 ?: '' - options.publish_by_id = args.publish_by_id ?: false - options.publish_dir = args.publish_dir ?: '' - options.publish_files = args.publish_files - options.suffix = args.suffix ?: '' - return options -} - -/* - * Tidy up and join elements of a list to return a path string - */ -def getPathFromList(path_list) { - def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries - paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes - return paths.join('/') -} - -/* - * Function to save/publish module results - */ -def saveFiles(Map args) { - if (!args.filename.endsWith('.version.txt')) { - def ioptions = initOptions(args.options) - def path_list = [ ioptions.publish_dir ?: args.publish_dir ] - if (ioptions.publish_by_id) { - path_list.add(args.publish_id) - } - if (ioptions.publish_files instanceof Map) { - for (ext in ioptions.publish_files) { - if (args.filename.endsWith(ext.key)) { - def ext_list = path_list.collect() - ext_list.add(ext.value) - return "${getPathFromList(ext_list)}/$args.filename" - } - } - } else if (ioptions.publish_files == null) { - return "${getPathFromList(path_list)}/$args.filename" - } - } -} +/* + * ----------------------------------------------------- + * Utility functions used in nf-core DSL2 module files + * ----------------------------------------------------- + */ + +/* + * Extract name of software tool from process name using $task.process + */ +def getSoftwareName(task_process) { + return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() +} + +/* + * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules + */ +def initOptions(Map args) { + def Map options = [:] + options.args = args.args ?: '' + options.args2 = args.args2 ?: '' + options.publish_by_id = args.publish_by_id ?: false + options.publish_dir = args.publish_dir ?: '' + options.publish_files = args.publish_files + options.suffix = args.suffix ?: '' + return options +} + +/* + * Tidy up and join elements of a list to return a path string + */ +def getPathFromList(path_list) { + def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries + paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes + return paths.join('/') +} + +/* + * Function to save/publish module results + */ +def saveFiles(Map args) { + if (!args.filename.endsWith('.version.txt')) { + def ioptions = initOptions(args.options) + def path_list = [ ioptions.publish_dir ?: args.publish_dir ] + if (ioptions.publish_by_id) { + path_list.add(args.publish_id) + } + if (ioptions.publish_files instanceof Map) { + for (ext in ioptions.publish_files) { + if (args.filename.endsWith(ext.key)) { + def ext_list = path_list.collect() + ext_list.add(ext.value) + return "${getPathFromList(ext_list)}/$args.filename" + } + } + } else if (ioptions.publish_files == null) { + return "${getPathFromList(path_list)}/$args.filename" + } + } +} diff --git a/software/rseqc/junctionsaturation/main.nf b/software/rseqc/junctionsaturation/main.nf index e607c822..b11cdad8 100644 --- a/software/rseqc/junctionsaturation/main.nf +++ b/software/rseqc/junctionsaturation/main.nf @@ -1,42 +1,42 @@ -// Import generic module functions -include { initOptions; saveFiles; getSoftwareName } from './functions' - -params.options = [:] -def options = initOptions(params.options) - -process RSEQC_JUNCTIONSATURATION { - 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), publish_id:meta.id) } - - conda (params.enable_conda ? "bioconda::rseqc=3.0.1" : null) - if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { - container "https://depot.galaxyproject.org/singularity/rseqc:3.0.1--py37h516909a_1" - } else { - container "quay.io/biocontainers/rseqc:3.0.1--py37h516909a_1" - } - - input: - tuple val(meta), path(bam) - path bed - - output: - tuple val(meta), path("*.pdf"), emit: pdf - tuple val(meta), path("*.r") , emit: rscript - path "*.version.txt" , emit: version - - script: - def software = getSoftwareName(task.process) - def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" - """ - junction_saturation.py \\ - -i $bam \\ - -r $bed \\ - -o $prefix \\ - $options.args - - junction_saturation.py --version | sed -e "s/junction_saturation.py //g" > ${software}.version.txt - """ -} +// Import generic module functions +include { initOptions; saveFiles; getSoftwareName } from './functions' + +params.options = [:] +def options = initOptions(params.options) + +process RSEQC_JUNCTIONSATURATION { + 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), publish_id:meta.id) } + + conda (params.enable_conda ? "bioconda::rseqc=3.0.1" : null) + if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { + container "https://depot.galaxyproject.org/singularity/rseqc:3.0.1--py37h516909a_1" + } else { + container "quay.io/biocontainers/rseqc:3.0.1--py37h516909a_1" + } + + input: + tuple val(meta), path(bam) + path bed + + output: + tuple val(meta), path("*.pdf"), emit: pdf + tuple val(meta), path("*.r") , emit: rscript + path "*.version.txt" , emit: version + + script: + def software = getSoftwareName(task.process) + def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" + """ + junction_saturation.py \\ + -i $bam \\ + -r $bed \\ + -o $prefix \\ + $options.args + + junction_saturation.py --version | sed -e "s/junction_saturation.py //g" > ${software}.version.txt + """ +} diff --git a/software/rseqc/readdistribution/functions.nf b/software/rseqc/readdistribution/functions.nf index b3ac3801..d25eea86 100644 --- a/software/rseqc/readdistribution/functions.nf +++ b/software/rseqc/readdistribution/functions.nf @@ -1,59 +1,59 @@ -/* - * ----------------------------------------------------- - * Utility functions used in nf-core DSL2 module files - * ----------------------------------------------------- - */ - -/* - * Extract name of software tool from process name using $task.process - */ -def getSoftwareName(task_process) { - return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() -} - -/* - * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules - */ -def initOptions(Map args) { - def Map options = [:] - options.args = args.args ?: '' - options.args2 = args.args2 ?: '' - options.publish_by_id = args.publish_by_id ?: false - options.publish_dir = args.publish_dir ?: '' - options.publish_files = args.publish_files - options.suffix = args.suffix ?: '' - return options -} - -/* - * Tidy up and join elements of a list to return a path string - */ -def getPathFromList(path_list) { - def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries - paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes - return paths.join('/') -} - -/* - * Function to save/publish module results - */ -def saveFiles(Map args) { - if (!args.filename.endsWith('.version.txt')) { - def ioptions = initOptions(args.options) - def path_list = [ ioptions.publish_dir ?: args.publish_dir ] - if (ioptions.publish_by_id) { - path_list.add(args.publish_id) - } - if (ioptions.publish_files instanceof Map) { - for (ext in ioptions.publish_files) { - if (args.filename.endsWith(ext.key)) { - def ext_list = path_list.collect() - ext_list.add(ext.value) - return "${getPathFromList(ext_list)}/$args.filename" - } - } - } else if (ioptions.publish_files == null) { - return "${getPathFromList(path_list)}/$args.filename" - } - } -} +/* + * ----------------------------------------------------- + * Utility functions used in nf-core DSL2 module files + * ----------------------------------------------------- + */ + +/* + * Extract name of software tool from process name using $task.process + */ +def getSoftwareName(task_process) { + return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() +} + +/* + * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules + */ +def initOptions(Map args) { + def Map options = [:] + options.args = args.args ?: '' + options.args2 = args.args2 ?: '' + options.publish_by_id = args.publish_by_id ?: false + options.publish_dir = args.publish_dir ?: '' + options.publish_files = args.publish_files + options.suffix = args.suffix ?: '' + return options +} + +/* + * Tidy up and join elements of a list to return a path string + */ +def getPathFromList(path_list) { + def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries + paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes + return paths.join('/') +} + +/* + * Function to save/publish module results + */ +def saveFiles(Map args) { + if (!args.filename.endsWith('.version.txt')) { + def ioptions = initOptions(args.options) + def path_list = [ ioptions.publish_dir ?: args.publish_dir ] + if (ioptions.publish_by_id) { + path_list.add(args.publish_id) + } + if (ioptions.publish_files instanceof Map) { + for (ext in ioptions.publish_files) { + if (args.filename.endsWith(ext.key)) { + def ext_list = path_list.collect() + ext_list.add(ext.value) + return "${getPathFromList(ext_list)}/$args.filename" + } + } + } else if (ioptions.publish_files == null) { + return "${getPathFromList(path_list)}/$args.filename" + } + } +} diff --git a/software/rseqc/readdistribution/main.nf b/software/rseqc/readdistribution/main.nf index b248fc65..6782c40b 100644 --- a/software/rseqc/readdistribution/main.nf +++ b/software/rseqc/readdistribution/main.nf @@ -1,40 +1,40 @@ -// Import generic module functions -include { initOptions; saveFiles; getSoftwareName } from './functions' - -params.options = [:] -def options = initOptions(params.options) - -process RSEQC_READDISTRIBUTION { - 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), publish_id:meta.id) } - - conda (params.enable_conda ? "bioconda::rseqc=3.0.1" : null) - if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { - container "https://depot.galaxyproject.org/singularity/rseqc:3.0.1--py37h516909a_1" - } else { - container "quay.io/biocontainers/rseqc:3.0.1--py37h516909a_1" - } - - input: - tuple val(meta), path(bam) - path bed - - output: - tuple val(meta), path("*.read_distribution.txt"), emit: txt - path "*.version.txt" , emit: version - - script: - def software = getSoftwareName(task.process) - def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" - """ - read_distribution.py \\ - -i $bam \\ - -r $bed \\ - > ${prefix}.read_distribution.txt - - read_distribution.py --version | sed -e "s/read_distribution.py //g" > ${software}.version.txt - """ -} +// Import generic module functions +include { initOptions; saveFiles; getSoftwareName } from './functions' + +params.options = [:] +def options = initOptions(params.options) + +process RSEQC_READDISTRIBUTION { + 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), publish_id:meta.id) } + + conda (params.enable_conda ? "bioconda::rseqc=3.0.1" : null) + if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { + container "https://depot.galaxyproject.org/singularity/rseqc:3.0.1--py37h516909a_1" + } else { + container "quay.io/biocontainers/rseqc:3.0.1--py37h516909a_1" + } + + input: + tuple val(meta), path(bam) + path bed + + output: + tuple val(meta), path("*.read_distribution.txt"), emit: txt + path "*.version.txt" , emit: version + + script: + def software = getSoftwareName(task.process) + def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" + """ + read_distribution.py \\ + -i $bam \\ + -r $bed \\ + > ${prefix}.read_distribution.txt + + read_distribution.py --version | sed -e "s/read_distribution.py //g" > ${software}.version.txt + """ +} diff --git a/software/rseqc/readduplication/functions.nf b/software/rseqc/readduplication/functions.nf index b3ac3801..d25eea86 100644 --- a/software/rseqc/readduplication/functions.nf +++ b/software/rseqc/readduplication/functions.nf @@ -1,59 +1,59 @@ -/* - * ----------------------------------------------------- - * Utility functions used in nf-core DSL2 module files - * ----------------------------------------------------- - */ - -/* - * Extract name of software tool from process name using $task.process - */ -def getSoftwareName(task_process) { - return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() -} - -/* - * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules - */ -def initOptions(Map args) { - def Map options = [:] - options.args = args.args ?: '' - options.args2 = args.args2 ?: '' - options.publish_by_id = args.publish_by_id ?: false - options.publish_dir = args.publish_dir ?: '' - options.publish_files = args.publish_files - options.suffix = args.suffix ?: '' - return options -} - -/* - * Tidy up and join elements of a list to return a path string - */ -def getPathFromList(path_list) { - def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries - paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes - return paths.join('/') -} - -/* - * Function to save/publish module results - */ -def saveFiles(Map args) { - if (!args.filename.endsWith('.version.txt')) { - def ioptions = initOptions(args.options) - def path_list = [ ioptions.publish_dir ?: args.publish_dir ] - if (ioptions.publish_by_id) { - path_list.add(args.publish_id) - } - if (ioptions.publish_files instanceof Map) { - for (ext in ioptions.publish_files) { - if (args.filename.endsWith(ext.key)) { - def ext_list = path_list.collect() - ext_list.add(ext.value) - return "${getPathFromList(ext_list)}/$args.filename" - } - } - } else if (ioptions.publish_files == null) { - return "${getPathFromList(path_list)}/$args.filename" - } - } -} +/* + * ----------------------------------------------------- + * Utility functions used in nf-core DSL2 module files + * ----------------------------------------------------- + */ + +/* + * Extract name of software tool from process name using $task.process + */ +def getSoftwareName(task_process) { + return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() +} + +/* + * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules + */ +def initOptions(Map args) { + def Map options = [:] + options.args = args.args ?: '' + options.args2 = args.args2 ?: '' + options.publish_by_id = args.publish_by_id ?: false + options.publish_dir = args.publish_dir ?: '' + options.publish_files = args.publish_files + options.suffix = args.suffix ?: '' + return options +} + +/* + * Tidy up and join elements of a list to return a path string + */ +def getPathFromList(path_list) { + def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries + paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes + return paths.join('/') +} + +/* + * Function to save/publish module results + */ +def saveFiles(Map args) { + if (!args.filename.endsWith('.version.txt')) { + def ioptions = initOptions(args.options) + def path_list = [ ioptions.publish_dir ?: args.publish_dir ] + if (ioptions.publish_by_id) { + path_list.add(args.publish_id) + } + if (ioptions.publish_files instanceof Map) { + for (ext in ioptions.publish_files) { + if (args.filename.endsWith(ext.key)) { + def ext_list = path_list.collect() + ext_list.add(ext.value) + return "${getPathFromList(ext_list)}/$args.filename" + } + } + } else if (ioptions.publish_files == null) { + return "${getPathFromList(path_list)}/$args.filename" + } + } +} diff --git a/software/rseqc/readduplication/main.nf b/software/rseqc/readduplication/main.nf index 23bc602c..1d0d99fd 100644 --- a/software/rseqc/readduplication/main.nf +++ b/software/rseqc/readduplication/main.nf @@ -1,42 +1,42 @@ -// Import generic module functions -include { initOptions; saveFiles; getSoftwareName } from './functions' - -params.options = [:] -def options = initOptions(params.options) - -process RSEQC_READDUPLICATION { - 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), publish_id:meta.id) } - - conda (params.enable_conda ? "bioconda::rseqc=3.0.1" : null) - if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { - container "https://depot.galaxyproject.org/singularity/rseqc:3.0.1--py37h516909a_1" - } else { - container "quay.io/biocontainers/rseqc:3.0.1--py37h516909a_1" - } - - input: - tuple val(meta), path(bam) - - output: - tuple val(meta), path("*seq.DupRate.xls"), emit: seq_xls - tuple val(meta), path("*pos.DupRate.xls"), emit: pos_xls - tuple val(meta), path("*.pdf") , emit: pdf - tuple val(meta), path("*.r") , emit: rscript - path "*.version.txt" , emit: version - - script: - def software = getSoftwareName(task.process) - def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" - """ - read_duplication.py \\ - -i $bam \\ - -o $prefix \\ - $options.args - - read_duplication.py --version | sed -e "s/read_duplication.py //g" > ${software}.version.txt - """ -} +// Import generic module functions +include { initOptions; saveFiles; getSoftwareName } from './functions' + +params.options = [:] +def options = initOptions(params.options) + +process RSEQC_READDUPLICATION { + 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), publish_id:meta.id) } + + conda (params.enable_conda ? "bioconda::rseqc=3.0.1" : null) + if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { + container "https://depot.galaxyproject.org/singularity/rseqc:3.0.1--py37h516909a_1" + } else { + container "quay.io/biocontainers/rseqc:3.0.1--py37h516909a_1" + } + + input: + tuple val(meta), path(bam) + + output: + tuple val(meta), path("*seq.DupRate.xls"), emit: seq_xls + tuple val(meta), path("*pos.DupRate.xls"), emit: pos_xls + tuple val(meta), path("*.pdf") , emit: pdf + tuple val(meta), path("*.r") , emit: rscript + path "*.version.txt" , emit: version + + script: + def software = getSoftwareName(task.process) + def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" + """ + read_duplication.py \\ + -i $bam \\ + -o $prefix \\ + $options.args + + read_duplication.py --version | sed -e "s/read_duplication.py //g" > ${software}.version.txt + """ +} diff --git a/software/salmon/index/functions.nf b/software/salmon/index/functions.nf index b3ac3801..d25eea86 100644 --- a/software/salmon/index/functions.nf +++ b/software/salmon/index/functions.nf @@ -1,59 +1,59 @@ -/* - * ----------------------------------------------------- - * Utility functions used in nf-core DSL2 module files - * ----------------------------------------------------- - */ - -/* - * Extract name of software tool from process name using $task.process - */ -def getSoftwareName(task_process) { - return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() -} - -/* - * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules - */ -def initOptions(Map args) { - def Map options = [:] - options.args = args.args ?: '' - options.args2 = args.args2 ?: '' - options.publish_by_id = args.publish_by_id ?: false - options.publish_dir = args.publish_dir ?: '' - options.publish_files = args.publish_files - options.suffix = args.suffix ?: '' - return options -} - -/* - * Tidy up and join elements of a list to return a path string - */ -def getPathFromList(path_list) { - def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries - paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes - return paths.join('/') -} - -/* - * Function to save/publish module results - */ -def saveFiles(Map args) { - if (!args.filename.endsWith('.version.txt')) { - def ioptions = initOptions(args.options) - def path_list = [ ioptions.publish_dir ?: args.publish_dir ] - if (ioptions.publish_by_id) { - path_list.add(args.publish_id) - } - if (ioptions.publish_files instanceof Map) { - for (ext in ioptions.publish_files) { - if (args.filename.endsWith(ext.key)) { - def ext_list = path_list.collect() - ext_list.add(ext.value) - return "${getPathFromList(ext_list)}/$args.filename" - } - } - } else if (ioptions.publish_files == null) { - return "${getPathFromList(path_list)}/$args.filename" - } - } -} +/* + * ----------------------------------------------------- + * Utility functions used in nf-core DSL2 module files + * ----------------------------------------------------- + */ + +/* + * Extract name of software tool from process name using $task.process + */ +def getSoftwareName(task_process) { + return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() +} + +/* + * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules + */ +def initOptions(Map args) { + def Map options = [:] + options.args = args.args ?: '' + options.args2 = args.args2 ?: '' + options.publish_by_id = args.publish_by_id ?: false + options.publish_dir = args.publish_dir ?: '' + options.publish_files = args.publish_files + options.suffix = args.suffix ?: '' + return options +} + +/* + * Tidy up and join elements of a list to return a path string + */ +def getPathFromList(path_list) { + def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries + paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes + return paths.join('/') +} + +/* + * Function to save/publish module results + */ +def saveFiles(Map args) { + if (!args.filename.endsWith('.version.txt')) { + def ioptions = initOptions(args.options) + def path_list = [ ioptions.publish_dir ?: args.publish_dir ] + if (ioptions.publish_by_id) { + path_list.add(args.publish_id) + } + if (ioptions.publish_files instanceof Map) { + for (ext in ioptions.publish_files) { + if (args.filename.endsWith(ext.key)) { + def ext_list = path_list.collect() + ext_list.add(ext.value) + return "${getPathFromList(ext_list)}/$args.filename" + } + } + } else if (ioptions.publish_files == null) { + return "${getPathFromList(path_list)}/$args.filename" + } + } +} diff --git a/software/salmon/index/main.nf b/software/salmon/index/main.nf index 5349d6ce..0b335aa9 100644 --- a/software/salmon/index/main.nf +++ b/software/salmon/index/main.nf @@ -1,51 +1,51 @@ -// Import generic module functions -include { initOptions; saveFiles; getSoftwareName } from './functions' - -params.options = [:] -def options = initOptions(params.options) - -process SALMON_INDEX { - tag "$transcript_fasta" - label "process_medium" - publishDir "${params.outdir}", - mode: params.publish_dir_mode, - saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:'') } - - conda (params.enable_conda ? "bioconda::salmon=1.4.0" : null) - if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { - container "https://depot.galaxyproject.org/singularity/salmon:1.4.0--hf69c8f4_0" - } else { - container "quay.io/biocontainers/salmon:1.4.0--hf69c8f4_0" - } - - input: - path genome_fasta - path transcript_fasta - - output: - path "salmon" , emit: index - path "*.version.txt", emit: version - - script: - def software = getSoftwareName(task.process) - def get_decoy_ids = "grep '^>' $genome_fasta | cut -d ' ' -f 1 > decoys.txt" - def gentrome = "gentrome.fa" - if (genome_fasta.endsWith('.gz')) { - get_decoy_ids = "grep '^>' <(gunzip -c $genome_fasta) | cut -d ' ' -f 1 > decoys.txt" - gentrome = "gentrome.fa.gz" - } - """ - $get_decoy_ids - sed -i.bak -e 's/>//g' decoys.txt - cat $transcript_fasta $genome_fasta > $gentrome - - salmon \\ - index \\ - --threads $task.cpus \\ - -t $gentrome \\ - -d decoys.txt \\ - $options.args \\ - -i salmon - salmon --version | sed -e "s/salmon //g" > ${software}.version.txt - """ -} +// Import generic module functions +include { initOptions; saveFiles; getSoftwareName } from './functions' + +params.options = [:] +def options = initOptions(params.options) + +process SALMON_INDEX { + tag "$transcript_fasta" + label "process_medium" + publishDir "${params.outdir}", + mode: params.publish_dir_mode, + saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:'') } + + conda (params.enable_conda ? "bioconda::salmon=1.4.0" : null) + if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { + container "https://depot.galaxyproject.org/singularity/salmon:1.4.0--hf69c8f4_0" + } else { + container "quay.io/biocontainers/salmon:1.4.0--hf69c8f4_0" + } + + input: + path genome_fasta + path transcript_fasta + + output: + path "salmon" , emit: index + path "*.version.txt", emit: version + + script: + def software = getSoftwareName(task.process) + def get_decoy_ids = "grep '^>' $genome_fasta | cut -d ' ' -f 1 > decoys.txt" + def gentrome = "gentrome.fa" + if (genome_fasta.endsWith('.gz')) { + get_decoy_ids = "grep '^>' <(gunzip -c $genome_fasta) | cut -d ' ' -f 1 > decoys.txt" + gentrome = "gentrome.fa.gz" + } + """ + $get_decoy_ids + sed -i.bak -e 's/>//g' decoys.txt + cat $transcript_fasta $genome_fasta > $gentrome + + salmon \\ + index \\ + --threads $task.cpus \\ + -t $gentrome \\ + -d decoys.txt \\ + $options.args \\ + -i salmon + salmon --version | sed -e "s/salmon //g" > ${software}.version.txt + """ +} diff --git a/software/salmon/quant/functions.nf b/software/salmon/quant/functions.nf index b3ac3801..d25eea86 100644 --- a/software/salmon/quant/functions.nf +++ b/software/salmon/quant/functions.nf @@ -1,59 +1,59 @@ -/* - * ----------------------------------------------------- - * Utility functions used in nf-core DSL2 module files - * ----------------------------------------------------- - */ - -/* - * Extract name of software tool from process name using $task.process - */ -def getSoftwareName(task_process) { - return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() -} - -/* - * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules - */ -def initOptions(Map args) { - def Map options = [:] - options.args = args.args ?: '' - options.args2 = args.args2 ?: '' - options.publish_by_id = args.publish_by_id ?: false - options.publish_dir = args.publish_dir ?: '' - options.publish_files = args.publish_files - options.suffix = args.suffix ?: '' - return options -} - -/* - * Tidy up and join elements of a list to return a path string - */ -def getPathFromList(path_list) { - def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries - paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes - return paths.join('/') -} - -/* - * Function to save/publish module results - */ -def saveFiles(Map args) { - if (!args.filename.endsWith('.version.txt')) { - def ioptions = initOptions(args.options) - def path_list = [ ioptions.publish_dir ?: args.publish_dir ] - if (ioptions.publish_by_id) { - path_list.add(args.publish_id) - } - if (ioptions.publish_files instanceof Map) { - for (ext in ioptions.publish_files) { - if (args.filename.endsWith(ext.key)) { - def ext_list = path_list.collect() - ext_list.add(ext.value) - return "${getPathFromList(ext_list)}/$args.filename" - } - } - } else if (ioptions.publish_files == null) { - return "${getPathFromList(path_list)}/$args.filename" - } - } -} +/* + * ----------------------------------------------------- + * Utility functions used in nf-core DSL2 module files + * ----------------------------------------------------- + */ + +/* + * Extract name of software tool from process name using $task.process + */ +def getSoftwareName(task_process) { + return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() +} + +/* + * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules + */ +def initOptions(Map args) { + def Map options = [:] + options.args = args.args ?: '' + options.args2 = args.args2 ?: '' + options.publish_by_id = args.publish_by_id ?: false + options.publish_dir = args.publish_dir ?: '' + options.publish_files = args.publish_files + options.suffix = args.suffix ?: '' + return options +} + +/* + * Tidy up and join elements of a list to return a path string + */ +def getPathFromList(path_list) { + def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries + paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes + return paths.join('/') +} + +/* + * Function to save/publish module results + */ +def saveFiles(Map args) { + if (!args.filename.endsWith('.version.txt')) { + def ioptions = initOptions(args.options) + def path_list = [ ioptions.publish_dir ?: args.publish_dir ] + if (ioptions.publish_by_id) { + path_list.add(args.publish_id) + } + if (ioptions.publish_files instanceof Map) { + for (ext in ioptions.publish_files) { + if (args.filename.endsWith(ext.key)) { + def ext_list = path_list.collect() + ext_list.add(ext.value) + return "${getPathFromList(ext_list)}/$args.filename" + } + } + } else if (ioptions.publish_files == null) { + return "${getPathFromList(path_list)}/$args.filename" + } + } +} diff --git a/software/salmon/quant/main.nf b/software/salmon/quant/main.nf index 42874e0b..716f13da 100644 --- a/software/salmon/quant/main.nf +++ b/software/salmon/quant/main.nf @@ -24,7 +24,7 @@ process SALMON_QUANT { path gtf path transcript_fasta val alignment_mode - + output: tuple val(meta), path("${prefix}"), emit: results path "*.version.txt" , emit: version @@ -39,7 +39,7 @@ process SALMON_QUANT { reference = "-t $transcript_fasta" input_reads = "-a $reads" } - + def strandedness = meta.single_end ? 'U' : 'IU' if (meta.strandedness == 'forward') { strandedness = meta.single_end ? 'SF' : 'ISF' diff --git a/software/samtools/flagstat/functions.nf b/software/samtools/flagstat/functions.nf index b3ac3801..d25eea86 100644 --- a/software/samtools/flagstat/functions.nf +++ b/software/samtools/flagstat/functions.nf @@ -1,59 +1,59 @@ -/* - * ----------------------------------------------------- - * Utility functions used in nf-core DSL2 module files - * ----------------------------------------------------- - */ - -/* - * Extract name of software tool from process name using $task.process - */ -def getSoftwareName(task_process) { - return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() -} - -/* - * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules - */ -def initOptions(Map args) { - def Map options = [:] - options.args = args.args ?: '' - options.args2 = args.args2 ?: '' - options.publish_by_id = args.publish_by_id ?: false - options.publish_dir = args.publish_dir ?: '' - options.publish_files = args.publish_files - options.suffix = args.suffix ?: '' - return options -} - -/* - * Tidy up and join elements of a list to return a path string - */ -def getPathFromList(path_list) { - def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries - paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes - return paths.join('/') -} - -/* - * Function to save/publish module results - */ -def saveFiles(Map args) { - if (!args.filename.endsWith('.version.txt')) { - def ioptions = initOptions(args.options) - def path_list = [ ioptions.publish_dir ?: args.publish_dir ] - if (ioptions.publish_by_id) { - path_list.add(args.publish_id) - } - if (ioptions.publish_files instanceof Map) { - for (ext in ioptions.publish_files) { - if (args.filename.endsWith(ext.key)) { - def ext_list = path_list.collect() - ext_list.add(ext.value) - return "${getPathFromList(ext_list)}/$args.filename" - } - } - } else if (ioptions.publish_files == null) { - return "${getPathFromList(path_list)}/$args.filename" - } - } -} +/* + * ----------------------------------------------------- + * Utility functions used in nf-core DSL2 module files + * ----------------------------------------------------- + */ + +/* + * Extract name of software tool from process name using $task.process + */ +def getSoftwareName(task_process) { + return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() +} + +/* + * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules + */ +def initOptions(Map args) { + def Map options = [:] + options.args = args.args ?: '' + options.args2 = args.args2 ?: '' + options.publish_by_id = args.publish_by_id ?: false + options.publish_dir = args.publish_dir ?: '' + options.publish_files = args.publish_files + options.suffix = args.suffix ?: '' + return options +} + +/* + * Tidy up and join elements of a list to return a path string + */ +def getPathFromList(path_list) { + def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries + paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes + return paths.join('/') +} + +/* + * Function to save/publish module results + */ +def saveFiles(Map args) { + if (!args.filename.endsWith('.version.txt')) { + def ioptions = initOptions(args.options) + def path_list = [ ioptions.publish_dir ?: args.publish_dir ] + if (ioptions.publish_by_id) { + path_list.add(args.publish_id) + } + if (ioptions.publish_files instanceof Map) { + for (ext in ioptions.publish_files) { + if (args.filename.endsWith(ext.key)) { + def ext_list = path_list.collect() + ext_list.add(ext.value) + return "${getPathFromList(ext_list)}/$args.filename" + } + } + } else if (ioptions.publish_files == null) { + return "${getPathFromList(path_list)}/$args.filename" + } + } +} diff --git a/software/samtools/flagstat/main.nf b/software/samtools/flagstat/main.nf index e23f0864..9b663ee7 100644 --- a/software/samtools/flagstat/main.nf +++ b/software/samtools/flagstat/main.nf @@ -1,32 +1,32 @@ -// Import generic module functions -include { saveFiles; getSoftwareName } from './functions' - -params.options = [:] - -process SAMTOOLS_FLAGSTAT { - tag "$meta.id" - publishDir "${params.outdir}", - mode: params.publish_dir_mode, - saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) } - - conda (params.enable_conda ? "bioconda::samtools=1.10" : null) - if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { - container "https://depot.galaxyproject.org/singularity/samtools:1.10--h9402c20_2" - } else { - container "quay.io/biocontainers/samtools:1.10--h9402c20_2" - } - - input: - tuple val(meta), path(bam), path(bai) - - output: - tuple val(meta), path("*.flagstat"), emit: flagstat - path "*.version.txt" , emit: version - - script: - def software = getSoftwareName(task.process) - """ - samtools flagstat $bam > ${bam}.flagstat - echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//' > ${software}.version.txt - """ -} +// Import generic module functions +include { saveFiles; getSoftwareName } from './functions' + +params.options = [:] + +process SAMTOOLS_FLAGSTAT { + tag "$meta.id" + publishDir "${params.outdir}", + mode: params.publish_dir_mode, + saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) } + + conda (params.enable_conda ? "bioconda::samtools=1.10" : null) + if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { + container "https://depot.galaxyproject.org/singularity/samtools:1.10--h9402c20_2" + } else { + container "quay.io/biocontainers/samtools:1.10--h9402c20_2" + } + + input: + tuple val(meta), path(bam), path(bai) + + output: + tuple val(meta), path("*.flagstat"), emit: flagstat + path "*.version.txt" , emit: version + + script: + def software = getSoftwareName(task.process) + """ + samtools flagstat $bam > ${bam}.flagstat + echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//' > ${software}.version.txt + """ +} diff --git a/software/samtools/idxstats/functions.nf b/software/samtools/idxstats/functions.nf index b3ac3801..d25eea86 100644 --- a/software/samtools/idxstats/functions.nf +++ b/software/samtools/idxstats/functions.nf @@ -1,59 +1,59 @@ -/* - * ----------------------------------------------------- - * Utility functions used in nf-core DSL2 module files - * ----------------------------------------------------- - */ - -/* - * Extract name of software tool from process name using $task.process - */ -def getSoftwareName(task_process) { - return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() -} - -/* - * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules - */ -def initOptions(Map args) { - def Map options = [:] - options.args = args.args ?: '' - options.args2 = args.args2 ?: '' - options.publish_by_id = args.publish_by_id ?: false - options.publish_dir = args.publish_dir ?: '' - options.publish_files = args.publish_files - options.suffix = args.suffix ?: '' - return options -} - -/* - * Tidy up and join elements of a list to return a path string - */ -def getPathFromList(path_list) { - def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries - paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes - return paths.join('/') -} - -/* - * Function to save/publish module results - */ -def saveFiles(Map args) { - if (!args.filename.endsWith('.version.txt')) { - def ioptions = initOptions(args.options) - def path_list = [ ioptions.publish_dir ?: args.publish_dir ] - if (ioptions.publish_by_id) { - path_list.add(args.publish_id) - } - if (ioptions.publish_files instanceof Map) { - for (ext in ioptions.publish_files) { - if (args.filename.endsWith(ext.key)) { - def ext_list = path_list.collect() - ext_list.add(ext.value) - return "${getPathFromList(ext_list)}/$args.filename" - } - } - } else if (ioptions.publish_files == null) { - return "${getPathFromList(path_list)}/$args.filename" - } - } -} +/* + * ----------------------------------------------------- + * Utility functions used in nf-core DSL2 module files + * ----------------------------------------------------- + */ + +/* + * Extract name of software tool from process name using $task.process + */ +def getSoftwareName(task_process) { + return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() +} + +/* + * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules + */ +def initOptions(Map args) { + def Map options = [:] + options.args = args.args ?: '' + options.args2 = args.args2 ?: '' + options.publish_by_id = args.publish_by_id ?: false + options.publish_dir = args.publish_dir ?: '' + options.publish_files = args.publish_files + options.suffix = args.suffix ?: '' + return options +} + +/* + * Tidy up and join elements of a list to return a path string + */ +def getPathFromList(path_list) { + def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries + paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes + return paths.join('/') +} + +/* + * Function to save/publish module results + */ +def saveFiles(Map args) { + if (!args.filename.endsWith('.version.txt')) { + def ioptions = initOptions(args.options) + def path_list = [ ioptions.publish_dir ?: args.publish_dir ] + if (ioptions.publish_by_id) { + path_list.add(args.publish_id) + } + if (ioptions.publish_files instanceof Map) { + for (ext in ioptions.publish_files) { + if (args.filename.endsWith(ext.key)) { + def ext_list = path_list.collect() + ext_list.add(ext.value) + return "${getPathFromList(ext_list)}/$args.filename" + } + } + } else if (ioptions.publish_files == null) { + return "${getPathFromList(path_list)}/$args.filename" + } + } +} diff --git a/software/samtools/idxstats/main.nf b/software/samtools/idxstats/main.nf index 40ac4702..26ff4075 100644 --- a/software/samtools/idxstats/main.nf +++ b/software/samtools/idxstats/main.nf @@ -1,32 +1,32 @@ -// Import generic module functions -include { saveFiles; getSoftwareName } from './functions' - -params.options = [:] - -process SAMTOOLS_IDXSTATS { - tag "$meta.id" - publishDir "${params.outdir}", - mode: params.publish_dir_mode, - saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) } - - conda (params.enable_conda ? "bioconda::samtools=1.10" : null) - if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { - container "https://depot.galaxyproject.org/singularity/samtools:1.10--h9402c20_2" - } else { - container "quay.io/biocontainers/samtools:1.10--h9402c20_2" - } - - input: - tuple val(meta), path(bam), path(bai) - - output: - tuple val(meta), path("*.idxstats"), emit: idxstats - path "*.version.txt" , emit: version - - script: - def software = getSoftwareName(task.process) - """ - samtools idxstats $bam > ${bam}.idxstats - echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//' > ${software}.version.txt - """ -} +// Import generic module functions +include { saveFiles; getSoftwareName } from './functions' + +params.options = [:] + +process SAMTOOLS_IDXSTATS { + tag "$meta.id" + publishDir "${params.outdir}", + mode: params.publish_dir_mode, + saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) } + + conda (params.enable_conda ? "bioconda::samtools=1.10" : null) + if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { + container "https://depot.galaxyproject.org/singularity/samtools:1.10--h9402c20_2" + } else { + container "quay.io/biocontainers/samtools:1.10--h9402c20_2" + } + + input: + tuple val(meta), path(bam), path(bai) + + output: + tuple val(meta), path("*.idxstats"), emit: idxstats + path "*.version.txt" , emit: version + + script: + def software = getSoftwareName(task.process) + """ + samtools idxstats $bam > ${bam}.idxstats + echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//' > ${software}.version.txt + """ +} diff --git a/software/samtools/index/functions.nf b/software/samtools/index/functions.nf index b3ac3801..d25eea86 100644 --- a/software/samtools/index/functions.nf +++ b/software/samtools/index/functions.nf @@ -1,59 +1,59 @@ -/* - * ----------------------------------------------------- - * Utility functions used in nf-core DSL2 module files - * ----------------------------------------------------- - */ - -/* - * Extract name of software tool from process name using $task.process - */ -def getSoftwareName(task_process) { - return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() -} - -/* - * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules - */ -def initOptions(Map args) { - def Map options = [:] - options.args = args.args ?: '' - options.args2 = args.args2 ?: '' - options.publish_by_id = args.publish_by_id ?: false - options.publish_dir = args.publish_dir ?: '' - options.publish_files = args.publish_files - options.suffix = args.suffix ?: '' - return options -} - -/* - * Tidy up and join elements of a list to return a path string - */ -def getPathFromList(path_list) { - def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries - paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes - return paths.join('/') -} - -/* - * Function to save/publish module results - */ -def saveFiles(Map args) { - if (!args.filename.endsWith('.version.txt')) { - def ioptions = initOptions(args.options) - def path_list = [ ioptions.publish_dir ?: args.publish_dir ] - if (ioptions.publish_by_id) { - path_list.add(args.publish_id) - } - if (ioptions.publish_files instanceof Map) { - for (ext in ioptions.publish_files) { - if (args.filename.endsWith(ext.key)) { - def ext_list = path_list.collect() - ext_list.add(ext.value) - return "${getPathFromList(ext_list)}/$args.filename" - } - } - } else if (ioptions.publish_files == null) { - return "${getPathFromList(path_list)}/$args.filename" - } - } -} +/* + * ----------------------------------------------------- + * Utility functions used in nf-core DSL2 module files + * ----------------------------------------------------- + */ + +/* + * Extract name of software tool from process name using $task.process + */ +def getSoftwareName(task_process) { + return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() +} + +/* + * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules + */ +def initOptions(Map args) { + def Map options = [:] + options.args = args.args ?: '' + options.args2 = args.args2 ?: '' + options.publish_by_id = args.publish_by_id ?: false + options.publish_dir = args.publish_dir ?: '' + options.publish_files = args.publish_files + options.suffix = args.suffix ?: '' + return options +} + +/* + * Tidy up and join elements of a list to return a path string + */ +def getPathFromList(path_list) { + def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries + paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes + return paths.join('/') +} + +/* + * Function to save/publish module results + */ +def saveFiles(Map args) { + if (!args.filename.endsWith('.version.txt')) { + def ioptions = initOptions(args.options) + def path_list = [ ioptions.publish_dir ?: args.publish_dir ] + if (ioptions.publish_by_id) { + path_list.add(args.publish_id) + } + if (ioptions.publish_files instanceof Map) { + for (ext in ioptions.publish_files) { + if (args.filename.endsWith(ext.key)) { + def ext_list = path_list.collect() + ext_list.add(ext.value) + return "${getPathFromList(ext_list)}/$args.filename" + } + } + } else if (ioptions.publish_files == null) { + return "${getPathFromList(path_list)}/$args.filename" + } + } +} diff --git a/software/samtools/index/main.nf b/software/samtools/index/main.nf index c0dadfd5..5dd631da 100644 --- a/software/samtools/index/main.nf +++ b/software/samtools/index/main.nf @@ -1,32 +1,32 @@ -// Import generic module functions -include { saveFiles; getSoftwareName } from './functions' - -params.options = [:] - -process SAMTOOLS_INDEX { - tag "$meta.id" - publishDir "${params.outdir}", - mode: params.publish_dir_mode, - saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) } - - conda (params.enable_conda ? "bioconda::samtools=1.10" : null) - if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { - container "https://depot.galaxyproject.org/singularity/samtools:1.10--h9402c20_2" - } else { - container "quay.io/biocontainers/samtools:1.10--h9402c20_2" - } - - input: - tuple val(meta), path(bam) - - output: - tuple val(meta), path("*.bai"), emit: bai - path "*.version.txt" , emit: version - - script: - def software = getSoftwareName(task.process) - """ - samtools index $bam - echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//' > ${software}.version.txt - """ -} +// Import generic module functions +include { saveFiles; getSoftwareName } from './functions' + +params.options = [:] + +process SAMTOOLS_INDEX { + tag "$meta.id" + publishDir "${params.outdir}", + mode: params.publish_dir_mode, + saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) } + + conda (params.enable_conda ? "bioconda::samtools=1.10" : null) + if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { + container "https://depot.galaxyproject.org/singularity/samtools:1.10--h9402c20_2" + } else { + container "quay.io/biocontainers/samtools:1.10--h9402c20_2" + } + + input: + tuple val(meta), path(bam) + + output: + tuple val(meta), path("*.bai"), emit: bai + path "*.version.txt" , emit: version + + script: + def software = getSoftwareName(task.process) + """ + samtools index $bam + echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//' > ${software}.version.txt + """ +} diff --git a/software/samtools/sort/functions.nf b/software/samtools/sort/functions.nf index b3ac3801..d25eea86 100644 --- a/software/samtools/sort/functions.nf +++ b/software/samtools/sort/functions.nf @@ -1,59 +1,59 @@ -/* - * ----------------------------------------------------- - * Utility functions used in nf-core DSL2 module files - * ----------------------------------------------------- - */ - -/* - * Extract name of software tool from process name using $task.process - */ -def getSoftwareName(task_process) { - return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() -} - -/* - * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules - */ -def initOptions(Map args) { - def Map options = [:] - options.args = args.args ?: '' - options.args2 = args.args2 ?: '' - options.publish_by_id = args.publish_by_id ?: false - options.publish_dir = args.publish_dir ?: '' - options.publish_files = args.publish_files - options.suffix = args.suffix ?: '' - return options -} - -/* - * Tidy up and join elements of a list to return a path string - */ -def getPathFromList(path_list) { - def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries - paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes - return paths.join('/') -} - -/* - * Function to save/publish module results - */ -def saveFiles(Map args) { - if (!args.filename.endsWith('.version.txt')) { - def ioptions = initOptions(args.options) - def path_list = [ ioptions.publish_dir ?: args.publish_dir ] - if (ioptions.publish_by_id) { - path_list.add(args.publish_id) - } - if (ioptions.publish_files instanceof Map) { - for (ext in ioptions.publish_files) { - if (args.filename.endsWith(ext.key)) { - def ext_list = path_list.collect() - ext_list.add(ext.value) - return "${getPathFromList(ext_list)}/$args.filename" - } - } - } else if (ioptions.publish_files == null) { - return "${getPathFromList(path_list)}/$args.filename" - } - } -} +/* + * ----------------------------------------------------- + * Utility functions used in nf-core DSL2 module files + * ----------------------------------------------------- + */ + +/* + * Extract name of software tool from process name using $task.process + */ +def getSoftwareName(task_process) { + return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() +} + +/* + * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules + */ +def initOptions(Map args) { + def Map options = [:] + options.args = args.args ?: '' + options.args2 = args.args2 ?: '' + options.publish_by_id = args.publish_by_id ?: false + options.publish_dir = args.publish_dir ?: '' + options.publish_files = args.publish_files + options.suffix = args.suffix ?: '' + return options +} + +/* + * Tidy up and join elements of a list to return a path string + */ +def getPathFromList(path_list) { + def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries + paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes + return paths.join('/') +} + +/* + * Function to save/publish module results + */ +def saveFiles(Map args) { + if (!args.filename.endsWith('.version.txt')) { + def ioptions = initOptions(args.options) + def path_list = [ ioptions.publish_dir ?: args.publish_dir ] + if (ioptions.publish_by_id) { + path_list.add(args.publish_id) + } + if (ioptions.publish_files instanceof Map) { + for (ext in ioptions.publish_files) { + if (args.filename.endsWith(ext.key)) { + def ext_list = path_list.collect() + ext_list.add(ext.value) + return "${getPathFromList(ext_list)}/$args.filename" + } + } + } else if (ioptions.publish_files == null) { + return "${getPathFromList(path_list)}/$args.filename" + } + } +} diff --git a/software/samtools/sort/main.nf b/software/samtools/sort/main.nf index e43e4a9b..2b95b1d5 100644 --- a/software/samtools/sort/main.nf +++ b/software/samtools/sort/main.nf @@ -1,35 +1,35 @@ -// Import generic module functions -include { initOptions; saveFiles; getSoftwareName } from './functions' - -params.options = [:] -def options = initOptions(params.options) - -process SAMTOOLS_SORT { - 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), publish_id:meta.id) } - - conda (params.enable_conda ? "bioconda::samtools=1.10" : null) - if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { - container "https://depot.galaxyproject.org/singularity/samtools:1.10--h9402c20_2" - } else { - container "quay.io/biocontainers/samtools:1.10--h9402c20_2" - } - - input: - tuple val(meta), path(bam) - - output: - tuple val(meta), path("*.bam"), emit: bam - path "*.version.txt" , emit: version - - script: - def software = getSoftwareName(task.process) - def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" - """ - samtools sort $options.args -@ $task.cpus -o ${prefix}.bam -T $prefix $bam - echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//' > ${software}.version.txt - """ -} +// Import generic module functions +include { initOptions; saveFiles; getSoftwareName } from './functions' + +params.options = [:] +def options = initOptions(params.options) + +process SAMTOOLS_SORT { + 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), publish_id:meta.id) } + + conda (params.enable_conda ? "bioconda::samtools=1.10" : null) + if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { + container "https://depot.galaxyproject.org/singularity/samtools:1.10--h9402c20_2" + } else { + container "quay.io/biocontainers/samtools:1.10--h9402c20_2" + } + + input: + tuple val(meta), path(bam) + + output: + tuple val(meta), path("*.bam"), emit: bam + path "*.version.txt" , emit: version + + script: + def software = getSoftwareName(task.process) + def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" + """ + samtools sort $options.args -@ $task.cpus -o ${prefix}.bam -T $prefix $bam + echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//' > ${software}.version.txt + """ +} diff --git a/software/samtools/stats/functions.nf b/software/samtools/stats/functions.nf index b3ac3801..d25eea86 100644 --- a/software/samtools/stats/functions.nf +++ b/software/samtools/stats/functions.nf @@ -1,59 +1,59 @@ -/* - * ----------------------------------------------------- - * Utility functions used in nf-core DSL2 module files - * ----------------------------------------------------- - */ - -/* - * Extract name of software tool from process name using $task.process - */ -def getSoftwareName(task_process) { - return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() -} - -/* - * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules - */ -def initOptions(Map args) { - def Map options = [:] - options.args = args.args ?: '' - options.args2 = args.args2 ?: '' - options.publish_by_id = args.publish_by_id ?: false - options.publish_dir = args.publish_dir ?: '' - options.publish_files = args.publish_files - options.suffix = args.suffix ?: '' - return options -} - -/* - * Tidy up and join elements of a list to return a path string - */ -def getPathFromList(path_list) { - def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries - paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes - return paths.join('/') -} - -/* - * Function to save/publish module results - */ -def saveFiles(Map args) { - if (!args.filename.endsWith('.version.txt')) { - def ioptions = initOptions(args.options) - def path_list = [ ioptions.publish_dir ?: args.publish_dir ] - if (ioptions.publish_by_id) { - path_list.add(args.publish_id) - } - if (ioptions.publish_files instanceof Map) { - for (ext in ioptions.publish_files) { - if (args.filename.endsWith(ext.key)) { - def ext_list = path_list.collect() - ext_list.add(ext.value) - return "${getPathFromList(ext_list)}/$args.filename" - } - } - } else if (ioptions.publish_files == null) { - return "${getPathFromList(path_list)}/$args.filename" - } - } -} +/* + * ----------------------------------------------------- + * Utility functions used in nf-core DSL2 module files + * ----------------------------------------------------- + */ + +/* + * Extract name of software tool from process name using $task.process + */ +def getSoftwareName(task_process) { + return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() +} + +/* + * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules + */ +def initOptions(Map args) { + def Map options = [:] + options.args = args.args ?: '' + options.args2 = args.args2 ?: '' + options.publish_by_id = args.publish_by_id ?: false + options.publish_dir = args.publish_dir ?: '' + options.publish_files = args.publish_files + options.suffix = args.suffix ?: '' + return options +} + +/* + * Tidy up and join elements of a list to return a path string + */ +def getPathFromList(path_list) { + def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries + paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes + return paths.join('/') +} + +/* + * Function to save/publish module results + */ +def saveFiles(Map args) { + if (!args.filename.endsWith('.version.txt')) { + def ioptions = initOptions(args.options) + def path_list = [ ioptions.publish_dir ?: args.publish_dir ] + if (ioptions.publish_by_id) { + path_list.add(args.publish_id) + } + if (ioptions.publish_files instanceof Map) { + for (ext in ioptions.publish_files) { + if (args.filename.endsWith(ext.key)) { + def ext_list = path_list.collect() + ext_list.add(ext.value) + return "${getPathFromList(ext_list)}/$args.filename" + } + } + } else if (ioptions.publish_files == null) { + return "${getPathFromList(path_list)}/$args.filename" + } + } +} diff --git a/software/samtools/stats/main.nf b/software/samtools/stats/main.nf index ba38c6ad..d8d1d020 100644 --- a/software/samtools/stats/main.nf +++ b/software/samtools/stats/main.nf @@ -1,32 +1,32 @@ -// Import generic module functions -include { saveFiles; getSoftwareName } from './functions' - -params.options = [:] - -process SAMTOOLS_STATS { - tag "$meta.id" - publishDir "${params.outdir}", - mode: params.publish_dir_mode, - saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) } - - conda (params.enable_conda ? "bioconda::samtools=1.10" : null) - if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { - container "https://depot.galaxyproject.org/singularity/samtools:1.10--h9402c20_2" - } else { - container "quay.io/biocontainers/samtools:1.10--h9402c20_2" - } - - input: - tuple val(meta), path(bam), path(bai) - - output: - tuple val(meta), path("*.stats"), emit: stats - path "*.version.txt" , emit: version - - script: - def software = getSoftwareName(task.process) - """ - samtools stats $bam > ${bam}.stats - echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//' > ${software}.version.txt - """ -} +// Import generic module functions +include { saveFiles; getSoftwareName } from './functions' + +params.options = [:] + +process SAMTOOLS_STATS { + tag "$meta.id" + publishDir "${params.outdir}", + mode: params.publish_dir_mode, + saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) } + + conda (params.enable_conda ? "bioconda::samtools=1.10" : null) + if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { + container "https://depot.galaxyproject.org/singularity/samtools:1.10--h9402c20_2" + } else { + container "quay.io/biocontainers/samtools:1.10--h9402c20_2" + } + + input: + tuple val(meta), path(bam), path(bai) + + output: + tuple val(meta), path("*.stats"), emit: stats + path "*.version.txt" , emit: version + + script: + def software = getSoftwareName(task.process) + """ + samtools stats $bam > ${bam}.stats + echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//' > ${software}.version.txt + """ +} diff --git a/software/sortmerna/functions.nf b/software/sortmerna/functions.nf index b3ac3801..d25eea86 100644 --- a/software/sortmerna/functions.nf +++ b/software/sortmerna/functions.nf @@ -1,59 +1,59 @@ -/* - * ----------------------------------------------------- - * Utility functions used in nf-core DSL2 module files - * ----------------------------------------------------- - */ - -/* - * Extract name of software tool from process name using $task.process - */ -def getSoftwareName(task_process) { - return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() -} - -/* - * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules - */ -def initOptions(Map args) { - def Map options = [:] - options.args = args.args ?: '' - options.args2 = args.args2 ?: '' - options.publish_by_id = args.publish_by_id ?: false - options.publish_dir = args.publish_dir ?: '' - options.publish_files = args.publish_files - options.suffix = args.suffix ?: '' - return options -} - -/* - * Tidy up and join elements of a list to return a path string - */ -def getPathFromList(path_list) { - def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries - paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes - return paths.join('/') -} - -/* - * Function to save/publish module results - */ -def saveFiles(Map args) { - if (!args.filename.endsWith('.version.txt')) { - def ioptions = initOptions(args.options) - def path_list = [ ioptions.publish_dir ?: args.publish_dir ] - if (ioptions.publish_by_id) { - path_list.add(args.publish_id) - } - if (ioptions.publish_files instanceof Map) { - for (ext in ioptions.publish_files) { - if (args.filename.endsWith(ext.key)) { - def ext_list = path_list.collect() - ext_list.add(ext.value) - return "${getPathFromList(ext_list)}/$args.filename" - } - } - } else if (ioptions.publish_files == null) { - return "${getPathFromList(path_list)}/$args.filename" - } - } -} +/* + * ----------------------------------------------------- + * Utility functions used in nf-core DSL2 module files + * ----------------------------------------------------- + */ + +/* + * Extract name of software tool from process name using $task.process + */ +def getSoftwareName(task_process) { + return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() +} + +/* + * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules + */ +def initOptions(Map args) { + def Map options = [:] + options.args = args.args ?: '' + options.args2 = args.args2 ?: '' + options.publish_by_id = args.publish_by_id ?: false + options.publish_dir = args.publish_dir ?: '' + options.publish_files = args.publish_files + options.suffix = args.suffix ?: '' + return options +} + +/* + * Tidy up and join elements of a list to return a path string + */ +def getPathFromList(path_list) { + def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries + paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes + return paths.join('/') +} + +/* + * Function to save/publish module results + */ +def saveFiles(Map args) { + if (!args.filename.endsWith('.version.txt')) { + def ioptions = initOptions(args.options) + def path_list = [ ioptions.publish_dir ?: args.publish_dir ] + if (ioptions.publish_by_id) { + path_list.add(args.publish_id) + } + if (ioptions.publish_files instanceof Map) { + for (ext in ioptions.publish_files) { + if (args.filename.endsWith(ext.key)) { + def ext_list = path_list.collect() + ext_list.add(ext.value) + return "${getPathFromList(ext_list)}/$args.filename" + } + } + } else if (ioptions.publish_files == null) { + return "${getPathFromList(path_list)}/$args.filename" + } + } +} diff --git a/software/sortmerna/main.nf b/software/sortmerna/main.nf index 5f2c34f9..ac1ce074 100644 --- a/software/sortmerna/main.nf +++ b/software/sortmerna/main.nf @@ -1,73 +1,73 @@ -// Import generic module functions -include { initOptions; saveFiles; getSoftwareName } from './functions' - -params.options = [:] -def options = initOptions(params.options) - -process SORTMERNA { - tag "$meta.id" - label "process_high" - publishDir "${params.outdir}", - mode: params.publish_dir_mode, - saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) } - - conda (params.enable_conda ? "bioconda::sortmerna=4.2.0" : null) - if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { - container "https://depot.galaxyproject.org/singularity/sortmerna:4.2.0--0" - } else { - container "quay.io/biocontainers/sortmerna:4.2.0--0" - } - - input: - tuple val(meta), path(reads) - path fasta - - output: - tuple val(meta), path("*.fastq.gz"), emit: reads - tuple val(meta), path("*.log") , emit: log - path "*.version.txt" , emit: version - - script: - def software = getSoftwareName(task.process) - def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" - - def Refs = "" - for (i=0; i ${prefix}.fastq.gz - mv rRNA_reads.log ${prefix}.sortmerna.log - - echo \$(sortmerna --version 2>&1) | sed 's/^.*SortMeRNA version //; s/ Build Date.*\$//' > ${software}.version.txt - """ - } else { - """ - sortmerna \\ - $Refs \\ - --reads ${reads[0]} \\ - --reads ${reads[1]} \\ - --threads $task.cpus \\ - --workdir . \\ - --aligned rRNA_reads \\ - --other non_rRNA_reads \\ - --paired_in \\ - --out2 \\ - $options.args - - gzip -f < non_rRNA_reads_fwd.fq > ${prefix}_1.fastq.gz - gzip -f < non_rRNA_reads_rev.fq > ${prefix}_2.fastq.gz - mv rRNA_reads.log ${prefix}.sortmerna.log - - echo \$(sortmerna --version 2>&1) | sed 's/^.*SortMeRNA version //; s/ Build Date.*\$//' > ${software}.version.txt - """ - } -} +// Import generic module functions +include { initOptions; saveFiles; getSoftwareName } from './functions' + +params.options = [:] +def options = initOptions(params.options) + +process SORTMERNA { + tag "$meta.id" + label "process_high" + publishDir "${params.outdir}", + mode: params.publish_dir_mode, + saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) } + + conda (params.enable_conda ? "bioconda::sortmerna=4.2.0" : null) + if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { + container "https://depot.galaxyproject.org/singularity/sortmerna:4.2.0--0" + } else { + container "quay.io/biocontainers/sortmerna:4.2.0--0" + } + + input: + tuple val(meta), path(reads) + path fasta + + output: + tuple val(meta), path("*.fastq.gz"), emit: reads + tuple val(meta), path("*.log") , emit: log + path "*.version.txt" , emit: version + + script: + def software = getSoftwareName(task.process) + def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" + + def Refs = "" + for (i=0; i ${prefix}.fastq.gz + mv rRNA_reads.log ${prefix}.sortmerna.log + + echo \$(sortmerna --version 2>&1) | sed 's/^.*SortMeRNA version //; s/ Build Date.*\$//' > ${software}.version.txt + """ + } else { + """ + sortmerna \\ + $Refs \\ + --reads ${reads[0]} \\ + --reads ${reads[1]} \\ + --threads $task.cpus \\ + --workdir . \\ + --aligned rRNA_reads \\ + --other non_rRNA_reads \\ + --paired_in \\ + --out2 \\ + $options.args + + gzip -f < non_rRNA_reads_fwd.fq > ${prefix}_1.fastq.gz + gzip -f < non_rRNA_reads_rev.fq > ${prefix}_2.fastq.gz + mv rRNA_reads.log ${prefix}.sortmerna.log + + echo \$(sortmerna --version 2>&1) | sed 's/^.*SortMeRNA version //; s/ Build Date.*\$//' > ${software}.version.txt + """ + } +} diff --git a/software/star/align/functions.nf b/software/star/align/functions.nf index b3ac3801..d25eea86 100644 --- a/software/star/align/functions.nf +++ b/software/star/align/functions.nf @@ -1,59 +1,59 @@ -/* - * ----------------------------------------------------- - * Utility functions used in nf-core DSL2 module files - * ----------------------------------------------------- - */ - -/* - * Extract name of software tool from process name using $task.process - */ -def getSoftwareName(task_process) { - return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() -} - -/* - * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules - */ -def initOptions(Map args) { - def Map options = [:] - options.args = args.args ?: '' - options.args2 = args.args2 ?: '' - options.publish_by_id = args.publish_by_id ?: false - options.publish_dir = args.publish_dir ?: '' - options.publish_files = args.publish_files - options.suffix = args.suffix ?: '' - return options -} - -/* - * Tidy up and join elements of a list to return a path string - */ -def getPathFromList(path_list) { - def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries - paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes - return paths.join('/') -} - -/* - * Function to save/publish module results - */ -def saveFiles(Map args) { - if (!args.filename.endsWith('.version.txt')) { - def ioptions = initOptions(args.options) - def path_list = [ ioptions.publish_dir ?: args.publish_dir ] - if (ioptions.publish_by_id) { - path_list.add(args.publish_id) - } - if (ioptions.publish_files instanceof Map) { - for (ext in ioptions.publish_files) { - if (args.filename.endsWith(ext.key)) { - def ext_list = path_list.collect() - ext_list.add(ext.value) - return "${getPathFromList(ext_list)}/$args.filename" - } - } - } else if (ioptions.publish_files == null) { - return "${getPathFromList(path_list)}/$args.filename" - } - } -} +/* + * ----------------------------------------------------- + * Utility functions used in nf-core DSL2 module files + * ----------------------------------------------------- + */ + +/* + * Extract name of software tool from process name using $task.process + */ +def getSoftwareName(task_process) { + return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() +} + +/* + * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules + */ +def initOptions(Map args) { + def Map options = [:] + options.args = args.args ?: '' + options.args2 = args.args2 ?: '' + options.publish_by_id = args.publish_by_id ?: false + options.publish_dir = args.publish_dir ?: '' + options.publish_files = args.publish_files + options.suffix = args.suffix ?: '' + return options +} + +/* + * Tidy up and join elements of a list to return a path string + */ +def getPathFromList(path_list) { + def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries + paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes + return paths.join('/') +} + +/* + * Function to save/publish module results + */ +def saveFiles(Map args) { + if (!args.filename.endsWith('.version.txt')) { + def ioptions = initOptions(args.options) + def path_list = [ ioptions.publish_dir ?: args.publish_dir ] + if (ioptions.publish_by_id) { + path_list.add(args.publish_id) + } + if (ioptions.publish_files instanceof Map) { + for (ext in ioptions.publish_files) { + if (args.filename.endsWith(ext.key)) { + def ext_list = path_list.collect() + ext_list.add(ext.value) + return "${getPathFromList(ext_list)}/$args.filename" + } + } + } else if (ioptions.publish_files == null) { + return "${getPathFromList(path_list)}/$args.filename" + } + } +} diff --git a/software/star/align/main.nf b/software/star/align/main.nf index 866608d8..0d465e42 100644 --- a/software/star/align/main.nf +++ b/software/star/align/main.nf @@ -1,66 +1,66 @@ -// Import generic module functions -include { initOptions; saveFiles; getSoftwareName } from './functions' - -params.options = [:] -def options = initOptions(params.options) - -process STAR_ALIGN { - tag "$meta.id" - label 'process_high' - publishDir "${params.outdir}", - mode: params.publish_dir_mode, - saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) } - - // Note: 2.7X indices incompatible with AWS iGenomes. - conda (params.enable_conda ? "bioconda::star=2.6.1d" : null) - if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { - container "https://depot.galaxyproject.org/singularity/star:2.6.1d--0" - } else { - container "quay.io/biocontainers/star:2.6.1d--0" - } - - - input: - tuple val(meta), path(reads) - path index - path gtf - - output: - tuple val(meta), path("*Aligned.out.bam") , emit: bam - tuple val(meta), path("*Log.final.out") , emit: log_final - tuple val(meta), path("*Log.out") , emit: log_out - tuple val(meta), path("*Log.progress.out"), emit: log_progress - path "*.version.txt" , emit: version - - tuple val(meta), path("*sortedByCoord.out.bam") , optional:true, emit: bam_sorted - tuple val(meta), path("*toTranscriptome.out.bam"), optional:true, emit: bam_transcript - tuple val(meta), path("*fastq.gz") , optional:true, emit: fastq - tuple val(meta), path("*.tab") , optional:true, emit: tab - - script: - def software = getSoftwareName(task.process) - def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" - def ignore_gtf = params.star_ignore_sjdbgtf ? '' : "--sjdbGTFfile $gtf" - def seq_center = params.seq_center ? "--outSAMattrRGline ID:$prefix 'CN:$params.seq_center' 'SM:$prefix'" : "--outSAMattrRGline ID:$prefix 'SM:$prefix'" - """ - STAR \\ - --genomeDir $index \\ - --readFilesIn $reads \\ - --runThreadN $task.cpus \\ - --outFileNamePrefix $prefix. \\ - $ignore_gtf \\ - $seq_center \\ - $options.args - - if [ -f ${prefix}.Unmapped.out.mate1 ]; then - mv ${prefix}.Unmapped.out.mate1 ${prefix}.unmapped_1.fastq - gzip ${prefix}.unmapped_1.fastq - fi - if [ -f ${prefix}.Unmapped.out.mate2 ]; then - mv ${prefix}.Unmapped.out.mate2 ${prefix}.unmapped_2.fastq - gzip ${prefix}.unmapped_2.fastq - fi - - STAR --version | sed -e "s/STAR_//g" > ${software}.version.txt - """ -} +// Import generic module functions +include { initOptions; saveFiles; getSoftwareName } from './functions' + +params.options = [:] +def options = initOptions(params.options) + +process STAR_ALIGN { + tag "$meta.id" + label 'process_high' + publishDir "${params.outdir}", + mode: params.publish_dir_mode, + saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) } + + // Note: 2.7X indices incompatible with AWS iGenomes. + conda (params.enable_conda ? "bioconda::star=2.6.1d" : null) + if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { + container "https://depot.galaxyproject.org/singularity/star:2.6.1d--0" + } else { + container "quay.io/biocontainers/star:2.6.1d--0" + } + + + input: + tuple val(meta), path(reads) + path index + path gtf + + output: + tuple val(meta), path("*Aligned.out.bam") , emit: bam + tuple val(meta), path("*Log.final.out") , emit: log_final + tuple val(meta), path("*Log.out") , emit: log_out + tuple val(meta), path("*Log.progress.out"), emit: log_progress + path "*.version.txt" , emit: version + + tuple val(meta), path("*sortedByCoord.out.bam") , optional:true, emit: bam_sorted + tuple val(meta), path("*toTranscriptome.out.bam"), optional:true, emit: bam_transcript + tuple val(meta), path("*fastq.gz") , optional:true, emit: fastq + tuple val(meta), path("*.tab") , optional:true, emit: tab + + script: + def software = getSoftwareName(task.process) + def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" + def ignore_gtf = params.star_ignore_sjdbgtf ? '' : "--sjdbGTFfile $gtf" + def seq_center = params.seq_center ? "--outSAMattrRGline ID:$prefix 'CN:$params.seq_center' 'SM:$prefix'" : "--outSAMattrRGline ID:$prefix 'SM:$prefix'" + """ + STAR \\ + --genomeDir $index \\ + --readFilesIn $reads \\ + --runThreadN $task.cpus \\ + --outFileNamePrefix $prefix. \\ + $ignore_gtf \\ + $seq_center \\ + $options.args + + if [ -f ${prefix}.Unmapped.out.mate1 ]; then + mv ${prefix}.Unmapped.out.mate1 ${prefix}.unmapped_1.fastq + gzip ${prefix}.unmapped_1.fastq + fi + if [ -f ${prefix}.Unmapped.out.mate2 ]; then + mv ${prefix}.Unmapped.out.mate2 ${prefix}.unmapped_2.fastq + gzip ${prefix}.unmapped_2.fastq + fi + + STAR --version | sed -e "s/STAR_//g" > ${software}.version.txt + """ +} diff --git a/software/star/genomegenerate/functions.nf b/software/star/genomegenerate/functions.nf index b3ac3801..d25eea86 100644 --- a/software/star/genomegenerate/functions.nf +++ b/software/star/genomegenerate/functions.nf @@ -1,59 +1,59 @@ -/* - * ----------------------------------------------------- - * Utility functions used in nf-core DSL2 module files - * ----------------------------------------------------- - */ - -/* - * Extract name of software tool from process name using $task.process - */ -def getSoftwareName(task_process) { - return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() -} - -/* - * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules - */ -def initOptions(Map args) { - def Map options = [:] - options.args = args.args ?: '' - options.args2 = args.args2 ?: '' - options.publish_by_id = args.publish_by_id ?: false - options.publish_dir = args.publish_dir ?: '' - options.publish_files = args.publish_files - options.suffix = args.suffix ?: '' - return options -} - -/* - * Tidy up and join elements of a list to return a path string - */ -def getPathFromList(path_list) { - def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries - paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes - return paths.join('/') -} - -/* - * Function to save/publish module results - */ -def saveFiles(Map args) { - if (!args.filename.endsWith('.version.txt')) { - def ioptions = initOptions(args.options) - def path_list = [ ioptions.publish_dir ?: args.publish_dir ] - if (ioptions.publish_by_id) { - path_list.add(args.publish_id) - } - if (ioptions.publish_files instanceof Map) { - for (ext in ioptions.publish_files) { - if (args.filename.endsWith(ext.key)) { - def ext_list = path_list.collect() - ext_list.add(ext.value) - return "${getPathFromList(ext_list)}/$args.filename" - } - } - } else if (ioptions.publish_files == null) { - return "${getPathFromList(path_list)}/$args.filename" - } - } -} +/* + * ----------------------------------------------------- + * Utility functions used in nf-core DSL2 module files + * ----------------------------------------------------- + */ + +/* + * Extract name of software tool from process name using $task.process + */ +def getSoftwareName(task_process) { + return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() +} + +/* + * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules + */ +def initOptions(Map args) { + def Map options = [:] + options.args = args.args ?: '' + options.args2 = args.args2 ?: '' + options.publish_by_id = args.publish_by_id ?: false + options.publish_dir = args.publish_dir ?: '' + options.publish_files = args.publish_files + options.suffix = args.suffix ?: '' + return options +} + +/* + * Tidy up and join elements of a list to return a path string + */ +def getPathFromList(path_list) { + def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries + paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes + return paths.join('/') +} + +/* + * Function to save/publish module results + */ +def saveFiles(Map args) { + if (!args.filename.endsWith('.version.txt')) { + def ioptions = initOptions(args.options) + def path_list = [ ioptions.publish_dir ?: args.publish_dir ] + if (ioptions.publish_by_id) { + path_list.add(args.publish_id) + } + if (ioptions.publish_files instanceof Map) { + for (ext in ioptions.publish_files) { + if (args.filename.endsWith(ext.key)) { + def ext_list = path_list.collect() + ext_list.add(ext.value) + return "${getPathFromList(ext_list)}/$args.filename" + } + } + } else if (ioptions.publish_files == null) { + return "${getPathFromList(path_list)}/$args.filename" + } + } +} diff --git a/software/stringtie/functions.nf b/software/stringtie/functions.nf index b3ac3801..d25eea86 100644 --- a/software/stringtie/functions.nf +++ b/software/stringtie/functions.nf @@ -1,59 +1,59 @@ -/* - * ----------------------------------------------------- - * Utility functions used in nf-core DSL2 module files - * ----------------------------------------------------- - */ - -/* - * Extract name of software tool from process name using $task.process - */ -def getSoftwareName(task_process) { - return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() -} - -/* - * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules - */ -def initOptions(Map args) { - def Map options = [:] - options.args = args.args ?: '' - options.args2 = args.args2 ?: '' - options.publish_by_id = args.publish_by_id ?: false - options.publish_dir = args.publish_dir ?: '' - options.publish_files = args.publish_files - options.suffix = args.suffix ?: '' - return options -} - -/* - * Tidy up and join elements of a list to return a path string - */ -def getPathFromList(path_list) { - def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries - paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes - return paths.join('/') -} - -/* - * Function to save/publish module results - */ -def saveFiles(Map args) { - if (!args.filename.endsWith('.version.txt')) { - def ioptions = initOptions(args.options) - def path_list = [ ioptions.publish_dir ?: args.publish_dir ] - if (ioptions.publish_by_id) { - path_list.add(args.publish_id) - } - if (ioptions.publish_files instanceof Map) { - for (ext in ioptions.publish_files) { - if (args.filename.endsWith(ext.key)) { - def ext_list = path_list.collect() - ext_list.add(ext.value) - return "${getPathFromList(ext_list)}/$args.filename" - } - } - } else if (ioptions.publish_files == null) { - return "${getPathFromList(path_list)}/$args.filename" - } - } -} +/* + * ----------------------------------------------------- + * Utility functions used in nf-core DSL2 module files + * ----------------------------------------------------- + */ + +/* + * Extract name of software tool from process name using $task.process + */ +def getSoftwareName(task_process) { + return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() +} + +/* + * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules + */ +def initOptions(Map args) { + def Map options = [:] + options.args = args.args ?: '' + options.args2 = args.args2 ?: '' + options.publish_by_id = args.publish_by_id ?: false + options.publish_dir = args.publish_dir ?: '' + options.publish_files = args.publish_files + options.suffix = args.suffix ?: '' + return options +} + +/* + * Tidy up and join elements of a list to return a path string + */ +def getPathFromList(path_list) { + def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries + paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes + return paths.join('/') +} + +/* + * Function to save/publish module results + */ +def saveFiles(Map args) { + if (!args.filename.endsWith('.version.txt')) { + def ioptions = initOptions(args.options) + def path_list = [ ioptions.publish_dir ?: args.publish_dir ] + if (ioptions.publish_by_id) { + path_list.add(args.publish_id) + } + if (ioptions.publish_files instanceof Map) { + for (ext in ioptions.publish_files) { + if (args.filename.endsWith(ext.key)) { + def ext_list = path_list.collect() + ext_list.add(ext.value) + return "${getPathFromList(ext_list)}/$args.filename" + } + } + } else if (ioptions.publish_files == null) { + return "${getPathFromList(path_list)}/$args.filename" + } + } +} diff --git a/software/stringtie/main.nf b/software/stringtie/main.nf index 35f5eab8..321fa4c5 100644 --- a/software/stringtie/main.nf +++ b/software/stringtie/main.nf @@ -1,55 +1,55 @@ -// Import generic module functions -include { initOptions; saveFiles; getSoftwareName } from './functions' - -params.options = [:] -def options = initOptions(params.options) - -process STRINGTIE { - 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), publish_id:meta.id) } - - conda (params.enable_conda ? "bioconda::stringtie=2.1.4" : null) - if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { - container "https://depot.galaxyproject.org/singularity/stringtie:2.1.4--h7e0af3c_0" - } else { - container "quay.io/biocontainers/stringtie:2.1.4--h7e0af3c_0" - } - - input: - tuple val(meta), path(bam) - path gtf - - output: - tuple val(meta), path("*.coverage.gtf") , emit: coverage_gtf - tuple val(meta), path("*.transcripts.gtf"), emit: transcript_gtf - tuple val(meta), path("*.txt") , emit: abundance - tuple val(meta), path("*.ballgown") , emit: ballgown - path "*.version.txt" , emit: version - - script: - def software = getSoftwareName(task.process) - def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" - - def strandedness = '' - if (meta.strandedness == 'forward') { - strandedness = '--fr' - } else if (meta.strandedness == 'reverse') { - strandedness = '--rf' - } - """ - stringtie \\ - $bam \\ - $strandedness \\ - -G $gtf \\ - -o ${prefix}.transcripts.gtf \\ - -A ${prefix}.gene_abundance.txt \\ - -C ${prefix}.coverage.gtf \\ - -b ${prefix}.ballgown \\ - $options.args - - stringtie --version > ${software}.version.txt - """ -} +// Import generic module functions +include { initOptions; saveFiles; getSoftwareName } from './functions' + +params.options = [:] +def options = initOptions(params.options) + +process STRINGTIE { + 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), publish_id:meta.id) } + + conda (params.enable_conda ? "bioconda::stringtie=2.1.4" : null) + if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { + container "https://depot.galaxyproject.org/singularity/stringtie:2.1.4--h7e0af3c_0" + } else { + container "quay.io/biocontainers/stringtie:2.1.4--h7e0af3c_0" + } + + input: + tuple val(meta), path(bam) + path gtf + + output: + tuple val(meta), path("*.coverage.gtf") , emit: coverage_gtf + tuple val(meta), path("*.transcripts.gtf"), emit: transcript_gtf + tuple val(meta), path("*.txt") , emit: abundance + tuple val(meta), path("*.ballgown") , emit: ballgown + path "*.version.txt" , emit: version + + script: + def software = getSoftwareName(task.process) + def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" + + def strandedness = '' + if (meta.strandedness == 'forward') { + strandedness = '--fr' + } else if (meta.strandedness == 'reverse') { + strandedness = '--rf' + } + """ + stringtie \\ + $bam \\ + $strandedness \\ + -G $gtf \\ + -o ${prefix}.transcripts.gtf \\ + -A ${prefix}.gene_abundance.txt \\ + -C ${prefix}.coverage.gtf \\ + -b ${prefix}.ballgown \\ + $options.args + + stringtie --version > ${software}.version.txt + """ +} diff --git a/software/subread/featurecounts/functions.nf b/software/subread/featurecounts/functions.nf index b3ac3801..d25eea86 100644 --- a/software/subread/featurecounts/functions.nf +++ b/software/subread/featurecounts/functions.nf @@ -1,59 +1,59 @@ -/* - * ----------------------------------------------------- - * Utility functions used in nf-core DSL2 module files - * ----------------------------------------------------- - */ - -/* - * Extract name of software tool from process name using $task.process - */ -def getSoftwareName(task_process) { - return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() -} - -/* - * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules - */ -def initOptions(Map args) { - def Map options = [:] - options.args = args.args ?: '' - options.args2 = args.args2 ?: '' - options.publish_by_id = args.publish_by_id ?: false - options.publish_dir = args.publish_dir ?: '' - options.publish_files = args.publish_files - options.suffix = args.suffix ?: '' - return options -} - -/* - * Tidy up and join elements of a list to return a path string - */ -def getPathFromList(path_list) { - def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries - paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes - return paths.join('/') -} - -/* - * Function to save/publish module results - */ -def saveFiles(Map args) { - if (!args.filename.endsWith('.version.txt')) { - def ioptions = initOptions(args.options) - def path_list = [ ioptions.publish_dir ?: args.publish_dir ] - if (ioptions.publish_by_id) { - path_list.add(args.publish_id) - } - if (ioptions.publish_files instanceof Map) { - for (ext in ioptions.publish_files) { - if (args.filename.endsWith(ext.key)) { - def ext_list = path_list.collect() - ext_list.add(ext.value) - return "${getPathFromList(ext_list)}/$args.filename" - } - } - } else if (ioptions.publish_files == null) { - return "${getPathFromList(path_list)}/$args.filename" - } - } -} +/* + * ----------------------------------------------------- + * Utility functions used in nf-core DSL2 module files + * ----------------------------------------------------- + */ + +/* + * Extract name of software tool from process name using $task.process + */ +def getSoftwareName(task_process) { + return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() +} + +/* + * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules + */ +def initOptions(Map args) { + def Map options = [:] + options.args = args.args ?: '' + options.args2 = args.args2 ?: '' + options.publish_by_id = args.publish_by_id ?: false + options.publish_dir = args.publish_dir ?: '' + options.publish_files = args.publish_files + options.suffix = args.suffix ?: '' + return options +} + +/* + * Tidy up and join elements of a list to return a path string + */ +def getPathFromList(path_list) { + def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries + paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes + return paths.join('/') +} + +/* + * Function to save/publish module results + */ +def saveFiles(Map args) { + if (!args.filename.endsWith('.version.txt')) { + def ioptions = initOptions(args.options) + def path_list = [ ioptions.publish_dir ?: args.publish_dir ] + if (ioptions.publish_by_id) { + path_list.add(args.publish_id) + } + if (ioptions.publish_files instanceof Map) { + for (ext in ioptions.publish_files) { + if (args.filename.endsWith(ext.key)) { + def ext_list = path_list.collect() + ext_list.add(ext.value) + return "${getPathFromList(ext_list)}/$args.filename" + } + } + } else if (ioptions.publish_files == null) { + return "${getPathFromList(path_list)}/$args.filename" + } + } +} diff --git a/software/subread/featurecounts/main.nf b/software/subread/featurecounts/main.nf index 55ad94b1..d9780ea5 100644 --- a/software/subread/featurecounts/main.nf +++ b/software/subread/featurecounts/main.nf @@ -20,7 +20,7 @@ process SUBREAD_FEATURECOUNTS { input: tuple val(meta), path(bams), path(annotation) - + output: tuple val(meta), path("*featureCounts.txt") , emit: counts tuple val(meta), path("*featureCounts.txt.summary"), emit: summary diff --git a/software/trimgalore/functions.nf b/software/trimgalore/functions.nf index b3ac3801..d25eea86 100644 --- a/software/trimgalore/functions.nf +++ b/software/trimgalore/functions.nf @@ -1,59 +1,59 @@ -/* - * ----------------------------------------------------- - * Utility functions used in nf-core DSL2 module files - * ----------------------------------------------------- - */ - -/* - * Extract name of software tool from process name using $task.process - */ -def getSoftwareName(task_process) { - return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() -} - -/* - * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules - */ -def initOptions(Map args) { - def Map options = [:] - options.args = args.args ?: '' - options.args2 = args.args2 ?: '' - options.publish_by_id = args.publish_by_id ?: false - options.publish_dir = args.publish_dir ?: '' - options.publish_files = args.publish_files - options.suffix = args.suffix ?: '' - return options -} - -/* - * Tidy up and join elements of a list to return a path string - */ -def getPathFromList(path_list) { - def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries - paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes - return paths.join('/') -} - -/* - * Function to save/publish module results - */ -def saveFiles(Map args) { - if (!args.filename.endsWith('.version.txt')) { - def ioptions = initOptions(args.options) - def path_list = [ ioptions.publish_dir ?: args.publish_dir ] - if (ioptions.publish_by_id) { - path_list.add(args.publish_id) - } - if (ioptions.publish_files instanceof Map) { - for (ext in ioptions.publish_files) { - if (args.filename.endsWith(ext.key)) { - def ext_list = path_list.collect() - ext_list.add(ext.value) - return "${getPathFromList(ext_list)}/$args.filename" - } - } - } else if (ioptions.publish_files == null) { - return "${getPathFromList(path_list)}/$args.filename" - } - } -} +/* + * ----------------------------------------------------- + * Utility functions used in nf-core DSL2 module files + * ----------------------------------------------------- + */ + +/* + * Extract name of software tool from process name using $task.process + */ +def getSoftwareName(task_process) { + return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() +} + +/* + * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules + */ +def initOptions(Map args) { + def Map options = [:] + options.args = args.args ?: '' + options.args2 = args.args2 ?: '' + options.publish_by_id = args.publish_by_id ?: false + options.publish_dir = args.publish_dir ?: '' + options.publish_files = args.publish_files + options.suffix = args.suffix ?: '' + return options +} + +/* + * Tidy up and join elements of a list to return a path string + */ +def getPathFromList(path_list) { + def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries + paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes + return paths.join('/') +} + +/* + * Function to save/publish module results + */ +def saveFiles(Map args) { + if (!args.filename.endsWith('.version.txt')) { + def ioptions = initOptions(args.options) + def path_list = [ ioptions.publish_dir ?: args.publish_dir ] + if (ioptions.publish_by_id) { + path_list.add(args.publish_id) + } + if (ioptions.publish_files instanceof Map) { + for (ext in ioptions.publish_files) { + if (args.filename.endsWith(ext.key)) { + def ext_list = path_list.collect() + ext_list.add(ext.value) + return "${getPathFromList(ext_list)}/$args.filename" + } + } + } else if (ioptions.publish_files == null) { + return "${getPathFromList(path_list)}/$args.filename" + } + } +} diff --git a/software/ucsc/bedgraphtobigwig/functions.nf b/software/ucsc/bedgraphtobigwig/functions.nf index b3ac3801..d25eea86 100644 --- a/software/ucsc/bedgraphtobigwig/functions.nf +++ b/software/ucsc/bedgraphtobigwig/functions.nf @@ -1,59 +1,59 @@ -/* - * ----------------------------------------------------- - * Utility functions used in nf-core DSL2 module files - * ----------------------------------------------------- - */ - -/* - * Extract name of software tool from process name using $task.process - */ -def getSoftwareName(task_process) { - return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() -} - -/* - * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules - */ -def initOptions(Map args) { - def Map options = [:] - options.args = args.args ?: '' - options.args2 = args.args2 ?: '' - options.publish_by_id = args.publish_by_id ?: false - options.publish_dir = args.publish_dir ?: '' - options.publish_files = args.publish_files - options.suffix = args.suffix ?: '' - return options -} - -/* - * Tidy up and join elements of a list to return a path string - */ -def getPathFromList(path_list) { - def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries - paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes - return paths.join('/') -} - -/* - * Function to save/publish module results - */ -def saveFiles(Map args) { - if (!args.filename.endsWith('.version.txt')) { - def ioptions = initOptions(args.options) - def path_list = [ ioptions.publish_dir ?: args.publish_dir ] - if (ioptions.publish_by_id) { - path_list.add(args.publish_id) - } - if (ioptions.publish_files instanceof Map) { - for (ext in ioptions.publish_files) { - if (args.filename.endsWith(ext.key)) { - def ext_list = path_list.collect() - ext_list.add(ext.value) - return "${getPathFromList(ext_list)}/$args.filename" - } - } - } else if (ioptions.publish_files == null) { - return "${getPathFromList(path_list)}/$args.filename" - } - } -} +/* + * ----------------------------------------------------- + * Utility functions used in nf-core DSL2 module files + * ----------------------------------------------------- + */ + +/* + * Extract name of software tool from process name using $task.process + */ +def getSoftwareName(task_process) { + return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() +} + +/* + * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules + */ +def initOptions(Map args) { + def Map options = [:] + options.args = args.args ?: '' + options.args2 = args.args2 ?: '' + options.publish_by_id = args.publish_by_id ?: false + options.publish_dir = args.publish_dir ?: '' + options.publish_files = args.publish_files + options.suffix = args.suffix ?: '' + return options +} + +/* + * Tidy up and join elements of a list to return a path string + */ +def getPathFromList(path_list) { + def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries + paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes + return paths.join('/') +} + +/* + * Function to save/publish module results + */ +def saveFiles(Map args) { + if (!args.filename.endsWith('.version.txt')) { + def ioptions = initOptions(args.options) + def path_list = [ ioptions.publish_dir ?: args.publish_dir ] + if (ioptions.publish_by_id) { + path_list.add(args.publish_id) + } + if (ioptions.publish_files instanceof Map) { + for (ext in ioptions.publish_files) { + if (args.filename.endsWith(ext.key)) { + def ext_list = path_list.collect() + ext_list.add(ext.value) + return "${getPathFromList(ext_list)}/$args.filename" + } + } + } else if (ioptions.publish_files == null) { + return "${getPathFromList(path_list)}/$args.filename" + } + } +} diff --git a/software/ucsc/bedgraphtobigwig/main.nf b/software/ucsc/bedgraphtobigwig/main.nf index 4a8e95e9..10300280 100644 --- a/software/ucsc/bedgraphtobigwig/main.nf +++ b/software/ucsc/bedgraphtobigwig/main.nf @@ -19,11 +19,11 @@ process UCSC_BEDGRAPHTOBIGWIG { } else { container "quay.io/biocontainers/ucsc-bedgraphtobigwig:377--h446ed27_1" } - + input: tuple val(meta), path(bedgraph) path sizes - + output: tuple val(meta), path("*.bigWig"), emit: bigwig path "*.version.txt" , emit: version diff --git a/software/umitools/dedup/functions.nf b/software/umitools/dedup/functions.nf index b3ac3801..d25eea86 100644 --- a/software/umitools/dedup/functions.nf +++ b/software/umitools/dedup/functions.nf @@ -1,59 +1,59 @@ -/* - * ----------------------------------------------------- - * Utility functions used in nf-core DSL2 module files - * ----------------------------------------------------- - */ - -/* - * Extract name of software tool from process name using $task.process - */ -def getSoftwareName(task_process) { - return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() -} - -/* - * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules - */ -def initOptions(Map args) { - def Map options = [:] - options.args = args.args ?: '' - options.args2 = args.args2 ?: '' - options.publish_by_id = args.publish_by_id ?: false - options.publish_dir = args.publish_dir ?: '' - options.publish_files = args.publish_files - options.suffix = args.suffix ?: '' - return options -} - -/* - * Tidy up and join elements of a list to return a path string - */ -def getPathFromList(path_list) { - def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries - paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes - return paths.join('/') -} - -/* - * Function to save/publish module results - */ -def saveFiles(Map args) { - if (!args.filename.endsWith('.version.txt')) { - def ioptions = initOptions(args.options) - def path_list = [ ioptions.publish_dir ?: args.publish_dir ] - if (ioptions.publish_by_id) { - path_list.add(args.publish_id) - } - if (ioptions.publish_files instanceof Map) { - for (ext in ioptions.publish_files) { - if (args.filename.endsWith(ext.key)) { - def ext_list = path_list.collect() - ext_list.add(ext.value) - return "${getPathFromList(ext_list)}/$args.filename" - } - } - } else if (ioptions.publish_files == null) { - return "${getPathFromList(path_list)}/$args.filename" - } - } -} +/* + * ----------------------------------------------------- + * Utility functions used in nf-core DSL2 module files + * ----------------------------------------------------- + */ + +/* + * Extract name of software tool from process name using $task.process + */ +def getSoftwareName(task_process) { + return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() +} + +/* + * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules + */ +def initOptions(Map args) { + def Map options = [:] + options.args = args.args ?: '' + options.args2 = args.args2 ?: '' + options.publish_by_id = args.publish_by_id ?: false + options.publish_dir = args.publish_dir ?: '' + options.publish_files = args.publish_files + options.suffix = args.suffix ?: '' + return options +} + +/* + * Tidy up and join elements of a list to return a path string + */ +def getPathFromList(path_list) { + def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries + paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes + return paths.join('/') +} + +/* + * Function to save/publish module results + */ +def saveFiles(Map args) { + if (!args.filename.endsWith('.version.txt')) { + def ioptions = initOptions(args.options) + def path_list = [ ioptions.publish_dir ?: args.publish_dir ] + if (ioptions.publish_by_id) { + path_list.add(args.publish_id) + } + if (ioptions.publish_files instanceof Map) { + for (ext in ioptions.publish_files) { + if (args.filename.endsWith(ext.key)) { + def ext_list = path_list.collect() + ext_list.add(ext.value) + return "${getPathFromList(ext_list)}/$args.filename" + } + } + } else if (ioptions.publish_files == null) { + return "${getPathFromList(path_list)}/$args.filename" + } + } +} diff --git a/software/umitools/dedup/main.nf b/software/umitools/dedup/main.nf index ce1dd987..9df37494 100644 --- a/software/umitools/dedup/main.nf +++ b/software/umitools/dedup/main.nf @@ -1,41 +1,41 @@ -// Import generic module functions -include { initOptions; saveFiles; getSoftwareName } from './functions' - -params.options = [:] -def options = initOptions(params.options) - -process UMITOOLS_DEDUP { - 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), publish_id:meta.id) } - - conda (params.enable_conda ? "bioconda::umi_tools=1.1.1" : null) - if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { - container "https://depot.galaxyproject.org/singularity/umi_tools:1.1.1--py38h0213d0e_1" - } else { - container "quay.io/biocontainers/umi_tools:1.1.1--py38h0213d0e_1" - } - - input: - tuple val(meta), path(bam), path(bai) - - output: - tuple val(meta), path("*.bam"), emit: bam - tuple val(meta), path("*.tsv"), emit: tsv - path "*.version.txt" , emit: version - - script: - def software = getSoftwareName(task.process) - def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" - """ - umi_tools dedup \\ - -I $bam \\ - -S ${prefix}.bam \\ - --output-stats=$prefix \\ - $options.args \\ - - umi_tools --version | sed -e "s/UMI-tools version: //g" > ${software}.version.txt - """ -} +// Import generic module functions +include { initOptions; saveFiles; getSoftwareName } from './functions' + +params.options = [:] +def options = initOptions(params.options) + +process UMITOOLS_DEDUP { + 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), publish_id:meta.id) } + + conda (params.enable_conda ? "bioconda::umi_tools=1.1.1" : null) + if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { + container "https://depot.galaxyproject.org/singularity/umi_tools:1.1.1--py38h0213d0e_1" + } else { + container "quay.io/biocontainers/umi_tools:1.1.1--py38h0213d0e_1" + } + + input: + tuple val(meta), path(bam), path(bai) + + output: + tuple val(meta), path("*.bam"), emit: bam + tuple val(meta), path("*.tsv"), emit: tsv + path "*.version.txt" , emit: version + + script: + def software = getSoftwareName(task.process) + def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" + """ + umi_tools dedup \\ + -I $bam \\ + -S ${prefix}.bam \\ + --output-stats=$prefix \\ + $options.args \\ + + umi_tools --version | sed -e "s/UMI-tools version: //g" > ${software}.version.txt + """ +} diff --git a/software/umitools/extract/functions.nf b/software/umitools/extract/functions.nf index b3ac3801..d25eea86 100644 --- a/software/umitools/extract/functions.nf +++ b/software/umitools/extract/functions.nf @@ -1,59 +1,59 @@ -/* - * ----------------------------------------------------- - * Utility functions used in nf-core DSL2 module files - * ----------------------------------------------------- - */ - -/* - * Extract name of software tool from process name using $task.process - */ -def getSoftwareName(task_process) { - return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() -} - -/* - * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules - */ -def initOptions(Map args) { - def Map options = [:] - options.args = args.args ?: '' - options.args2 = args.args2 ?: '' - options.publish_by_id = args.publish_by_id ?: false - options.publish_dir = args.publish_dir ?: '' - options.publish_files = args.publish_files - options.suffix = args.suffix ?: '' - return options -} - -/* - * Tidy up and join elements of a list to return a path string - */ -def getPathFromList(path_list) { - def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries - paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes - return paths.join('/') -} - -/* - * Function to save/publish module results - */ -def saveFiles(Map args) { - if (!args.filename.endsWith('.version.txt')) { - def ioptions = initOptions(args.options) - def path_list = [ ioptions.publish_dir ?: args.publish_dir ] - if (ioptions.publish_by_id) { - path_list.add(args.publish_id) - } - if (ioptions.publish_files instanceof Map) { - for (ext in ioptions.publish_files) { - if (args.filename.endsWith(ext.key)) { - def ext_list = path_list.collect() - ext_list.add(ext.value) - return "${getPathFromList(ext_list)}/$args.filename" - } - } - } else if (ioptions.publish_files == null) { - return "${getPathFromList(path_list)}/$args.filename" - } - } -} +/* + * ----------------------------------------------------- + * Utility functions used in nf-core DSL2 module files + * ----------------------------------------------------- + */ + +/* + * Extract name of software tool from process name using $task.process + */ +def getSoftwareName(task_process) { + return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() +} + +/* + * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules + */ +def initOptions(Map args) { + def Map options = [:] + options.args = args.args ?: '' + options.args2 = args.args2 ?: '' + options.publish_by_id = args.publish_by_id ?: false + options.publish_dir = args.publish_dir ?: '' + options.publish_files = args.publish_files + options.suffix = args.suffix ?: '' + return options +} + +/* + * Tidy up and join elements of a list to return a path string + */ +def getPathFromList(path_list) { + def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries + paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes + return paths.join('/') +} + +/* + * Function to save/publish module results + */ +def saveFiles(Map args) { + if (!args.filename.endsWith('.version.txt')) { + def ioptions = initOptions(args.options) + def path_list = [ ioptions.publish_dir ?: args.publish_dir ] + if (ioptions.publish_by_id) { + path_list.add(args.publish_id) + } + if (ioptions.publish_files instanceof Map) { + for (ext in ioptions.publish_files) { + if (args.filename.endsWith(ext.key)) { + def ext_list = path_list.collect() + ext_list.add(ext.value) + return "${getPathFromList(ext_list)}/$args.filename" + } + } + } else if (ioptions.publish_files == null) { + return "${getPathFromList(path_list)}/$args.filename" + } + } +} diff --git a/software/umitools/extract/main.nf b/software/umitools/extract/main.nf index eb1372a5..89f78b9b 100644 --- a/software/umitools/extract/main.nf +++ b/software/umitools/extract/main.nf @@ -1,57 +1,57 @@ -// Import generic module functions -include { initOptions; saveFiles; getSoftwareName } from './functions' - -params.options = [:] -def options = initOptions(params.options) - -process UMITOOLS_EXTRACT { - tag "$meta.id" - label "process_low" - publishDir "${params.outdir}", - mode: params.publish_dir_mode, - saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) } - - conda (params.enable_conda ? "bioconda::umi_tools=1.1.1" : null) - if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { - container "https://depot.galaxyproject.org/singularity/umi_tools:1.1.1--py38h0213d0e_1" - } else { - container "quay.io/biocontainers/umi_tools:1.1.1--py38h0213d0e_1" - } - - input: - tuple val(meta), path(reads) - - output: - tuple val(meta), path("*.fastq.gz"), emit: reads - tuple val(meta), path("*.log") , emit: log - path "*.version.txt" , emit: version - - script: - def software = getSoftwareName(task.process) - def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" - if (meta.single_end) { - """ - umi_tools \\ - extract \\ - -I $reads \\ - -S ${prefix}.umi_extract.fastq.gz \\ - $options.args \\ - > ${prefix}.umi_extract.log - - umi_tools --version | sed -e "s/UMI-tools version: //g" > ${software}.version.txt - """ - } else { - """ - umi_tools \\ - extract \\ - -I ${reads[0]} \\ - --read2-in=${reads[1]} \\ - -S ${prefix}.umi_extract_1.fastq.gz \\ - --read2-out=${prefix}.umi_extract_2.fastq.gz \\ - $options.args \\ - > ${prefix}.umi_extract.log - - umi_tools --version | sed -e "s/UMI-tools version: //g" > ${software}.version.txt - """ - } -} +// Import generic module functions +include { initOptions; saveFiles; getSoftwareName } from './functions' + +params.options = [:] +def options = initOptions(params.options) + +process UMITOOLS_EXTRACT { + tag "$meta.id" + label "process_low" + publishDir "${params.outdir}", + mode: params.publish_dir_mode, + saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) } + + conda (params.enable_conda ? "bioconda::umi_tools=1.1.1" : null) + if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { + container "https://depot.galaxyproject.org/singularity/umi_tools:1.1.1--py38h0213d0e_1" + } else { + container "quay.io/biocontainers/umi_tools:1.1.1--py38h0213d0e_1" + } + + input: + tuple val(meta), path(reads) + + output: + tuple val(meta), path("*.fastq.gz"), emit: reads + tuple val(meta), path("*.log") , emit: log + path "*.version.txt" , emit: version + + script: + def software = getSoftwareName(task.process) + def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" + if (meta.single_end) { + """ + umi_tools \\ + extract \\ + -I $reads \\ + -S ${prefix}.umi_extract.fastq.gz \\ + $options.args \\ + > ${prefix}.umi_extract.log + + umi_tools --version | sed -e "s/UMI-tools version: //g" > ${software}.version.txt + """ + } else { + """ + umi_tools \\ + extract \\ + -I ${reads[0]} \\ + --read2-in=${reads[1]} \\ + -S ${prefix}.umi_extract_1.fastq.gz \\ + --read2-out=${prefix}.umi_extract_2.fastq.gz \\ + $options.args \\ + > ${prefix}.umi_extract.log + + umi_tools --version | sed -e "s/UMI-tools version: //g" > ${software}.version.txt + """ + } +} From 41329b89820c92c63bdf1212e4df3935137aac05 Mon Sep 17 00:00:00 2001 From: Kevin Menden Date: Fri, 18 Dec 2020 08:16:18 +0100 Subject: [PATCH 18/29] Apply suggestions from code review Co-authored-by: Harshil Patel --- software/bowtie/align/main.nf | 4 ++-- software/bowtie/index/main.nf | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/software/bowtie/align/main.nf b/software/bowtie/align/main.nf index 4271d33a..03bfd6e7 100644 --- a/software/bowtie/align/main.nf +++ b/software/bowtie/align/main.nf @@ -25,7 +25,7 @@ process BOWTIE_ALIGN { output: tuple val(meta), path('*.bam'), emit: bam tuple val(meta), path('*.out'), emit: log - path 'bowtie.version.txt', emit: version + path '*.version.txt' , emit: version script: def software = getSoftwareName(task.process) @@ -45,6 +45,6 @@ process BOWTIE_ALIGN { 2> ${prefix}.out \\ | samtools view $options.args2 -@ $task.cpus -bS -o ${prefix}.bam - - bowtie --version | head -n 1 | cut -d" " -f3 > ${software}.version.txt + echo \$(bowtie --version 2>&1) | sed 's/^.*bowtie-align-s version //; s/ .*\$//' > ${software}.version.txt """ } diff --git a/software/bowtie/index/main.nf b/software/bowtie/index/main.nf index 38f1c289..8b982bcf 100644 --- a/software/bowtie/index/main.nf +++ b/software/bowtie/index/main.nf @@ -29,7 +29,7 @@ process BOWTIE_INDEX { def software = getSoftwareName(task.process) """ mkdir bowtie - bowtie-build --threads $task.cpus ${fasta} bowtie/${fasta.baseName}.index - bowtie --version | head -n 1 | cut -d" " -f3 > ${software}.version.txt + bowtie-build --threads $task.cpus $fasta bowtie/${fasta.baseName} + echo \$(bowtie --version 2>&1) | sed 's/^.*bowtie-align-s version //; s/ .*\$//' > ${software}.version.txt """ } From dc4108fd9b9d2982d84d24a7f765e5c5a0d3364d Mon Sep 17 00:00:00 2001 From: Kevin Menden Date: Fri, 18 Dec 2020 09:13:35 +0100 Subject: [PATCH 19/29] Update software/bowtie/align/meta.yml Co-authored-by: Harshil Patel --- software/bowtie/align/meta.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/software/bowtie/align/meta.yml b/software/bowtie/align/meta.yml index 633ef56a..50f5e8d0 100644 --- a/software/bowtie/align/meta.yml +++ b/software/bowtie/align/meta.yml @@ -53,7 +53,7 @@ input: description: Bowtie genome index files pattern: "*.ebwt" output: - - sam: + - bam: type: file description: Output SAM file containing read alignments pattern: "*.{sam}" From a7f1ff29d7baf10417efc22dbc8de52dc8700ccc Mon Sep 17 00:00:00 2001 From: Kevin Menden Date: Fri, 18 Dec 2020 09:13:42 +0100 Subject: [PATCH 20/29] Update software/bowtie/align/meta.yml Co-authored-by: Harshil Patel --- software/bowtie/align/meta.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/software/bowtie/align/meta.yml b/software/bowtie/align/meta.yml index 50f5e8d0..b6909b61 100644 --- a/software/bowtie/align/meta.yml +++ b/software/bowtie/align/meta.yml @@ -56,7 +56,7 @@ output: - bam: type: file description: Output SAM file containing read alignments - pattern: "*.{sam}" + pattern: "*.{bam}" - version: type: file description: File containing software version From 7805d25cc56190ac1ad88f0634fb32458cbc4379 Mon Sep 17 00:00:00 2001 From: Kevin Menden Date: Fri, 18 Dec 2020 09:13:48 +0100 Subject: [PATCH 21/29] Update software/bowtie/align/meta.yml Co-authored-by: Harshil Patel --- software/bowtie/align/meta.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/software/bowtie/align/meta.yml b/software/bowtie/align/meta.yml index b6909b61..72f7c0b5 100644 --- a/software/bowtie/align/meta.yml +++ b/software/bowtie/align/meta.yml @@ -55,7 +55,7 @@ input: output: - bam: type: file - description: Output SAM file containing read alignments + description: Output BAM file containing read alignments pattern: "*.{bam}" - version: type: file From f840325eadf2c9853ca6b02f3c8a4d48cccc3ff4 Mon Sep 17 00:00:00 2001 From: kevinmenden Date: Fri, 18 Dec 2020 09:14:40 +0100 Subject: [PATCH 22/29] added unaligned output --- software/bowtie/align/main.nf | 11 +++++ software/bowtie/align/meta.yml | 88 ++++++++++++++++++---------------- 2 files changed, 57 insertions(+), 42 deletions(-) diff --git a/software/bowtie/align/main.nf b/software/bowtie/align/main.nf index 03bfd6e7..43425ca5 100644 --- a/software/bowtie/align/main.nf +++ b/software/bowtie/align/main.nf @@ -26,6 +26,8 @@ process BOWTIE_ALIGN { tuple val(meta), path('*.bam'), emit: bam tuple val(meta), path('*.out'), emit: log path '*.version.txt' , emit: version + tuple val(meta), path('*fastq.gz'), optional:true, emit: fastq + path 'test.txt', emit: test script: def software = getSoftwareName(task.process) @@ -45,6 +47,15 @@ process BOWTIE_ALIGN { 2> ${prefix}.out \\ | samtools view $options.args2 -@ $task.cpus -bS -o ${prefix}.bam - + touch test.txt + if [ -f ${prefix}.unmapped.fastq ]; then + gzip ${prefix}.unmapped.fastq + fi + if [ -f ${prefix}.unmapped_1.fastq ]; then + gzip ${prefix}.unmapped_1.fastq + gzip ${prefix}.unmapped_2.fastq + fi + echo \$(bowtie --version 2>&1) | sed 's/^.*bowtie-align-s version //; s/ .*\$//' > ${software}.version.txt """ } diff --git a/software/bowtie/align/meta.yml b/software/bowtie/align/meta.yml index 633ef56a..b7dbdb83 100644 --- a/software/bowtie/align/meta.yml +++ b/software/bowtie/align/meta.yml @@ -7,59 +7,63 @@ keywords: - reference tools: - bowtie: - description: | - bowtie is a software package for mapping DNA sequences against - a large reference genome, such as the human genome. - homepage: http://bowtie-bio.sourceforge.net/index.shtml - documentation: http://bowtie-bio.sourceforge.net/manual.shtml - arxiv: arXiv:1303.3997 + description: | + bowtie is a software package for mapping DNA sequences against + a large reference genome, such as the human genome. + homepage: http://bowtie-bio.sourceforge.net/index.shtml + documentation: http://bowtie-bio.sourceforge.net/manual.shtml + arxiv: arXiv:1303.3997 params: - outdir: - type: string - description: | - The pipeline's output directory. By default, the module will - output files into `$params.outdir/` + type: string + description: | + The pipeline's output directory. By default, the module will + output files into `$params.outdir/` - publish_dir_mode: - type: string - description: | - Value for the Nextflow `publishDir` mode parameter. - Available: symlink, rellink, link, copy, copyNoFollow, move. + type: string + description: | + Value for the Nextflow `publishDir` mode parameter. + Available: symlink, rellink, link, copy, copyNoFollow, move. - enable_conda: - type: boolean - description: | - Run the module with Conda using the software specified - via the `conda` directive + type: boolean + description: | + Run the module with Conda using the software specified + via the `conda` directive - singularity_pull_docker_container: - type: boolean - description: | - Instead of directly downloading Singularity images for use with Singularity, - force the workflow to pull and convert Docker containers instead. + type: boolean + description: | + Instead of directly downloading Singularity images for use with Singularity, + force the workflow to pull and convert Docker containers instead. - save_unaligned: - type: boolean - description: Save unaligned reads + type: boolean + description: Save unaligned reads input: - meta: - type: map - description: | - Groovy Map containing sample information - e.g. [ id:'test', single_end:false ] + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] - reads: - type: file - description: | - List of input FastQ files of size 1 and 2 for single-end and paired-end data, - respectively. + type: file + description: | + List of input FastQ files of size 1 and 2 for single-end and paired-end data, + respectively. - index: - type: file - description: Bowtie genome index files - pattern: "*.ebwt" + type: file + description: Bowtie genome index files + pattern: "*.ebwt" output: - - sam: - type: file - description: Output SAM file containing read alignments - pattern: "*.{sam}" + - bam: + type: file + description: Output SAM file containing read alignments + pattern: "*.{bam}" - version: - type: file - description: File containing software version - pattern: "*.{version.txt}" + type: file + description: File containing software version + pattern: "*.{version.txt}" + - fastq: + type: file + description: Unaligned FastQ files + pattern: "*.fastq.gz" authors: - "@kevinmenden" From 0eb20c14bf17d47419111dd5ebce7071dcf39569 Mon Sep 17 00:00:00 2001 From: kevinmenden Date: Fri, 18 Dec 2020 09:20:35 +0100 Subject: [PATCH 23/29] fixed unaligned output --- software/bowtie/align/main.nf | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/software/bowtie/align/main.nf b/software/bowtie/align/main.nf index 43425ca5..de9e8b3d 100644 --- a/software/bowtie/align/main.nf +++ b/software/bowtie/align/main.nf @@ -27,12 +27,11 @@ process BOWTIE_ALIGN { tuple val(meta), path('*.out'), emit: log path '*.version.txt' , emit: version tuple val(meta), path('*fastq.gz'), optional:true, emit: fastq - path 'test.txt', emit: test script: def software = getSoftwareName(task.process) def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" - def unaligned = params.save_unaligned ? "--un ${prefix}.unmapped" : '' + def unaligned = params.save_unaligned ? "--un ${prefix}.unmapped.fastq" : '' def endedness = meta.single_end ? "$reads" : "-1 ${reads[0]} -2 ${reads[1]}" """ INDEX=`find -L ./ -name "*.3.ebwt" | sed 's/.3.ebwt//'` @@ -47,7 +46,6 @@ process BOWTIE_ALIGN { 2> ${prefix}.out \\ | samtools view $options.args2 -@ $task.cpus -bS -o ${prefix}.bam - - touch test.txt if [ -f ${prefix}.unmapped.fastq ]; then gzip ${prefix}.unmapped.fastq fi From 07f0a2476a4729166cc623cfef1e7b8d295c182e Mon Sep 17 00:00:00 2001 From: kevinmenden Date: Fri, 18 Dec 2020 09:50:05 +0100 Subject: [PATCH 24/29] fixed linting errors --- software/bowtie/align/functions.nf | 3 +- software/bowtie/index/functions.nf | 3 +- software/bowtie/index/meta.yml | 60 +++++++++++++++--------------- tests/software/bowtie/test.yml | 6 +-- 4 files changed, 36 insertions(+), 36 deletions(-) diff --git a/software/bowtie/align/functions.nf b/software/bowtie/align/functions.nf index b3ac3801..55d5271c 100644 --- a/software/bowtie/align/functions.nf +++ b/software/bowtie/align/functions.nf @@ -1,3 +1,4 @@ + /* * ----------------------------------------------------- * Utility functions used in nf-core DSL2 module files @@ -56,4 +57,4 @@ def saveFiles(Map args) { return "${getPathFromList(path_list)}/$args.filename" } } -} +} \ No newline at end of file diff --git a/software/bowtie/index/functions.nf b/software/bowtie/index/functions.nf index b3ac3801..55d5271c 100644 --- a/software/bowtie/index/functions.nf +++ b/software/bowtie/index/functions.nf @@ -1,3 +1,4 @@ + /* * ----------------------------------------------------- * Utility functions used in nf-core DSL2 module files @@ -56,4 +57,4 @@ def saveFiles(Map args) { return "${getPathFromList(path_list)}/$args.filename" } } -} +} \ No newline at end of file diff --git a/software/bowtie/index/meta.yml b/software/bowtie/index/meta.yml index db781a0a..e5296b05 100644 --- a/software/bowtie/index/meta.yml +++ b/software/bowtie/index/meta.yml @@ -7,45 +7,45 @@ keywords: - reference tools: - bowtie: - description: | - bowtie is a software package for mapping DNA sequences against - a large reference genome, such as the human genome. - homepage: http://bowtie-bio.sourceforge.net/index.shtml - documentation: http://bowtie-bio.sourceforge.net/manual.shtml - arxiv: arXiv:1303.3997 + description: | + bowtie is a software package for mapping DNA sequences against + a large reference genome, such as the human genome. + homepage: http://bowtie-bio.sourceforge.net/index.shtml + documentation: http://bowtie-bio.sourceforge.net/manual.shtml + arxiv: arXiv:1303.3997 params: - outdir: - type: string - description: | - The pipeline's output directory. By default, the module will - output files into `$params.outdir/` + type: string + description: | + The pipeline's output directory. By default, the module will + output files into `$params.outdir/` - publish_dir_mode: - type: string - description: | - Value for the Nextflow `publishDir` mode parameter. - Available: symlink, rellink, link, copy, copyNoFollow, move. + type: string + description: | + Value for the Nextflow `publishDir` mode parameter. + Available: symlink, rellink, link, copy, copyNoFollow, move. - enable_conda: - type: boolean - description: | - Run the module with Conda using the software specified - via the `conda` directive + type: boolean + description: | + Run the module with Conda using the software specified + via the `conda` directive - singularity_pull_docker_container: - type: boolean - description: | - Instead of directly downloading Singularity images for use with Singularity, - force the workflow to pull and convert Docker containers instead. + type: boolean + description: | + Instead of directly downloading Singularity images for use with Singularity, + force the workflow to pull and convert Docker containers instead. input: - fasta: - type: file - description: Input genome fasta file + type: file + description: Input genome fasta file output: - index: - type: file - description: Bowtie genome index files - pattern: "*.ebwt" + type: file + description: Bowtie genome index files + pattern: "*.ebwt" - version: - type: file - description: File containing software version - pattern: "*.{version.txt}" + type: file + description: File containing software version + pattern: "*.{version.txt}" authors: - "@kevinmenden" diff --git a/tests/software/bowtie/test.yml b/tests/software/bowtie/test.yml index 6a28578d..8d6404bc 100644 --- a/tests/software/bowtie/test.yml +++ b/tests/software/bowtie/test.yml @@ -17,7 +17,7 @@ - path: output/bowtie/bowtie/NC_010473.index.rev.2.ebwt md5sum: f3c398bba5158f4039334a932d79c051 -- name: Run bowtie index and align signle-end +- name: Run bowtie index and align single-end command: nextflow run ./tests/software/bowtie -profile docker -entry test_bowtie_alignment_single_end -c tests/config/nextflow.config tags: - bowtie @@ -40,8 +40,7 @@ - path: output/bowtie/test.bam md5sum: 8179c68a819accbc9137dc881736106f - -- name: Run bowtie index and align paired_end +- name: Run bowtie index and align paired-end command: nextflow run ./tests/software/bowtie -profile docker -entry test_bowtie_alignment_paired_end -c tests/config/nextflow.config tags: - bowtie @@ -63,4 +62,3 @@ md5sum: a23e9a2a76e949aeb3693bcfae41a615 - path: output/bowtie/test.bam md5sum: 9ce5aebf37128f4bb1d24e9548e22009 - From 0be13edc52acbc27131da6a24e76f139c776ecb6 Mon Sep 17 00:00:00 2001 From: kevinmenden Date: Fri, 18 Dec 2020 09:52:38 +0100 Subject: [PATCH 25/29] next try at editorconfig --- software/bowtie/align/functions.nf | 2 +- software/bowtie/index/functions.nf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/software/bowtie/align/functions.nf b/software/bowtie/align/functions.nf index 55d5271c..f237d7f0 100644 --- a/software/bowtie/align/functions.nf +++ b/software/bowtie/align/functions.nf @@ -57,4 +57,4 @@ def saveFiles(Map args) { return "${getPathFromList(path_list)}/$args.filename" } } -} \ No newline at end of file +} diff --git a/software/bowtie/index/functions.nf b/software/bowtie/index/functions.nf index 55d5271c..f237d7f0 100644 --- a/software/bowtie/index/functions.nf +++ b/software/bowtie/index/functions.nf @@ -57,4 +57,4 @@ def saveFiles(Map args) { return "${getPathFromList(path_list)}/$args.filename" } } -} \ No newline at end of file +} From 299a3fa07e751da60680d1efad9f87f6d9e7fb88 Mon Sep 17 00:00:00 2001 From: kevinmenden Date: Fri, 18 Dec 2020 10:58:37 +0100 Subject: [PATCH 26/29] adding .index back --- software/bowtie/index/main.nf | 2 +- tests/software/bowtie/main.nf | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/software/bowtie/index/main.nf b/software/bowtie/index/main.nf index 8b982bcf..b0156381 100644 --- a/software/bowtie/index/main.nf +++ b/software/bowtie/index/main.nf @@ -29,7 +29,7 @@ process BOWTIE_INDEX { def software = getSoftwareName(task.process) """ mkdir bowtie - bowtie-build --threads $task.cpus $fasta bowtie/${fasta.baseName} + bowtie-build --threads $task.cpus $fasta bowtie/${fasta.baseName}.index echo \$(bowtie --version 2>&1) | sed 's/^.*bowtie-align-s version //; s/ .*\$//' > ${software}.version.txt """ } diff --git a/tests/software/bowtie/main.nf b/tests/software/bowtie/main.nf index 6b4e24e6..c496a619 100644 --- a/tests/software/bowtie/main.nf +++ b/tests/software/bowtie/main.nf @@ -31,4 +31,3 @@ workflow test_bowtie_alignment_paired_end { file("${launchDir}/tests/data/fastq/rna/test_R2.fastq.gz", checkIfExists: true) ] ] BOWTIE_ALIGN ( input, BOWTIE_INDEX.out.index ) } - From db0b631906d16561036434c00c775890f2d5a55d Mon Sep 17 00:00:00 2001 From: kevinmenden Date: Fri, 18 Dec 2020 11:06:02 +0100 Subject: [PATCH 27/29] removed index from test output --- software/bowtie/index/main.nf | 2 +- tests/software/bowtie/test.yml | 36 +++++++++++++++++----------------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/software/bowtie/index/main.nf b/software/bowtie/index/main.nf index b0156381..8b982bcf 100644 --- a/software/bowtie/index/main.nf +++ b/software/bowtie/index/main.nf @@ -29,7 +29,7 @@ process BOWTIE_INDEX { def software = getSoftwareName(task.process) """ mkdir bowtie - bowtie-build --threads $task.cpus $fasta bowtie/${fasta.baseName}.index + bowtie-build --threads $task.cpus $fasta bowtie/${fasta.baseName} echo \$(bowtie --version 2>&1) | sed 's/^.*bowtie-align-s version //; s/ .*\$//' > ${software}.version.txt """ } diff --git a/tests/software/bowtie/test.yml b/tests/software/bowtie/test.yml index 8d6404bc..188b8119 100644 --- a/tests/software/bowtie/test.yml +++ b/tests/software/bowtie/test.yml @@ -4,17 +4,17 @@ - bowtie - bowtie_index files: - - path: output/bowtie/bowtie/NC_010473.index.1.ebwt + - path: output/bowtie/bowtie/NC_010473.1.ebwt md5sum: 90f0b7aa5bbaeaaa999839ac13ad203c - - path: output/bowtie/bowtie/NC_010473.index.2.ebwt + - path: output/bowtie/bowtie/NC_010473.2.ebwt md5sum: bfd10c5319c6a0dbc540fd789254a5dd - - path: output/bowtie/bowtie/NC_010473.index.3.ebwt + - path: output/bowtie/bowtie/NC_010473.3.ebwt md5sum: cd201e81724f3099131aec16ef2cc53b - - path: output/bowtie/bowtie/NC_010473.index.4.ebwt + - path: output/bowtie/bowtie/NC_010473.4.ebwt md5sum: bbb9d6d21ad765d135f95290204e8433 - - path: output/bowtie/bowtie/NC_010473.index.rev.1.ebwt + - path: output/bowtie/bowtie/NC_010473.rev.1.ebwt md5sum: 44f719c2fe42e1f35d54e798775846d1 - - path: output/bowtie/bowtie/NC_010473.index.rev.2.ebwt + - path: output/bowtie/bowtie/NC_010473.rev.2.ebwt md5sum: f3c398bba5158f4039334a932d79c051 - name: Run bowtie index and align single-end @@ -23,17 +23,17 @@ - bowtie - bowtie_align files: - - path: output/bowtie/bowtie/NC_010473.index.1.ebwt + - path: output/bowtie/bowtie/NC_010473.1.ebwt md5sum: 90f0b7aa5bbaeaaa999839ac13ad203c - - path: output/bowtie/bowtie/NC_010473.index.2.ebwt + - path: output/bowtie/bowtie/NC_010473.2.ebwt md5sum: bfd10c5319c6a0dbc540fd789254a5dd - - path: output/bowtie/bowtie/NC_010473.index.3.ebwt + - path: output/bowtie/bowtie/NC_010473.3.ebwt md5sum: cd201e81724f3099131aec16ef2cc53b - - path: output/bowtie/bowtie/NC_010473.index.4.ebwt + - path: output/bowtie/bowtie/NC_010473.4.ebwt md5sum: bbb9d6d21ad765d135f95290204e8433 - - path: output/bowtie/bowtie/NC_010473.index.rev.1.ebwt + - path: output/bowtie/bowtie/NC_010473.rev.1.ebwt md5sum: 44f719c2fe42e1f35d54e798775846d1 - - path: output/bowtie/bowtie/NC_010473.index.rev.2.ebwt + - path: output/bowtie/bowtie/NC_010473.rev.2.ebwt md5sum: f3c398bba5158f4039334a932d79c051 - path: output/bowtie/test.out md5sum: a81cb18024616415a6cec3108a36fccd @@ -46,17 +46,17 @@ - bowtie - bowtie_align files: - - path: output/bowtie/bowtie/NC_010473.index.1.ebwt + - path: output/bowtie/bowtie/NC_010473.1.ebwt md5sum: 90f0b7aa5bbaeaaa999839ac13ad203c - - path: output/bowtie/bowtie/NC_010473.index.2.ebwt + - path: output/bowtie/bowtie/NC_010473.2.ebwt md5sum: bfd10c5319c6a0dbc540fd789254a5dd - - path: output/bowtie/bowtie/NC_010473.index.3.ebwt + - path: output/bowtie/bowtie/NC_010473.3.ebwt md5sum: cd201e81724f3099131aec16ef2cc53b - - path: output/bowtie/bowtie/NC_010473.index.4.ebwt + - path: output/bowtie/bowtie/NC_010473.4.ebwt md5sum: bbb9d6d21ad765d135f95290204e8433 - - path: output/bowtie/bowtie/NC_010473.index.rev.1.ebwt + - path: output/bowtie/bowtie/NC_010473.rev.1.ebwt md5sum: 44f719c2fe42e1f35d54e798775846d1 - - path: output/bowtie/bowtie/NC_010473.index.rev.2.ebwt + - path: output/bowtie/bowtie/NC_010473.rev.2.ebwt md5sum: f3c398bba5158f4039334a932d79c051 - path: output/bowtie/test.out md5sum: a23e9a2a76e949aeb3693bcfae41a615 From 32f6191ff31d40df5c565fe367b1c1f844d85da8 Mon Sep 17 00:00:00 2001 From: kevinmenden Date: Fri, 18 Dec 2020 11:11:19 +0100 Subject: [PATCH 28/29] editorconfig --- software/bowtie/align/functions.nf | 120 ++++++++++++++--------------- software/bowtie/index/functions.nf | 120 ++++++++++++++--------------- 2 files changed, 120 insertions(+), 120 deletions(-) diff --git a/software/bowtie/align/functions.nf b/software/bowtie/align/functions.nf index f237d7f0..6f3b4b29 100644 --- a/software/bowtie/align/functions.nf +++ b/software/bowtie/align/functions.nf @@ -1,60 +1,60 @@ - -/* - * ----------------------------------------------------- - * Utility functions used in nf-core DSL2 module files - * ----------------------------------------------------- - */ - -/* - * Extract name of software tool from process name using $task.process - */ -def getSoftwareName(task_process) { - return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() -} - -/* - * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules - */ -def initOptions(Map args) { - def Map options = [:] - options.args = args.args ?: '' - options.args2 = args.args2 ?: '' - options.publish_by_id = args.publish_by_id ?: false - options.publish_dir = args.publish_dir ?: '' - options.publish_files = args.publish_files - options.suffix = args.suffix ?: '' - return options -} - -/* - * Tidy up and join elements of a list to return a path string - */ -def getPathFromList(path_list) { - def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries - paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes - return paths.join('/') -} - -/* - * Function to save/publish module results - */ -def saveFiles(Map args) { - if (!args.filename.endsWith('.version.txt')) { - def ioptions = initOptions(args.options) - def path_list = [ ioptions.publish_dir ?: args.publish_dir ] - if (ioptions.publish_by_id) { - path_list.add(args.publish_id) - } - if (ioptions.publish_files instanceof Map) { - for (ext in ioptions.publish_files) { - if (args.filename.endsWith(ext.key)) { - def ext_list = path_list.collect() - ext_list.add(ext.value) - return "${getPathFromList(ext_list)}/$args.filename" - } - } - } else if (ioptions.publish_files == null) { - return "${getPathFromList(path_list)}/$args.filename" - } - } -} + +/* + * ----------------------------------------------------- + * Utility functions used in nf-core DSL2 module files + * ----------------------------------------------------- + */ + +/* + * Extract name of software tool from process name using $task.process + */ +def getSoftwareName(task_process) { + return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() +} + +/* + * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules + */ +def initOptions(Map args) { + def Map options = [:] + options.args = args.args ?: '' + options.args2 = args.args2 ?: '' + options.publish_by_id = args.publish_by_id ?: false + options.publish_dir = args.publish_dir ?: '' + options.publish_files = args.publish_files + options.suffix = args.suffix ?: '' + return options +} + +/* + * Tidy up and join elements of a list to return a path string + */ +def getPathFromList(path_list) { + def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries + paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", '') } // Trim whitespace and trailing slashes + return paths.join('/') +} + +/* + * Function to save/publish module results + */ +def saveFiles(Map args) { + if (!args.filename.endsWith('.version.txt')) { + def ioptions = initOptions(args.options) + def path_list = [ ioptions.publish_dir ?: args.publish_dir ] + if (ioptions.publish_by_id) { + path_list.add(args.publish_id) + } + if (ioptions.publish_files instanceof Map) { + for (ext in ioptions.publish_files) { + if (args.filename.endsWith(ext.key)) { + def ext_list = path_list.collect() + ext_list.add(ext.value) + return "${getPathFromList(ext_list)}/$args.filename" + } + } + } else if (ioptions.publish_files == null) { + return "${getPathFromList(path_list)}/$args.filename" + } + } +} diff --git a/software/bowtie/index/functions.nf b/software/bowtie/index/functions.nf index f237d7f0..6f3b4b29 100644 --- a/software/bowtie/index/functions.nf +++ b/software/bowtie/index/functions.nf @@ -1,60 +1,60 @@ - -/* - * ----------------------------------------------------- - * Utility functions used in nf-core DSL2 module files - * ----------------------------------------------------- - */ - -/* - * Extract name of software tool from process name using $task.process - */ -def getSoftwareName(task_process) { - return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() -} - -/* - * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules - */ -def initOptions(Map args) { - def Map options = [:] - options.args = args.args ?: '' - options.args2 = args.args2 ?: '' - options.publish_by_id = args.publish_by_id ?: false - options.publish_dir = args.publish_dir ?: '' - options.publish_files = args.publish_files - options.suffix = args.suffix ?: '' - return options -} - -/* - * Tidy up and join elements of a list to return a path string - */ -def getPathFromList(path_list) { - def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries - paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", "") } // Trim whitespace and trailing slashes - return paths.join('/') -} - -/* - * Function to save/publish module results - */ -def saveFiles(Map args) { - if (!args.filename.endsWith('.version.txt')) { - def ioptions = initOptions(args.options) - def path_list = [ ioptions.publish_dir ?: args.publish_dir ] - if (ioptions.publish_by_id) { - path_list.add(args.publish_id) - } - if (ioptions.publish_files instanceof Map) { - for (ext in ioptions.publish_files) { - if (args.filename.endsWith(ext.key)) { - def ext_list = path_list.collect() - ext_list.add(ext.value) - return "${getPathFromList(ext_list)}/$args.filename" - } - } - } else if (ioptions.publish_files == null) { - return "${getPathFromList(path_list)}/$args.filename" - } - } -} + +/* + * ----------------------------------------------------- + * Utility functions used in nf-core DSL2 module files + * ----------------------------------------------------- + */ + +/* + * Extract name of software tool from process name using $task.process + */ +def getSoftwareName(task_process) { + return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase() +} + +/* + * Function to initialise default values and to generate a Groovy Map of available options for nf-core modules + */ +def initOptions(Map args) { + def Map options = [:] + options.args = args.args ?: '' + options.args2 = args.args2 ?: '' + options.publish_by_id = args.publish_by_id ?: false + options.publish_dir = args.publish_dir ?: '' + options.publish_files = args.publish_files + options.suffix = args.suffix ?: '' + return options +} + +/* + * Tidy up and join elements of a list to return a path string + */ +def getPathFromList(path_list) { + def paths = path_list.findAll { item -> !item?.trim().isEmpty() } // Remove empty entries + paths = paths.collect { it.trim().replaceAll("^[/]+|[/]+\$", '') } // Trim whitespace and trailing slashes + return paths.join('/') +} + +/* + * Function to save/publish module results + */ +def saveFiles(Map args) { + if (!args.filename.endsWith('.version.txt')) { + def ioptions = initOptions(args.options) + def path_list = [ ioptions.publish_dir ?: args.publish_dir ] + if (ioptions.publish_by_id) { + path_list.add(args.publish_id) + } + if (ioptions.publish_files instanceof Map) { + for (ext in ioptions.publish_files) { + if (args.filename.endsWith(ext.key)) { + def ext_list = path_list.collect() + ext_list.add(ext.value) + return "${getPathFromList(ext_list)}/$args.filename" + } + } + } else if (ioptions.publish_files == null) { + return "${getPathFromList(path_list)}/$args.filename" + } + } +} From 8f75bac67e70b49c272c9436e0157098f71b139e Mon Sep 17 00:00:00 2001 From: kevinmenden Date: Fri, 18 Dec 2020 11:16:58 +0100 Subject: [PATCH 29/29] update test.bam md5sums --- tests/software/bowtie/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/software/bowtie/test.yml b/tests/software/bowtie/test.yml index 188b8119..229165ac 100644 --- a/tests/software/bowtie/test.yml +++ b/tests/software/bowtie/test.yml @@ -38,7 +38,7 @@ - path: output/bowtie/test.out md5sum: a81cb18024616415a6cec3108a36fccd - path: output/bowtie/test.bam - md5sum: 8179c68a819accbc9137dc881736106f + md5sum: 9feed8a55d4b5e600dcc577768ef07fc - name: Run bowtie index and align paired-end command: nextflow run ./tests/software/bowtie -profile docker -entry test_bowtie_alignment_paired_end -c tests/config/nextflow.config @@ -61,4 +61,4 @@ - path: output/bowtie/test.out md5sum: a23e9a2a76e949aeb3693bcfae41a615 - path: output/bowtie/test.bam - md5sum: 9ce5aebf37128f4bb1d24e9548e22009 + md5sum: cf6a6381aa504e8342638ff3b509721e