Merge remote-tracking branch 'nf-core/master'

This commit is contained in:
Chris Cheshire 2021-10-21 12:17:21 +01:00
commit d437618e2c
983 changed files with 18868 additions and 8398 deletions

View file

@ -20,7 +20,7 @@ Closes #XXX <!-- If this PR fixes an issue, please link it here! -->
- [ ] If you've added a new tool - have you followed the module conventions in the [contribution docs](https://github.com/nf-core/modules/tree/master/.github/CONTRIBUTING.md)
- [ ] If necessary, include test data in your PR.
- [ ] Remove all TODO statements.
- [ ] Emit the `<SOFTWARE>.version.txt` file.
- [ ] Emit the `versions.yml` file.
- [ ] Follow the naming conventions.
- [ ] Follow the parameters requirements.
- [ ] Follow the input/output options guidelines.

View file

@ -1,5 +1,10 @@
name: Code Linting
on: [push, pull_request]
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
Markdown:

View file

@ -1,7 +1,12 @@
name: nf-core linting
# This workflow is triggered on pushes and PRs to the repository.
# It runs the `nf-core lint` tests to ensure that the module code meets the nf-core guidelines
on: [push, pull_request]
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
changes:
@ -66,6 +71,8 @@ jobs:
- name: Lint ${{ matrix.tags }}
run: nf-core modules lint ${{ matrix.tags }}
# HACK
if: startsWith( matrix.tags, 'subworkflow' ) != true
- uses: actions/cache@v2
with:

View file

@ -1,9 +1,16 @@
name: Pytest-workflow
on: [push, pull_request]
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
changes:
name: Check for changes
###########
# Modules #
###########
module_changes:
name: Check for changes in the modules
runs-on: ubuntu-latest
outputs:
# Expose matched filters as job 'modules' output variable
@ -16,17 +23,17 @@ jobs:
with:
filters: "tests/config/pytest_modules.yml"
test:
module_test:
runs-on: ubuntu-20.04
name: ${{ matrix.tags }} ${{ matrix.profile }} ${{ matrix.nxf_version }}
needs: changes
if: needs.changes.outputs.modules != '[]'
needs: module_changes
if: needs.module_changes.outputs.modules != '[]'
strategy:
fail-fast: false
matrix:
nxf_version: ["21.04.0"]
tags: ["${{ fromJson(needs.changes.outputs.modules) }}"]
tags: ${{ fromJson(needs.module_changes.outputs.modules) }}
profile: ["docker", "singularity", "conda"]
env:
NXF_ANSI_LOG: false
@ -89,7 +96,110 @@ jobs:
# Test the module
- name: Run pytest-workflow
# only use one thread for pytest-workflow to avoid race condition on conda cache.
run: TMPDIR=~ PROFILE=${{ matrix.profile }} pytest --tag ${{ matrix.tags }} --symlink --kwdof
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: |
/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()

5
.gitignore vendored
View file

@ -5,6 +5,9 @@ test_output/
output/
.DS_Store
*.code-workspace
tests/data/
.screenrc
.*.sw?
tests/data/
__pycache__
*.pyo
*.pyc

View file

@ -9,6 +9,13 @@ 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
//
@ -37,9 +44,13 @@ def getPathFromList(path_list) {
// Function to save/publish module results
//
def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// 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) {
@ -65,4 +76,3 @@ def saveFiles(Map args) {
return "${getPathFromList(path_list)}/$args.filename"
}
}
}

View file

@ -1,5 +1,5 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
@ -24,10 +24,9 @@ process ABACAS {
output:
tuple val(meta), path('*.abacas*'), emit: results
path '*.version.txt' , emit: version
path "versions.yml" , emit: versions
script:
def software = getSoftwareName(task.process)
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
"""
abacas.pl \\
@ -40,6 +39,9 @@ process ABACAS {
mv nucmer.filtered.delta ${prefix}.abacas.nucmer.filtered.delta
mv nucmer.tiling ${prefix}.abacas.nucmer.tiling
mv unused_contigs.out ${prefix}.abacas.unused.contigs.out
echo \$(abacas.pl -v 2>&1) | sed 's/^.*ABACAS.//; s/ .*\$//' > ${software}.version.txt
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$(echo \$(abacas.pl -v 2>&1) | sed 's/^.*ABACAS.//; s/ .*\$//')
END_VERSIONS
"""
}

View file

@ -48,10 +48,10 @@ output:
'test.abacas.MULTIFASTA.fa' ]
pattern: "*.{abacas}*"
- version:
- versions:
type: file
description: File containing software version
pattern: "*.{version.txt}"
description: File containing software versions
pattern: "versions.yml"
authors:
- "@joseespinosa"

View file

@ -9,6 +9,13 @@ 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
//
@ -37,9 +44,13 @@ def getPathFromList(path_list) {
// Function to save/publish module results
//
def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// 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) {
@ -65,4 +76,3 @@ def saveFiles(Map args) {
return "${getPathFromList(path_list)}/$args.filename"
}
}
}

View file

@ -1,4 +1,4 @@
include { initOptions; saveFiles; getSoftwareName } from './functions'
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
@ -23,10 +23,9 @@ process ADAPTERREMOVAL {
output:
tuple val(meta), path('*.fastq.gz'), emit: reads
tuple val(meta), path('*.log') , emit: log
path "*.version.txt" , emit: version
path "versions.yml" , emit: versions
script:
def software = getSoftwareName(task.process)
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
if (meta.single_end) {
@ -41,7 +40,10 @@ process ADAPTERREMOVAL {
--seed 42 \\
--gzip \\
AdapterRemoval --version 2>&1 | sed -e "s/AdapterRemoval ver. //g" > ${software}.version.txt
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$(AdapterRemoval --version 2>&1 | sed -e "s/AdapterRemoval ver. //g")
END_VERSIONS
"""
} else if (!meta.single_end && !meta.collapse) {
"""
@ -57,7 +59,10 @@ process ADAPTERREMOVAL {
--seed 42 \\
--gzip \\
AdapterRemoval --version 2>&1 | sed -e "s/AdapterRemoval ver. //g" > ${software}.version.txt
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$(AdapterRemoval --version 2>&1 | sed -e "s/AdapterRemoval ver. //g")
END_VERSIONS
"""
} else {
"""
@ -73,7 +78,10 @@ process ADAPTERREMOVAL {
--gzip \\
cat *.collapsed.gz *.collapsed.truncated.gz > ${prefix}.merged.fastq.gz
AdapterRemoval --version 2>&1 | sed -e "s/AdapterRemoval ver. //g" > ${software}.version.txt
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$(AdapterRemoval --version 2>&1 | sed -e "s/AdapterRemoval ver. //g")
END_VERSIONS
"""
}

View file

@ -41,10 +41,10 @@ output:
type: file
description: AdapterRemoval log file
pattern: "*.log"
- version:
- versions:
type: file
description: File containing software version
pattern: "*.{version.txt}"
description: File containing software versions
pattern: "versions.yml"
authors:
- "@maxibor"

View file

@ -9,6 +9,13 @@ 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
//
@ -37,9 +44,13 @@ def getPathFromList(path_list) {
// Function to save/publish module results
//
def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// 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) {
@ -65,4 +76,3 @@ def saveFiles(Map args) {
return "${getPathFromList(path_list)}/$args.filename"
}
}
}

View file

@ -1,5 +1,5 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
@ -24,16 +24,18 @@ process AGRVATE {
output:
tuple val(meta), path("${fasta.baseName}-results/${fasta.baseName}-summary.tab"), emit: summary
path "${fasta.baseName}-results" , emit: results_dir
path "*.version.txt" , emit: version
path "versions.yml" , emit: versions
script:
def software = getSoftwareName(task.process)
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
"""
agrvate \\
$options.args \\
-i $fasta
echo \$(agrvate -v 2>&1) | sed 's/agrvate //;' > ${software}.version.txt
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$(echo \$(agrvate -v 2>&1) | sed 's/agrvate v//;')
END_VERSIONS
"""
}

View file

@ -38,9 +38,9 @@ output:
type: directory
description: Results of the agrvate assessement
pattern: "*-results"
- version:
- versions:
type: file
description: File containing software version
pattern: "*.{version.txt}"
description: File containing software versions
pattern: "versions.yml"
authors:
- "@abhi18av"

View file

@ -9,6 +9,13 @@ 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
//
@ -37,9 +44,13 @@ def getPathFromList(path_list) {
// Function to save/publish module results
//
def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// 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) {
@ -65,4 +76,3 @@ def saveFiles(Map args) {
return "${getPathFromList(path_list)}/$args.filename"
}
}
}

View file

@ -1,5 +1,5 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
@ -24,10 +24,9 @@ process ALLELECOUNTER {
output:
tuple val(meta), path("*.alleleCount"), emit: allelecount
path "*.version.txt" , emit: version
path "versions.yml" , emit: versions
script:
def software = getSoftwareName(task.process)
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
"""
alleleCounter \\
@ -36,6 +35,9 @@ process ALLELECOUNTER {
-b $bam \\
-o ${prefix}.alleleCount
alleleCounter --version > ${software}.version.txt
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$(alleleCounter --version)
END_VERSIONS
"""
}

View file

@ -39,10 +39,10 @@ output:
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- version:
- versions:
type: file
description: File containing software version
pattern: "*.{version.txt}"
description: File containing software versions
pattern: "versions.yml"
- alleleCount:
type: file
description: Allele count file

78
modules/amps/functions.nf Normal file
View file

@ -0,0 +1,78 @@
//
// 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"
}
}

47
modules/amps/main.nf Normal file
View file

@ -0,0 +1,47 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process AMPS {
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)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/hops:0.35--hdfd78af_1"
} else {
container "quay.io/biocontainers/hops:0.35--hdfd78af_1"
}
input:
path maltextract_results
path taxon_list
val filter
output:
path "results/heatmap_overview_Wevid.json" , emit: json
path "results/heatmap_overview_Wevid.pdf" , emit: summary_pdf
path "results/heatmap_overview_Wevid.tsv" , emit: tsv
path "results/pdf_candidate_profiles/" , emit: candidate_pdfs
path "versions.yml" , emit: versions
script:
"""
postprocessing.AMPS.r \\
-r $maltextract_results \\
-n $taxon_list \\
-m $filter \\
-t $task.cpus \\
-j \\
$options.args
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$(echo \$(hops --version 2>&1) | sed 's/HOPS version//')
END_VERSIONS
"""
}

66
modules/amps/meta.yml Normal file
View file

@ -0,0 +1,66 @@
name: amps
description: Post-processing script of the MaltExtract component of the HOPS package
keywords:
- malt
- MaltExtract
- HOPS
- amps
- alignment
- metagenomics
- ancient DNA
- aDNA
- palaeogenomics
- archaeogenomics
- microbiome
- authentication
- damage
- edit distance
- post Post-processing
- visualisation
tools:
- amps:
description: Post-processing script of the MaltExtract tool for ancient metagenomics
homepage: "https://github.com/rhuebler/HOPS"
documentation: "https://github.com/keyfm/amps"
tool_dev_url: "https://github.com/keyfm/amps"
doi: "10.1186/s13059-019-1903-0"
licence: ['GPL >=3']
input:
- maltextract_results:
type: directory
description: MaltExtract output directory
pattern: "results/"
- taxon_list:
type: file
description: List of target taxa to evaluate used in MaltExtract
pattern: "*.txt"
- filter:
type: string
description: The filter mode used in MaltExtract
pattern: "def_anc|default|scan|ancient|crawl"
output:
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
- json:
type: file
description: Candidate summary heatmap in MultiQC compatible JSON format
pattern: "heatmap_overview_Wevid.json"
- summary_pdf:
type: file
description: Candidate summary heatmap in PDF format
pattern: "heatmap_overview_Wevid.pdf"
- tsv:
type: file
description: Candidate summary heatmap in TSV format
pattern: "heatmap_overview_Wevid.tsv"
- candidate_pdfs:
type: directory
description: Directory of per sample output PDFs organised by reference
pattern: "pdf_candidate_profiles/"
authors:
- "@jfy133"

View file

@ -9,6 +9,13 @@ 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
//
@ -37,9 +44,13 @@ def getPathFromList(path_list) {
// Function to save/publish module results
//
def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// 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) {
@ -65,4 +76,3 @@ def saveFiles(Map args) {
return "${getPathFromList(path_list)}/$args.filename"
}
}
}

View file

@ -1,5 +1,5 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
@ -26,10 +26,9 @@ process ARRIBA {
output:
tuple val(meta), path("*.fusions.tsv") , emit: fusions
tuple val(meta), path("*.fusions.discarded.tsv"), emit: fusions_fail
path "*.version.txt" , emit: version
path "versions.yml" , emit: versions
script:
def software = getSoftwareName(task.process)
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
def blacklist = (options.args.contains('-b')) ? '' : '-f blacklist'
"""
@ -42,6 +41,9 @@ process ARRIBA {
$blacklist \\
$options.args
echo \$(arriba -h | grep 'Version:' 2>&1) | sed 's/Version:\s//' > ${software}.version.txt
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$(arriba -h | grep 'Version:' 2>&1 | sed 's/Version:\s//')
END_VERSIONS
"""
}

View file

@ -37,10 +37,10 @@ output:
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- version:
- versions:
type: file
description: File containing software version
pattern: "*.{version.txt}"
description: File containing software versions
pattern: "versions.yml"
- fusions:
type: file
description: File contains fusions which pass all of Arriba's filters.

View file

@ -9,6 +9,13 @@ 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
//
@ -37,9 +44,13 @@ def getPathFromList(path_list) {
// Function to save/publish module results
//
def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// 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) {
@ -65,4 +76,3 @@ def saveFiles(Map args) {
return "${getPathFromList(path_list)}/$args.filename"
}
}
}

View file

@ -1,5 +1,5 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
@ -23,10 +23,9 @@ process ARTIC_GUPPYPLEX {
output:
tuple val(meta), path("*.fastq.gz"), emit: fastq
path "*.version.txt" , emit: version
path "versions.yml" , emit: versions
script:
def software = getSoftwareName(task.process)
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
"""
artic \\
@ -36,6 +35,9 @@ process ARTIC_GUPPYPLEX {
--output ${prefix}.fastq
pigz -p $task.cpus *.fastq
echo \$(artic --version 2>&1) | sed 's/^.*artic //; s/ .*\$//' > ${software}.version.txt
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$(artic --version 2>&1 | sed 's/^.*artic //; s/ .*\$//')
END_VERSIONS
"""
}

View file

@ -34,10 +34,10 @@ output:
type: file
description: Aggregated FastQ files
pattern: "*.{fastq.gz}"
- version:
- versions:
type: file
description: File containing software version
pattern: "*.{version.txt}"
description: File containing software versions
pattern: "versions.yml"
authors:
- "@joseespinosa"

View file

@ -9,6 +9,13 @@ 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
//
@ -37,9 +44,13 @@ def getPathFromList(path_list) {
// Function to save/publish module results
//
def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// 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) {
@ -65,4 +76,3 @@ def saveFiles(Map args) {
return "${getPathFromList(path_list)}/$args.filename"
}
}
}

View file

@ -1,5 +1,5 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
@ -40,10 +40,9 @@ process ARTIC_MINION {
tuple val(meta), path("${prefix}.pass.vcf.gz") , emit: vcf
tuple val(meta), path("${prefix}.pass.vcf.gz.tbi") , emit: tbi
tuple val(meta), path("*.json"), optional:true , emit: json
path "*.version.txt" , emit: version
path "versions.yml" , emit: versions
script:
def software = getSoftwareName(task.process)
prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
def version = scheme_version.toString().toLowerCase().replaceAll('v','')
def fast5 = params.fast5_dir ? "--fast5-directory $fast5_dir" : ""
@ -68,6 +67,9 @@ process ARTIC_MINION {
$scheme \\
$prefix
echo \$(artic --version 2>&1) | sed 's/^.*artic //; s/ .*\$//' > ${software}.version.txt
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$(artic --version 2>&1 | sed 's/^.*artic //; s/ .*\$//')
END_VERSIONS
"""
}

View file

@ -103,10 +103,10 @@ output:
type: file
description: JSON file for MultiQC
pattern: "*.json"
- version:
- versions:
type: file
description: File containing software version
pattern: "*.{version.txt}"
description: File containing software versions
pattern: "versions.yml"
authors:
- "@joseespinosa"

View file

@ -9,6 +9,13 @@ 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
//
@ -37,9 +44,13 @@ def getPathFromList(path_list) {
// Function to save/publish module results
//
def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// 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) {
@ -65,4 +76,3 @@ def saveFiles(Map args) {
return "${getPathFromList(path_list)}/$args.filename"
}
}
}

View file

@ -1,5 +1,5 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
@ -23,10 +23,9 @@ process BAMALIGNCLEANER {
output:
tuple val(meta), path("*.bam"), emit: bam
path "*.version.txt" , emit: version
path "versions.yml" , emit: versions
script:
def software = getSoftwareName(task.process)
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
"""
@ -35,6 +34,9 @@ process BAMALIGNCLEANER {
-o ${prefix}.bam \\
${bam}
echo \$(bamAlignCleaner --version) | sed 's/.*version //' > ${software}.version.txt
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$(bamAlignCleaner --version | sed 's/.*version //')
END_VERSIONS
"""
}

View file

@ -27,10 +27,10 @@ output:
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- version:
- versions:
type: file
description: File containing software version
pattern: "*.{version.txt}"
description: File containing software versions
pattern: "versions.yml"
- bam:
type: file
description: Sorted BAM/CRAM file

View file

@ -0,0 +1,78 @@
//
// 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

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

View file

@ -0,0 +1,45 @@
name: bamtools_split
description: BamTools provides both a programmer's API and an end-user's toolkit for handling BAM files.
keywords:
- bamtools
- bamtools/split
- bam
- split
- chunk
tools:
- bamtools:
description: C++ API & command-line toolkit for working with BAM data
homepage: http://github.com/pezmaster31/bamtools
documentation: https://github.com/pezmaster31/bamtools/wiki
tool_dev_url: http://github.com/pezmaster31/bamtools
doi: ""
licence: ['MIT']
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- bam:
type: file
description: A BAM file to split
pattern: "*.bam"
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: Several Bam files
pattern: "*.bam"
authors:
- "@sguizard"

View file

@ -9,6 +9,13 @@ 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
//
@ -37,9 +44,13 @@ def getPathFromList(path_list) {
// Function to save/publish module results
//
def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// 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) {
@ -65,4 +76,3 @@ def saveFiles(Map args) {
return "${getPathFromList(path_list)}/$args.filename"
}
}
}

View file

@ -1,5 +1,5 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
@ -24,15 +24,17 @@ process BANDAGE_IMAGE {
output:
tuple val(meta), path('*.png'), emit: png
tuple val(meta), path('*.svg'), emit: svg
path '*.version.txt' , emit: version
path "versions.yml" , emit: versions
script:
def software = getSoftwareName(task.process)
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
"""
Bandage image $gfa ${prefix}.png $options.args
Bandage image $gfa ${prefix}.svg $options.args
echo \$(Bandage --version 2>&1) | sed 's/^.*Version: //; s/ .*\$//' > ${software}.version.txt
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$(echo \$(Bandage --version 2>&1) | sed 's/^.*Version: //; s/ .*\$//')
END_VERSIONS
"""
}

View file

@ -35,9 +35,9 @@ output:
type: file
description: Bandage image in SVG format
pattern: "*.svg"
- version:
- versions:
type: file
description: File containing software version
pattern: "*.{version.txt}"
description: File containing software versions
pattern: "versions.yml"
authors:
- "@heuermh"

View file

@ -9,6 +9,13 @@ 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
//
@ -37,9 +44,13 @@ def getPathFromList(path_list) {
// Function to save/publish module results
//
def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// 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) {
@ -65,4 +76,3 @@ def saveFiles(Map args) {
return "${getPathFromList(path_list)}/$args.filename"
}
}
}

View file

@ -1,5 +1,5 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
@ -24,10 +24,9 @@ process BBMAP_ALIGN {
output:
tuple val(meta), path("*.bam"), emit: bam
path "*.version.txt" , emit: version
path "versions.yml" , emit: versions
script:
def software = getSoftwareName(task.process)
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
input = meta.single_end ? "in=${fastq}" : "in=${fastq[0]} in2=${fastq[1]}"
@ -54,6 +53,11 @@ process BBMAP_ALIGN {
threads=$task.cpus \\
-Xmx${task.memory.toGiga()}g
echo \$(bbversion.sh) > ${software}.version.txt
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$(bbversion.sh)
samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
pigz: \$( pigz --version 2>&1 | sed 's/pigz //g' )
END_VERSIONS
"""
}

View file

@ -39,10 +39,10 @@ output:
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- version:
- versions:
type: file
description: File containing software version
pattern: "*.{version.txt}"
description: File containing software versions
pattern: "versions.yml"
- bam:
type: file
description: BAM file

View file

@ -9,6 +9,13 @@ 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
//
@ -37,9 +44,13 @@ def getPathFromList(path_list) {
// Function to save/publish module results
//
def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// 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) {
@ -65,4 +76,3 @@ def saveFiles(Map args) {
return "${getPathFromList(path_list)}/$args.filename"
}
}
}

View file

@ -1,4 +1,4 @@
include { initOptions; saveFiles; getSoftwareName } from './functions'
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
@ -24,10 +24,9 @@ process BBMAP_BBDUK {
output:
tuple val(meta), path('*.fastq.gz'), emit: reads
tuple val(meta), path('*.log') , emit: log
path '*.version.txt' , emit: version
path "versions.yml" , emit: versions
script:
def software = getSoftwareName(task.process)
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
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"
@ -42,6 +41,9 @@ process BBMAP_BBDUK {
$options.args \\
$contaminants_fa \\
&> ${prefix}.bbduk.log
echo \$(bbversion.sh) > ${software}.version.txt
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$(bbversion.sh)
END_VERSIONS
"""
}

View file

@ -39,10 +39,10 @@ output:
type: file
description: The trimmed/modified fastq reads
pattern: "*fastq.gz"
- version:
- versions:
type: file
description: File containing software version
pattern: "*.{version.txt}"
description: File containing software versions
pattern: "versions.yml"
- log:
type: file
description: Bbduk log file

View file

@ -0,0 +1,78 @@
//
// 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

@ -0,0 +1,94 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process BBMAP_BBSPLIT {
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)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/bbmap:38.93--he522d1c_0"
} else {
container "quay.io/biocontainers/bbmap:38.93--he522d1c_0"
}
input:
tuple val(meta), path(reads)
path index
path primary_ref
tuple val(other_ref_names), path (other_ref_paths)
val only_build_index
output:
path "bbsplit" , optional:true, emit: index
tuple val(meta), path('*primary*fastq.gz'), optional:true, emit: primary_fastq
tuple val(meta), path('*fastq.gz') , optional:true, emit: all_fastq
tuple val(meta), path('*txt') , optional:true, emit: stats
path "versions.yml" , emit: versions
script:
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
def avail_mem = 3
if (!task.memory) {
log.info '[BBSplit] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.'
} else {
avail_mem = task.memory.giga
}
def other_refs = []
other_ref_names.eachWithIndex { name, index ->
other_refs << "ref_${name}=${other_ref_paths[index]}"
}
if (only_build_index) {
if (primary_ref && other_ref_names && other_ref_paths) {
"""
bbsplit.sh \\
-Xmx${avail_mem}g \\
ref_primary=$primary_ref \\
${other_refs.join(' ')} \\
path=bbsplit \\
threads=$task.cpus \\
$options.args
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$(bbversion.sh 2>&1)
END_VERSIONS
"""
} else {
log.error 'ERROR: Please specify as input a primary fasta file along with names and paths to non-primary fasta files.'
}
} else {
def index_files = ''
if (index) {
index_files = "path=$index"
} else if (primary_ref && other_ref_names && other_ref_paths) {
index_files = "ref_primary=${primary_ref} ${other_refs.join(' ')}"
} else {
log.error 'ERROR: Please either specify a BBSplit index as input or a primary fasta file along with names and paths to non-primary fasta files.'
}
def fastq_in = meta.single_end ? "in=${reads}" : "in=${reads[0]} in2=${reads[1]}"
def fastq_out = meta.single_end ? "basename=${prefix}_%.fastq.gz" : "basename=${prefix}_%_#.fastq.gz"
"""
bbsplit.sh \\
-Xmx${avail_mem}g \\
$index_files \\
threads=$task.cpus \\
$fastq_in \\
$fastq_out \\
refstats=${prefix}.stats.txt \\
$options.args
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$(bbversion.sh 2>&1)
END_VERSIONS
"""
}
}

View file

@ -0,0 +1,75 @@
name: bbmap_bbsplit
description: write your description here
keywords:
- align
- map
- genome
- reference
tools:
- bbmap:
description: BBMap is a short read aligner, as well as various other bioinformatic tools.
homepage: https://jgi.doe.gov/data-and-tools/bbtools/bb-tools-user-guide/
documentation: https://jgi.doe.gov/data-and-tools/bbtools/bb-tools-user-guide/
tool_dev_url: None
doi: ""
licence: ['UC-LBL license (see package)']
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- reads:
type: file
description: |
List of input FastQ files of size 1 and 2 for single-end and paired-end data,
respectively.
- index:
type: directory
description: Directory to place generated index
pattern: "*"
- primary_ref:
type: path
description: Path to the primary reference
pattern: "*"
- other_ref_names:
type: list
description: List of other reference ids apart from the primary
- other_ref_paths:
type: list
description: Path to other references paths corresponding to "other_ref_names"
- only_build_index:
type: string
description: true = only build index; false = mapping
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"
- index:
type: directory
description: Directory with index files
pattern: "bbsplit"
- primary_fastq:
type: file
description: Output reads that map to the primary reference
pattern: "*primary*fastq.gz"
- all_fastq:
type: file
description: All reads mapping to any of the references
pattern: "*fastq.gz"
- stats:
type: file
description: Tab-delimited text file containing mapping statistics
pattern: "*.txt"
authors:
- "@joseespinosa"
- "@drpatelh"

View file

@ -9,6 +9,13 @@ 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
//
@ -37,9 +44,13 @@ def getPathFromList(path_list) {
// Function to save/publish module results
//
def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// 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) {
@ -65,4 +76,3 @@ def saveFiles(Map args) {
return "${getPathFromList(path_list)}/$args.filename"
}
}
}

View file

@ -1,5 +1,5 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
@ -23,10 +23,9 @@ process BBMAP_INDEX {
output:
path 'ref' , emit: index
path "*.version.txt" , emit: version
path "versions.yml" , emit: versions
script:
def software = getSoftwareName(task.process)
"""
bbmap.sh \\
ref=${fasta} \\
@ -34,6 +33,9 @@ process BBMAP_INDEX {
threads=$task.cpus \\
-Xmx${task.memory.toGiga()}g
echo \$(bbversion.sh) > ${software}.version.txt
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$(bbversion.sh)
END_VERSIONS
"""
}

View file

@ -20,10 +20,10 @@ input:
pattern: "*.{fna,fa,fasta}"
output:
- version:
- versions:
type: file
description: File containing software version
pattern: "*.{version.txt}"
description: File containing software versions
pattern: "versions.yml"
- db:
type: directory
description: Directory with index files

View file

@ -9,6 +9,13 @@ 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
//
@ -37,9 +44,13 @@ def getPathFromList(path_list) {
// Function to save/publish module results
//
def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// 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) {
@ -65,4 +76,3 @@ def saveFiles(Map args) {
return "${getPathFromList(path_list)}/$args.filename"
}
}
}

View file

@ -1,5 +1,5 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
@ -23,10 +23,9 @@ process BCFTOOLS_CONCAT {
output:
tuple val(meta), path("*.gz"), emit: vcf
path "*.version.txt" , emit: version
path "versions.yml" , emit: versions
script:
def software = getSoftwareName(task.process)
prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
"""
bcftools concat \\
@ -35,6 +34,9 @@ process BCFTOOLS_CONCAT {
--threads $task.cpus \\
${vcfs}
echo \$(bcftools --version 2>&1) | sed 's/^.*bcftools //; s/ .*\$//' > ${software}.version.txt
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//')
END_VERSIONS
"""
}

View file

@ -34,9 +34,9 @@ output:
type: file
description: VCF concatenated output file
pattern: "*.{vcf.gz}"
- version:
- versions:
type: file
description: File containing software version
pattern: "*.{version.txt}"
description: File containing software versions
pattern: "versions.yml"
authors:
- "@abhi18av"

View file

@ -9,6 +9,13 @@ 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
//
@ -37,9 +44,13 @@ def getPathFromList(path_list) {
// Function to save/publish module results
//
def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// 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) {
@ -65,4 +76,3 @@ def saveFiles(Map args) {
return "${getPathFromList(path_list)}/$args.filename"
}
}
}

View file

@ -1,5 +1,5 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
@ -23,16 +23,18 @@ process BCFTOOLS_CONSENSUS {
output:
tuple val(meta), path('*.fa'), emit: fasta
path '*.version.txt' , emit: version
path "versions.yml" , emit: versions
script:
def software = getSoftwareName(task.process)
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
"""
cat $fasta | bcftools consensus $vcf $options.args > ${prefix}.fa
header=\$(head -n 1 ${prefix}.fa | sed 's/>//g')
sed -i 's/\${header}/${meta.id}/g' ${prefix}.fa
echo \$(bcftools --version 2>&1) | sed 's/^.*bcftools //; s/ .*\$//' > ${software}.version.txt
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//')
END_VERSIONS
"""
}

View file

@ -39,10 +39,10 @@ output:
type: file
description: FASTA reference consensus file
pattern: "*.{fasta,fa}"
- version:
- versions:
type: file
description: File containing software version
pattern: "*.{version.txt}"
description: File containing software versions
pattern: "versions.yml"
authors:
- "@joseespinosa"
- "@drpatelh"

View file

@ -9,6 +9,13 @@ 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
//
@ -37,9 +44,13 @@ def getPathFromList(path_list) {
// Function to save/publish module results
//
def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// 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) {
@ -65,4 +76,3 @@ def saveFiles(Map args) {
return "${getPathFromList(path_list)}/$args.filename"
}
}
}

View file

@ -1,5 +1,5 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
@ -23,10 +23,9 @@ process BCFTOOLS_FILTER {
output:
tuple val(meta), path("*.gz"), emit: vcf
path "*.version.txt" , emit: version
path "versions.yml" , emit: versions
script:
def software = getSoftwareName(task.process)
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
"""
bcftools filter \\
@ -34,6 +33,9 @@ process BCFTOOLS_FILTER {
$options.args \\
$vcf
echo \$(bcftools --version 2>&1) | sed 's/^.*bcftools //; s/ .*\$//' > ${software}.version.txt
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//')
END_VERSIONS
"""
}

View file

@ -31,10 +31,10 @@ output:
type: file
description: VCF filtered output file
pattern: "*.{vcf}"
- version:
- versions:
type: file
description: File containing software version
pattern: "*.{version.txt}"
description: File containing software versions
pattern: "versions.yml"
authors:
- "@joseespinosa"
- "@drpatelh"

View file

@ -0,0 +1,78 @@
//
// 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

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

View file

@ -0,0 +1,49 @@
name: bcftools_index
description: Index VCF tools
keywords:
- vcf
- index
- bcftools
- csi
- tbi
tools:
- bcftools:
description: BCFtools is a set of utilities that manipulate variant calls in the Variant Call Format (VCF) and its binary counterpart BCF. All commands work transparently with both VCFs and BCFs, both uncompressed and BGZF-compressed. Most commands accept VCF, bgzipped VCF and BCF with filetype detected automatically even when streaming from a pipe. Indexed VCF and BCF will work in all situations. Un-indexed VCF and BCF and streams will work in most, but not all situations.
homepage: https://samtools.github.io/bcftools/
documentation: https://samtools.github.io/bcftools/howtos/index.html
tool_dev_url: https://github.com/samtools/bcftools
doi: "10.1093/gigascience/giab008"
licence: ['GPL']
input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- VCF:
type: file
description: VCF file (optionally GZIPPED)
pattern: "*.{vcf,vcf.gz}"
output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- version:
type: file
description: File containing software version
pattern: "versions.yml"
- csi:
type: file
description: Default VCF file index file
pattern: "*.csi"
- tbi:
type: file
description: Alternative VCF file index file for larger files (activated with -t parameter)
pattern: "*.tbi"
authors:
- "@jfy133"

View file

@ -9,6 +9,13 @@ 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
//
@ -37,9 +44,13 @@ def getPathFromList(path_list) {
// Function to save/publish module results
//
def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// 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) {
@ -65,4 +76,3 @@ def saveFiles(Map args) {
return "${getPathFromList(path_list)}/$args.filename"
}
}
}

View file

@ -1,5 +1,5 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
@ -23,16 +23,18 @@ process BCFTOOLS_ISEC {
output:
tuple val(meta), path("${prefix}"), emit: results
path "*.version.txt" , emit: version
path "versions.yml" , emit: versions
script:
def software = getSoftwareName(task.process)
prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
"""
bcftools isec \\
$options.args \\
-p $prefix \\
*.vcf.gz
echo \$(bcftools --version 2>&1) | sed 's/^.*bcftools //; s/ .*\$//' > ${software}.version.txt
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//')
END_VERSIONS
"""
}

View file

@ -39,10 +39,10 @@ output:
type: directory
description: Folder containing the set operations results perform on the vcf files
pattern: "${prefix}"
- version:
- versions:
type: file
description: File containing software version
pattern: "*.{version.txt}"
description: File containing software versions
pattern: "versions.yml"
authors:
- "@joseespinosa"
- "@drpatelh"

View file

@ -9,6 +9,13 @@ 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
//
@ -37,9 +44,13 @@ def getPathFromList(path_list) {
// Function to save/publish module results
//
def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// 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) {
@ -65,4 +76,3 @@ def saveFiles(Map args) {
return "${getPathFromList(path_list)}/$args.filename"
}
}
}

View file

@ -1,5 +1,5 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
@ -23,16 +23,18 @@ process BCFTOOLS_MERGE {
output:
tuple val(meta), path("*.gz"), emit: vcf
path "*.version.txt" , emit: version
path "versions.yml" , emit: versions
script:
def software = getSoftwareName(task.process)
prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
"""
bcftools merge -Oz \\
--output ${prefix}.vcf.gz \\
$options.args \\
*.vcf.gz
echo \$(bcftools --version 2>&1) | sed 's/^.*bcftools //; s/ .*\$//' > ${software}.version.txt
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//')
END_VERSIONS
"""
}

View file

@ -37,10 +37,10 @@ output:
type: file
description: VCF merged output file
pattern: "*.{vcf.gz}"
- version:
- versions:
type: file
description: File containing software version
pattern: "*.{version.txt}"
description: File containing software versions
pattern: "versions.yml"
authors:
- "@joseespinosa"
- "@drpatelh"

View file

@ -9,6 +9,13 @@ 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
//
@ -37,9 +44,13 @@ def getPathFromList(path_list) {
// Function to save/publish module results
//
def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// 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) {
@ -65,4 +76,3 @@ def saveFiles(Map args) {
return "${getPathFromList(path_list)}/$args.filename"
}
}
}

View file

@ -1,5 +1,5 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
@ -26,10 +26,9 @@ process BCFTOOLS_MPILEUP {
tuple val(meta), path("*.gz") , emit: vcf
tuple val(meta), path("*.tbi") , emit: tbi
tuple val(meta), path("*stats.txt"), emit: stats
path "*.version.txt" , emit: version
path "versions.yml" , emit: versions
script:
def software = getSoftwareName(task.process)
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
"""
echo "${meta.id}" > sample_name.list
@ -42,6 +41,9 @@ process BCFTOOLS_MPILEUP {
| bcftools view --output-file ${prefix}.vcf.gz --output-type z $options.args3
tabix -p vcf -f ${prefix}.vcf.gz
bcftools stats ${prefix}.vcf.gz > ${prefix}.bcftools_stats.txt
echo \$(bcftools --version 2>&1) | sed 's/^.*bcftools //; s/ .*\$//' > ${software}.version.txt
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//')
END_VERSIONS
"""
}

View file

@ -43,10 +43,10 @@ output:
type: file
description: Text output file containing stats
pattern: "*{stats.txt}"
- version:
- versions:
type: file
description: File containing software version
pattern: "*.{version.txt}"
description: File containing software versions
pattern: "versions.yml"
authors:
- "@joseespinosa"
- "@drpatelh"

View file

@ -9,6 +9,13 @@ 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
//
@ -37,9 +44,13 @@ def getPathFromList(path_list) {
// Function to save/publish module results
//
def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// 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) {
@ -65,4 +76,3 @@ def saveFiles(Map args) {
return "${getPathFromList(path_list)}/$args.filename"
}
}
}

View file

@ -1,5 +1,5 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
@ -24,10 +24,9 @@ process BCFTOOLS_NORM {
output:
tuple val(meta), path("*.gz") , emit: vcf
path "*.version.txt" , emit: version
path "versions.yml" , emit: versions
script:
def software = getSoftwareName(task.process)
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
"""
bcftools norm \\
@ -37,6 +36,9 @@ process BCFTOOLS_NORM {
--threads $task.cpus \\
${vcf}
echo \$(bcftools --version 2>&1) | sed 's/^.*bcftools //; s/ .*\$//' > ${software}.version.txt
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//')
END_VERSIONS
"""
}

View file

@ -37,9 +37,9 @@ output:
type: file
description: VCF normalized output file
pattern: "*.{vcf.gz}"
- version:
- versions:
type: file
description: File containing software version
pattern: "*.{version.txt}"
description: File containing software versions
pattern: "versions.yml"
authors:
- "@abhi18av"

View file

@ -9,6 +9,13 @@ 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
//
@ -37,9 +44,13 @@ def getPathFromList(path_list) {
// Function to save/publish module results
//
def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// 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) {
@ -65,4 +76,3 @@ def saveFiles(Map args) {
return "${getPathFromList(path_list)}/$args.filename"
}
}
}

View file

@ -1,5 +1,5 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
@ -26,10 +26,9 @@ process BCFTOOLS_QUERY {
output:
tuple val(meta), path("*.gz") , emit: vcf
path "*.version.txt" , emit: version
path "versions.yml" , emit: versions
script:
def software = getSoftwareName(task.process)
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
def regions_file = regions ? "--regions-file ${regions}" : ""
def targets_file = targets ? "--targets-file ${targets}" : ""
@ -44,6 +43,9 @@ process BCFTOOLS_QUERY {
$options.args \\
${vcf}
echo \$(bcftools --version 2>&1) | sed 's/^.*bcftools //; s/ .*\$//' > ${software}.version.txt
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//')
END_VERSIONS
"""
}

View file

@ -53,9 +53,9 @@ output:
type: file
description: VCF query output file
pattern: "*.{vcf.gz}"
- version:
- versions:
type: file
description: File containing software version
pattern: "*.{version.txt}"
description: File containing software versions
pattern: "versions.yml"
authors:
- "@abhi18av"

View file

@ -9,6 +9,13 @@ 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
//
@ -37,9 +44,13 @@ def getPathFromList(path_list) {
// Function to save/publish module results
//
def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// 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) {
@ -65,4 +76,3 @@ def saveFiles(Map args) {
return "${getPathFromList(path_list)}/$args.filename"
}
}
}

View file

@ -1,5 +1,5 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
@ -25,10 +25,9 @@ process BCFTOOLS_REHEADER {
output:
tuple val(meta), path("*.vcf.gz"), emit: vcf
path "*.version.txt" , emit: version
path "versions.yml" , emit: versions
script:
def software = getSoftwareName(task.process)
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
def update_sequences = fai ? "-f $fai" : ""
def new_header = header ? "-h $header" : ""
@ -42,6 +41,9 @@ process BCFTOOLS_REHEADER {
-o ${prefix}.vcf.gz \\
$vcf
echo \$(bcftools --version 2>&1) | sed 's/^.*bcftools //; s/ .*\$//' > ${software}.version.txt
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//')
END_VERSIONS
"""
}

View file

@ -38,10 +38,10 @@ output:
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- version:
- versions:
type: file
description: File containing software version
pattern: "*.{version.txt}"
description: File containing software versions
pattern: "versions.yml"
- vcf:
type: file
description: VCF with updated header

View file

@ -9,6 +9,13 @@ 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
//
@ -37,9 +44,13 @@ def getPathFromList(path_list) {
// Function to save/publish module results
//
def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// 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) {
@ -65,4 +76,3 @@ def saveFiles(Map args) {
return "${getPathFromList(path_list)}/$args.filename"
}
}
}

View file

@ -1,5 +1,5 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
@ -23,13 +23,15 @@ process BCFTOOLS_STATS {
output:
tuple val(meta), path("*stats.txt"), emit: stats
path "*.version.txt" , emit: version
path "versions.yml" , emit: versions
script:
def software = getSoftwareName(task.process)
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
"""
bcftools stats $options.args $vcf > ${prefix}.bcftools_stats.txt
echo \$(bcftools --version 2>&1) | sed 's/^.*bcftools //; s/ .*\$//' > ${software}.version.txt
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//')
END_VERSIONS
"""
}

View file

@ -32,10 +32,10 @@ output:
type: file
description: Text output file containing stats
pattern: "*_{stats.txt}"
- version:
- versions:
type: file
description: File containing software version
pattern: "*.{version.txt}"
description: File containing software versions
pattern: "versions.yml"
authors:
- "@joseespinosa"
- "@drpatelh"

View file

@ -9,6 +9,13 @@ 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
//
@ -37,9 +44,13 @@ def getPathFromList(path_list) {
// Function to save/publish module results
//
def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// 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) {
@ -65,4 +76,3 @@ def saveFiles(Map args) {
return "${getPathFromList(path_list)}/$args.filename"
}
}
}

View file

@ -1,5 +1,5 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
@ -26,10 +26,9 @@ process BCFTOOLS_VIEW {
output:
tuple val(meta), path("*.gz") , emit: vcf
path "*.version.txt" , emit: version
path "versions.yml" , emit: versions
script:
def software = getSoftwareName(task.process)
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
def regions_file = regions ? "--regions-file ${regions}" : ""
def targets_file = targets ? "--targets-file ${targets}" : ""
@ -46,6 +45,9 @@ process BCFTOOLS_VIEW {
--threads $task.cpus \\
${vcf}
echo \$(bcftools --version 2>&1) | sed 's/^.*bcftools //; s/ .*\$//' > ${software}.version.txt
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//')
END_VERSIONS
"""
}

View file

@ -54,9 +54,9 @@ output:
type: file
description: VCF normalized output file
pattern: "*.{vcf.gz}"
- version:
- versions:
type: file
description: File containing software version
pattern: "*.{version.txt}"
description: File containing software versions
pattern: "versions.yml"
authors:
- "@abhi18av"

View file

@ -9,6 +9,13 @@ 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
//
@ -37,9 +44,13 @@ def getPathFromList(path_list) {
// Function to save/publish module results
//
def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// 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) {
@ -65,4 +76,3 @@ def saveFiles(Map args) {
return "${getPathFromList(path_list)}/$args.filename"
}
}
}

View file

@ -1,5 +1,5 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
@ -23,10 +23,9 @@ process BEDTOOLS_BAMTOBED {
output:
tuple val(meta), path("*.bed"), emit: bed
path "*.version.txt" , emit: version
path "versions.yml" , emit: versions
script:
def software = getSoftwareName(task.process)
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
"""
bedtools \\
@ -35,6 +34,9 @@ process BEDTOOLS_BAMTOBED {
-i $bam \\
| bedtools sort > ${prefix}.bed
bedtools --version | sed -e "s/bedtools v//g" > ${software}.version.txt
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$(bedtools --version | sed -e "s/bedtools v//g")
END_VERSIONS
"""
}

View file

@ -28,10 +28,10 @@ output:
type: file
description: Bed file containing genomic intervals.
pattern: "*.{bed}"
- version:
- versions:
type: file
description: File containing software version
pattern: "*.{version.txt}"
description: File containing software versions
pattern: "versions.yml"
authors:
- "@yuukiiwa"
- "@drpatelh"

View file

@ -9,6 +9,13 @@ 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
//
@ -37,9 +44,13 @@ def getPathFromList(path_list) {
// Function to save/publish module results
//
def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// 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) {
@ -65,4 +76,3 @@ def saveFiles(Map args) {
return "${getPathFromList(path_list)}/$args.filename"
}
}
}

View file

@ -1,5 +1,5 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
@ -24,10 +24,9 @@ process BEDTOOLS_COMPLEMENT {
output:
tuple val(meta), path('*.bed'), emit: bed
path '*.version.txt' , emit: version
path "versions.yml" , emit: versions
script:
def software = getSoftwareName(task.process)
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
"""
bedtools \\
@ -37,6 +36,9 @@ process BEDTOOLS_COMPLEMENT {
$options.args \\
> ${prefix}.bed
bedtools --version | sed -e "s/bedtools v//g" > ${software}.version.txt
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$(bedtools --version | sed -e "s/bedtools v//g")
END_VERSIONS
"""
}

View file

@ -32,10 +32,10 @@ output:
type: file
description: Bed file with all genomic intervals that are not covered by at least one record from the input file.
pattern: "*.{bed}"
- version:
- versions:
type: file
description: File containing software version
pattern: "*.{version.txt}"
description: File containing software versions
pattern: "versions.yml"
authors:
- "@Emiller88"
- "@sruthipsuresh"

View file

@ -9,6 +9,13 @@ 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
//
@ -37,9 +44,13 @@ def getPathFromList(path_list) {
// Function to save/publish module results
//
def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// 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) {
@ -65,4 +76,3 @@ def saveFiles(Map args) {
return "${getPathFromList(path_list)}/$args.filename"
}
}
}

View file

@ -1,5 +1,5 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
@ -25,10 +25,9 @@ process BEDTOOLS_GENOMECOV {
output:
tuple val(meta), path("*.${extension}"), emit: genomecov
path "*.version.txt" , emit: version
path "versions.yml" , emit: versions
script:
def software = getSoftwareName(task.process)
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
if (intervals.name =~ /\.bam/) {
"""
@ -38,7 +37,10 @@ process BEDTOOLS_GENOMECOV {
$options.args \\
> ${prefix}.${extension}
bedtools --version | sed -e "s/bedtools v//g" > ${software}.version.txt
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$(bedtools --version | sed -e "s/bedtools v//g")
END_VERSIONS
"""
} else {
"""
@ -49,7 +51,10 @@ process BEDTOOLS_GENOMECOV {
$options.args \\
> ${prefix}.${extension}
bedtools --version | sed -e "s/bedtools v//g" > ${software}.version.txt
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$(bedtools --version | sed -e "s/bedtools v//g")
END_VERSIONS
"""
}
}

View file

@ -35,10 +35,10 @@ output:
type: file
description: Computed genome coverage file
pattern: "*.${extension}"
- version:
- versions:
type: file
description: File containing software version
pattern: "*.{version.txt}"
description: File containing software versions
pattern: "versions.yml"
authors:
- "@Emiller88"
- "@sruthipsuresh"

View file

@ -9,6 +9,13 @@ 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
//
@ -37,9 +44,13 @@ def getPathFromList(path_list) {
// Function to save/publish module results
//
def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// 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) {
@ -65,4 +76,3 @@ def saveFiles(Map args) {
return "${getPathFromList(path_list)}/$args.filename"
}
}
}

View file

@ -1,5 +1,5 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
@ -24,10 +24,9 @@ process BEDTOOLS_GETFASTA {
output:
path "*.fa" , emit: fasta
path "*.version.txt", emit: version
path "versions.yml" , emit: versions
script:
def software = getSoftwareName(task.process)
def prefix = options.suffix ? "${bed.baseName}${options.suffix}" : "${bed.baseName}"
"""
bedtools \\
@ -37,6 +36,9 @@ process BEDTOOLS_GETFASTA {
-bed $bed \\
-fo ${prefix}.fa
bedtools --version | sed -e "s/bedtools v//g" > ${software}.version.txt
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$(bedtools --version | sed -e "s/bedtools v//g")
END_VERSIONS
"""
}

View file

@ -24,10 +24,10 @@ output:
type: file
description: Output fasta file with extracted sequences
pattern: "*.{fa}"
- version:
- versions:
type: file
description: File containing software version
pattern: "*.{version.txt}"
description: File containing software versions
pattern: "versions.yml"
authors:
- "@joseespinosa"
- "@drpatelh"

View file

@ -9,6 +9,13 @@ 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
//
@ -37,9 +44,13 @@ def getPathFromList(path_list) {
// Function to save/publish module results
//
def saveFiles(Map args) {
if (!args.filename.endsWith('.version.txt')) {
def ioptions = initOptions(args.options)
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
// 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) {
@ -65,4 +76,3 @@ def saveFiles(Map args) {
return "${getPathFromList(path_list)}/$args.filename"
}
}
}

View file

@ -1,5 +1,5 @@
// Import generic module functions
include { initOptions; saveFiles; getSoftwareName } from './functions'
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
@ -24,10 +24,9 @@ process BEDTOOLS_INTERSECT {
output:
tuple val(meta), path("*.${extension}"), emit: intersect
path '*.version.txt' , emit: version
path "versions.yml" , emit: versions
script:
def software = getSoftwareName(task.process)
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
"""
bedtools \\
@ -37,6 +36,9 @@ process BEDTOOLS_INTERSECT {
$options.args \\
> ${prefix}.${extension}
bedtools --version | sed -e "s/bedtools v//g" > ${software}.version.txt
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$(bedtools --version | sed -e "s/bedtools v//g")
END_VERSIONS
"""
}

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