Update all modules to new NF DSL2 syntax (#1099)

* Add comment line for consistency

* Remove all functions.nf

* Remove include functions.nf and publishDir options

* Replace options.args3 with task.ext.args3 - 3 modules

* Replace options.args3 with task.ext.args3 - 17 modules

* Replace {task.cpus} with task.cpus

* Replace off on off off off off off off off on off on off on off off off on off off off on on off off off on on off off off off off off off on off off off off on off on on off off off on on on on off off off on off on on off on on off off on on on off on on off on off off off off on off off off on off off on off on off off off on on off on off on off off on off off off on off off off on off off off off on off off off on on on off on on off off on off on on on off on on off on on on off off off off off on on off off on off off off off off on off off on on off on on off on off off off on off off off off on on off on off off on off off on off on off off off off off off off off on on off on off off off.args with

* Add def args = task.ext.args line to all modules in script section

* Replace options.args with args and args_list

* Initialise args2 and args3 properly

* Replace container syntax

* Revert container changes for cellranger/mkref

* Replace getProcessName in all modules

* Replace getSoftwareName in all modules

* Unify modules using VERSION variable

* Replae options.suffix with task.ext.suffix

* Remove NF version restriction for CI

* Bump NF version in README

* Replace task.process.tokenize logic with task.process

* Minor tweaks to unify syntax in tests main.nf

* Add a separate nextflow.config for each module

* Transfer remaining module options to nextflow.config

* Remove addParams from tests main.nf

* Remove TODO statements

* Use -c to import module specific config

* Bump NF version to 21.10.3

* Fix tests for artic/minion

* Fix broken publishDir syntax

* Standardise and fix obvious failing module tests

* Remove kronatools to krona

* Comment out tags in subworkflow test.yml

* Fix failing module tests

* Add consistent indentation to nextflow.config

* Comment out subworklow definitions

* Fix kallistobustools/ref

* Fix rmarkdownnotebook

* Fix jupyternotebook

* Quote task.process

* Add plink2/vcf to pytest_modules.yml

* Remove NF_CORE_MODULES_TEST from pytest CI

* Fix more tests

* Move bacteroides_fragilis to prokaryotes folder

* Fix cooler merge tests

* Fix kallistobustools/count tests

* Fix kallistobustools/ref tests

* Update test_10x_1_fastq_gz file for kallistobustools/count tests

* Fix bcftools/query tests

* Fix delly/call tests

* Fix cooler/zoomify tests

* Fix csvtk/split tests

* Fix gatk4/intervallisttools tests

* Fix gatk4/variantfiltration

* Fix pydamage/filter tests

* Fix test data for unicycler

* Fix gstama/collapse module

* Fix leehom tests

* Fix metaphlan3 tests

* Fix pairtools/select tests

* Update nextflow.config

* Update nextflow.config

* feat: update syntax

* Fix arriba tests

* Fix more failing tests

* Update test syntax

* Remove comments from tests nextflow.config

* Apply suggestions from code review

* Fix kallistobustools/count module

* Update dumpsoftwareversions module

* Update custom/dumpsoftwareversions

* Add args2 to untar module

* Update leftover modules

* Remove last remaining addParams

Co-authored-by: JoseEspinosa <kadomu@gmail.com>
Co-authored-by: Gregor Sturm <mail@gregor-sturm.de>
Co-authored-by: MaxUlysse <max.u.garcia@gmail.com>
This commit is contained in:
Harshil Patel 2021-11-26 07:58:40 +00:00 committed by GitHub
parent 45985ff6f0
commit 20d8250d9f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1803 changed files with 7649 additions and 36540 deletions

View file

@ -7,7 +7,6 @@ on:
pull_request: pull_request:
branches: [master] branches: [master]
jobs: jobs:
changes: changes:
name: Check for changes name: Check for changes
@ -25,9 +24,6 @@ jobs:
lint: lint:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
env:
NXF_VER: 21.04.0
name: ${{ matrix.tags }} name: ${{ matrix.tags }}
needs: changes needs: changes
if: needs.changes.outputs.modules != '[]' if: needs.changes.outputs.modules != '[]'

View file

@ -23,13 +23,12 @@ jobs:
test: test:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
name: ${{ matrix.tags }} ${{ matrix.profile }} ${{ matrix.nxf_version }} name: ${{ matrix.tags }} ${{ matrix.profile }}
needs: changes needs: changes
if: needs.changes.outputs.modules != '[]' if: needs.changes.outputs.modules != '[]'
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
nxf_version: ["21.04.0"]
tags: ["${{ fromJson(needs.changes.outputs.modules) }}"] tags: ["${{ fromJson(needs.changes.outputs.modules) }}"]
profile: ["docker", "singularity", "conda"] profile: ["docker", "singularity", "conda"]
env: env:
@ -60,13 +59,12 @@ jobs:
- uses: actions/cache@v2 - uses: actions/cache@v2
with: with:
path: /usr/local/bin/nextflow path: /usr/local/bin/nextflow
key: ${{ runner.os }}-nextflow-${{ matrix.nxf_version }} key: ${{ runner.os }}
restore-keys: | restore-keys: |
${{ runner.os }}-nextflow- ${{ runner.os }}-nextflow-
- name: Install Nextflow - name: Install Nextflow
env: env:
NXF_VER: ${{ matrix.nxf_version }}
CAPSULE_LOG: none CAPSULE_LOG: none
run: | run: |
wget -qO- get.nextflow.io | bash wget -qO- get.nextflow.io | bash
@ -93,13 +91,13 @@ jobs:
# Test the module # Test the module
- name: Run pytest-workflow - name: Run pytest-workflow
# only use one thread for pytest-workflow to avoid race condition on conda cache. # only use one thread for pytest-workflow to avoid race condition on conda cache.
run: NF_CORE_MODULES_TEST=1 TMPDIR=~ PROFILE=${{ matrix.profile }} pytest --tag ${{ matrix.tags }} --symlink --kwdof run: TMPDIR=~ PROFILE=${{ matrix.profile }} pytest --tag ${{ matrix.tags }} --symlink --kwdof
- name: Upload logs on failure - name: Upload logs on failure
if: failure() if: failure()
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: logs-${{ matrix.profile }}-${{ matrix.nxf_version }} name: logs-${{ matrix.profile }}
path: | path: |
/home/runner/pytest_workflow_*/*/.nextflow.log /home/runner/pytest_workflow_*/*/.nextflow.log
/home/runner/pytest_workflow_*/*/log.out /home/runner/pytest_workflow_*/*/log.out

View file

@ -1,6 +1,6 @@
# ![nf-core/modules](docs/images/nfcore-modules_logo.png) # ![nf-core/modules](docs/images/nfcore-modules_logo.png)
[![Nextflow](https://img.shields.io/badge/nextflow%20DSL2-%E2%89%A521.04.0-23aa62.svg?labelColor=000000)](https://www.nextflow.io/) [![Nextflow](https://img.shields.io/badge/nextflow%20DSL2-%E2%89%A521.10.3-23aa62.svg?labelColor=000000)](https://www.nextflow.io/)
[![run with conda](http://img.shields.io/badge/run%20with-conda-3EB049?labelColor=000000&logo=anaconda)](https://docs.conda.io/en/latest/) [![run with conda](http://img.shields.io/badge/run%20with-conda-3EB049?labelColor=000000&logo=anaconda)](https://docs.conda.io/en/latest/)
[![run with docker](https://img.shields.io/badge/run%20with-docker-0db7ed?labelColor=000000&logo=docker)](https://www.docker.com/) [![run with docker](https://img.shields.io/badge/run%20with-docker-0db7ed?labelColor=000000&logo=docker)](https://www.docker.com/)
[![run with singularity](https://img.shields.io/badge/run%20with-singularity-1d355c.svg?labelColor=000000)](https://sylabs.io/docs/) [![run with singularity](https://img.shields.io/badge/run%20with-singularity-1d355c.svg?labelColor=000000)](https://sylabs.io/docs/)
@ -78,7 +78,7 @@ We have written a helper command in the `nf-core/tools` package that uses the Gi
nextflow.enable.dsl = 2 nextflow.enable.dsl = 2
include { FASTQC } from './modules/nf-core/modules/fastqc/main' addParams( options: [:] ) include { FASTQC } from './modules/nf-core/modules/fastqc/main'
``` ```
5. Remove the module from the pipeline repository if required: 5. Remove the module from the pipeline repository if required:

View file

@ -1,78 +0,0 @@
//
// 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()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// 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.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
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) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
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"
}
}

View file

@ -1,22 +1,11 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process ABACAS { process ABACAS {
tag "$meta.id" tag "$meta.id"
label 'process_medium' label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::abacas=1.3.1" : null) conda (params.enable_conda ? "bioconda::abacas=1.3.1" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
container "https://depot.galaxyproject.org/singularity/abacas:1.3.1--pl526_0" 'https://depot.galaxyproject.org/singularity/abacas:1.3.1--pl526_0' :
} else { 'quay.io/biocontainers/abacas:1.3.1--pl526_0' }"
container "quay.io/biocontainers/abacas:1.3.1--pl526_0"
}
input: input:
tuple val(meta), path(scaffold) tuple val(meta), path(scaffold)
@ -27,12 +16,13 @@ process ABACAS {
path "versions.yml" , emit: versions path "versions.yml" , emit: versions
script: script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def args = task.ext.args ?: ''
def prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}"
""" """
abacas.pl \\ abacas.pl \\
-r $fasta \\ -r $fasta \\
-q $scaffold \\ -q $scaffold \\
$options.args \\ $args \\
-o ${prefix}.abacas -o ${prefix}.abacas
mv nucmer.delta ${prefix}.abacas.nucmer.delta mv nucmer.delta ${prefix}.abacas.nucmer.delta
@ -40,8 +30,8 @@ process ABACAS {
mv nucmer.tiling ${prefix}.abacas.nucmer.tiling mv nucmer.tiling ${prefix}.abacas.nucmer.tiling
mv unused_contigs.out ${prefix}.abacas.unused.contigs.out mv unused_contigs.out ${prefix}.abacas.unused.contigs.out
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}: "${task.process}":
${getSoftwareName(task.process)}: \$(echo \$(abacas.pl -v 2>&1) | sed 's/^.*ABACAS.//; s/ .*\$//') abacas: \$(echo \$(abacas.pl -v 2>&1) | sed 's/^.*ABACAS.//; s/ .*\$//')
END_VERSIONS END_VERSIONS
""" """
} }

View file

@ -1,78 +0,0 @@
//
// 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()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// 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.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
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) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
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"
}
}

View file

@ -1,21 +1,11 @@
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process ADAPTERREMOVAL { process ADAPTERREMOVAL {
tag "$meta.id" tag "$meta.id"
label 'process_medium' label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::adapterremoval=2.3.2" : null) conda (params.enable_conda ? "bioconda::adapterremoval=2.3.2" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
container "https://depot.galaxyproject.org/singularity/adapterremoval:2.3.2--hb7ba0dd_0" 'https://depot.galaxyproject.org/singularity/adapterremoval:2.3.2--hb7ba0dd_0' :
} else { 'quay.io/biocontainers/adapterremoval:2.3.2--hb7ba0dd_0' }"
container "quay.io/biocontainers/adapterremoval:2.3.2--hb7ba0dd_0"
}
input: input:
tuple val(meta), path(reads) tuple val(meta), path(reads)
@ -26,13 +16,14 @@ process ADAPTERREMOVAL {
path "versions.yml" , emit: versions path "versions.yml" , emit: versions
script: script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def args = task.ext.args ?: ''
def prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}"
if (meta.single_end) { if (meta.single_end) {
""" """
AdapterRemoval \\ AdapterRemoval \\
--file1 $reads \\ --file1 $reads \\
$options.args \\ $args \\
--basename $prefix \\ --basename $prefix \\
--threads $task.cpus \\ --threads $task.cpus \\
--settings ${prefix}.log \\ --settings ${prefix}.log \\
@ -41,8 +32,8 @@ process ADAPTERREMOVAL {
--gzip \\ --gzip \\
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}: "${task.process}":
${getSoftwareName(task.process)}: \$(AdapterRemoval --version 2>&1 | sed -e "s/AdapterRemoval ver. //g") adapterremoval: \$(AdapterRemoval --version 2>&1 | sed -e "s/AdapterRemoval ver. //g")
END_VERSIONS END_VERSIONS
""" """
} else if (!meta.single_end && !meta.collapse) { } else if (!meta.single_end && !meta.collapse) {
@ -50,7 +41,7 @@ process ADAPTERREMOVAL {
AdapterRemoval \\ AdapterRemoval \\
--file1 ${reads[0]} \\ --file1 ${reads[0]} \\
--file2 ${reads[1]} \\ --file2 ${reads[1]} \\
$options.args \\ $args \\
--basename $prefix \\ --basename $prefix \\
--threads $task.cpus \\ --threads $task.cpus \\
--settings ${prefix}.log \\ --settings ${prefix}.log \\
@ -60,8 +51,8 @@ process ADAPTERREMOVAL {
--gzip \\ --gzip \\
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}: "${task.process}":
${getSoftwareName(task.process)}: \$(AdapterRemoval --version 2>&1 | sed -e "s/AdapterRemoval ver. //g") adapterremoval: \$(AdapterRemoval --version 2>&1 | sed -e "s/AdapterRemoval ver. //g")
END_VERSIONS END_VERSIONS
""" """
} else { } else {
@ -70,7 +61,7 @@ process ADAPTERREMOVAL {
--file1 ${reads[0]} \\ --file1 ${reads[0]} \\
--file2 ${reads[1]} \\ --file2 ${reads[1]} \\
--collapse \\ --collapse \\
$options.args \\ $args \\
--basename $prefix \\ --basename $prefix \\
--threads $task.cpus \\ --threads $task.cpus \\
--settings ${prefix}.log \\ --settings ${prefix}.log \\
@ -79,8 +70,8 @@ process ADAPTERREMOVAL {
cat *.collapsed.gz *.collapsed.truncated.gz > ${prefix}.merged.fastq.gz cat *.collapsed.gz *.collapsed.truncated.gz > ${prefix}.merged.fastq.gz
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}: "${task.process}":
${getSoftwareName(task.process)}: \$(AdapterRemoval --version 2>&1 | sed -e "s/AdapterRemoval ver. //g") adapterremoval: \$(AdapterRemoval --version 2>&1 | sed -e "s/AdapterRemoval ver. //g")
END_VERSIONS END_VERSIONS
""" """
} }

View file

@ -1,78 +0,0 @@
//
// 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()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// 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.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
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) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
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"
}
}

View file

@ -1,22 +1,11 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process AGRVATE { process AGRVATE {
tag "$meta.id" tag "$meta.id"
label 'process_low' label 'process_low'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::agrvate=1.0.2" : null) conda (params.enable_conda ? "bioconda::agrvate=1.0.2" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
container "https://depot.galaxyproject.org/singularity/agrvate:1.0.2--hdfd78af_0" 'https://depot.galaxyproject.org/singularity/agrvate:1.0.2--hdfd78af_0' :
} else { 'quay.io/biocontainers/agrvate:1.0.2--hdfd78af_0' }"
container "quay.io/biocontainers/agrvate:1.0.2--hdfd78af_0"
}
input: input:
tuple val(meta), path(fasta) tuple val(meta), path(fasta)
@ -27,15 +16,16 @@ process AGRVATE {
path "versions.yml" , emit: versions path "versions.yml" , emit: versions
script: script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def args = task.ext.args ?: ''
def prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}"
""" """
agrvate \\ agrvate \\
$options.args \\ $args \\
-i $fasta -i $fasta
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}: "${task.process}":
${getSoftwareName(task.process)}: \$(echo \$(agrvate -v 2>&1) | sed 's/agrvate v//;') agrvate: \$(echo \$(agrvate -v 2>&1) | sed 's/agrvate v//;')
END_VERSIONS END_VERSIONS
""" """
} }

View file

@ -1,78 +0,0 @@
//
// 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()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// 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.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
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) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
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"
}
}

View file

@ -1,22 +1,11 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process ALLELECOUNTER { process ALLELECOUNTER {
tag "$meta.id" tag "$meta.id"
label 'process_low' label 'process_low'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? 'bioconda::cancerit-allelecount=4.3.0' : null) conda (params.enable_conda ? 'bioconda::cancerit-allelecount=4.3.0' : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
container "https://depot.galaxyproject.org/singularity/cancerit-allelecount:4.3.0--h41abebc_0" 'https://depot.galaxyproject.org/singularity/cancerit-allelecount:4.3.0--h41abebc_0' :
} else { 'quay.io/biocontainers/cancerit-allelecount:4.3.0--h41abebc_0' }"
container "quay.io/biocontainers/cancerit-allelecount:4.3.0--h41abebc_0"
}
input: input:
tuple val(meta), path(input), path(input_index) tuple val(meta), path(input), path(input_index)
@ -28,20 +17,21 @@ process ALLELECOUNTER {
path "versions.yml" , emit: versions path "versions.yml" , emit: versions
script: script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def args = task.ext.args ?: ''
def prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}"
def reference_options = fasta ? "-r $fasta": "" def reference_options = fasta ? "-r $fasta": ""
""" """
alleleCounter \\ alleleCounter \\
$options.args \\ $args \\
-l $loci \\ -l $loci \\
-b $input \\ -b $input \\
$reference_options \\ $reference_options \\
-o ${prefix}.alleleCount -o ${prefix}.alleleCount
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}: "${task.process}":
${getSoftwareName(task.process)}: \$(alleleCounter --version) allelecounter: \$(alleleCounter --version)
END_VERSIONS END_VERSIONS
""" """
} }

View file

@ -1,78 +0,0 @@
//
// 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()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// 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.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
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) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
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"
}
}

View file

@ -1,21 +1,10 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process AMPS { process AMPS {
label 'process_low' label 'process_low'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:[:], publish_by_meta:[]) }
conda (params.enable_conda ? "bioconda::hops=0.35" : null) conda (params.enable_conda ? "bioconda::hops=0.35" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
container "https://depot.galaxyproject.org/singularity/hops:0.35--hdfd78af_1" 'https://depot.galaxyproject.org/singularity/hops:0.35--hdfd78af_1' :
} else { 'quay.io/biocontainers/hops:0.35--hdfd78af_1' }"
container "quay.io/biocontainers/hops:0.35--hdfd78af_1"
}
input: input:
path maltextract_results path maltextract_results
@ -30,6 +19,7 @@ process AMPS {
path "versions.yml" , emit: versions path "versions.yml" , emit: versions
script: script:
def args = task.ext.args ?: ''
""" """
postprocessing.AMPS.r \\ postprocessing.AMPS.r \\
-r $maltextract_results \\ -r $maltextract_results \\
@ -37,11 +27,11 @@ process AMPS {
-m $filter \\ -m $filter \\
-t $task.cpus \\ -t $task.cpus \\
-j \\ -j \\
$options.args $args
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}: "${task.process}":
${getSoftwareName(task.process)}: \$(echo \$(hops --version 2>&1) | sed 's/HOPS version//') amps: \$(echo \$(hops --version 2>&1) | sed 's/HOPS version//')
END_VERSIONS END_VERSIONS
""" """
} }

View file

@ -1,78 +0,0 @@
//
// 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()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// 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.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
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) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
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"
}
}

View file

@ -1,22 +1,11 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process ARRIBA { process ARRIBA {
tag "$meta.id" tag "$meta.id"
label 'process_medium' label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::arriba=2.1.0" : null) conda (params.enable_conda ? "bioconda::arriba=2.1.0" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
container "https://depot.galaxyproject.org/singularity/arriba:2.1.0--h3198e80_1" 'https://depot.galaxyproject.org/singularity/arriba:2.1.0--h3198e80_1' :
} else { 'quay.io/biocontainers/arriba:2.1.0--h3198e80_1' }"
container "quay.io/biocontainers/arriba:2.1.0--h3198e80_1"
}
input: input:
tuple val(meta), path(bam) tuple val(meta), path(bam)
@ -29,8 +18,9 @@ process ARRIBA {
path "versions.yml" , emit: versions path "versions.yml" , emit: versions
script: script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def args = task.ext.args ?: ''
def blacklist = (options.args.contains('-b')) ? '' : '-f blacklist' def prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}"
def blacklist = (args.contains('-b')) ? '' : '-f blacklist'
""" """
arriba \\ arriba \\
-x $bam \\ -x $bam \\
@ -39,11 +29,11 @@ process ARRIBA {
-o ${prefix}.fusions.tsv \\ -o ${prefix}.fusions.tsv \\
-O ${prefix}.fusions.discarded.tsv \\ -O ${prefix}.fusions.discarded.tsv \\
$blacklist \\ $blacklist \\
$options.args $args
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}: "${task.process}":
${getSoftwareName(task.process)}: \$(arriba -h | grep 'Version:' 2>&1 | sed 's/Version:\s//') arriba: \$(arriba -h | grep 'Version:' 2>&1 | sed 's/Version:\s//')
END_VERSIONS END_VERSIONS
""" """
} }

View file

@ -1,78 +0,0 @@
//
// 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()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// 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.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
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) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
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"
}
}

View file

@ -1,22 +1,11 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process ARTIC_GUPPYPLEX { process ARTIC_GUPPYPLEX {
tag "$meta.id" tag "$meta.id"
label 'process_high' label 'process_high'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::artic=1.2.1" : null) conda (params.enable_conda ? "bioconda::artic=1.2.1" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
container "https://depot.galaxyproject.org/singularity/artic:1.2.1--py_0" 'https://depot.galaxyproject.org/singularity/artic:1.2.1--py_0' :
} else { 'quay.io/biocontainers/artic:1.2.1--py_0' }"
container "quay.io/biocontainers/artic:1.2.1--py_0"
}
input: input:
tuple val(meta), path(fastq_dir) tuple val(meta), path(fastq_dir)
@ -26,18 +15,19 @@ process ARTIC_GUPPYPLEX {
path "versions.yml" , emit: versions path "versions.yml" , emit: versions
script: script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def args = task.ext.args ?: ''
def prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}"
""" """
artic \\ artic \\
guppyplex \\ guppyplex \\
$options.args \\ $args \\
--directory $fastq_dir \\ --directory $fastq_dir \\
--output ${prefix}.fastq --output ${prefix}.fastq
pigz -p $task.cpus *.fastq pigz -p $task.cpus *.fastq
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}: "${task.process}":
${getSoftwareName(task.process)}: \$(artic --version 2>&1 | sed 's/^.*artic //; s/ .*\$//') artic: \$(artic --version 2>&1 | sed 's/^.*artic //; s/ .*\$//')
END_VERSIONS END_VERSIONS
""" """
} }

View file

@ -1,78 +0,0 @@
//
// 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()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// 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.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
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) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
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"
}
}

View file

@ -1,22 +1,11 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process ARTIC_MINION { process ARTIC_MINION {
tag "$meta.id" tag "$meta.id"
label 'process_high' label 'process_high'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::artic=1.2.1" : null) conda (params.enable_conda ? "bioconda::artic=1.2.1" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
container "https://depot.galaxyproject.org/singularity/artic:1.2.1--py_0" 'https://depot.galaxyproject.org/singularity/artic:1.2.1--py_0' :
} else { 'quay.io/biocontainers/artic:1.2.1--py_0' }"
container "quay.io/biocontainers/artic:1.2.1--py_0"
}
input: input:
tuple val(meta), path(fastq) tuple val(meta), path(fastq)
@ -43,20 +32,21 @@ process ARTIC_MINION {
path "versions.yml" , emit: versions path "versions.yml" , emit: versions
script: script:
prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def args = task.ext.args ?: ''
prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}"
def version = scheme_version.toString().toLowerCase().replaceAll('v','') def version = scheme_version.toString().toLowerCase().replaceAll('v','')
def fast5 = params.fast5_dir ? "--fast5-directory $fast5_dir" : "" def fast5 = fast5_dir ? "--fast5-directory $fast5_dir" : ""
def summary = params.sequencing_summary ? "--sequencing-summary $sequencing_summary" : "" def summary = sequencing_summary ? "--sequencing-summary $sequencing_summary" : ""
def model = "" def model = ""
if (options.args.tokenize().contains('--medaka')) { if (args.tokenize().contains('--medaka')) {
fast5 = "" fast5 = ""
summary = "" summary = ""
model = file(params.artic_minion_medaka_model).exists() ? "--medaka-model ./$medaka_model" : "--medaka-model $params.artic_minion_medaka_model" model = file(medaka_model).exists() ? "--medaka-model ./$medaka_model" : "--medaka-model $medaka_model"
} }
""" """
artic \\ artic \\
minion \\ minion \\
$options.args \\ $args \\
--threads $task.cpus \\ --threads $task.cpus \\
--read-file $fastq \\ --read-file $fastq \\
--scheme-directory ./primer-schemes \\ --scheme-directory ./primer-schemes \\
@ -68,8 +58,8 @@ process ARTIC_MINION {
$prefix $prefix
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}: "${task.process}":
${getSoftwareName(task.process)}: \$(artic --version 2>&1 | sed 's/^.*artic //; s/ .*\$//') artic: \$(artic --version 2>&1 | sed 's/^.*artic //; s/ .*\$//')
END_VERSIONS END_VERSIONS
""" """
} }

View file

@ -1,78 +0,0 @@
//
// 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()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// 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.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
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) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
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"
}
}

View file

@ -1,22 +1,11 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process ASSEMBLYSCAN { process ASSEMBLYSCAN {
tag "$meta.id" tag "$meta.id"
label 'process_low' label 'process_low'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::assembly-scan=0.4.1" : null) conda (params.enable_conda ? "bioconda::assembly-scan=0.4.1" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
container "https://depot.galaxyproject.org/singularity/assembly-scan:0.4.1--pyhdfd78af_0" 'https://depot.galaxyproject.org/singularity/assembly-scan:0.4.1--pyhdfd78af_0' :
} else { 'quay.io/biocontainers/assembly-scan:0.4.1--pyhdfd78af_0' }"
container "quay.io/biocontainers/assembly-scan:0.4.1--pyhdfd78af_0"
}
input: input:
tuple val(meta), path(assembly) tuple val(meta), path(assembly)
@ -26,13 +15,14 @@ process ASSEMBLYSCAN {
path "versions.yml" , emit: versions path "versions.yml" , emit: versions
script: script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def args = task.ext.args ?: ''
def prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}"
""" """
assembly-scan $assembly > ${prefix}.json assembly-scan $assembly > ${prefix}.json
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}: "${task.process}":
${getSoftwareName(task.process)}: \$( assembly-scan --version 2>&1 | sed 's/^.*assembly-scan //; s/Using.*\$//' ) assemblyscan: \$( assembly-scan --version 2>&1 | sed 's/^.*assembly-scan //; s/Using.*\$//' )
END_VERSIONS END_VERSIONS
""" """
} }

View file

@ -1,78 +0,0 @@
//
// 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()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// 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.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
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) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
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"
}
}

View file

@ -1,21 +1,11 @@
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process ATAQV_ATAQV { process ATAQV_ATAQV {
tag "$meta.id" tag "$meta.id"
label 'process_medium' label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::ataqv=1.2.1" : null) conda (params.enable_conda ? "bioconda::ataqv=1.2.1" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
container "https://depot.galaxyproject.org/singularity/ataqv:1.2.1--py39ha23c084_2" 'https://depot.galaxyproject.org/singularity/ataqv:1.2.1--py39ha23c084_2' :
} else { 'quay.io/biocontainers/ataqv:1.2.1--py36hfdecbe1_2' }"
container "quay.io/biocontainers/ataqv:1.2.1--py36hfdecbe1_2"
}
input: input:
tuple val(meta), path(bam), path(bai), path(peak_file) tuple val(meta), path(bam), path(bai), path(peak_file)
@ -30,14 +20,15 @@ process ATAQV_ATAQV {
path "versions.yml" , emit: versions path "versions.yml" , emit: versions
script: script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def args = task.ext.args ?: ''
def prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}"
def peak = peak_file ? "--peak-file $peak_file" : '' def peak = peak_file ? "--peak-file $peak_file" : ''
def tss = tss_file ? "--tss-file $tss_file" : '' def tss = tss_file ? "--tss-file $tss_file" : ''
def excl_regs = excl_regs_file ? "--excluded-region-file $excl_regs_file" : '' def excl_regs = excl_regs_file ? "--excluded-region-file $excl_regs_file" : ''
def autosom_ref = autosom_ref_file ? "--autosomal-reference-file $autosom_ref_file" : '' def autosom_ref = autosom_ref_file ? "--autosomal-reference-file $autosom_ref_file" : ''
""" """
ataqv \\ ataqv \\
$options.args \\ $args \\
$peak \\ $peak \\
$tss \\ $tss \\
$excl_regs \\ $excl_regs \\
@ -49,8 +40,8 @@ process ATAQV_ATAQV {
$bam $bam
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}: "${task.process}":
${getSoftwareName(task.process)}: \$( ataqv --version ) ataqv: \$( ataqv --version )
END_VERSIONS END_VERSIONS
""" """
} }

View file

@ -1,78 +0,0 @@
//
// 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()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// 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.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
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) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
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"
}
}

View file

@ -1,22 +1,11 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process BAKTA { process BAKTA {
tag "$meta.id" tag "$meta.id"
label 'process_medium' label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::bakta=1.2.2" : null) conda (params.enable_conda ? "bioconda::bakta=1.2.2" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
container "https://depot.galaxyproject.org/singularity/bakta:1.2.2--pyhdfd78af_0" 'https://depot.galaxyproject.org/singularity/bakta:1.2.2--pyhdfd78af_0' :
} else { 'quay.io/biocontainers/bakta:1.2.2--pyhdfd78af_0' }"
container "quay.io/biocontainers/bakta:1.2.2--pyhdfd78af_0"
}
input: input:
tuple val(meta), path(fasta) tuple val(meta), path(fasta)
@ -37,27 +26,28 @@ process BAKTA {
path "versions.yml" , emit: versions path "versions.yml" , emit: versions
script: script:
prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def args = task.ext.args ?: ''
prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}"
def proteins_opt = proteins ? "--proteins ${proteins[0]}" : "" def proteins_opt = proteins ? "--proteins ${proteins[0]}" : ""
def prodigal_opt = prodigal_tf ? "--prodigal-tf ${prodigal_tf[0]}" : "" def prodigal_opt = prodigal_tf ? "--prodigal-tf ${prodigal_tf[0]}" : ""
""" """
bakta \\ bakta \\
$options.args \\ $args \\
--threads $task.cpus \\ --threads $task.cpus \\
--prefix ${prefix} \\ --prefix $prefix \\
--db $db \\ --db $db \\
$proteins_opt \\ $proteins_opt \\
$prodigal_tf \\ $prodigal_tf \\
$fasta $fasta
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}: "${task.process}":
${getSoftwareName(task.process)}: \$( echo \$(bakta --version 2>&1) | sed 's/^.*bakta //' ) bakta: \$( echo \$(bakta --version 2>&1) | sed 's/^.*bakta //' )
END_VERSIONS END_VERSIONS
""" """
stub: stub:
prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}"
""" """
touch ${prefix}.embl touch ${prefix}.embl
touch ${prefix}.faa touch ${prefix}.faa
@ -70,8 +60,8 @@ process BAKTA {
touch ${prefix}.tsv touch ${prefix}.tsv
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}: "${task.process}":
${getSoftwareName(task.process)}: \$( echo \$(bakta --version 2>&1) | sed 's/^.*bakta //' ) bakta: \$( echo \$(bakta --version 2>&1) | sed 's/^.*bakta //' )
END_VERSIONS END_VERSIONS
""" """
} }

View file

@ -1,78 +0,0 @@
//
// 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()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// 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.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
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) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
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"
}
}

View file

@ -1,22 +1,11 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process BAMALIGNCLEANER { process BAMALIGNCLEANER {
tag "$meta.id" tag "$meta.id"
label 'process_low' label 'process_low'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::bamaligncleaner=0.2.1" : null) conda (params.enable_conda ? "bioconda::bamaligncleaner=0.2.1" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
container "https://depot.galaxyproject.org/singularity/bamaligncleaner:0.2.1--pyhdfd78af_0" 'https://depot.galaxyproject.org/singularity/bamaligncleaner:0.2.1--pyhdfd78af_0' :
} else { 'quay.io/biocontainers/bamaligncleaner:0.2.1--pyhdfd78af_0' }"
container "quay.io/biocontainers/bamaligncleaner:0.2.1--pyhdfd78af_0"
}
input: input:
tuple val(meta), path(bam) tuple val(meta), path(bam)
@ -26,17 +15,18 @@ process BAMALIGNCLEANER {
path "versions.yml" , emit: versions path "versions.yml" , emit: versions
script: script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def args = task.ext.args ?: ''
def prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}"
""" """
bamAlignCleaner \\ bamAlignCleaner \\
$options.args \\ $args \\
-o ${prefix}.bam \\ -o ${prefix}.bam \\
${bam} ${bam}
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}: "${task.process}":
${getSoftwareName(task.process)}: \$(bamAlignCleaner --version | sed 's/.*version //') bamaligncleaner: \$(bamAlignCleaner --version | sed 's/.*version //')
END_VERSIONS END_VERSIONS
""" """
} }

View file

@ -1,78 +0,0 @@
//
// 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()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// 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.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
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) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
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"
}
}

View file

@ -1,22 +1,11 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process BAMTOOLS_SPLIT { process BAMTOOLS_SPLIT {
tag "$meta.id" tag "$meta.id"
label 'process_low' label 'process_low'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::bamtools=2.5.1" : null) conda (params.enable_conda ? "bioconda::bamtools=2.5.1" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
container "https://depot.galaxyproject.org/singularity/bamtools:2.5.1--h9a82719_9" 'https://depot.galaxyproject.org/singularity/bamtools:2.5.1--h9a82719_9' :
} else { 'quay.io/biocontainers/bamtools:2.5.1--h9a82719_9' }"
container "quay.io/biocontainers/bamtools:2.5.1--h9a82719_9"
}
input: input:
tuple val(meta), path(bam) tuple val(meta), path(bam)
@ -26,16 +15,17 @@ process BAMTOOLS_SPLIT {
path "versions.yml" , emit: versions path "versions.yml" , emit: versions
script: script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def args = task.ext.args ?: ''
def prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}"
""" """
bamtools \\ bamtools \\
split \\ split \\
-in $bam \\ -in $bam \\
$options.args $args
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}: "${task.process}":
${getSoftwareName(task.process)}: \$( bamtools --version | grep -e 'bamtools' | sed 's/^.*bamtools //' ) bamtools: \$( bamtools --version | grep -e 'bamtools' | sed 's/^.*bamtools //' )
END_VERSIONS END_VERSIONS
""" """
} }

View file

@ -1,78 +0,0 @@
//
// 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()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// 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.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
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) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
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"
}
}

View file

@ -1,22 +1,11 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process BAMUTIL_TRIMBAM { process BAMUTIL_TRIMBAM {
tag "$meta.id" tag "$meta.id"
label 'process_low' label 'process_low'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::bamutil=1.0.15" : null) conda (params.enable_conda ? "bioconda::bamutil=1.0.15" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
container "https://depot.galaxyproject.org/singularity/bamutil:1.0.15--h2e03b76_1" 'https://depot.galaxyproject.org/singularity/bamutil:1.0.15--h2e03b76_1' :
} else { 'quay.io/biocontainers/bamutil:1.0.15--h2e03b76_1' }"
container "quay.io/biocontainers/bamutil:1.0.15--h2e03b76_1"
}
input: input:
tuple val(meta), path(bam), val(trim_left), val(trim_right) tuple val(meta), path(bam), val(trim_left), val(trim_right)
@ -26,19 +15,20 @@ process BAMUTIL_TRIMBAM {
path "versions.yml" , emit: versions path "versions.yml" , emit: versions
script: script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def args = task.ext.args ?: ''
def prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}"
""" """
bam \\ bam \\
trimBam \\ trimBam \\
$bam \\ $bam \\
${prefix}.bam \\ ${prefix}.bam \\
$options.args \\ $args \\
-L $trim_left \\ -L $trim_left \\
-R $trim_right -R $trim_right
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}: "${task.process}":
${getSoftwareName(task.process)}: \$( echo \$( bam trimBam 2>&1 ) | sed 's/^Version: //;s/;.*//' ) bamutil: \$( echo \$( bam trimBam 2>&1 ) | sed 's/^Version: //;s/;.*//' )
END_VERSIONS END_VERSIONS
""" """
} }

View file

@ -1,78 +0,0 @@
//
// 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()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// 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.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
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) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
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"
}
}

View file

@ -1,22 +1,11 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process BANDAGE_IMAGE { process BANDAGE_IMAGE {
tag "${meta.id}" tag "${meta.id}"
label 'process_low' label 'process_low'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? 'bioconda::bandage=0.8.1' : null) conda (params.enable_conda ? 'bioconda::bandage=0.8.1' : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
container "https://depot.galaxyproject.org/singularity/bandage:0.8.1--hc9558a2_2" 'https://depot.galaxyproject.org/singularity/bandage:0.8.1--hc9558a2_2' :
} else { 'quay.io/biocontainers/bandage:0.8.1--hc9558a2_2' }"
container "quay.io/biocontainers/bandage:0.8.1--hc9558a2_2"
}
input: input:
tuple val(meta), path(gfa) tuple val(meta), path(gfa)
@ -27,14 +16,15 @@ process BANDAGE_IMAGE {
path "versions.yml" , emit: versions path "versions.yml" , emit: versions
script: script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def args = task.ext.args ?: ''
def prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}"
""" """
Bandage image $gfa ${prefix}.png $options.args Bandage image $gfa ${prefix}.png $args
Bandage image $gfa ${prefix}.svg $options.args Bandage image $gfa ${prefix}.svg $args
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}: "${task.process}":
${getSoftwareName(task.process)}: \$(echo \$(Bandage --version 2>&1) | sed 's/^.*Version: //; s/ .*\$//') bandage: \$(echo \$(Bandage --version 2>&1) | sed 's/^.*Version: //; s/ .*\$//')
END_VERSIONS END_VERSIONS
""" """
} }

View file

@ -1,78 +0,0 @@
//
// 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()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// 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.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
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) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
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"
}
}

View file

@ -1,22 +1,11 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process BBMAP_ALIGN { process BBMAP_ALIGN {
tag "$meta.id" tag "$meta.id"
label 'process_medium' label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::bbmap=38.92 bioconda::samtools=1.13 pigz=2.6" : null) conda (params.enable_conda ? "bioconda::bbmap=38.92 bioconda::samtools=1.13 pigz=2.6" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
container "https://depot.galaxyproject.org/singularity/mulled-v2-008daec56b7aaf3f162d7866758142b9f889d690:f5f55fc5623bb7b3f725e8d2f86bedacfd879510-0" 'https://depot.galaxyproject.org/singularity/mulled-v2-008daec56b7aaf3f162d7866758142b9f889d690:f5f55fc5623bb7b3f725e8d2f86bedacfd879510-0' :
} else { 'quay.io/biocontainers/mulled-v2-008daec56b7aaf3f162d7866758142b9f889d690:f5f55fc5623bb7b3f725e8d2f86bedacfd879510-0' }"
container "quay.io/biocontainers/mulled-v2-008daec56b7aaf3f162d7866758142b9f889d690:f5f55fc5623bb7b3f725e8d2f86bedacfd879510-0"
}
input: input:
tuple val(meta), path(fastq) tuple val(meta), path(fastq)
@ -28,7 +17,8 @@ process BBMAP_ALIGN {
path "versions.yml" , emit: versions path "versions.yml" , emit: versions
script: script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def args = task.ext.args ?: ''
def prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}"
input = meta.single_end ? "in=${fastq}" : "in=${fastq[0]} in2=${fastq[1]}" input = meta.single_end ? "in=${fastq}" : "in=${fastq[0]} in2=${fastq[1]}"
@ -50,14 +40,14 @@ process BBMAP_ALIGN {
$db \\ $db \\
$input \\ $input \\
out=${prefix}.bam \\ out=${prefix}.bam \\
$options.args \\ $args \\
threads=$task.cpus \\ threads=$task.cpus \\
-Xmx${task.memory.toGiga()}g \\ -Xmx${task.memory.toGiga()}g \\
&> ${prefix}.bbmap.log &> ${prefix}.bbmap.log
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}: "${task.process}":
${getSoftwareName(task.process)}: \$(bbversion.sh) bbmap: \$(bbversion.sh)
samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//') samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
pigz: \$( pigz --version 2>&1 | sed 's/pigz //g' ) pigz: \$( pigz --version 2>&1 | sed 's/pigz //g' )
END_VERSIONS END_VERSIONS

View file

@ -1,78 +0,0 @@
//
// 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()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// 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.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
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) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
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"
}
}

View file

@ -1,21 +1,11 @@
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process BBMAP_BBDUK { process BBMAP_BBDUK {
tag "$meta.id" tag "$meta.id"
label 'process_medium' label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::bbmap=38.90" : null) conda (params.enable_conda ? "bioconda::bbmap=38.90" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
container "https://depot.galaxyproject.org/singularity/bbmap:38.90--he522d1c_1" 'https://depot.galaxyproject.org/singularity/bbmap:38.90--he522d1c_1' :
} else { 'quay.io/biocontainers/bbmap:38.90--he522d1c_1' }"
container "quay.io/biocontainers/bbmap:38.90--he522d1c_1"
}
input: input:
tuple val(meta), path(reads) tuple val(meta), path(reads)
@ -27,7 +17,8 @@ process BBMAP_BBDUK {
path "versions.yml" , emit: versions path "versions.yml" , emit: versions
script: script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def args = task.ext.args ?: ''
def prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}"
def raw = meta.single_end ? "in=${reads[0]}" : "in1=${reads[0]} in2=${reads[1]}" def raw = meta.single_end ? "in=${reads[0]}" : "in1=${reads[0]} in2=${reads[1]}"
def trimmed = meta.single_end ? "out=${prefix}.fastq.gz" : "out1=${prefix}_1.fastq.gz out2=${prefix}_2.fastq.gz" def trimmed = meta.single_end ? "out=${prefix}.fastq.gz" : "out1=${prefix}_1.fastq.gz out2=${prefix}_2.fastq.gz"
def contaminants_fa = contaminants ? "ref=$contaminants" : '' def contaminants_fa = contaminants ? "ref=$contaminants" : ''
@ -38,12 +29,12 @@ process BBMAP_BBDUK {
$raw \\ $raw \\
$trimmed \\ $trimmed \\
threads=$task.cpus \\ threads=$task.cpus \\
$options.args \\ $args \\
$contaminants_fa \\ $contaminants_fa \\
&> ${prefix}.bbduk.log &> ${prefix}.bbduk.log
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}: "${task.process}":
${getSoftwareName(task.process)}: \$(bbversion.sh) bbmap: \$(bbversion.sh)
END_VERSIONS END_VERSIONS
""" """
} }

View file

@ -1,78 +0,0 @@
//
// 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()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// 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.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
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) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
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"
}
}

View file

@ -1,21 +1,10 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process BBMAP_BBSPLIT { process BBMAP_BBSPLIT {
label 'process_high' label 'process_high'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::bbmap=38.93" : null) conda (params.enable_conda ? "bioconda::bbmap=38.93" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
container "https://depot.galaxyproject.org/singularity/bbmap:38.93--he522d1c_0" 'https://depot.galaxyproject.org/singularity/bbmap:38.93--he522d1c_0' :
} else { 'quay.io/biocontainers/bbmap:38.93--he522d1c_0' }"
container "quay.io/biocontainers/bbmap:38.93--he522d1c_0"
}
input: input:
tuple val(meta), path(reads) tuple val(meta), path(reads)
@ -32,7 +21,8 @@ process BBMAP_BBSPLIT {
path "versions.yml" , emit: versions path "versions.yml" , emit: versions
script: script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def args = task.ext.args ?: ''
def prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}"
def avail_mem = 3 def avail_mem = 3
if (!task.memory) { if (!task.memory) {
@ -54,11 +44,11 @@ process BBMAP_BBSPLIT {
${other_refs.join(' ')} \\ ${other_refs.join(' ')} \\
path=bbsplit \\ path=bbsplit \\
threads=$task.cpus \\ threads=$task.cpus \\
$options.args $args
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}: "${task.process}":
${getSoftwareName(task.process)}: \$(bbversion.sh 2>&1) bbmap: \$(bbversion.sh 2>&1)
END_VERSIONS END_VERSIONS
""" """
} else { } else {
@ -83,11 +73,11 @@ process BBMAP_BBSPLIT {
$fastq_in \\ $fastq_in \\
$fastq_out \\ $fastq_out \\
refstats=${prefix}.stats.txt \\ refstats=${prefix}.stats.txt \\
$options.args $args
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}: "${task.process}":
${getSoftwareName(task.process)}: \$(bbversion.sh 2>&1) bbmap: \$(bbversion.sh 2>&1)
END_VERSIONS END_VERSIONS
""" """
} }

View file

@ -1,78 +0,0 @@
//
// 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()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// 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.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
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) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
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"
}
}

View file

@ -1,22 +1,11 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process BBMAP_INDEX { process BBMAP_INDEX {
tag "$fasta" tag "$fasta"
label 'process_long' label 'process_long'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:[:], publish_by_meta:[]) }
conda (params.enable_conda ? "bioconda::bbmap=38.92" : null) conda (params.enable_conda ? "bioconda::bbmap=38.92" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
container "https://depot.galaxyproject.org/singularity/bbmap:38.92--he522d1c_0" 'https://depot.galaxyproject.org/singularity/bbmap:38.92--he522d1c_0' :
} else { 'quay.io/biocontainers/bbmap:38.92--he522d1c_0' }"
container "quay.io/biocontainers/bbmap:38.92--he522d1c_0"
}
input: input:
path fasta path fasta
@ -26,16 +15,17 @@ process BBMAP_INDEX {
path "versions.yml" , emit: versions path "versions.yml" , emit: versions
script: script:
def args = task.ext.args ?: ''
""" """
bbmap.sh \\ bbmap.sh \\
ref=${fasta} \\ ref=${fasta} \\
$options.args \\ $args \\
threads=$task.cpus \\ threads=$task.cpus \\
-Xmx${task.memory.toGiga()}g -Xmx${task.memory.toGiga()}g
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}: "${task.process}":
${getSoftwareName(task.process)}: \$(bbversion.sh) bbmap: \$(bbversion.sh)
END_VERSIONS END_VERSIONS
""" """
} }

View file

@ -1,78 +0,0 @@
//
// 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()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// 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.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
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) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
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"
}
}

View file

@ -1,22 +1,11 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process BCFTOOLS_CONCAT { process BCFTOOLS_CONCAT {
tag "$meta.id" tag "$meta.id"
label 'process_medium' label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::bcftools=1.11" : null) conda (params.enable_conda ? "bioconda::bcftools=1.11" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
container "https://depot.galaxyproject.org/singularity/bcftools:1.11--h7c999a4_0" 'https://depot.galaxyproject.org/singularity/bcftools:1.11--h7c999a4_0' :
} else { 'quay.io/biocontainers/bcftools:1.11--h7c999a4_0' }"
container "quay.io/biocontainers/bcftools:1.11--h7c999a4_0"
}
input: input:
tuple val(meta), path(vcfs) tuple val(meta), path(vcfs)
@ -26,17 +15,18 @@ process BCFTOOLS_CONCAT {
path "versions.yml" , emit: versions path "versions.yml" , emit: versions
script: script:
prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def args = task.ext.args ?: ''
prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}"
""" """
bcftools concat \\ bcftools concat \\
--output ${prefix}.vcf.gz \\ --output ${prefix}.vcf.gz \\
$options.args \\ $args \\
--threads $task.cpus \\ --threads $task.cpus \\
${vcfs} ${vcfs}
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}: "${task.process}":
${getSoftwareName(task.process)}: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//') bcftools: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//')
END_VERSIONS END_VERSIONS
""" """
} }

View file

@ -1,78 +0,0 @@
//
// 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()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// 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.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
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) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
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"
}
}

View file

@ -1,22 +1,11 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process BCFTOOLS_CONSENSUS { process BCFTOOLS_CONSENSUS {
tag "$meta.id" tag "$meta.id"
label 'process_medium' label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? 'bioconda::bcftools=1.13' : null) conda (params.enable_conda ? 'bioconda::bcftools=1.13' : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
container 'https://depot.galaxyproject.org/singularity/bcftools:1.13--h3a49de5_0' 'https://depot.galaxyproject.org/singularity/bcftools:1.13--h3a49de5_0' :
} else { 'quay.io/biocontainers/bcftools:1.13--h3a49de5_0' }"
container 'quay.io/biocontainers/bcftools:1.13--h3a49de5_0'
}
input: input:
tuple val(meta), path(vcf), path(tbi), path(fasta) tuple val(meta), path(vcf), path(tbi), path(fasta)
@ -26,15 +15,16 @@ process BCFTOOLS_CONSENSUS {
path "versions.yml" , emit: versions path "versions.yml" , emit: versions
script: script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def args = task.ext.args ?: ''
def prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}"
""" """
cat $fasta | bcftools consensus $vcf $options.args > ${prefix}.fa cat $fasta | bcftools consensus $vcf $args > ${prefix}.fa
header=\$(head -n 1 ${prefix}.fa | sed 's/>//g') header=\$(head -n 1 ${prefix}.fa | sed 's/>//g')
sed -i 's/\${header}/${meta.id}/g' ${prefix}.fa sed -i 's/\${header}/${meta.id}/g' ${prefix}.fa
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}: "${task.process}":
${getSoftwareName(task.process)}: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//') bcftools: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//')
END_VERSIONS END_VERSIONS
""" """
} }

View file

@ -1,78 +0,0 @@
//
// 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()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// 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.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
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) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
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"
}
}

View file

@ -1,22 +1,11 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process BCFTOOLS_FILTER { process BCFTOOLS_FILTER {
tag "$meta.id" tag "$meta.id"
label 'process_medium' label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? 'bioconda::bcftools=1.13' : null) conda (params.enable_conda ? 'bioconda::bcftools=1.13' : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
container "https://depot.galaxyproject.org/singularity/bcftools:1.13--h3a49de5_0" 'https://depot.galaxyproject.org/singularity/bcftools:1.13--h3a49de5_0' :
} else { 'quay.io/biocontainers/bcftools:1.13--h3a49de5_0' }"
container "quay.io/biocontainers/bcftools:1.13--h3a49de5_0"
}
input: input:
tuple val(meta), path(vcf) tuple val(meta), path(vcf)
@ -26,16 +15,17 @@ process BCFTOOLS_FILTER {
path "versions.yml" , emit: versions path "versions.yml" , emit: versions
script: script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def args = task.ext.args ?: ''
def prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}"
""" """
bcftools filter \\ bcftools filter \\
--output ${prefix}.vcf.gz \\ --output ${prefix}.vcf.gz \\
$options.args \\ $args \\
$vcf $vcf
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}: "${task.process}":
${getSoftwareName(task.process)}: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//') bcftools: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//')
END_VERSIONS END_VERSIONS
""" """
} }

View file

@ -1,78 +0,0 @@
//
// 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()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// 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.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
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) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
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"
}
}

View file

@ -1,22 +1,11 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process BCFTOOLS_INDEX { process BCFTOOLS_INDEX {
tag "$meta.id" tag "$meta.id"
label 'process_low' label 'process_low'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? 'bioconda::bcftools=1.13' : null) conda (params.enable_conda ? 'bioconda::bcftools=1.13' : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
container "https://depot.galaxyproject.org/singularity/bcftools:1.13--h3a49de5_0" 'https://depot.galaxyproject.org/singularity/bcftools:1.13--h3a49de5_0' :
} else { 'quay.io/biocontainers/bcftools:1.13--h3a49de5_0' }"
container "quay.io/biocontainers/bcftools:1.13--h3a49de5_0"
}
input: input:
tuple val(meta), path(vcf) tuple val(meta), path(vcf)
@ -27,18 +16,19 @@ process BCFTOOLS_INDEX {
path "versions.yml" , emit: version path "versions.yml" , emit: version
script: script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def args = task.ext.args ?: ''
def prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}"
""" """
bcftools \\ bcftools \\
index \\ index \\
$options.args \\ $args \\
--threads $task.cpus \\ --threads $task.cpus \\
$vcf $vcf
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}: "${task.process}":
${getSoftwareName(task.process)}: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//') bcftools: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//')
END_VERSIONS END_VERSIONS
""" """
} }

View file

@ -1,78 +0,0 @@
//
// 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()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// 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.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
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) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
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"
}
}

View file

@ -1,22 +1,11 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process BCFTOOLS_ISEC { process BCFTOOLS_ISEC {
tag "$meta.id" tag "$meta.id"
label 'process_medium' label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? 'bioconda::bcftools=1.13' : null) conda (params.enable_conda ? 'bioconda::bcftools=1.13' : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
container "https://depot.galaxyproject.org/singularity/bcftools:1.13--h3a49de5_0" 'https://depot.galaxyproject.org/singularity/bcftools:1.13--h3a49de5_0' :
} else { 'quay.io/biocontainers/bcftools:1.13--h3a49de5_0' }"
container "quay.io/biocontainers/bcftools:1.13--h3a49de5_0"
}
input: input:
tuple val(meta), path(vcfs), path(tbis) tuple val(meta), path(vcfs), path(tbis)
@ -26,15 +15,16 @@ process BCFTOOLS_ISEC {
path "versions.yml" , emit: versions path "versions.yml" , emit: versions
script: script:
prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def args = task.ext.args ?: ''
prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}"
""" """
bcftools isec \\ bcftools isec \\
$options.args \\ $args \\
-p $prefix \\ -p $prefix \\
*.vcf.gz *.vcf.gz
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}: "${task.process}":
${getSoftwareName(task.process)}: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//') bcftools: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//')
END_VERSIONS END_VERSIONS
""" """
} }

View file

@ -1,78 +0,0 @@
//
// 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()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// 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.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
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) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
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"
}
}

View file

@ -1,22 +1,11 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process BCFTOOLS_MERGE { process BCFTOOLS_MERGE {
tag "$meta.id" tag "$meta.id"
label 'process_medium' label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? 'bioconda::bcftools=1.13' : null) conda (params.enable_conda ? 'bioconda::bcftools=1.13' : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
container "https://depot.galaxyproject.org/singularity/bcftools:1.13--h3a49de5_0" 'https://depot.galaxyproject.org/singularity/bcftools:1.13--h3a49de5_0' :
} else { 'quay.io/biocontainers/bcftools:1.13--h3a49de5_0' }"
container "quay.io/biocontainers/bcftools:1.13--h3a49de5_0"
}
input: input:
tuple val(meta), path(vcfs), path(tbis) tuple val(meta), path(vcfs), path(tbis)
@ -26,15 +15,16 @@ process BCFTOOLS_MERGE {
path "versions.yml" , emit: versions path "versions.yml" , emit: versions
script: script:
prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def args = task.ext.args ?: ''
prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}"
""" """
bcftools merge -Oz \\ bcftools merge -Oz \\
--output ${prefix}.vcf.gz \\ --output ${prefix}.vcf.gz \\
$options.args \\ $args \\
*.vcf.gz *.vcf.gz
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}: "${task.process}":
${getSoftwareName(task.process)}: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//') bcftools: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//')
END_VERSIONS END_VERSIONS
""" """
} }

View file

@ -1,78 +0,0 @@
//
// 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()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// 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.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
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) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
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"
}
}

View file

@ -1,22 +1,11 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process BCFTOOLS_MPILEUP { process BCFTOOLS_MPILEUP {
tag "$meta.id" tag "$meta.id"
label 'process_medium' label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? 'bioconda::bcftools=1.13' : null) conda (params.enable_conda ? 'bioconda::bcftools=1.13' : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
container "https://depot.galaxyproject.org/singularity/bcftools:1.13--h3a49de5_0" 'https://depot.galaxyproject.org/singularity/bcftools:1.13--h3a49de5_0' :
} else { 'quay.io/biocontainers/bcftools:1.13--h3a49de5_0' }"
container "quay.io/biocontainers/bcftools:1.13--h3a49de5_0"
}
input: input:
tuple val(meta), path(bam) tuple val(meta), path(bam)
@ -29,21 +18,28 @@ process BCFTOOLS_MPILEUP {
path "versions.yml" , emit: versions path "versions.yml" , emit: versions
script: script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def args = task.ext.args ?: ''
def args2 = task.ext.args2 ?: ''
def args3 = task.ext.args3 ?: ''
def prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}"
""" """
echo "${meta.id}" > sample_name.list echo "${meta.id}" > sample_name.list
bcftools mpileup \\ bcftools mpileup \\
--fasta-ref $fasta \\ --fasta-ref $fasta \\
$options.args \\ $args \\
$bam \\ $bam \\
| bcftools call --output-type v $options.args2 \\ | bcftools call --output-type v $args2 \\
| bcftools reheader --samples sample_name.list \\ | bcftools reheader --samples sample_name.list \\
| bcftools view --output-file ${prefix}.vcf.gz --output-type z $options.args3 | bcftools view --output-file ${prefix}.vcf.gz --output-type z $args3
tabix -p vcf -f ${prefix}.vcf.gz tabix -p vcf -f ${prefix}.vcf.gz
bcftools stats ${prefix}.vcf.gz > ${prefix}.bcftools_stats.txt bcftools stats ${prefix}.vcf.gz > ${prefix}.bcftools_stats.txt
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}: "${task.process}":
${getSoftwareName(task.process)}: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//') bcftools: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//')
END_VERSIONS END_VERSIONS
""" """
} }

View file

@ -1,78 +0,0 @@
//
// 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()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// 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.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
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) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
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"
}
}

View file

@ -1,22 +1,11 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process BCFTOOLS_NORM { process BCFTOOLS_NORM {
tag "$meta.id" tag "$meta.id"
label 'process_medium' label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::bcftools=1.13" : null) conda (params.enable_conda ? "bioconda::bcftools=1.13" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
container "https://depot.galaxyproject.org/singularity/bcftools:1.13--h3a49de5_0" 'https://depot.galaxyproject.org/singularity/bcftools:1.13--h3a49de5_0' :
} else { 'quay.io/biocontainers/bcftools:1.13--h3a49de5_0' }"
container "quay.io/biocontainers/bcftools:1.13--h3a49de5_0"
}
input: input:
tuple val(meta), path(vcf) tuple val(meta), path(vcf)
@ -27,18 +16,19 @@ process BCFTOOLS_NORM {
path "versions.yml" , emit: versions path "versions.yml" , emit: versions
script: script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def args = task.ext.args ?: ''
def prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}"
""" """
bcftools norm \\ bcftools norm \\
--fasta-ref ${fasta} \\ --fasta-ref ${fasta} \\
--output ${prefix}.vcf.gz \\ --output ${prefix}.vcf.gz \\
$options.args \\ $args \\
--threads $task.cpus \\ --threads $task.cpus \\
${vcf} ${vcf}
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}: "${task.process}":
${getSoftwareName(task.process)}: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//') bcftools: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//')
END_VERSIONS END_VERSIONS
""" """
} }

View file

@ -1,78 +0,0 @@
//
// 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()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// 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.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
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) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
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"
}
}

View file

@ -1,22 +1,11 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process BCFTOOLS_QUERY { process BCFTOOLS_QUERY {
tag "$meta.id" tag "$meta.id"
label 'process_medium' label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::bcftools=1.13" : null) conda (params.enable_conda ? "bioconda::bcftools=1.13" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
container "https://depot.galaxyproject.org/singularity/bcftools:1.13--h3a49de5_0" 'https://depot.galaxyproject.org/singularity/bcftools:1.13--h3a49de5_0' :
} else { 'quay.io/biocontainers/bcftools:1.13--h3a49de5_0' }"
container "quay.io/biocontainers/bcftools:1.13--h3a49de5_0"
}
input: input:
tuple val(meta), path(vcf), path(index) tuple val(meta), path(vcf), path(index)
@ -29,7 +18,8 @@ process BCFTOOLS_QUERY {
path "versions.yml" , emit: versions path "versions.yml" , emit: versions
script: script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def args = task.ext.args ?: ''
def prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}"
def regions_file = regions ? "--regions-file ${regions}" : "" def regions_file = regions ? "--regions-file ${regions}" : ""
def targets_file = targets ? "--targets-file ${targets}" : "" def targets_file = targets ? "--targets-file ${targets}" : ""
def samples_file = samples ? "--samples-file ${samples}" : "" def samples_file = samples ? "--samples-file ${samples}" : ""
@ -40,12 +30,12 @@ process BCFTOOLS_QUERY {
${regions_file} \\ ${regions_file} \\
${targets_file} \\ ${targets_file} \\
${samples_file} \\ ${samples_file} \\
$options.args \\ $args \\
${vcf} ${vcf}
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}: "${task.process}":
${getSoftwareName(task.process)}: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//') bcftools: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//')
END_VERSIONS END_VERSIONS
""" """
} }

View file

@ -1,78 +0,0 @@
//
// 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()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// 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.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
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) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
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"
}
}

View file

@ -1,22 +1,11 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process BCFTOOLS_REHEADER { process BCFTOOLS_REHEADER {
tag "$meta.id" tag "$meta.id"
label 'process_low' label 'process_low'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::bcftools=1.13" : null) conda (params.enable_conda ? "bioconda::bcftools=1.13" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
container "https://depot.galaxyproject.org/singularity/bcftools:1.13--h3a49de5_0" 'https://depot.galaxyproject.org/singularity/bcftools:1.13--h3a49de5_0' :
} else { 'quay.io/biocontainers/bcftools:1.13--h3a49de5_0' }"
container "quay.io/biocontainers/bcftools:1.13--h3a49de5_0"
}
input: input:
tuple val(meta), path(vcf) tuple val(meta), path(vcf)
@ -28,7 +17,8 @@ process BCFTOOLS_REHEADER {
path "versions.yml" , emit: versions path "versions.yml" , emit: versions
script: script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def args = task.ext.args ?: ''
def prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}"
def update_sequences = fai ? "-f $fai" : "" def update_sequences = fai ? "-f $fai" : ""
def new_header = header ? "-h $header" : "" def new_header = header ? "-h $header" : ""
""" """
@ -36,14 +26,14 @@ process BCFTOOLS_REHEADER {
reheader \\ reheader \\
$update_sequences \\ $update_sequences \\
$new_header \\ $new_header \\
$options.args \\ $args \\
--threads $task.cpus \\ --threads $task.cpus \\
-o ${prefix}.vcf.gz \\ -o ${prefix}.vcf.gz \\
$vcf $vcf
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}: "${task.process}":
${getSoftwareName(task.process)}: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//') bcftools: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//')
END_VERSIONS END_VERSIONS
""" """
} }

View file

@ -1,78 +0,0 @@
//
// 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()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// 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.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
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) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
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"
}
}

View file

@ -1,22 +1,11 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process BCFTOOLS_STATS { process BCFTOOLS_STATS {
tag "$meta.id" tag "$meta.id"
label 'process_medium' label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? 'bioconda::bcftools=1.13' : null) conda (params.enable_conda ? 'bioconda::bcftools=1.13' : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
container "https://depot.galaxyproject.org/singularity/bcftools:1.13--h3a49de5_0" 'https://depot.galaxyproject.org/singularity/bcftools:1.13--h3a49de5_0' :
} else { 'quay.io/biocontainers/bcftools:1.13--h3a49de5_0' }"
container "quay.io/biocontainers/bcftools:1.13--h3a49de5_0"
}
input: input:
tuple val(meta), path(vcf) tuple val(meta), path(vcf)
@ -26,12 +15,13 @@ process BCFTOOLS_STATS {
path "versions.yml" , emit: versions path "versions.yml" , emit: versions
script: script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def args = task.ext.args ?: ''
def prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}"
""" """
bcftools stats $options.args $vcf > ${prefix}.bcftools_stats.txt bcftools stats $args $vcf > ${prefix}.bcftools_stats.txt
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}: "${task.process}":
${getSoftwareName(task.process)}: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//') bcftools: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//')
END_VERSIONS END_VERSIONS
""" """
} }

View file

@ -1,78 +0,0 @@
//
// 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()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// 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.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
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) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
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"
}
}

View file

@ -1,22 +1,11 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process BCFTOOLS_VIEW { process BCFTOOLS_VIEW {
tag "$meta.id" tag "$meta.id"
label 'process_medium' label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::bcftools=1.13" : null) conda (params.enable_conda ? "bioconda::bcftools=1.13" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
container "https://depot.galaxyproject.org/singularity/bcftools:1.13--h3a49de5_0" 'https://depot.galaxyproject.org/singularity/bcftools:1.13--h3a49de5_0' :
} else { 'quay.io/biocontainers/bcftools:1.13--h3a49de5_0' }"
container "quay.io/biocontainers/bcftools:1.13--h3a49de5_0"
}
input: input:
tuple val(meta), path(vcf), path(index) tuple val(meta), path(vcf), path(index)
@ -29,25 +18,24 @@ process BCFTOOLS_VIEW {
path "versions.yml" , emit: versions path "versions.yml" , emit: versions
script: script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def args = task.ext.args ?: ''
def prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}"
def regions_file = regions ? "--regions-file ${regions}" : "" def regions_file = regions ? "--regions-file ${regions}" : ""
def targets_file = targets ? "--targets-file ${targets}" : "" def targets_file = targets ? "--targets-file ${targets}" : ""
def samples_file = samples ? "--samples-file ${samples}" : "" def samples_file = samples ? "--samples-file ${samples}" : ""
""" """
bcftools view \\ bcftools view \\
--output ${prefix}.vcf.gz \\ --output ${prefix}.vcf.gz \\
${regions_file} \\ ${regions_file} \\
${targets_file} \\ ${targets_file} \\
${samples_file} \\ ${samples_file} \\
$options.args \\ $args \\
--threads $task.cpus \\ --threads $task.cpus \\
${vcf} ${vcf}
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}: "${task.process}":
${getSoftwareName(task.process)}: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//') bcftools: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//')
END_VERSIONS END_VERSIONS
""" """
} }

View file

@ -1,78 +0,0 @@
//
// 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()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// 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.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
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) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
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"
}
}

View file

@ -1,22 +1,11 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process BEDTOOLS_BAMTOBED { process BEDTOOLS_BAMTOBED {
tag "$meta.id" tag "$meta.id"
label 'process_medium' label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::bedtools=2.30.0" : null) conda (params.enable_conda ? "bioconda::bedtools=2.30.0" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
container "https://depot.galaxyproject.org/singularity/bedtools:2.30.0--hc088bd4_0" 'https://depot.galaxyproject.org/singularity/bedtools:2.30.0--hc088bd4_0' :
} else { 'quay.io/biocontainers/bedtools:2.30.0--hc088bd4_0' }"
container "quay.io/biocontainers/bedtools:2.30.0--hc088bd4_0"
}
input: input:
tuple val(meta), path(bam) tuple val(meta), path(bam)
@ -26,17 +15,18 @@ process BEDTOOLS_BAMTOBED {
path "versions.yml" , emit: versions path "versions.yml" , emit: versions
script: script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def args = task.ext.args ?: ''
def prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}"
""" """
bedtools \\ bedtools \\
bamtobed \\ bamtobed \\
$options.args \\ $args \\
-i $bam \\ -i $bam \\
| bedtools sort > ${prefix}.bed | bedtools sort > ${prefix}.bed
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}: "${task.process}":
${getSoftwareName(task.process)}: \$(bedtools --version | sed -e "s/bedtools v//g") bedtools: \$(bedtools --version | sed -e "s/bedtools v//g")
END_VERSIONS END_VERSIONS
""" """
} }

View file

@ -1,78 +0,0 @@
//
// 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()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// 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.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
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) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
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"
}
}

View file

@ -1,22 +1,11 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process BEDTOOLS_COMPLEMENT { process BEDTOOLS_COMPLEMENT {
tag "$meta.id" tag "$meta.id"
label 'process_medium' label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::bedtools=2.30.0" : null) conda (params.enable_conda ? "bioconda::bedtools=2.30.0" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
container "https://depot.galaxyproject.org/singularity/bedtools:2.30.0--hc088bd4_0" 'https://depot.galaxyproject.org/singularity/bedtools:2.30.0--hc088bd4_0' :
} else { 'quay.io/biocontainers/bedtools:2.30.0--hc088bd4_0' }"
container "quay.io/biocontainers/bedtools:2.30.0--hc088bd4_0"
}
input: input:
tuple val(meta), path(bed) tuple val(meta), path(bed)
@ -27,18 +16,19 @@ process BEDTOOLS_COMPLEMENT {
path "versions.yml" , emit: versions path "versions.yml" , emit: versions
script: script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def args = task.ext.args ?: ''
def prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}"
""" """
bedtools \\ bedtools \\
complement \\ complement \\
-i $bed \\ -i $bed \\
-g $sizes \\ -g $sizes \\
$options.args \\ $args \\
> ${prefix}.bed > ${prefix}.bed
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}: "${task.process}":
${getSoftwareName(task.process)}: \$(bedtools --version | sed -e "s/bedtools v//g") bedtools: \$(bedtools --version | sed -e "s/bedtools v//g")
END_VERSIONS END_VERSIONS
""" """
} }

View file

@ -1,78 +0,0 @@
//
// 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()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// 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.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
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) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
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"
}
}

View file

@ -1,22 +1,11 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process BEDTOOLS_GENOMECOV { process BEDTOOLS_GENOMECOV {
tag "$meta.id" tag "$meta.id"
label 'process_medium' label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::bedtools=2.30.0" : null) conda (params.enable_conda ? "bioconda::bedtools=2.30.0" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
container "https://depot.galaxyproject.org/singularity/bedtools:2.30.0--hc088bd4_0" 'https://depot.galaxyproject.org/singularity/bedtools:2.30.0--hc088bd4_0' :
} else { 'quay.io/biocontainers/bedtools:2.30.0--hc088bd4_0' }"
container "quay.io/biocontainers/bedtools:2.30.0--hc088bd4_0"
}
input: input:
tuple val(meta), path(intervals), val(scale) tuple val(meta), path(intervals), val(scale)
@ -28,15 +17,14 @@ process BEDTOOLS_GENOMECOV {
path "versions.yml" , emit: versions path "versions.yml" , emit: versions
script: script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def args = task.ext.args ?: ''
def args_token = options.args.tokenize() def args_list = args.tokenize()
def args = options.args
args += (scale > 0 && scale != 1) ? " -scale $scale" : "" args += (scale > 0 && scale != 1) ? " -scale $scale" : ""
if (!args_list.contains('-bg') && (scale > 0 && scale != 1)) {
if (!args_token.contains('-bg') && (scale > 0 && scale != 1)) {
args += " -bg" args += " -bg"
} }
def prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}"
if (intervals.name =~ /\.bam/) { if (intervals.name =~ /\.bam/) {
""" """
bedtools \\ bedtools \\
@ -46,8 +34,8 @@ process BEDTOOLS_GENOMECOV {
> ${prefix}.${extension} > ${prefix}.${extension}
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}: "${task.process}":
${getSoftwareName(task.process)}: \$(bedtools --version | sed -e "s/bedtools v//g") bedtools: \$(bedtools --version | sed -e "s/bedtools v//g")
END_VERSIONS END_VERSIONS
""" """
} else { } else {
@ -60,8 +48,8 @@ process BEDTOOLS_GENOMECOV {
> ${prefix}.${extension} > ${prefix}.${extension}
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}: "${task.process}":
${getSoftwareName(task.process)}: \$(bedtools --version | sed -e "s/bedtools v//g") bedtools: \$(bedtools --version | sed -e "s/bedtools v//g")
END_VERSIONS END_VERSIONS
""" """
} }

View file

@ -1,78 +0,0 @@
//
// 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()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// 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.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
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) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
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"
}
}

View file

@ -1,22 +1,11 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process BEDTOOLS_GETFASTA { process BEDTOOLS_GETFASTA {
tag "$bed" tag "$bed"
label 'process_medium' label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:[:], publish_by_meta:[]) }
conda (params.enable_conda ? "bioconda::bedtools=2.30.0" : null) conda (params.enable_conda ? "bioconda::bedtools=2.30.0" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
container "https://depot.galaxyproject.org/singularity/bedtools:2.30.0--hc088bd4_0" 'https://depot.galaxyproject.org/singularity/bedtools:2.30.0--hc088bd4_0' :
} else { 'quay.io/biocontainers/bedtools:2.30.0--hc088bd4_0' }"
container "quay.io/biocontainers/bedtools:2.30.0--hc088bd4_0"
}
input: input:
path bed path bed
@ -27,18 +16,19 @@ process BEDTOOLS_GETFASTA {
path "versions.yml" , emit: versions path "versions.yml" , emit: versions
script: script:
def prefix = options.suffix ? "${bed.baseName}${options.suffix}" : "${bed.baseName}" def args = task.ext.args ?: ''
def prefix = task.ext.suffix ? "${bed.baseName}${task.ext.suffix}" : "${bed.baseName}"
""" """
bedtools \\ bedtools \\
getfasta \\ getfasta \\
$options.args \\ $args \\
-fi $fasta \\ -fi $fasta \\
-bed $bed \\ -bed $bed \\
-fo ${prefix}.fa -fo ${prefix}.fa
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}: "${task.process}":
${getSoftwareName(task.process)}: \$(bedtools --version | sed -e "s/bedtools v//g") bedtools: \$(bedtools --version | sed -e "s/bedtools v//g")
END_VERSIONS END_VERSIONS
""" """
} }

View file

@ -1,78 +0,0 @@
//
// 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()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// 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.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
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) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
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"
}
}

View file

@ -1,22 +1,11 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process BEDTOOLS_INTERSECT { process BEDTOOLS_INTERSECT {
tag "$meta.id" tag "$meta.id"
label 'process_medium' label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::bedtools=2.30.0" : null) conda (params.enable_conda ? "bioconda::bedtools=2.30.0" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
container "https://depot.galaxyproject.org/singularity/bedtools:2.30.0--hc088bd4_0" 'https://depot.galaxyproject.org/singularity/bedtools:2.30.0--hc088bd4_0' :
} else { 'quay.io/biocontainers/bedtools:2.30.0--hc088bd4_0' }"
container "quay.io/biocontainers/bedtools:2.30.0--hc088bd4_0"
}
input: input:
tuple val(meta), path(intervals1), path(intervals2) tuple val(meta), path(intervals1), path(intervals2)
@ -27,18 +16,19 @@ process BEDTOOLS_INTERSECT {
path "versions.yml" , emit: versions path "versions.yml" , emit: versions
script: script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def args = task.ext.args ?: ''
def prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}"
""" """
bedtools \\ bedtools \\
intersect \\ intersect \\
-a $intervals1 \\ -a $intervals1 \\
-b $intervals2 \\ -b $intervals2 \\
$options.args \\ $args \\
> ${prefix}.${extension} > ${prefix}.${extension}
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}: "${task.process}":
${getSoftwareName(task.process)}: \$(bedtools --version | sed -e "s/bedtools v//g") bedtools: \$(bedtools --version | sed -e "s/bedtools v//g")
END_VERSIONS END_VERSIONS
""" """
} }

View file

@ -1,78 +0,0 @@
//
// 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()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// 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.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
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) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
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"
}
}

View file

@ -1,22 +1,11 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process BEDTOOLS_MAKEWINDOWS { process BEDTOOLS_MAKEWINDOWS {
tag "$meta.id" tag "$meta.id"
label 'process_low' label 'process_low'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::bedtools=2.30.0" : null) conda (params.enable_conda ? "bioconda::bedtools=2.30.0" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
container "https://depot.galaxyproject.org/singularity/bedtools:2.30.0--h7d7f7ad_1" 'https://depot.galaxyproject.org/singularity/bedtools:2.30.0--h7d7f7ad_1' :
} else { 'quay.io/biocontainers/bedtools:2.30.0--h7d7f7ad_1' }"
container "quay.io/biocontainers/bedtools:2.30.0--h7d7f7ad_1"
}
input: input:
tuple val(meta), path(regions) tuple val(meta), path(regions)
@ -27,18 +16,19 @@ process BEDTOOLS_MAKEWINDOWS {
path "versions.yml" , emit: versions path "versions.yml" , emit: versions
script: script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def args = task.ext.args ?: ''
def prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}"
def arg_input = use_bed ? "-b $regions" : "-g $regions" def arg_input = use_bed ? "-b $regions" : "-g $regions"
""" """
bedtools \\ bedtools \\
makewindows \\ makewindows \\
${arg_input} \\ ${arg_input} \\
$options.args \\ $args \\
> ${prefix}.tab > ${prefix}.tab
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}: "${task.process}":
${getSoftwareName(task.process)}: \$(bedtools --version | sed -e "s/bedtools v//g") bedtools: \$(bedtools --version | sed -e "s/bedtools v//g")
END_VERSIONS END_VERSIONS
""" """
} }

View file

@ -1,78 +0,0 @@
//
// 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()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// 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.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
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) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
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"
}
}

View file

@ -1,22 +1,11 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process BEDTOOLS_MASKFASTA { process BEDTOOLS_MASKFASTA {
tag "$meta.id" tag "$meta.id"
label 'process_medium' label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::bedtools=2.30.0" : null) conda (params.enable_conda ? "bioconda::bedtools=2.30.0" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
container "https://depot.galaxyproject.org/singularity/bedtools:2.30.0--hc088bd4_0" 'https://depot.galaxyproject.org/singularity/bedtools:2.30.0--hc088bd4_0' :
} else { 'quay.io/biocontainers/bedtools:2.30.0--hc088bd4_0' }"
container "quay.io/biocontainers/bedtools:2.30.0--hc088bd4_0"
}
input: input:
tuple val(meta), path(bed) tuple val(meta), path(bed)
@ -27,17 +16,18 @@ process BEDTOOLS_MASKFASTA {
path "versions.yml" , emit: versions path "versions.yml" , emit: versions
script: script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def args = task.ext.args ?: ''
def prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}"
""" """
bedtools \\ bedtools \\
maskfasta \\ maskfasta \\
$options.args \\ $args \\
-fi $fasta \\ -fi $fasta \\
-bed $bed \\ -bed $bed \\
-fo ${prefix}.fa -fo ${prefix}.fa
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}: "${task.process}":
${getSoftwareName(task.process)}: \$(bedtools --version | sed -e "s/bedtools v//g") bedtools: \$(bedtools --version | sed -e "s/bedtools v//g")
END_VERSIONS END_VERSIONS
""" """
} }

View file

@ -1,78 +0,0 @@
//
// 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()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// 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.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
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) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
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"
}
}

View file

@ -1,22 +1,11 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process BEDTOOLS_MERGE { process BEDTOOLS_MERGE {
tag "$meta.id" tag "$meta.id"
label 'process_medium' label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::bedtools=2.30.0" : null) conda (params.enable_conda ? "bioconda::bedtools=2.30.0" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
container "https://depot.galaxyproject.org/singularity/bedtools:2.30.0--hc088bd4_0" 'https://depot.galaxyproject.org/singularity/bedtools:2.30.0--hc088bd4_0' :
} else { 'quay.io/biocontainers/bedtools:2.30.0--hc088bd4_0' }"
container "quay.io/biocontainers/bedtools:2.30.0--hc088bd4_0"
}
input: input:
tuple val(meta), path(bed) tuple val(meta), path(bed)
@ -26,17 +15,18 @@ process BEDTOOLS_MERGE {
path "versions.yml" , emit: versions path "versions.yml" , emit: versions
script: script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def args = task.ext.args ?: ''
def prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}"
""" """
bedtools \\ bedtools \\
merge \\ merge \\
-i $bed \\ -i $bed \\
$options.args \\ $args \\
> ${prefix}.bed > ${prefix}.bed
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}: "${task.process}":
${getSoftwareName(task.process)}: \$(bedtools --version | sed -e "s/bedtools v//g") bedtools: \$(bedtools --version | sed -e "s/bedtools v//g")
END_VERSIONS END_VERSIONS
""" """
} }

View file

@ -1,78 +0,0 @@
//
// 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()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// 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.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
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) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
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"
}
}

View file

@ -1,22 +1,11 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process BEDTOOLS_SLOP { process BEDTOOLS_SLOP {
tag "$meta.id" tag "$meta.id"
label 'process_medium' label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::bedtools=2.30.0" : null) conda (params.enable_conda ? "bioconda::bedtools=2.30.0" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
container "https://depot.galaxyproject.org/singularity/bedtools:2.30.0--hc088bd4_0" 'https://depot.galaxyproject.org/singularity/bedtools:2.30.0--hc088bd4_0' :
} else { 'quay.io/biocontainers/bedtools:2.30.0--hc088bd4_0' }"
container "quay.io/biocontainers/bedtools:2.30.0--hc088bd4_0"
}
input: input:
tuple val(meta), path(bed) tuple val(meta), path(bed)
@ -27,18 +16,19 @@ process BEDTOOLS_SLOP {
path "versions.yml" , emit: versions path "versions.yml" , emit: versions
script: script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def args = task.ext.args ?: ''
def prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}"
""" """
bedtools \\ bedtools \\
slop \\ slop \\
-i $bed \\ -i $bed \\
-g $sizes \\ -g $sizes \\
$options.args \\ $args \\
> ${prefix}.bed > ${prefix}.bed
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}: "${task.process}":
${getSoftwareName(task.process)}: \$(bedtools --version | sed -e "s/bedtools v//g") bedtools: \$(bedtools --version | sed -e "s/bedtools v//g")
END_VERSIONS END_VERSIONS
""" """

View file

@ -1,78 +0,0 @@
//
// 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()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// 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.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
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) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
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"
}
}

View file

@ -1,22 +1,11 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process BEDTOOLS_SORT { process BEDTOOLS_SORT {
tag "$meta.id" tag "$meta.id"
label 'process_medium' label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::bedtools=2.30.0" : null) conda (params.enable_conda ? "bioconda::bedtools=2.30.0" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
container "https://depot.galaxyproject.org/singularity/bedtools:2.30.0--hc088bd4_0" 'https://depot.galaxyproject.org/singularity/bedtools:2.30.0--hc088bd4_0' :
} else { 'quay.io/biocontainers/bedtools:2.30.0--hc088bd4_0' }"
container "quay.io/biocontainers/bedtools:2.30.0--hc088bd4_0"
}
input: input:
tuple val(meta), path(intervals) tuple val(meta), path(intervals)
@ -27,17 +16,18 @@ process BEDTOOLS_SORT {
path "versions.yml" , emit: versions path "versions.yml" , emit: versions
script: script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def args = task.ext.args ?: ''
def prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}"
""" """
bedtools \\ bedtools \\
sort \\ sort \\
-i $intervals \\ -i $intervals \\
$options.args \\ $args \\
> ${prefix}.${extension} > ${prefix}.${extension}
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}: "${task.process}":
${getSoftwareName(task.process)}: \$(bedtools --version | sed -e "s/bedtools v//g") bedtools: \$(bedtools --version | sed -e "s/bedtools v//g")
END_VERSIONS END_VERSIONS
""" """
} }

View file

@ -1,78 +0,0 @@
//
// 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()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// 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.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
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) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
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"
}
}

View file

@ -1,22 +1,11 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process BEDTOOLS_SUBTRACT { process BEDTOOLS_SUBTRACT {
tag "$meta.id" tag "$meta.id"
label 'process_medium' label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::bedtools=2.30.0" : null) conda (params.enable_conda ? "bioconda::bedtools=2.30.0" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
container "https://depot.galaxyproject.org/singularity/bedtools:2.30.0--hc088bd4_0" 'https://depot.galaxyproject.org/singularity/bedtools:2.30.0--hc088bd4_0' :
} else { 'quay.io/biocontainers/bedtools:2.30.0--hc088bd4_0' }"
container "quay.io/biocontainers/bedtools:2.30.0--hc088bd4_0"
}
input: input:
tuple val(meta), path(intervals1), path(intervals2) tuple val(meta), path(intervals1), path(intervals2)
@ -26,18 +15,19 @@ process BEDTOOLS_SUBTRACT {
path "versions.yml" , emit: versions path "versions.yml" , emit: versions
script: script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def args = task.ext.args ?: ''
def prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}"
""" """
bedtools \\ bedtools \\
subtract \\ subtract \\
-a $intervals1 \\ -a $intervals1 \\
-b $intervals2 \\ -b $intervals2 \\
$options.args \\ $args \\
> ${prefix}.bed > ${prefix}.bed
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}: "${task.process}":
${getSoftwareName(task.process)}: \$(bedtools --version | sed -e "s/bedtools v//g") bedtools: \$(bedtools --version | sed -e "s/bedtools v//g")
END_VERSIONS END_VERSIONS
""" """
} }

View file

@ -1,78 +0,0 @@
//
// 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()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// 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.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
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) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
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"
}
}

View file

@ -1,22 +1,11 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process BISMARK_ALIGN { process BISMARK_ALIGN {
tag "$meta.id" tag "$meta.id"
label 'process_high' label 'process_high'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::bismark=0.23.0" : null) conda (params.enable_conda ? "bioconda::bismark=0.23.0" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
container "https://depot.galaxyproject.org/singularity/bismark:0.23.0--0" 'https://depot.galaxyproject.org/singularity/bismark:0.23.0--0' :
} else { 'quay.io/biocontainers/bismark:0.23.0--0' }"
container "quay.io/biocontainers/bismark:0.23.0--0"
}
input: input:
tuple val(meta), path(reads) tuple val(meta), path(reads)
@ -29,18 +18,19 @@ process BISMARK_ALIGN {
path "versions.yml" , emit: versions path "versions.yml" , emit: versions
script: script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def args = task.ext.args ?: ''
def prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}"
def fastq = meta.single_end ? reads : "-1 ${reads[0]} -2 ${reads[1]}" def fastq = meta.single_end ? reads : "-1 ${reads[0]} -2 ${reads[1]}"
""" """
bismark \\ bismark \\
$fastq \\ $fastq \\
$options.args \\ $args \\
--genome $index \\ --genome $index \\
--bam --bam
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}: "${task.process}":
${getSoftwareName(task.process)}: \$(echo \$(bismark -v 2>&1) | sed 's/^.*Bismark Version: v//; s/Copyright.*\$//') bismark: \$(echo \$(bismark -v 2>&1) | sed 's/^.*Bismark Version: v//; s/Copyright.*\$//')
END_VERSIONS END_VERSIONS
""" """
} }

View file

@ -1,78 +0,0 @@
//
// 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()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// 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.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
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) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
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"
}
}

View file

@ -1,22 +1,11 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process BISMARK_DEDUPLICATE { process BISMARK_DEDUPLICATE {
tag "$meta.id" tag "$meta.id"
label 'process_high' label 'process_high'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::bismark=0.23.0" : null) conda (params.enable_conda ? "bioconda::bismark=0.23.0" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
container "https://depot.galaxyproject.org/singularity/bismark:0.23.0--0" 'https://depot.galaxyproject.org/singularity/bismark:0.23.0--0' :
} else { 'quay.io/biocontainers/bismark:0.23.0--0' }"
container "quay.io/biocontainers/bismark:0.23.0--0"
}
input: input:
tuple val(meta), path(bam) tuple val(meta), path(bam)
@ -27,17 +16,18 @@ process BISMARK_DEDUPLICATE {
path "versions.yml" , emit: versions path "versions.yml" , emit: versions
script: script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}" def args = task.ext.args ?: ''
def prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}"
def seqtype = meta.single_end ? '-s' : '-p' def seqtype = meta.single_end ? '-s' : '-p'
""" """
deduplicate_bismark \\ deduplicate_bismark \\
$options.args \\ $args \\
$seqtype \\ $seqtype \\
--bam $bam --bam $bam
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}: "${task.process}":
${getSoftwareName(task.process)}: \$(echo \$(bismark -v 2>&1) | sed 's/^.*Bismark Version: v//; s/Copyright.*\$//') bismark: \$(echo \$(bismark -v 2>&1) | sed 's/^.*Bismark Version: v//; s/Copyright.*\$//')
END_VERSIONS END_VERSIONS
""" """
} }

View file

@ -1,78 +0,0 @@
//
// 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()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// 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.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
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) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
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"
}
}

View file

@ -1,22 +1,11 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process BISMARK_GENOMEPREPARATION { process BISMARK_GENOMEPREPARATION {
tag "$fasta" tag "$fasta"
label 'process_high' label 'process_high'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:[:], publish_by_meta:[]) }
conda (params.enable_conda ? "bioconda::bismark=0.23.0" : null) conda (params.enable_conda ? "bioconda::bismark=0.23.0" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
container "https://depot.galaxyproject.org/singularity/bismark:0.23.0--0" 'https://depot.galaxyproject.org/singularity/bismark:0.23.0--0' :
} else { 'quay.io/biocontainers/bismark:0.23.0--0' }"
container "quay.io/biocontainers/bismark:0.23.0--0"
}
input: input:
path fasta, stageAs: "BismarkIndex/*" path fasta, stageAs: "BismarkIndex/*"
@ -26,14 +15,15 @@ process BISMARK_GENOMEPREPARATION {
path "versions.yml" , emit: versions path "versions.yml" , emit: versions
script: script:
def args = task.ext.args ?: ''
""" """
bismark_genome_preparation \\ bismark_genome_preparation \\
$options.args \\ $args \\
BismarkIndex BismarkIndex
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}: "${task.process}":
${getSoftwareName(task.process)}: \$(echo \$(bismark -v 2>&1) | sed 's/^.*Bismark Version: v//; s/Copyright.*\$//') bismark: \$(echo \$(bismark -v 2>&1) | sed 's/^.*Bismark Version: v//; s/Copyright.*\$//')
END_VERSIONS END_VERSIONS
""" """
} }

View file

@ -1,78 +0,0 @@
//
// 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()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// 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.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
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) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
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"
}
}

View file

@ -1,22 +1,11 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process BISMARK_METHYLATIONEXTRACTOR { process BISMARK_METHYLATIONEXTRACTOR {
tag "$meta.id" tag "$meta.id"
label 'process_high' label 'process_high'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::bismark=0.23.0" : null) conda (params.enable_conda ? "bioconda::bismark=0.23.0" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
container "https://depot.galaxyproject.org/singularity/bismark:0.23.0--0" 'https://depot.galaxyproject.org/singularity/bismark:0.23.0--0' :
} else { 'quay.io/biocontainers/bismark:0.23.0--0' }"
container "quay.io/biocontainers/bismark:0.23.0--0"
}
input: input:
tuple val(meta), path(bam) tuple val(meta), path(bam)
@ -31,6 +20,7 @@ process BISMARK_METHYLATIONEXTRACTOR {
path "versions.yml" , emit: versions path "versions.yml" , emit: versions
script: script:
def args = task.ext.args ?: ''
def seqtype = meta.single_end ? '-s' : '-p' def seqtype = meta.single_end ? '-s' : '-p'
""" """
bismark_methylation_extractor \\ bismark_methylation_extractor \\
@ -39,12 +29,12 @@ process BISMARK_METHYLATIONEXTRACTOR {
--gzip \\ --gzip \\
--report \\ --report \\
$seqtype \\ $seqtype \\
$options.args \\ $args \\
$bam $bam
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}: "${task.process}":
${getSoftwareName(task.process)}: \$(echo \$(bismark -v 2>&1) | sed 's/^.*Bismark Version: v//; s/Copyright.*\$//') bismark: \$(echo \$(bismark -v 2>&1) | sed 's/^.*Bismark Version: v//; s/Copyright.*\$//')
END_VERSIONS END_VERSIONS
""" """
} }

View file

@ -1,78 +0,0 @@
//
// 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()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// 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.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
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) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
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"
}
}

View file

@ -1,22 +1,11 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process BISMARK_REPORT { process BISMARK_REPORT {
tag "$meta.id" tag "$meta.id"
label 'process_low' label 'process_low'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::bismark=0.23.0" : null) conda (params.enable_conda ? "bioconda::bismark=0.23.0" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
container "https://depot.galaxyproject.org/singularity/bismark:0.23.0--0" 'https://depot.galaxyproject.org/singularity/bismark:0.23.0--0' :
} else { 'quay.io/biocontainers/bismark:0.23.0--0' }"
container "quay.io/biocontainers/bismark:0.23.0--0"
}
input: input:
tuple val(meta), path(align_report), path(dedup_report), path(splitting_report), path(mbias) tuple val(meta), path(align_report), path(dedup_report), path(splitting_report), path(mbias)
@ -26,12 +15,13 @@ process BISMARK_REPORT {
path "versions.yml" , emit: versions path "versions.yml" , emit: versions
script: script:
def args = task.ext.args ?: ''
""" """
bismark2report $options.args bismark2report $args
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}: "${task.process}":
${getSoftwareName(task.process)}: \$(echo \$(bismark -v 2>&1) | sed 's/^.*Bismark Version: v//; s/Copyright.*\$//') bismark: \$(echo \$(bismark -v 2>&1) | sed 's/^.*Bismark Version: v//; s/Copyright.*\$//')
END_VERSIONS END_VERSIONS
""" """
} }

View file

@ -1,78 +0,0 @@
//
// 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()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// 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.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
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) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
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"
}
}

View file

@ -1,21 +1,10 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process BISMARK_SUMMARY { process BISMARK_SUMMARY {
label 'process_low' label 'process_low'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:[:], publish_by_meta:[]) }
conda (params.enable_conda ? "bioconda::bismark=0.23.0" : null) conda (params.enable_conda ? "bioconda::bismark=0.23.0" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) { container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
container "https://depot.galaxyproject.org/singularity/bismark:0.23.0--0" 'https://depot.galaxyproject.org/singularity/bismark:0.23.0--0' :
} else { 'quay.io/biocontainers/bismark:0.23.0--0' }"
container "quay.io/biocontainers/bismark:0.23.0--0"
}
input: input:
path(bam) path(bam)
@ -29,12 +18,13 @@ process BISMARK_SUMMARY {
path "versions.yml" , emit: versions path "versions.yml" , emit: versions
script: script:
def args = task.ext.args ?: ''
""" """
bismark2summary bismark2summary
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}: "${task.process}":
${getSoftwareName(task.process)}: \$(echo \$(bismark -v 2>&1) | sed 's/^.*Bismark Version: v//; s/Copyright.*\$//') bismark: \$(echo \$(bismark -v 2>&1) | sed 's/^.*Bismark Version: v//; s/Copyright.*\$//')
END_VERSIONS END_VERSIONS
""" """
} }

View file

@ -1,78 +0,0 @@
//
// 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()
}
//
// Extract name of module from process name using $task.process
//
def getProcessName(task_process) {
return task_process.tokenize(':')[-1]
}
//
// 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.args3 = args.args3 ?: ''
options.publish_by_meta = args.publish_by_meta ?: []
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) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// Do not publish versions.yml unless running from pytest workflow
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
return null
}
if (ioptions.publish_by_meta) {
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
for (key in key_list) {
if (args.meta && key instanceof String) {
def path = key
if (args.meta.containsKey(key)) {
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
}
path = path instanceof String ? path : ''
path_list.add(path)
}
}
}
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"
}
}

Some files were not shown because too many files have changed in this diff Show more