Merge branch 'nf-core:master' into master

This commit is contained in:
Svyatoslav Sidorov 2021-12-14 11:20:20 +00:00 committed by GitHub
commit c628315b46
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1887 changed files with 16713 additions and 32646 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

@ -6,11 +6,8 @@ on:
branches: [master] branches: [master]
jobs: jobs:
########### changes:
# Modules # name: Check for changes
###########
module_changes:
name: Check for changes in the modules
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs: outputs:
# Expose matched filters as job 'modules' output variable # Expose matched filters as job 'modules' output variable
@ -23,17 +20,16 @@ jobs:
with: with:
filters: "tests/config/pytest_modules.yml" filters: "tests/config/pytest_modules.yml"
module_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: module_changes needs: changes
if: needs.module_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.module_changes.outputs.modules) }}
profile: ["docker", "singularity", "conda"] profile: ["docker", "singularity", "conda"]
env: env:
NXF_ANSI_LOG: false NXF_ANSI_LOG: false
@ -63,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
@ -96,118 +91,17 @@ 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: |
/home/runner/pytest_workflow_*/*/.nextflow.log
/home/runner/pytest_workflow_*/*/log.out
/home/runner/pytest_workflow_*/*/log.err
/home/runner/pytest_workflow_*/*/work
################
# Subworkflows #
################
subworkflow_changes:
name: Check for changes in the subworkflows
runs-on: ubuntu-latest
outputs:
# Expose matched filters as job 'subworkflows' output variable
subworkflows: ${{ steps.filter.outputs.changes }}
steps:
- uses: actions/checkout@v2
- uses: dorny/paths-filter@v2
id: filter
with:
filters: "tests/config/pytest_subworkflows.yml"
subworkflow_test:
runs-on: ubuntu-20.04
name: ${{ matrix.tags }} ${{ matrix.profile }} ${{ matrix.nxf_version }}
needs: subworkflow_changes
if: needs.subworkflow_changes.outputs.subworkflows != '[]'
strategy:
fail-fast: false
matrix:
nxf_version: ["21.04.0"]
tags: ${{ fromJson(needs.subworkflow_changes.outputs.subworkflows) }}
profile: ["docker", "singularity", "conda"]
env:
NXF_ANSI_LOG: false
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.x"
- uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.x"
- name: Install Python dependencies
run: python -m pip install --upgrade pip pytest-workflow
- uses: actions/cache@v2
with:
path: /usr/local/bin/nextflow
key: ${{ runner.os }}-nextflow-${{ matrix.nxf_version }}
restore-keys: |
${{ runner.os }}-nextflow-
- name: Install Nextflow
env:
NXF_VER: ${{ matrix.nxf_version }}
CAPSULE_LOG: none
run: |
wget -qO- get.nextflow.io | bash
sudo mv nextflow /usr/local/bin/
- name: Set up Singularity
if: matrix.profile == 'singularity'
uses: eWaterCycle/setup-singularity@v5
with:
singularity-version: 3.7.1
- name: Setup miniconda
if: matrix.profile == 'conda'
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
channels: conda-forge,bioconda,defaults
python-version: ${{ matrix.python-version }}
- name: Conda clean
if: matrix.profile == 'conda'
run: conda clean -a
# Test the module
- name: Run pytest-workflow
# 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
- name: Upload logs on failure
if: failure()
uses: actions/upload-artifact@v2
with:
name: logs-${{ matrix.profile }}-${{ matrix.nxf_version }}
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
/home/runner/pytest_workflow_*/*/log.err /home/runner/pytest_workflow_*/*/log.err
/home/runner/pytest_workflow_*/*/work /home/runner/pytest_workflow_*/*/work
!/home/runner/pytest_workflow_*/*/work/conda
!/home/runner/pytest_workflow_*/*/work/singularity

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:

3
main.nf Normal file
View file

@ -0,0 +1,3 @@
/*
* not actually used - just a placeholder
*/

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.prefix ?: "${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.prefix ?: "${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,16 +32,16 @@ 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) {
""" """
AdapterRemoval \\ AdapterRemoval \\
--file1 ${reads[0]} \\ --file1 ${reads[0]} \\
--file2 ${reads[0]} \\ --file2 ${reads[1]} \\
$options.args \\ $args \\
--basename $prefix \\ --basename $prefix \\
--threads $task.cpus \\ --threads $task.cpus \\
--settings ${prefix}.log \\ --settings ${prefix}.log \\
@ -60,17 +51,17 @@ 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 {
""" """
AdapterRemoval \\ AdapterRemoval \\
--file1 ${reads[0]} \\ --file1 ${reads[0]} \\
--file2 ${reads[0]} \\ --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.1" : 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.1--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.1--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.prefix ?: "${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.prefix ?: "${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.prefix ?: "${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.prefix ?: "${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.prefix ?: "${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.prefix ?: "${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

@ -0,0 +1,47 @@
process ATAQV_ATAQV {
tag "$meta.id"
label 'process_medium'
conda (params.enable_conda ? "bioconda::ataqv=1.2.1" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/ataqv:1.2.1--py39ha23c084_2' :
'quay.io/biocontainers/ataqv:1.2.1--py36hfdecbe1_2' }"
input:
tuple val(meta), path(bam), path(bai), path(peak_file)
val organism
path tss_file
path excl_regs_file
path autosom_ref_file
output:
tuple val(meta), path("*.ataqv.json"), emit: json
tuple val(meta), path("*.problems") , emit: problems, optional: true
path "versions.yml" , emit: versions
script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def peak = peak_file ? "--peak-file $peak_file" : ''
def tss = tss_file ? "--tss-file $tss_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" : ''
"""
ataqv \\
$args \\
$peak \\
$tss \\
$excl_regs \\
$autosom_ref \\
--metrics-file "${prefix}.ataqv.json" \\
--threads $task.cpus \\
--name $prefix \\
$organism \\
$bam
cat <<-END_VERSIONS > versions.yml
"${task.process}":
ataqv: \$( ataqv --version )
END_VERSIONS
"""
}

View file

@ -0,0 +1,66 @@
name: ataqv_ataqv
description: ataqv function of a corresponding ataqv tool
keywords:
- ataqv
tools:
- ataqv:
description: ataqv is a toolkit for measuring and comparing ATAC-seq results. It was written to help understand how well ATAC-seq assays have worked, and to make it easier to spot differences that might be caused by library prep or sequencing.
homepage: https://github.com/ParkerLab/ataqv/blob/master/README.rst
documentation: https://github.com/ParkerLab/ataqv/blob/master/README.rst
tool_dev_url: https://github.com/ParkerLab/ataqv
doi: "https://doi.org/10.1016/j.cels.2020.02.009"
licence: ['GPL v3']
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- bam:
type: file
description: BAM file
pattern: "*.bam"
- bai:
type: file
description: BAM index file with the same prefix as bam file. Required if tss_file input is provided.
pattern: "*.bam.bai"
- peak_file:
type: file
description: A BED file of peaks called for alignments in the BAM file
pattern: "*.bed"
- organism:
type: string
description: The subject of the experiment, which determines the list of autosomes (see "Reference Genome Configuration" section at https://github.com/ParkerLab/ataqv).
- tss_file:
type: file
description: A BED file of transcription start sites for the experiment organism. If supplied, a TSS enrichment score will be calculated according to the ENCODE data standards. This calculation requires that the BAM file of alignments be indexed.
pattern: "*.bed"
- excl_regs_file:
type: file
description: A BED file containing excluded regions. Peaks or TSS overlapping these will be ignored.
pattern: "*.bed"
- autosom_ref_file:
type: file
description: A file containing autosomal reference names, one per line. The names must match the reference names in the alignment file exactly, or the metrics based on counts of autosomal alignments will be wrong.
output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- json:
type: file
description: The JSON file to which metrics will be written.
- problems:
type: file
description: If given, problematic reads will be logged to a file per read group, with names derived from the read group IDs, with ".problems" appended. If no read groups are found, the reads will be written to one file named after the BAM file.
pattern: "*.problems"
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
authors:
- "@i-pletenev"

67
modules/bakta/main.nf Normal file
View file

@ -0,0 +1,67 @@
process BAKTA {
tag "$meta.id"
label 'process_medium'
conda (params.enable_conda ? "bioconda::bakta=1.2.2" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/bakta:1.2.2--pyhdfd78af_0' :
'quay.io/biocontainers/bakta:1.2.2--pyhdfd78af_0' }"
input:
tuple val(meta), path(fasta)
path db
path proteins
path prodigal_tf
output:
tuple val(meta), path("${prefix}.embl") , emit: embl
tuple val(meta), path("${prefix}.faa") , emit: faa
tuple val(meta), path("${prefix}.ffn") , emit: ffn
tuple val(meta), path("${prefix}.fna") , emit: fna
tuple val(meta), path("${prefix}.gbff") , emit: gbff
tuple val(meta), path("${prefix}.gff3") , emit: gff
tuple val(meta), path("${prefix}.hypotheticals.tsv"), emit: hypotheticals_tsv
tuple val(meta), path("${prefix}.hypotheticals.faa"), emit: hypotheticals_faa
tuple val(meta), path("${prefix}.tsv") , emit: tsv
path "versions.yml" , emit: versions
script:
def args = task.ext.args ?: ''
prefix = task.ext.prefix ?: "${meta.id}"
def proteins_opt = proteins ? "--proteins ${proteins[0]}" : ""
def prodigal_opt = prodigal_tf ? "--prodigal-tf ${prodigal_tf[0]}" : ""
"""
bakta \\
$args \\
--threads $task.cpus \\
--prefix $prefix \\
--db $db \\
$proteins_opt \\
$prodigal_tf \\
$fasta
cat <<-END_VERSIONS > versions.yml
"${task.process}":
bakta: \$( echo \$(bakta --version 2>&1) | sed 's/^.*bakta //' )
END_VERSIONS
"""
stub:
prefix = task.ext.prefix ?: "${meta.id}"
"""
touch ${prefix}.embl
touch ${prefix}.faa
touch ${prefix}.ffn
touch ${prefix}.fna
touch ${prefix}.gbff
touch ${prefix}.gff3
touch ${prefix}.hypotheticals.tsv
touch ${prefix}.hypotheticals.faa
touch ${prefix}.tsv
cat <<-END_VERSIONS > versions.yml
"${task.process}":
bakta: \$( echo \$(bakta --version 2>&1) | sed 's/^.*bakta //' )
END_VERSIONS
"""
}

85
modules/bakta/meta.yml Normal file
View file

@ -0,0 +1,85 @@
name: bakta
description: Rapid annotation of bacterial genomes & plasmids.
keywords:
- annotation
- fasta
- prokaryote
tools:
- bakta:
description: Rapid & standardized annotation of bacterial genomes & plasmids.
homepage: https://github.com/oschwengers/bakta
documentation: https://github.com/oschwengers/bakta
tool_dev_url: https://github.com/oschwengers/bakta
doi: "10.1099/mgen.0.000685"
licence: ['GPL v3']
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- fasta:
type: file
description: |
FASTA file to be annotated. Has to contain at least a non-empty string dummy value.
- db:
type: file
description: |
Path to the Bakta database
- proteins:
type: file
description: FASTA file of trusted proteins to first annotate from (optional)
- prodigal_tf:
type: file
description: Training file to use for Prodigal (optional)
output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
- tsv:
type: file
description: annotations as simple human readble tab separated values
pattern: "*.tsv"
- gff:
type: file
description: annotations & sequences in GFF3 format
pattern: "*.gff3"
- gbff:
type: file
description: annotations & sequences in (multi) GenBank format
pattern: "*.gbff"
- embl:
type: file
description: annotations & sequences in (multi) EMBL format
pattern: "*.embl"
- fna:
type: file
description: replicon/contig DNA sequences as FASTA
pattern: "*.fna"
- faa:
type: file
description: CDS/sORF amino acid sequences as FASTA
pattern: "*.faa"
- ffn:
type: file
description: feature nucleotide sequences as FASTA
pattern: "*.ffn"
- hypotheticals_tsv:
type: file
description: further information on hypothetical protein CDS as simple human readble tab separated values
pattern: "*.hypotheticals.tsv"
- hypotheticals_faa:
type: file
description: hypothetical protein CDS amino acid sequences as FASTA
pattern: "*.hypotheticals.faa"
authors:
- "@rpetit3"

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.prefix ?: "${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.prefix ?: "${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

@ -0,0 +1,34 @@
process BAMUTIL_TRIMBAM {
tag "$meta.id"
label 'process_low'
conda (params.enable_conda ? "bioconda::bamutil=1.0.15" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/bamutil:1.0.15--h2e03b76_1' :
'quay.io/biocontainers/bamutil:1.0.15--h2e03b76_1' }"
input:
tuple val(meta), path(bam), val(trim_left), val(trim_right)
output:
tuple val(meta), path("*.bam"), emit: bam
path "versions.yml" , emit: versions
script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
"""
bam \\
trimBam \\
$bam \\
${prefix}.bam \\
$args \\
-L $trim_left \\
-R $trim_right
cat <<-END_VERSIONS > versions.yml
"${task.process}":
bamutil: \$( echo \$( bam trimBam 2>&1 ) | sed 's/^Version: //;s/;.*//' )
END_VERSIONS
"""
}

View file

@ -0,0 +1,51 @@
name: bamutil_trimbam
description: trims the end of reads in a SAM/BAM file, changing read ends to N and quality to !, or by soft clipping
keywords:
- bam
- trim
- clipping
- bamUtil
- trimBam
tools:
- bamutil:
description: Programs that perform operations on SAM/BAM files, all built into a single executable, bam.
homepage: https://genome.sph.umich.edu/wiki/BamUtil
documentation: https://genome.sph.umich.edu/wiki/BamUtil:_trimBam
tool_dev_url: https://github.com/statgen/bamUtil
doi: "10.1101/gr.176552.114"
licence: ['GPL v3']
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- bam:
type: file
description: BAM file
pattern: "*.bam"
- trim_left:
type: integer
description: Number of bases to trim off the right-hand side of a read. Reverse strands are reversed before trimming.
- trim_right:
type: integer
description: Number of bases to trim off the right-hand side of a read. Reverse strands are reversed before trimming.
output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
- bam:
type: file
description: Trimmed but unsorted BAM file
pattern: "*.bam"
authors:
- "@jfy133"

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.prefix ?: "${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)
@ -24,10 +13,12 @@ process BBMAP_ALIGN {
output: output:
tuple val(meta), path("*.bam"), emit: bam tuple val(meta), path("*.bam"), emit: bam
tuple val(meta), path("*.log"), emit: log
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.prefix ?: "${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]}"
@ -49,13 +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
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.prefix ?: "${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.prefix ?: "${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.prefix ?: "${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.prefix ?: "${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.prefix ?: "${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.prefix ?: "${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.prefix ?: "${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.prefix ?: "${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.prefix ?: "${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.prefix ?: "${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.prefix ?: "${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.prefix ?: "${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.prefix ?: "${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.prefix ?: "${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.prefix ?: "${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.prefix ?: "${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.prefix ?: "${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.prefix ?: "${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.prefix ?: "${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.prefix ?: "${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.prefix ?: "${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.prefix ?: "${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.prefix ?: "${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.prefix ?: "${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.prefix ?: "${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.prefix ?: "${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.prefix ?: "${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
""" """
} }

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