mirror of
https://github.com/MillironX/nf-core_modules.git
synced 2024-12-24 11:48:17 +00:00
Merge remote-tracking branch 'nf-core/master'
This commit is contained in:
commit
d437618e2c
983 changed files with 18868 additions and 8398 deletions
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
|
@ -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 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.
|
- [ ] If necessary, include test data in your PR.
|
||||||
- [ ] Remove all TODO statements.
|
- [ ] Remove all TODO statements.
|
||||||
- [ ] Emit the `<SOFTWARE>.version.txt` file.
|
- [ ] Emit the `versions.yml` file.
|
||||||
- [ ] Follow the naming conventions.
|
- [ ] Follow the naming conventions.
|
||||||
- [ ] Follow the parameters requirements.
|
- [ ] Follow the parameters requirements.
|
||||||
- [ ] Follow the input/output options guidelines.
|
- [ ] Follow the input/output options guidelines.
|
||||||
|
|
7
.github/workflows/code-linting.yml
vendored
7
.github/workflows/code-linting.yml
vendored
|
@ -1,5 +1,10 @@
|
||||||
name: Code Linting
|
name: Code Linting
|
||||||
on: [push, pull_request]
|
on:
|
||||||
|
push:
|
||||||
|
branches: [master]
|
||||||
|
pull_request:
|
||||||
|
branches: [master]
|
||||||
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
Markdown:
|
Markdown:
|
||||||
|
|
9
.github/workflows/nf-core-linting.yml
vendored
9
.github/workflows/nf-core-linting.yml
vendored
|
@ -1,7 +1,12 @@
|
||||||
name: nf-core linting
|
name: nf-core linting
|
||||||
# This workflow is triggered on pushes and PRs to the repository.
|
# 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
|
# 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:
|
jobs:
|
||||||
changes:
|
changes:
|
||||||
|
@ -66,6 +71,8 @@ jobs:
|
||||||
|
|
||||||
- name: Lint ${{ matrix.tags }}
|
- name: Lint ${{ matrix.tags }}
|
||||||
run: nf-core modules lint ${{ matrix.tags }}
|
run: nf-core modules lint ${{ matrix.tags }}
|
||||||
|
# HACK
|
||||||
|
if: startsWith( matrix.tags, 'subworkflow' ) != true
|
||||||
|
|
||||||
- uses: actions/cache@v2
|
- uses: actions/cache@v2
|
||||||
with:
|
with:
|
||||||
|
|
126
.github/workflows/pytest-workflow.yml
vendored
126
.github/workflows/pytest-workflow.yml
vendored
|
@ -1,9 +1,16 @@
|
||||||
name: Pytest-workflow
|
name: Pytest-workflow
|
||||||
on: [push, pull_request]
|
on:
|
||||||
|
push:
|
||||||
|
branches: [master]
|
||||||
|
pull_request:
|
||||||
|
branches: [master]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
changes:
|
###########
|
||||||
name: Check for changes
|
# Modules #
|
||||||
|
###########
|
||||||
|
module_changes:
|
||||||
|
name: Check for changes in the modules
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
outputs:
|
||||||
# Expose matched filters as job 'modules' output variable
|
# Expose matched filters as job 'modules' output variable
|
||||||
|
@ -16,17 +23,17 @@ jobs:
|
||||||
with:
|
with:
|
||||||
filters: "tests/config/pytest_modules.yml"
|
filters: "tests/config/pytest_modules.yml"
|
||||||
|
|
||||||
test:
|
module_test:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
|
|
||||||
name: ${{ matrix.tags }} ${{ matrix.profile }} ${{ matrix.nxf_version }}
|
name: ${{ matrix.tags }} ${{ matrix.profile }} ${{ matrix.nxf_version }}
|
||||||
needs: changes
|
needs: module_changes
|
||||||
if: needs.changes.outputs.modules != '[]'
|
if: needs.module_changes.outputs.modules != '[]'
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
nxf_version: ["21.04.0"]
|
nxf_version: ["21.04.0"]
|
||||||
tags: ["${{ fromJson(needs.changes.outputs.modules) }}"]
|
tags: ${{ fromJson(needs.module_changes.outputs.modules) }}
|
||||||
profile: ["docker", "singularity", "conda"]
|
profile: ["docker", "singularity", "conda"]
|
||||||
env:
|
env:
|
||||||
NXF_ANSI_LOG: false
|
NXF_ANSI_LOG: false
|
||||||
|
@ -89,7 +96,110 @@ jobs:
|
||||||
# Test the module
|
# Test the module
|
||||||
- name: Run pytest-workflow
|
- name: Run pytest-workflow
|
||||||
# only use one thread for pytest-workflow to avoid race condition on conda cache.
|
# only use one thread for pytest-workflow to avoid race condition on conda cache.
|
||||||
run: 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
|
- name: Upload logs on failure
|
||||||
if: failure()
|
if: failure()
|
||||||
|
|
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -5,6 +5,9 @@ test_output/
|
||||||
output/
|
output/
|
||||||
.DS_Store
|
.DS_Store
|
||||||
*.code-workspace
|
*.code-workspace
|
||||||
|
tests/data/
|
||||||
.screenrc
|
.screenrc
|
||||||
.*.sw?
|
.*.sw?
|
||||||
tests/data/
|
__pycache__
|
||||||
|
*.pyo
|
||||||
|
*.pyc
|
||||||
|
|
|
@ -9,6 +9,13 @@ def getSoftwareName(task_process) {
|
||||||
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
|
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
|
// Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
|
||||||
//
|
//
|
||||||
|
@ -37,32 +44,35 @@ def getPathFromList(path_list) {
|
||||||
// Function to save/publish module results
|
// Function to save/publish module results
|
||||||
//
|
//
|
||||||
def saveFiles(Map args) {
|
def saveFiles(Map args) {
|
||||||
if (!args.filename.endsWith('.version.txt')) {
|
def ioptions = initOptions(args.options)
|
||||||
def ioptions = initOptions(args.options)
|
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
||||||
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
|
||||||
if (ioptions.publish_by_meta) {
|
// Do not publish versions.yml unless running from pytest workflow
|
||||||
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
|
||||||
for (key in key_list) {
|
return null
|
||||||
if (args.meta && key instanceof String) {
|
}
|
||||||
def path = key
|
if (ioptions.publish_by_meta) {
|
||||||
if (args.meta.containsKey(key)) {
|
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
||||||
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
|
for (key in key_list) {
|
||||||
}
|
if (args.meta && key instanceof String) {
|
||||||
path = path instanceof String ? path : ''
|
def path = key
|
||||||
path_list.add(path)
|
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 (ioptions.publish_files instanceof Map) {
|
||||||
if (args.filename.endsWith(ext.key)) {
|
for (ext in ioptions.publish_files) {
|
||||||
def ext_list = path_list.collect()
|
if (args.filename.endsWith(ext.key)) {
|
||||||
ext_list.add(ext.value)
|
def ext_list = path_list.collect()
|
||||||
return "${getPathFromList(ext_list)}/$args.filename"
|
ext_list.add(ext.value)
|
||||||
}
|
return "${getPathFromList(ext_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
} else if (ioptions.publish_files == null) {
|
}
|
||||||
return "${getPathFromList(path_list)}/$args.filename"
|
} else if (ioptions.publish_files == null) {
|
||||||
}
|
return "${getPathFromList(path_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Import generic module functions
|
// Import generic module functions
|
||||||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
|
||||||
|
|
||||||
params.options = [:]
|
params.options = [:]
|
||||||
options = initOptions(params.options)
|
options = initOptions(params.options)
|
||||||
|
@ -24,10 +24,9 @@ process ABACAS {
|
||||||
|
|
||||||
output:
|
output:
|
||||||
tuple val(meta), path('*.abacas*'), emit: results
|
tuple val(meta), path('*.abacas*'), emit: results
|
||||||
path '*.version.txt' , emit: version
|
path "versions.yml" , emit: versions
|
||||||
|
|
||||||
script:
|
script:
|
||||||
def software = getSoftwareName(task.process)
|
|
||||||
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||||
"""
|
"""
|
||||||
abacas.pl \\
|
abacas.pl \\
|
||||||
|
@ -40,6 +39,9 @@ process ABACAS {
|
||||||
mv nucmer.filtered.delta ${prefix}.abacas.nucmer.filtered.delta
|
mv nucmer.filtered.delta ${prefix}.abacas.nucmer.filtered.delta
|
||||||
mv nucmer.tiling ${prefix}.abacas.nucmer.tiling
|
mv nucmer.tiling ${prefix}.abacas.nucmer.tiling
|
||||||
mv unused_contigs.out ${prefix}.abacas.unused.contigs.out
|
mv unused_contigs.out ${prefix}.abacas.unused.contigs.out
|
||||||
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
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,10 +48,10 @@ output:
|
||||||
'test.abacas.MULTIFASTA.fa' ]
|
'test.abacas.MULTIFASTA.fa' ]
|
||||||
pattern: "*.{abacas}*"
|
pattern: "*.{abacas}*"
|
||||||
|
|
||||||
- version:
|
- versions:
|
||||||
type: file
|
type: file
|
||||||
description: File containing software version
|
description: File containing software versions
|
||||||
pattern: "*.{version.txt}"
|
pattern: "versions.yml"
|
||||||
|
|
||||||
authors:
|
authors:
|
||||||
- "@joseespinosa"
|
- "@joseespinosa"
|
||||||
|
|
|
@ -9,6 +9,13 @@ def getSoftwareName(task_process) {
|
||||||
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
|
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
|
// Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
|
||||||
//
|
//
|
||||||
|
@ -37,32 +44,35 @@ def getPathFromList(path_list) {
|
||||||
// Function to save/publish module results
|
// Function to save/publish module results
|
||||||
//
|
//
|
||||||
def saveFiles(Map args) {
|
def saveFiles(Map args) {
|
||||||
if (!args.filename.endsWith('.version.txt')) {
|
def ioptions = initOptions(args.options)
|
||||||
def ioptions = initOptions(args.options)
|
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
||||||
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
|
||||||
if (ioptions.publish_by_meta) {
|
// Do not publish versions.yml unless running from pytest workflow
|
||||||
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
|
||||||
for (key in key_list) {
|
return null
|
||||||
if (args.meta && key instanceof String) {
|
}
|
||||||
def path = key
|
if (ioptions.publish_by_meta) {
|
||||||
if (args.meta.containsKey(key)) {
|
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
||||||
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
|
for (key in key_list) {
|
||||||
}
|
if (args.meta && key instanceof String) {
|
||||||
path = path instanceof String ? path : ''
|
def path = key
|
||||||
path_list.add(path)
|
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 (ioptions.publish_files instanceof Map) {
|
||||||
if (args.filename.endsWith(ext.key)) {
|
for (ext in ioptions.publish_files) {
|
||||||
def ext_list = path_list.collect()
|
if (args.filename.endsWith(ext.key)) {
|
||||||
ext_list.add(ext.value)
|
def ext_list = path_list.collect()
|
||||||
return "${getPathFromList(ext_list)}/$args.filename"
|
ext_list.add(ext.value)
|
||||||
}
|
return "${getPathFromList(ext_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
} else if (ioptions.publish_files == null) {
|
}
|
||||||
return "${getPathFromList(path_list)}/$args.filename"
|
} else if (ioptions.publish_files == null) {
|
||||||
}
|
return "${getPathFromList(path_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
|
||||||
|
|
||||||
params.options = [:]
|
params.options = [:]
|
||||||
options = initOptions(params.options)
|
options = initOptions(params.options)
|
||||||
|
@ -23,10 +23,9 @@ process ADAPTERREMOVAL {
|
||||||
output:
|
output:
|
||||||
tuple val(meta), path('*.fastq.gz'), emit: reads
|
tuple val(meta), path('*.fastq.gz'), emit: reads
|
||||||
tuple val(meta), path('*.log') , emit: log
|
tuple val(meta), path('*.log') , emit: log
|
||||||
path "*.version.txt" , emit: version
|
path "versions.yml" , emit: versions
|
||||||
|
|
||||||
script:
|
script:
|
||||||
def software = getSoftwareName(task.process)
|
|
||||||
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||||
|
|
||||||
if (meta.single_end) {
|
if (meta.single_end) {
|
||||||
|
@ -41,7 +40,10 @@ process ADAPTERREMOVAL {
|
||||||
--seed 42 \\
|
--seed 42 \\
|
||||||
--gzip \\
|
--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) {
|
} else if (!meta.single_end && !meta.collapse) {
|
||||||
"""
|
"""
|
||||||
|
@ -57,7 +59,10 @@ process ADAPTERREMOVAL {
|
||||||
--seed 42 \\
|
--seed 42 \\
|
||||||
--gzip \\
|
--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 {
|
} else {
|
||||||
"""
|
"""
|
||||||
|
@ -73,7 +78,10 @@ process ADAPTERREMOVAL {
|
||||||
--gzip \\
|
--gzip \\
|
||||||
|
|
||||||
cat *.collapsed.gz *.collapsed.truncated.gz > ${prefix}.merged.fastq.gz
|
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
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,10 +41,10 @@ output:
|
||||||
type: file
|
type: file
|
||||||
description: AdapterRemoval log file
|
description: AdapterRemoval log file
|
||||||
pattern: "*.log"
|
pattern: "*.log"
|
||||||
- version:
|
- versions:
|
||||||
type: file
|
type: file
|
||||||
description: File containing software version
|
description: File containing software versions
|
||||||
pattern: "*.{version.txt}"
|
pattern: "versions.yml"
|
||||||
|
|
||||||
authors:
|
authors:
|
||||||
- "@maxibor"
|
- "@maxibor"
|
||||||
|
|
|
@ -9,6 +9,13 @@ def getSoftwareName(task_process) {
|
||||||
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
|
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
|
// Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
|
||||||
//
|
//
|
||||||
|
@ -37,32 +44,35 @@ def getPathFromList(path_list) {
|
||||||
// Function to save/publish module results
|
// Function to save/publish module results
|
||||||
//
|
//
|
||||||
def saveFiles(Map args) {
|
def saveFiles(Map args) {
|
||||||
if (!args.filename.endsWith('.version.txt')) {
|
def ioptions = initOptions(args.options)
|
||||||
def ioptions = initOptions(args.options)
|
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
||||||
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
|
||||||
if (ioptions.publish_by_meta) {
|
// Do not publish versions.yml unless running from pytest workflow
|
||||||
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
|
||||||
for (key in key_list) {
|
return null
|
||||||
if (args.meta && key instanceof String) {
|
}
|
||||||
def path = key
|
if (ioptions.publish_by_meta) {
|
||||||
if (args.meta.containsKey(key)) {
|
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
||||||
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
|
for (key in key_list) {
|
||||||
}
|
if (args.meta && key instanceof String) {
|
||||||
path = path instanceof String ? path : ''
|
def path = key
|
||||||
path_list.add(path)
|
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 (ioptions.publish_files instanceof Map) {
|
||||||
if (args.filename.endsWith(ext.key)) {
|
for (ext in ioptions.publish_files) {
|
||||||
def ext_list = path_list.collect()
|
if (args.filename.endsWith(ext.key)) {
|
||||||
ext_list.add(ext.value)
|
def ext_list = path_list.collect()
|
||||||
return "${getPathFromList(ext_list)}/$args.filename"
|
ext_list.add(ext.value)
|
||||||
}
|
return "${getPathFromList(ext_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
} else if (ioptions.publish_files == null) {
|
}
|
||||||
return "${getPathFromList(path_list)}/$args.filename"
|
} else if (ioptions.publish_files == null) {
|
||||||
}
|
return "${getPathFromList(path_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Import generic module functions
|
// Import generic module functions
|
||||||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
|
||||||
|
|
||||||
params.options = [:]
|
params.options = [:]
|
||||||
options = initOptions(params.options)
|
options = initOptions(params.options)
|
||||||
|
@ -24,16 +24,18 @@ process AGRVATE {
|
||||||
output:
|
output:
|
||||||
tuple val(meta), path("${fasta.baseName}-results/${fasta.baseName}-summary.tab"), emit: summary
|
tuple val(meta), path("${fasta.baseName}-results/${fasta.baseName}-summary.tab"), emit: summary
|
||||||
path "${fasta.baseName}-results" , emit: results_dir
|
path "${fasta.baseName}-results" , emit: results_dir
|
||||||
path "*.version.txt" , emit: version
|
path "versions.yml" , emit: versions
|
||||||
|
|
||||||
script:
|
script:
|
||||||
def software = getSoftwareName(task.process)
|
|
||||||
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||||
"""
|
"""
|
||||||
agrvate \\
|
agrvate \\
|
||||||
$options.args \\
|
$options.args \\
|
||||||
-i $fasta
|
-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
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,9 +38,9 @@ output:
|
||||||
type: directory
|
type: directory
|
||||||
description: Results of the agrvate assessement
|
description: Results of the agrvate assessement
|
||||||
pattern: "*-results"
|
pattern: "*-results"
|
||||||
- version:
|
- versions:
|
||||||
type: file
|
type: file
|
||||||
description: File containing software version
|
description: File containing software versions
|
||||||
pattern: "*.{version.txt}"
|
pattern: "versions.yml"
|
||||||
authors:
|
authors:
|
||||||
- "@abhi18av"
|
- "@abhi18av"
|
||||||
|
|
|
@ -9,6 +9,13 @@ def getSoftwareName(task_process) {
|
||||||
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
|
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
|
// Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
|
||||||
//
|
//
|
||||||
|
@ -37,32 +44,35 @@ def getPathFromList(path_list) {
|
||||||
// Function to save/publish module results
|
// Function to save/publish module results
|
||||||
//
|
//
|
||||||
def saveFiles(Map args) {
|
def saveFiles(Map args) {
|
||||||
if (!args.filename.endsWith('.version.txt')) {
|
def ioptions = initOptions(args.options)
|
||||||
def ioptions = initOptions(args.options)
|
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
||||||
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
|
||||||
if (ioptions.publish_by_meta) {
|
// Do not publish versions.yml unless running from pytest workflow
|
||||||
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
|
||||||
for (key in key_list) {
|
return null
|
||||||
if (args.meta && key instanceof String) {
|
}
|
||||||
def path = key
|
if (ioptions.publish_by_meta) {
|
||||||
if (args.meta.containsKey(key)) {
|
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
||||||
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
|
for (key in key_list) {
|
||||||
}
|
if (args.meta && key instanceof String) {
|
||||||
path = path instanceof String ? path : ''
|
def path = key
|
||||||
path_list.add(path)
|
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 (ioptions.publish_files instanceof Map) {
|
||||||
if (args.filename.endsWith(ext.key)) {
|
for (ext in ioptions.publish_files) {
|
||||||
def ext_list = path_list.collect()
|
if (args.filename.endsWith(ext.key)) {
|
||||||
ext_list.add(ext.value)
|
def ext_list = path_list.collect()
|
||||||
return "${getPathFromList(ext_list)}/$args.filename"
|
ext_list.add(ext.value)
|
||||||
}
|
return "${getPathFromList(ext_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
} else if (ioptions.publish_files == null) {
|
}
|
||||||
return "${getPathFromList(path_list)}/$args.filename"
|
} else if (ioptions.publish_files == null) {
|
||||||
}
|
return "${getPathFromList(path_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Import generic module functions
|
// Import generic module functions
|
||||||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
|
||||||
|
|
||||||
params.options = [:]
|
params.options = [:]
|
||||||
options = initOptions(params.options)
|
options = initOptions(params.options)
|
||||||
|
@ -24,10 +24,9 @@ process ALLELECOUNTER {
|
||||||
|
|
||||||
output:
|
output:
|
||||||
tuple val(meta), path("*.alleleCount"), emit: allelecount
|
tuple val(meta), path("*.alleleCount"), emit: allelecount
|
||||||
path "*.version.txt" , emit: version
|
path "versions.yml" , emit: versions
|
||||||
|
|
||||||
script:
|
script:
|
||||||
def software = getSoftwareName(task.process)
|
|
||||||
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||||
"""
|
"""
|
||||||
alleleCounter \\
|
alleleCounter \\
|
||||||
|
@ -36,6 +35,9 @@ process ALLELECOUNTER {
|
||||||
-b $bam \\
|
-b $bam \\
|
||||||
-o ${prefix}.alleleCount
|
-o ${prefix}.alleleCount
|
||||||
|
|
||||||
alleleCounter --version > ${software}.version.txt
|
cat <<-END_VERSIONS > versions.yml
|
||||||
|
${getProcessName(task.process)}:
|
||||||
|
${getSoftwareName(task.process)}: \$(alleleCounter --version)
|
||||||
|
END_VERSIONS
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,10 +39,10 @@ output:
|
||||||
description: |
|
description: |
|
||||||
Groovy Map containing sample information
|
Groovy Map containing sample information
|
||||||
e.g. [ id:'test', single_end:false ]
|
e.g. [ id:'test', single_end:false ]
|
||||||
- version:
|
- versions:
|
||||||
type: file
|
type: file
|
||||||
description: File containing software version
|
description: File containing software versions
|
||||||
pattern: "*.{version.txt}"
|
pattern: "versions.yml"
|
||||||
- alleleCount:
|
- alleleCount:
|
||||||
type: file
|
type: file
|
||||||
description: Allele count file
|
description: Allele count file
|
||||||
|
|
78
modules/amps/functions.nf
Normal file
78
modules/amps/functions.nf
Normal 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
47
modules/amps/main.nf
Normal 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
66
modules/amps/meta.yml
Normal 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"
|
|
@ -9,6 +9,13 @@ def getSoftwareName(task_process) {
|
||||||
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
|
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
|
// Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
|
||||||
//
|
//
|
||||||
|
@ -37,32 +44,35 @@ def getPathFromList(path_list) {
|
||||||
// Function to save/publish module results
|
// Function to save/publish module results
|
||||||
//
|
//
|
||||||
def saveFiles(Map args) {
|
def saveFiles(Map args) {
|
||||||
if (!args.filename.endsWith('.version.txt')) {
|
def ioptions = initOptions(args.options)
|
||||||
def ioptions = initOptions(args.options)
|
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
||||||
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
|
||||||
if (ioptions.publish_by_meta) {
|
// Do not publish versions.yml unless running from pytest workflow
|
||||||
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
|
||||||
for (key in key_list) {
|
return null
|
||||||
if (args.meta && key instanceof String) {
|
}
|
||||||
def path = key
|
if (ioptions.publish_by_meta) {
|
||||||
if (args.meta.containsKey(key)) {
|
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
||||||
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
|
for (key in key_list) {
|
||||||
}
|
if (args.meta && key instanceof String) {
|
||||||
path = path instanceof String ? path : ''
|
def path = key
|
||||||
path_list.add(path)
|
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 (ioptions.publish_files instanceof Map) {
|
||||||
if (args.filename.endsWith(ext.key)) {
|
for (ext in ioptions.publish_files) {
|
||||||
def ext_list = path_list.collect()
|
if (args.filename.endsWith(ext.key)) {
|
||||||
ext_list.add(ext.value)
|
def ext_list = path_list.collect()
|
||||||
return "${getPathFromList(ext_list)}/$args.filename"
|
ext_list.add(ext.value)
|
||||||
}
|
return "${getPathFromList(ext_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
} else if (ioptions.publish_files == null) {
|
}
|
||||||
return "${getPathFromList(path_list)}/$args.filename"
|
} else if (ioptions.publish_files == null) {
|
||||||
}
|
return "${getPathFromList(path_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Import generic module functions
|
// Import generic module functions
|
||||||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
|
||||||
|
|
||||||
params.options = [:]
|
params.options = [:]
|
||||||
options = initOptions(params.options)
|
options = initOptions(params.options)
|
||||||
|
@ -26,10 +26,9 @@ process ARRIBA {
|
||||||
output:
|
output:
|
||||||
tuple val(meta), path("*.fusions.tsv") , emit: fusions
|
tuple val(meta), path("*.fusions.tsv") , emit: fusions
|
||||||
tuple val(meta), path("*.fusions.discarded.tsv"), emit: fusions_fail
|
tuple val(meta), path("*.fusions.discarded.tsv"), emit: fusions_fail
|
||||||
path "*.version.txt" , emit: version
|
path "versions.yml" , emit: versions
|
||||||
|
|
||||||
script:
|
script:
|
||||||
def software = getSoftwareName(task.process)
|
|
||||||
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||||
def blacklist = (options.args.contains('-b')) ? '' : '-f blacklist'
|
def blacklist = (options.args.contains('-b')) ? '' : '-f blacklist'
|
||||||
"""
|
"""
|
||||||
|
@ -42,6 +41,9 @@ process ARRIBA {
|
||||||
$blacklist \\
|
$blacklist \\
|
||||||
$options.args
|
$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
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,10 +37,10 @@ output:
|
||||||
description: |
|
description: |
|
||||||
Groovy Map containing sample information
|
Groovy Map containing sample information
|
||||||
e.g. [ id:'test', single_end:false ]
|
e.g. [ id:'test', single_end:false ]
|
||||||
- version:
|
- versions:
|
||||||
type: file
|
type: file
|
||||||
description: File containing software version
|
description: File containing software versions
|
||||||
pattern: "*.{version.txt}"
|
pattern: "versions.yml"
|
||||||
- fusions:
|
- fusions:
|
||||||
type: file
|
type: file
|
||||||
description: File contains fusions which pass all of Arriba's filters.
|
description: File contains fusions which pass all of Arriba's filters.
|
||||||
|
|
|
@ -9,6 +9,13 @@ def getSoftwareName(task_process) {
|
||||||
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
|
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
|
// Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
|
||||||
//
|
//
|
||||||
|
@ -37,32 +44,35 @@ def getPathFromList(path_list) {
|
||||||
// Function to save/publish module results
|
// Function to save/publish module results
|
||||||
//
|
//
|
||||||
def saveFiles(Map args) {
|
def saveFiles(Map args) {
|
||||||
if (!args.filename.endsWith('.version.txt')) {
|
def ioptions = initOptions(args.options)
|
||||||
def ioptions = initOptions(args.options)
|
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
||||||
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
|
||||||
if (ioptions.publish_by_meta) {
|
// Do not publish versions.yml unless running from pytest workflow
|
||||||
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
|
||||||
for (key in key_list) {
|
return null
|
||||||
if (args.meta && key instanceof String) {
|
}
|
||||||
def path = key
|
if (ioptions.publish_by_meta) {
|
||||||
if (args.meta.containsKey(key)) {
|
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
||||||
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
|
for (key in key_list) {
|
||||||
}
|
if (args.meta && key instanceof String) {
|
||||||
path = path instanceof String ? path : ''
|
def path = key
|
||||||
path_list.add(path)
|
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 (ioptions.publish_files instanceof Map) {
|
||||||
if (args.filename.endsWith(ext.key)) {
|
for (ext in ioptions.publish_files) {
|
||||||
def ext_list = path_list.collect()
|
if (args.filename.endsWith(ext.key)) {
|
||||||
ext_list.add(ext.value)
|
def ext_list = path_list.collect()
|
||||||
return "${getPathFromList(ext_list)}/$args.filename"
|
ext_list.add(ext.value)
|
||||||
}
|
return "${getPathFromList(ext_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
} else if (ioptions.publish_files == null) {
|
}
|
||||||
return "${getPathFromList(path_list)}/$args.filename"
|
} else if (ioptions.publish_files == null) {
|
||||||
}
|
return "${getPathFromList(path_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Import generic module functions
|
// Import generic module functions
|
||||||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
|
||||||
|
|
||||||
params.options = [:]
|
params.options = [:]
|
||||||
options = initOptions(params.options)
|
options = initOptions(params.options)
|
||||||
|
@ -23,10 +23,9 @@ process ARTIC_GUPPYPLEX {
|
||||||
|
|
||||||
output:
|
output:
|
||||||
tuple val(meta), path("*.fastq.gz"), emit: fastq
|
tuple val(meta), path("*.fastq.gz"), emit: fastq
|
||||||
path "*.version.txt" , emit: version
|
path "versions.yml" , emit: versions
|
||||||
|
|
||||||
script:
|
script:
|
||||||
def software = getSoftwareName(task.process)
|
|
||||||
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||||
"""
|
"""
|
||||||
artic \\
|
artic \\
|
||||||
|
@ -36,6 +35,9 @@ process ARTIC_GUPPYPLEX {
|
||||||
--output ${prefix}.fastq
|
--output ${prefix}.fastq
|
||||||
|
|
||||||
pigz -p $task.cpus *.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
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,10 +34,10 @@ output:
|
||||||
type: file
|
type: file
|
||||||
description: Aggregated FastQ files
|
description: Aggregated FastQ files
|
||||||
pattern: "*.{fastq.gz}"
|
pattern: "*.{fastq.gz}"
|
||||||
- version:
|
- versions:
|
||||||
type: file
|
type: file
|
||||||
description: File containing software version
|
description: File containing software versions
|
||||||
pattern: "*.{version.txt}"
|
pattern: "versions.yml"
|
||||||
|
|
||||||
authors:
|
authors:
|
||||||
- "@joseespinosa"
|
- "@joseespinosa"
|
||||||
|
|
|
@ -9,6 +9,13 @@ def getSoftwareName(task_process) {
|
||||||
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
|
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
|
// Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
|
||||||
//
|
//
|
||||||
|
@ -37,32 +44,35 @@ def getPathFromList(path_list) {
|
||||||
// Function to save/publish module results
|
// Function to save/publish module results
|
||||||
//
|
//
|
||||||
def saveFiles(Map args) {
|
def saveFiles(Map args) {
|
||||||
if (!args.filename.endsWith('.version.txt')) {
|
def ioptions = initOptions(args.options)
|
||||||
def ioptions = initOptions(args.options)
|
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
||||||
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
|
||||||
if (ioptions.publish_by_meta) {
|
// Do not publish versions.yml unless running from pytest workflow
|
||||||
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
|
||||||
for (key in key_list) {
|
return null
|
||||||
if (args.meta && key instanceof String) {
|
}
|
||||||
def path = key
|
if (ioptions.publish_by_meta) {
|
||||||
if (args.meta.containsKey(key)) {
|
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
||||||
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
|
for (key in key_list) {
|
||||||
}
|
if (args.meta && key instanceof String) {
|
||||||
path = path instanceof String ? path : ''
|
def path = key
|
||||||
path_list.add(path)
|
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 (ioptions.publish_files instanceof Map) {
|
||||||
if (args.filename.endsWith(ext.key)) {
|
for (ext in ioptions.publish_files) {
|
||||||
def ext_list = path_list.collect()
|
if (args.filename.endsWith(ext.key)) {
|
||||||
ext_list.add(ext.value)
|
def ext_list = path_list.collect()
|
||||||
return "${getPathFromList(ext_list)}/$args.filename"
|
ext_list.add(ext.value)
|
||||||
}
|
return "${getPathFromList(ext_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
} else if (ioptions.publish_files == null) {
|
}
|
||||||
return "${getPathFromList(path_list)}/$args.filename"
|
} else if (ioptions.publish_files == null) {
|
||||||
}
|
return "${getPathFromList(path_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Import generic module functions
|
// Import generic module functions
|
||||||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
|
||||||
|
|
||||||
params.options = [:]
|
params.options = [:]
|
||||||
options = initOptions(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") , emit: vcf
|
||||||
tuple val(meta), path("${prefix}.pass.vcf.gz.tbi") , emit: tbi
|
tuple val(meta), path("${prefix}.pass.vcf.gz.tbi") , emit: tbi
|
||||||
tuple val(meta), path("*.json"), optional:true , emit: json
|
tuple val(meta), path("*.json"), optional:true , emit: json
|
||||||
path "*.version.txt" , emit: version
|
path "versions.yml" , emit: versions
|
||||||
|
|
||||||
script:
|
script:
|
||||||
def software = getSoftwareName(task.process)
|
|
||||||
prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||||
def version = scheme_version.toString().toLowerCase().replaceAll('v','')
|
def version = scheme_version.toString().toLowerCase().replaceAll('v','')
|
||||||
def fast5 = params.fast5_dir ? "--fast5-directory $fast5_dir" : ""
|
def fast5 = params.fast5_dir ? "--fast5-directory $fast5_dir" : ""
|
||||||
|
@ -68,6 +67,9 @@ process ARTIC_MINION {
|
||||||
$scheme \\
|
$scheme \\
|
||||||
$prefix
|
$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
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,10 +103,10 @@ output:
|
||||||
type: file
|
type: file
|
||||||
description: JSON file for MultiQC
|
description: JSON file for MultiQC
|
||||||
pattern: "*.json"
|
pattern: "*.json"
|
||||||
- version:
|
- versions:
|
||||||
type: file
|
type: file
|
||||||
description: File containing software version
|
description: File containing software versions
|
||||||
pattern: "*.{version.txt}"
|
pattern: "versions.yml"
|
||||||
|
|
||||||
authors:
|
authors:
|
||||||
- "@joseespinosa"
|
- "@joseespinosa"
|
||||||
|
|
|
@ -9,6 +9,13 @@ def getSoftwareName(task_process) {
|
||||||
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
|
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
|
// Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
|
||||||
//
|
//
|
||||||
|
@ -37,32 +44,35 @@ def getPathFromList(path_list) {
|
||||||
// Function to save/publish module results
|
// Function to save/publish module results
|
||||||
//
|
//
|
||||||
def saveFiles(Map args) {
|
def saveFiles(Map args) {
|
||||||
if (!args.filename.endsWith('.version.txt')) {
|
def ioptions = initOptions(args.options)
|
||||||
def ioptions = initOptions(args.options)
|
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
||||||
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
|
||||||
if (ioptions.publish_by_meta) {
|
// Do not publish versions.yml unless running from pytest workflow
|
||||||
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
|
||||||
for (key in key_list) {
|
return null
|
||||||
if (args.meta && key instanceof String) {
|
}
|
||||||
def path = key
|
if (ioptions.publish_by_meta) {
|
||||||
if (args.meta.containsKey(key)) {
|
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
||||||
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
|
for (key in key_list) {
|
||||||
}
|
if (args.meta && key instanceof String) {
|
||||||
path = path instanceof String ? path : ''
|
def path = key
|
||||||
path_list.add(path)
|
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 (ioptions.publish_files instanceof Map) {
|
||||||
if (args.filename.endsWith(ext.key)) {
|
for (ext in ioptions.publish_files) {
|
||||||
def ext_list = path_list.collect()
|
if (args.filename.endsWith(ext.key)) {
|
||||||
ext_list.add(ext.value)
|
def ext_list = path_list.collect()
|
||||||
return "${getPathFromList(ext_list)}/$args.filename"
|
ext_list.add(ext.value)
|
||||||
}
|
return "${getPathFromList(ext_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
} else if (ioptions.publish_files == null) {
|
}
|
||||||
return "${getPathFromList(path_list)}/$args.filename"
|
} else if (ioptions.publish_files == null) {
|
||||||
}
|
return "${getPathFromList(path_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Import generic module functions
|
// Import generic module functions
|
||||||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
|
||||||
|
|
||||||
params.options = [:]
|
params.options = [:]
|
||||||
options = initOptions(params.options)
|
options = initOptions(params.options)
|
||||||
|
@ -23,10 +23,9 @@ process BAMALIGNCLEANER {
|
||||||
|
|
||||||
output:
|
output:
|
||||||
tuple val(meta), path("*.bam"), emit: bam
|
tuple val(meta), path("*.bam"), emit: bam
|
||||||
path "*.version.txt" , emit: version
|
path "versions.yml" , emit: versions
|
||||||
|
|
||||||
script:
|
script:
|
||||||
def software = getSoftwareName(task.process)
|
|
||||||
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
@ -35,6 +34,9 @@ process BAMALIGNCLEANER {
|
||||||
-o ${prefix}.bam \\
|
-o ${prefix}.bam \\
|
||||||
${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
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,10 +27,10 @@ output:
|
||||||
description: |
|
description: |
|
||||||
Groovy Map containing sample information
|
Groovy Map containing sample information
|
||||||
e.g. [ id:'test', single_end:false ]
|
e.g. [ id:'test', single_end:false ]
|
||||||
- version:
|
- versions:
|
||||||
type: file
|
type: file
|
||||||
description: File containing software version
|
description: File containing software versions
|
||||||
pattern: "*.{version.txt}"
|
pattern: "versions.yml"
|
||||||
- bam:
|
- bam:
|
||||||
type: file
|
type: file
|
||||||
description: Sorted BAM/CRAM file
|
description: Sorted BAM/CRAM file
|
||||||
|
|
78
modules/bamtools/split/functions.nf
Normal file
78
modules/bamtools/split/functions.nf
Normal 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"
|
||||||
|
}
|
||||||
|
}
|
41
modules/bamtools/split/main.nf
Normal file
41
modules/bamtools/split/main.nf
Normal 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
|
||||||
|
"""
|
||||||
|
}
|
45
modules/bamtools/split/meta.yml
Normal file
45
modules/bamtools/split/meta.yml
Normal 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"
|
|
@ -9,6 +9,13 @@ def getSoftwareName(task_process) {
|
||||||
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
|
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
|
// Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
|
||||||
//
|
//
|
||||||
|
@ -37,32 +44,35 @@ def getPathFromList(path_list) {
|
||||||
// Function to save/publish module results
|
// Function to save/publish module results
|
||||||
//
|
//
|
||||||
def saveFiles(Map args) {
|
def saveFiles(Map args) {
|
||||||
if (!args.filename.endsWith('.version.txt')) {
|
def ioptions = initOptions(args.options)
|
||||||
def ioptions = initOptions(args.options)
|
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
||||||
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
|
||||||
if (ioptions.publish_by_meta) {
|
// Do not publish versions.yml unless running from pytest workflow
|
||||||
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
|
||||||
for (key in key_list) {
|
return null
|
||||||
if (args.meta && key instanceof String) {
|
}
|
||||||
def path = key
|
if (ioptions.publish_by_meta) {
|
||||||
if (args.meta.containsKey(key)) {
|
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
||||||
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
|
for (key in key_list) {
|
||||||
}
|
if (args.meta && key instanceof String) {
|
||||||
path = path instanceof String ? path : ''
|
def path = key
|
||||||
path_list.add(path)
|
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 (ioptions.publish_files instanceof Map) {
|
||||||
if (args.filename.endsWith(ext.key)) {
|
for (ext in ioptions.publish_files) {
|
||||||
def ext_list = path_list.collect()
|
if (args.filename.endsWith(ext.key)) {
|
||||||
ext_list.add(ext.value)
|
def ext_list = path_list.collect()
|
||||||
return "${getPathFromList(ext_list)}/$args.filename"
|
ext_list.add(ext.value)
|
||||||
}
|
return "${getPathFromList(ext_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
} else if (ioptions.publish_files == null) {
|
}
|
||||||
return "${getPathFromList(path_list)}/$args.filename"
|
} else if (ioptions.publish_files == null) {
|
||||||
}
|
return "${getPathFromList(path_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Import generic module functions
|
// Import generic module functions
|
||||||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
|
||||||
|
|
||||||
params.options = [:]
|
params.options = [:]
|
||||||
options = initOptions(params.options)
|
options = initOptions(params.options)
|
||||||
|
@ -24,15 +24,17 @@ process BANDAGE_IMAGE {
|
||||||
output:
|
output:
|
||||||
tuple val(meta), path('*.png'), emit: png
|
tuple val(meta), path('*.png'), emit: png
|
||||||
tuple val(meta), path('*.svg'), emit: svg
|
tuple val(meta), path('*.svg'), emit: svg
|
||||||
path '*.version.txt' , emit: version
|
path "versions.yml" , emit: versions
|
||||||
|
|
||||||
script:
|
script:
|
||||||
def software = getSoftwareName(task.process)
|
|
||||||
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||||
"""
|
"""
|
||||||
Bandage image $gfa ${prefix}.png $options.args
|
Bandage image $gfa ${prefix}.png $options.args
|
||||||
Bandage image $gfa ${prefix}.svg $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
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,9 +35,9 @@ output:
|
||||||
type: file
|
type: file
|
||||||
description: Bandage image in SVG format
|
description: Bandage image in SVG format
|
||||||
pattern: "*.svg"
|
pattern: "*.svg"
|
||||||
- version:
|
- versions:
|
||||||
type: file
|
type: file
|
||||||
description: File containing software version
|
description: File containing software versions
|
||||||
pattern: "*.{version.txt}"
|
pattern: "versions.yml"
|
||||||
authors:
|
authors:
|
||||||
- "@heuermh"
|
- "@heuermh"
|
||||||
|
|
|
@ -9,6 +9,13 @@ def getSoftwareName(task_process) {
|
||||||
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
|
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
|
// Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
|
||||||
//
|
//
|
||||||
|
@ -37,32 +44,35 @@ def getPathFromList(path_list) {
|
||||||
// Function to save/publish module results
|
// Function to save/publish module results
|
||||||
//
|
//
|
||||||
def saveFiles(Map args) {
|
def saveFiles(Map args) {
|
||||||
if (!args.filename.endsWith('.version.txt')) {
|
def ioptions = initOptions(args.options)
|
||||||
def ioptions = initOptions(args.options)
|
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
||||||
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
|
||||||
if (ioptions.publish_by_meta) {
|
// Do not publish versions.yml unless running from pytest workflow
|
||||||
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
|
||||||
for (key in key_list) {
|
return null
|
||||||
if (args.meta && key instanceof String) {
|
}
|
||||||
def path = key
|
if (ioptions.publish_by_meta) {
|
||||||
if (args.meta.containsKey(key)) {
|
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
||||||
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
|
for (key in key_list) {
|
||||||
}
|
if (args.meta && key instanceof String) {
|
||||||
path = path instanceof String ? path : ''
|
def path = key
|
||||||
path_list.add(path)
|
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 (ioptions.publish_files instanceof Map) {
|
||||||
if (args.filename.endsWith(ext.key)) {
|
for (ext in ioptions.publish_files) {
|
||||||
def ext_list = path_list.collect()
|
if (args.filename.endsWith(ext.key)) {
|
||||||
ext_list.add(ext.value)
|
def ext_list = path_list.collect()
|
||||||
return "${getPathFromList(ext_list)}/$args.filename"
|
ext_list.add(ext.value)
|
||||||
}
|
return "${getPathFromList(ext_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
} else if (ioptions.publish_files == null) {
|
}
|
||||||
return "${getPathFromList(path_list)}/$args.filename"
|
} else if (ioptions.publish_files == null) {
|
||||||
}
|
return "${getPathFromList(path_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Import generic module functions
|
// Import generic module functions
|
||||||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
|
||||||
|
|
||||||
params.options = [:]
|
params.options = [:]
|
||||||
options = initOptions(params.options)
|
options = initOptions(params.options)
|
||||||
|
@ -24,10 +24,9 @@ process BBMAP_ALIGN {
|
||||||
|
|
||||||
output:
|
output:
|
||||||
tuple val(meta), path("*.bam"), emit: bam
|
tuple val(meta), path("*.bam"), emit: bam
|
||||||
path "*.version.txt" , emit: version
|
path "versions.yml" , emit: versions
|
||||||
|
|
||||||
script:
|
script:
|
||||||
def software = getSoftwareName(task.process)
|
|
||||||
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||||
|
|
||||||
input = meta.single_end ? "in=${fastq}" : "in=${fastq[0]} in2=${fastq[1]}"
|
input = meta.single_end ? "in=${fastq}" : "in=${fastq[0]} in2=${fastq[1]}"
|
||||||
|
@ -54,6 +53,11 @@ process BBMAP_ALIGN {
|
||||||
threads=$task.cpus \\
|
threads=$task.cpus \\
|
||||||
-Xmx${task.memory.toGiga()}g
|
-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
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,10 +39,10 @@ output:
|
||||||
description: |
|
description: |
|
||||||
Groovy Map containing sample information
|
Groovy Map containing sample information
|
||||||
e.g. [ id:'test', single_end:false ]
|
e.g. [ id:'test', single_end:false ]
|
||||||
- version:
|
- versions:
|
||||||
type: file
|
type: file
|
||||||
description: File containing software version
|
description: File containing software versions
|
||||||
pattern: "*.{version.txt}"
|
pattern: "versions.yml"
|
||||||
- bam:
|
- bam:
|
||||||
type: file
|
type: file
|
||||||
description: BAM file
|
description: BAM file
|
||||||
|
|
|
@ -9,6 +9,13 @@ def getSoftwareName(task_process) {
|
||||||
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
|
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
|
// Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
|
||||||
//
|
//
|
||||||
|
@ -37,32 +44,35 @@ def getPathFromList(path_list) {
|
||||||
// Function to save/publish module results
|
// Function to save/publish module results
|
||||||
//
|
//
|
||||||
def saveFiles(Map args) {
|
def saveFiles(Map args) {
|
||||||
if (!args.filename.endsWith('.version.txt')) {
|
def ioptions = initOptions(args.options)
|
||||||
def ioptions = initOptions(args.options)
|
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
||||||
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
|
||||||
if (ioptions.publish_by_meta) {
|
// Do not publish versions.yml unless running from pytest workflow
|
||||||
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
|
||||||
for (key in key_list) {
|
return null
|
||||||
if (args.meta && key instanceof String) {
|
}
|
||||||
def path = key
|
if (ioptions.publish_by_meta) {
|
||||||
if (args.meta.containsKey(key)) {
|
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
||||||
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
|
for (key in key_list) {
|
||||||
}
|
if (args.meta && key instanceof String) {
|
||||||
path = path instanceof String ? path : ''
|
def path = key
|
||||||
path_list.add(path)
|
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 (ioptions.publish_files instanceof Map) {
|
||||||
if (args.filename.endsWith(ext.key)) {
|
for (ext in ioptions.publish_files) {
|
||||||
def ext_list = path_list.collect()
|
if (args.filename.endsWith(ext.key)) {
|
||||||
ext_list.add(ext.value)
|
def ext_list = path_list.collect()
|
||||||
return "${getPathFromList(ext_list)}/$args.filename"
|
ext_list.add(ext.value)
|
||||||
}
|
return "${getPathFromList(ext_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
} else if (ioptions.publish_files == null) {
|
}
|
||||||
return "${getPathFromList(path_list)}/$args.filename"
|
} else if (ioptions.publish_files == null) {
|
||||||
}
|
return "${getPathFromList(path_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
|
||||||
|
|
||||||
params.options = [:]
|
params.options = [:]
|
||||||
options = initOptions(params.options)
|
options = initOptions(params.options)
|
||||||
|
@ -24,10 +24,9 @@ process BBMAP_BBDUK {
|
||||||
output:
|
output:
|
||||||
tuple val(meta), path('*.fastq.gz'), emit: reads
|
tuple val(meta), path('*.fastq.gz'), emit: reads
|
||||||
tuple val(meta), path('*.log') , emit: log
|
tuple val(meta), path('*.log') , emit: log
|
||||||
path '*.version.txt' , emit: version
|
path "versions.yml" , emit: versions
|
||||||
|
|
||||||
script:
|
script:
|
||||||
def software = getSoftwareName(task.process)
|
|
||||||
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
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 raw = meta.single_end ? "in=${reads[0]}" : "in1=${reads[0]} in2=${reads[1]}"
|
||||||
def trimmed = meta.single_end ? "out=${prefix}.fastq.gz" : "out1=${prefix}_1.fastq.gz out2=${prefix}_2.fastq.gz"
|
def trimmed = meta.single_end ? "out=${prefix}.fastq.gz" : "out1=${prefix}_1.fastq.gz out2=${prefix}_2.fastq.gz"
|
||||||
|
@ -42,6 +41,9 @@ process BBMAP_BBDUK {
|
||||||
$options.args \\
|
$options.args \\
|
||||||
$contaminants_fa \\
|
$contaminants_fa \\
|
||||||
&> ${prefix}.bbduk.log
|
&> ${prefix}.bbduk.log
|
||||||
echo \$(bbversion.sh) > ${software}.version.txt
|
cat <<-END_VERSIONS > versions.yml
|
||||||
|
${getProcessName(task.process)}:
|
||||||
|
${getSoftwareName(task.process)}: \$(bbversion.sh)
|
||||||
|
END_VERSIONS
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,10 +39,10 @@ output:
|
||||||
type: file
|
type: file
|
||||||
description: The trimmed/modified fastq reads
|
description: The trimmed/modified fastq reads
|
||||||
pattern: "*fastq.gz"
|
pattern: "*fastq.gz"
|
||||||
- version:
|
- versions:
|
||||||
type: file
|
type: file
|
||||||
description: File containing software version
|
description: File containing software versions
|
||||||
pattern: "*.{version.txt}"
|
pattern: "versions.yml"
|
||||||
- log:
|
- log:
|
||||||
type: file
|
type: file
|
||||||
description: Bbduk log file
|
description: Bbduk log file
|
||||||
|
|
78
modules/bbmap/bbsplit/functions.nf
Normal file
78
modules/bbmap/bbsplit/functions.nf
Normal 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"
|
||||||
|
}
|
||||||
|
}
|
94
modules/bbmap/bbsplit/main.nf
Normal file
94
modules/bbmap/bbsplit/main.nf
Normal 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
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
}
|
75
modules/bbmap/bbsplit/meta.yml
Normal file
75
modules/bbmap/bbsplit/meta.yml
Normal 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"
|
|
@ -9,6 +9,13 @@ def getSoftwareName(task_process) {
|
||||||
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
|
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
|
// Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
|
||||||
//
|
//
|
||||||
|
@ -37,32 +44,35 @@ def getPathFromList(path_list) {
|
||||||
// Function to save/publish module results
|
// Function to save/publish module results
|
||||||
//
|
//
|
||||||
def saveFiles(Map args) {
|
def saveFiles(Map args) {
|
||||||
if (!args.filename.endsWith('.version.txt')) {
|
def ioptions = initOptions(args.options)
|
||||||
def ioptions = initOptions(args.options)
|
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
||||||
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
|
||||||
if (ioptions.publish_by_meta) {
|
// Do not publish versions.yml unless running from pytest workflow
|
||||||
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
|
||||||
for (key in key_list) {
|
return null
|
||||||
if (args.meta && key instanceof String) {
|
}
|
||||||
def path = key
|
if (ioptions.publish_by_meta) {
|
||||||
if (args.meta.containsKey(key)) {
|
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
||||||
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
|
for (key in key_list) {
|
||||||
}
|
if (args.meta && key instanceof String) {
|
||||||
path = path instanceof String ? path : ''
|
def path = key
|
||||||
path_list.add(path)
|
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 (ioptions.publish_files instanceof Map) {
|
||||||
if (args.filename.endsWith(ext.key)) {
|
for (ext in ioptions.publish_files) {
|
||||||
def ext_list = path_list.collect()
|
if (args.filename.endsWith(ext.key)) {
|
||||||
ext_list.add(ext.value)
|
def ext_list = path_list.collect()
|
||||||
return "${getPathFromList(ext_list)}/$args.filename"
|
ext_list.add(ext.value)
|
||||||
}
|
return "${getPathFromList(ext_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
} else if (ioptions.publish_files == null) {
|
}
|
||||||
return "${getPathFromList(path_list)}/$args.filename"
|
} else if (ioptions.publish_files == null) {
|
||||||
}
|
return "${getPathFromList(path_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Import generic module functions
|
// Import generic module functions
|
||||||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
|
||||||
|
|
||||||
params.options = [:]
|
params.options = [:]
|
||||||
options = initOptions(params.options)
|
options = initOptions(params.options)
|
||||||
|
@ -23,10 +23,9 @@ process BBMAP_INDEX {
|
||||||
|
|
||||||
output:
|
output:
|
||||||
path 'ref' , emit: index
|
path 'ref' , emit: index
|
||||||
path "*.version.txt" , emit: version
|
path "versions.yml" , emit: versions
|
||||||
|
|
||||||
script:
|
script:
|
||||||
def software = getSoftwareName(task.process)
|
|
||||||
"""
|
"""
|
||||||
bbmap.sh \\
|
bbmap.sh \\
|
||||||
ref=${fasta} \\
|
ref=${fasta} \\
|
||||||
|
@ -34,6 +33,9 @@ process BBMAP_INDEX {
|
||||||
threads=$task.cpus \\
|
threads=$task.cpus \\
|
||||||
-Xmx${task.memory.toGiga()}g
|
-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
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,10 +20,10 @@ input:
|
||||||
pattern: "*.{fna,fa,fasta}"
|
pattern: "*.{fna,fa,fasta}"
|
||||||
|
|
||||||
output:
|
output:
|
||||||
- version:
|
- versions:
|
||||||
type: file
|
type: file
|
||||||
description: File containing software version
|
description: File containing software versions
|
||||||
pattern: "*.{version.txt}"
|
pattern: "versions.yml"
|
||||||
- db:
|
- db:
|
||||||
type: directory
|
type: directory
|
||||||
description: Directory with index files
|
description: Directory with index files
|
||||||
|
|
|
@ -9,6 +9,13 @@ def getSoftwareName(task_process) {
|
||||||
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
|
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
|
// Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
|
||||||
//
|
//
|
||||||
|
@ -37,32 +44,35 @@ def getPathFromList(path_list) {
|
||||||
// Function to save/publish module results
|
// Function to save/publish module results
|
||||||
//
|
//
|
||||||
def saveFiles(Map args) {
|
def saveFiles(Map args) {
|
||||||
if (!args.filename.endsWith('.version.txt')) {
|
def ioptions = initOptions(args.options)
|
||||||
def ioptions = initOptions(args.options)
|
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
||||||
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
|
||||||
if (ioptions.publish_by_meta) {
|
// Do not publish versions.yml unless running from pytest workflow
|
||||||
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
|
||||||
for (key in key_list) {
|
return null
|
||||||
if (args.meta && key instanceof String) {
|
}
|
||||||
def path = key
|
if (ioptions.publish_by_meta) {
|
||||||
if (args.meta.containsKey(key)) {
|
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
||||||
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
|
for (key in key_list) {
|
||||||
}
|
if (args.meta && key instanceof String) {
|
||||||
path = path instanceof String ? path : ''
|
def path = key
|
||||||
path_list.add(path)
|
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 (ioptions.publish_files instanceof Map) {
|
||||||
if (args.filename.endsWith(ext.key)) {
|
for (ext in ioptions.publish_files) {
|
||||||
def ext_list = path_list.collect()
|
if (args.filename.endsWith(ext.key)) {
|
||||||
ext_list.add(ext.value)
|
def ext_list = path_list.collect()
|
||||||
return "${getPathFromList(ext_list)}/$args.filename"
|
ext_list.add(ext.value)
|
||||||
}
|
return "${getPathFromList(ext_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
} else if (ioptions.publish_files == null) {
|
}
|
||||||
return "${getPathFromList(path_list)}/$args.filename"
|
} else if (ioptions.publish_files == null) {
|
||||||
}
|
return "${getPathFromList(path_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Import generic module functions
|
// Import generic module functions
|
||||||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
|
||||||
|
|
||||||
params.options = [:]
|
params.options = [:]
|
||||||
options = initOptions(params.options)
|
options = initOptions(params.options)
|
||||||
|
@ -23,10 +23,9 @@ process BCFTOOLS_CONCAT {
|
||||||
|
|
||||||
output:
|
output:
|
||||||
tuple val(meta), path("*.gz"), emit: vcf
|
tuple val(meta), path("*.gz"), emit: vcf
|
||||||
path "*.version.txt" , emit: version
|
path "versions.yml" , emit: versions
|
||||||
|
|
||||||
script:
|
script:
|
||||||
def software = getSoftwareName(task.process)
|
|
||||||
prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||||
"""
|
"""
|
||||||
bcftools concat \\
|
bcftools concat \\
|
||||||
|
@ -35,6 +34,9 @@ process BCFTOOLS_CONCAT {
|
||||||
--threads $task.cpus \\
|
--threads $task.cpus \\
|
||||||
${vcfs}
|
${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
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,9 +34,9 @@ output:
|
||||||
type: file
|
type: file
|
||||||
description: VCF concatenated output file
|
description: VCF concatenated output file
|
||||||
pattern: "*.{vcf.gz}"
|
pattern: "*.{vcf.gz}"
|
||||||
- version:
|
- versions:
|
||||||
type: file
|
type: file
|
||||||
description: File containing software version
|
description: File containing software versions
|
||||||
pattern: "*.{version.txt}"
|
pattern: "versions.yml"
|
||||||
authors:
|
authors:
|
||||||
- "@abhi18av"
|
- "@abhi18av"
|
||||||
|
|
|
@ -9,6 +9,13 @@ def getSoftwareName(task_process) {
|
||||||
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
|
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
|
// Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
|
||||||
//
|
//
|
||||||
|
@ -37,32 +44,35 @@ def getPathFromList(path_list) {
|
||||||
// Function to save/publish module results
|
// Function to save/publish module results
|
||||||
//
|
//
|
||||||
def saveFiles(Map args) {
|
def saveFiles(Map args) {
|
||||||
if (!args.filename.endsWith('.version.txt')) {
|
def ioptions = initOptions(args.options)
|
||||||
def ioptions = initOptions(args.options)
|
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
||||||
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
|
||||||
if (ioptions.publish_by_meta) {
|
// Do not publish versions.yml unless running from pytest workflow
|
||||||
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
|
||||||
for (key in key_list) {
|
return null
|
||||||
if (args.meta && key instanceof String) {
|
}
|
||||||
def path = key
|
if (ioptions.publish_by_meta) {
|
||||||
if (args.meta.containsKey(key)) {
|
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
||||||
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
|
for (key in key_list) {
|
||||||
}
|
if (args.meta && key instanceof String) {
|
||||||
path = path instanceof String ? path : ''
|
def path = key
|
||||||
path_list.add(path)
|
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 (ioptions.publish_files instanceof Map) {
|
||||||
if (args.filename.endsWith(ext.key)) {
|
for (ext in ioptions.publish_files) {
|
||||||
def ext_list = path_list.collect()
|
if (args.filename.endsWith(ext.key)) {
|
||||||
ext_list.add(ext.value)
|
def ext_list = path_list.collect()
|
||||||
return "${getPathFromList(ext_list)}/$args.filename"
|
ext_list.add(ext.value)
|
||||||
}
|
return "${getPathFromList(ext_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
} else if (ioptions.publish_files == null) {
|
}
|
||||||
return "${getPathFromList(path_list)}/$args.filename"
|
} else if (ioptions.publish_files == null) {
|
||||||
}
|
return "${getPathFromList(path_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Import generic module functions
|
// Import generic module functions
|
||||||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
|
||||||
|
|
||||||
params.options = [:]
|
params.options = [:]
|
||||||
options = initOptions(params.options)
|
options = initOptions(params.options)
|
||||||
|
@ -23,16 +23,18 @@ process BCFTOOLS_CONSENSUS {
|
||||||
|
|
||||||
output:
|
output:
|
||||||
tuple val(meta), path('*.fa'), emit: fasta
|
tuple val(meta), path('*.fa'), emit: fasta
|
||||||
path '*.version.txt' , emit: version
|
path "versions.yml" , emit: versions
|
||||||
|
|
||||||
script:
|
script:
|
||||||
def software = getSoftwareName(task.process)
|
|
||||||
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||||
"""
|
"""
|
||||||
cat $fasta | bcftools consensus $vcf $options.args > ${prefix}.fa
|
cat $fasta | bcftools consensus $vcf $options.args > ${prefix}.fa
|
||||||
header=\$(head -n 1 ${prefix}.fa | sed 's/>//g')
|
header=\$(head -n 1 ${prefix}.fa | sed 's/>//g')
|
||||||
sed -i 's/\${header}/${meta.id}/g' ${prefix}.fa
|
sed -i 's/\${header}/${meta.id}/g' ${prefix}.fa
|
||||||
|
|
||||||
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
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,10 +39,10 @@ output:
|
||||||
type: file
|
type: file
|
||||||
description: FASTA reference consensus file
|
description: FASTA reference consensus file
|
||||||
pattern: "*.{fasta,fa}"
|
pattern: "*.{fasta,fa}"
|
||||||
- version:
|
- versions:
|
||||||
type: file
|
type: file
|
||||||
description: File containing software version
|
description: File containing software versions
|
||||||
pattern: "*.{version.txt}"
|
pattern: "versions.yml"
|
||||||
authors:
|
authors:
|
||||||
- "@joseespinosa"
|
- "@joseespinosa"
|
||||||
- "@drpatelh"
|
- "@drpatelh"
|
||||||
|
|
|
@ -9,6 +9,13 @@ def getSoftwareName(task_process) {
|
||||||
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
|
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
|
// Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
|
||||||
//
|
//
|
||||||
|
@ -37,32 +44,35 @@ def getPathFromList(path_list) {
|
||||||
// Function to save/publish module results
|
// Function to save/publish module results
|
||||||
//
|
//
|
||||||
def saveFiles(Map args) {
|
def saveFiles(Map args) {
|
||||||
if (!args.filename.endsWith('.version.txt')) {
|
def ioptions = initOptions(args.options)
|
||||||
def ioptions = initOptions(args.options)
|
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
||||||
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
|
||||||
if (ioptions.publish_by_meta) {
|
// Do not publish versions.yml unless running from pytest workflow
|
||||||
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
|
||||||
for (key in key_list) {
|
return null
|
||||||
if (args.meta && key instanceof String) {
|
}
|
||||||
def path = key
|
if (ioptions.publish_by_meta) {
|
||||||
if (args.meta.containsKey(key)) {
|
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
||||||
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
|
for (key in key_list) {
|
||||||
}
|
if (args.meta && key instanceof String) {
|
||||||
path = path instanceof String ? path : ''
|
def path = key
|
||||||
path_list.add(path)
|
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 (ioptions.publish_files instanceof Map) {
|
||||||
if (args.filename.endsWith(ext.key)) {
|
for (ext in ioptions.publish_files) {
|
||||||
def ext_list = path_list.collect()
|
if (args.filename.endsWith(ext.key)) {
|
||||||
ext_list.add(ext.value)
|
def ext_list = path_list.collect()
|
||||||
return "${getPathFromList(ext_list)}/$args.filename"
|
ext_list.add(ext.value)
|
||||||
}
|
return "${getPathFromList(ext_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
} else if (ioptions.publish_files == null) {
|
}
|
||||||
return "${getPathFromList(path_list)}/$args.filename"
|
} else if (ioptions.publish_files == null) {
|
||||||
}
|
return "${getPathFromList(path_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Import generic module functions
|
// Import generic module functions
|
||||||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
|
||||||
|
|
||||||
params.options = [:]
|
params.options = [:]
|
||||||
options = initOptions(params.options)
|
options = initOptions(params.options)
|
||||||
|
@ -23,10 +23,9 @@ process BCFTOOLS_FILTER {
|
||||||
|
|
||||||
output:
|
output:
|
||||||
tuple val(meta), path("*.gz"), emit: vcf
|
tuple val(meta), path("*.gz"), emit: vcf
|
||||||
path "*.version.txt" , emit: version
|
path "versions.yml" , emit: versions
|
||||||
|
|
||||||
script:
|
script:
|
||||||
def software = getSoftwareName(task.process)
|
|
||||||
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||||
"""
|
"""
|
||||||
bcftools filter \\
|
bcftools filter \\
|
||||||
|
@ -34,6 +33,9 @@ process BCFTOOLS_FILTER {
|
||||||
$options.args \\
|
$options.args \\
|
||||||
$vcf
|
$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
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,10 +31,10 @@ output:
|
||||||
type: file
|
type: file
|
||||||
description: VCF filtered output file
|
description: VCF filtered output file
|
||||||
pattern: "*.{vcf}"
|
pattern: "*.{vcf}"
|
||||||
- version:
|
- versions:
|
||||||
type: file
|
type: file
|
||||||
description: File containing software version
|
description: File containing software versions
|
||||||
pattern: "*.{version.txt}"
|
pattern: "versions.yml"
|
||||||
authors:
|
authors:
|
||||||
- "@joseespinosa"
|
- "@joseespinosa"
|
||||||
- "@drpatelh"
|
- "@drpatelh"
|
||||||
|
|
78
modules/bcftools/index/functions.nf
Normal file
78
modules/bcftools/index/functions.nf
Normal 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"
|
||||||
|
}
|
||||||
|
}
|
44
modules/bcftools/index/main.nf
Normal file
44
modules/bcftools/index/main.nf
Normal 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
|
||||||
|
"""
|
||||||
|
}
|
49
modules/bcftools/index/meta.yml
Normal file
49
modules/bcftools/index/meta.yml
Normal 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"
|
|
@ -9,6 +9,13 @@ def getSoftwareName(task_process) {
|
||||||
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
|
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
|
// Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
|
||||||
//
|
//
|
||||||
|
@ -37,32 +44,35 @@ def getPathFromList(path_list) {
|
||||||
// Function to save/publish module results
|
// Function to save/publish module results
|
||||||
//
|
//
|
||||||
def saveFiles(Map args) {
|
def saveFiles(Map args) {
|
||||||
if (!args.filename.endsWith('.version.txt')) {
|
def ioptions = initOptions(args.options)
|
||||||
def ioptions = initOptions(args.options)
|
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
||||||
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
|
||||||
if (ioptions.publish_by_meta) {
|
// Do not publish versions.yml unless running from pytest workflow
|
||||||
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
|
||||||
for (key in key_list) {
|
return null
|
||||||
if (args.meta && key instanceof String) {
|
}
|
||||||
def path = key
|
if (ioptions.publish_by_meta) {
|
||||||
if (args.meta.containsKey(key)) {
|
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
||||||
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
|
for (key in key_list) {
|
||||||
}
|
if (args.meta && key instanceof String) {
|
||||||
path = path instanceof String ? path : ''
|
def path = key
|
||||||
path_list.add(path)
|
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 (ioptions.publish_files instanceof Map) {
|
||||||
if (args.filename.endsWith(ext.key)) {
|
for (ext in ioptions.publish_files) {
|
||||||
def ext_list = path_list.collect()
|
if (args.filename.endsWith(ext.key)) {
|
||||||
ext_list.add(ext.value)
|
def ext_list = path_list.collect()
|
||||||
return "${getPathFromList(ext_list)}/$args.filename"
|
ext_list.add(ext.value)
|
||||||
}
|
return "${getPathFromList(ext_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
} else if (ioptions.publish_files == null) {
|
}
|
||||||
return "${getPathFromList(path_list)}/$args.filename"
|
} else if (ioptions.publish_files == null) {
|
||||||
}
|
return "${getPathFromList(path_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Import generic module functions
|
// Import generic module functions
|
||||||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
|
||||||
|
|
||||||
params.options = [:]
|
params.options = [:]
|
||||||
options = initOptions(params.options)
|
options = initOptions(params.options)
|
||||||
|
@ -23,16 +23,18 @@ process BCFTOOLS_ISEC {
|
||||||
|
|
||||||
output:
|
output:
|
||||||
tuple val(meta), path("${prefix}"), emit: results
|
tuple val(meta), path("${prefix}"), emit: results
|
||||||
path "*.version.txt" , emit: version
|
path "versions.yml" , emit: versions
|
||||||
|
|
||||||
script:
|
script:
|
||||||
def software = getSoftwareName(task.process)
|
|
||||||
prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||||
"""
|
"""
|
||||||
bcftools isec \\
|
bcftools isec \\
|
||||||
$options.args \\
|
$options.args \\
|
||||||
-p $prefix \\
|
-p $prefix \\
|
||||||
*.vcf.gz
|
*.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
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,10 +39,10 @@ output:
|
||||||
type: directory
|
type: directory
|
||||||
description: Folder containing the set operations results perform on the vcf files
|
description: Folder containing the set operations results perform on the vcf files
|
||||||
pattern: "${prefix}"
|
pattern: "${prefix}"
|
||||||
- version:
|
- versions:
|
||||||
type: file
|
type: file
|
||||||
description: File containing software version
|
description: File containing software versions
|
||||||
pattern: "*.{version.txt}"
|
pattern: "versions.yml"
|
||||||
authors:
|
authors:
|
||||||
- "@joseespinosa"
|
- "@joseespinosa"
|
||||||
- "@drpatelh"
|
- "@drpatelh"
|
||||||
|
|
|
@ -9,6 +9,13 @@ def getSoftwareName(task_process) {
|
||||||
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
|
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
|
// Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
|
||||||
//
|
//
|
||||||
|
@ -37,32 +44,35 @@ def getPathFromList(path_list) {
|
||||||
// Function to save/publish module results
|
// Function to save/publish module results
|
||||||
//
|
//
|
||||||
def saveFiles(Map args) {
|
def saveFiles(Map args) {
|
||||||
if (!args.filename.endsWith('.version.txt')) {
|
def ioptions = initOptions(args.options)
|
||||||
def ioptions = initOptions(args.options)
|
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
||||||
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
|
||||||
if (ioptions.publish_by_meta) {
|
// Do not publish versions.yml unless running from pytest workflow
|
||||||
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
|
||||||
for (key in key_list) {
|
return null
|
||||||
if (args.meta && key instanceof String) {
|
}
|
||||||
def path = key
|
if (ioptions.publish_by_meta) {
|
||||||
if (args.meta.containsKey(key)) {
|
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
||||||
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
|
for (key in key_list) {
|
||||||
}
|
if (args.meta && key instanceof String) {
|
||||||
path = path instanceof String ? path : ''
|
def path = key
|
||||||
path_list.add(path)
|
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 (ioptions.publish_files instanceof Map) {
|
||||||
if (args.filename.endsWith(ext.key)) {
|
for (ext in ioptions.publish_files) {
|
||||||
def ext_list = path_list.collect()
|
if (args.filename.endsWith(ext.key)) {
|
||||||
ext_list.add(ext.value)
|
def ext_list = path_list.collect()
|
||||||
return "${getPathFromList(ext_list)}/$args.filename"
|
ext_list.add(ext.value)
|
||||||
}
|
return "${getPathFromList(ext_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
} else if (ioptions.publish_files == null) {
|
}
|
||||||
return "${getPathFromList(path_list)}/$args.filename"
|
} else if (ioptions.publish_files == null) {
|
||||||
}
|
return "${getPathFromList(path_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Import generic module functions
|
// Import generic module functions
|
||||||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
|
||||||
|
|
||||||
params.options = [:]
|
params.options = [:]
|
||||||
options = initOptions(params.options)
|
options = initOptions(params.options)
|
||||||
|
@ -23,16 +23,18 @@ process BCFTOOLS_MERGE {
|
||||||
|
|
||||||
output:
|
output:
|
||||||
tuple val(meta), path("*.gz"), emit: vcf
|
tuple val(meta), path("*.gz"), emit: vcf
|
||||||
path "*.version.txt" , emit: version
|
path "versions.yml" , emit: versions
|
||||||
|
|
||||||
script:
|
script:
|
||||||
def software = getSoftwareName(task.process)
|
|
||||||
prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||||
"""
|
"""
|
||||||
bcftools merge -Oz \\
|
bcftools merge -Oz \\
|
||||||
--output ${prefix}.vcf.gz \\
|
--output ${prefix}.vcf.gz \\
|
||||||
$options.args \\
|
$options.args \\
|
||||||
*.vcf.gz
|
*.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
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,10 +37,10 @@ output:
|
||||||
type: file
|
type: file
|
||||||
description: VCF merged output file
|
description: VCF merged output file
|
||||||
pattern: "*.{vcf.gz}"
|
pattern: "*.{vcf.gz}"
|
||||||
- version:
|
- versions:
|
||||||
type: file
|
type: file
|
||||||
description: File containing software version
|
description: File containing software versions
|
||||||
pattern: "*.{version.txt}"
|
pattern: "versions.yml"
|
||||||
authors:
|
authors:
|
||||||
- "@joseespinosa"
|
- "@joseespinosa"
|
||||||
- "@drpatelh"
|
- "@drpatelh"
|
||||||
|
|
|
@ -9,6 +9,13 @@ def getSoftwareName(task_process) {
|
||||||
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
|
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
|
// Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
|
||||||
//
|
//
|
||||||
|
@ -37,32 +44,35 @@ def getPathFromList(path_list) {
|
||||||
// Function to save/publish module results
|
// Function to save/publish module results
|
||||||
//
|
//
|
||||||
def saveFiles(Map args) {
|
def saveFiles(Map args) {
|
||||||
if (!args.filename.endsWith('.version.txt')) {
|
def ioptions = initOptions(args.options)
|
||||||
def ioptions = initOptions(args.options)
|
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
||||||
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
|
||||||
if (ioptions.publish_by_meta) {
|
// Do not publish versions.yml unless running from pytest workflow
|
||||||
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
|
||||||
for (key in key_list) {
|
return null
|
||||||
if (args.meta && key instanceof String) {
|
}
|
||||||
def path = key
|
if (ioptions.publish_by_meta) {
|
||||||
if (args.meta.containsKey(key)) {
|
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
||||||
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
|
for (key in key_list) {
|
||||||
}
|
if (args.meta && key instanceof String) {
|
||||||
path = path instanceof String ? path : ''
|
def path = key
|
||||||
path_list.add(path)
|
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 (ioptions.publish_files instanceof Map) {
|
||||||
if (args.filename.endsWith(ext.key)) {
|
for (ext in ioptions.publish_files) {
|
||||||
def ext_list = path_list.collect()
|
if (args.filename.endsWith(ext.key)) {
|
||||||
ext_list.add(ext.value)
|
def ext_list = path_list.collect()
|
||||||
return "${getPathFromList(ext_list)}/$args.filename"
|
ext_list.add(ext.value)
|
||||||
}
|
return "${getPathFromList(ext_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
} else if (ioptions.publish_files == null) {
|
}
|
||||||
return "${getPathFromList(path_list)}/$args.filename"
|
} else if (ioptions.publish_files == null) {
|
||||||
}
|
return "${getPathFromList(path_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Import generic module functions
|
// Import generic module functions
|
||||||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
|
||||||
|
|
||||||
params.options = [:]
|
params.options = [:]
|
||||||
options = initOptions(params.options)
|
options = initOptions(params.options)
|
||||||
|
@ -26,10 +26,9 @@ process BCFTOOLS_MPILEUP {
|
||||||
tuple val(meta), path("*.gz") , emit: vcf
|
tuple val(meta), path("*.gz") , emit: vcf
|
||||||
tuple val(meta), path("*.tbi") , emit: tbi
|
tuple val(meta), path("*.tbi") , emit: tbi
|
||||||
tuple val(meta), path("*stats.txt"), emit: stats
|
tuple val(meta), path("*stats.txt"), emit: stats
|
||||||
path "*.version.txt" , emit: version
|
path "versions.yml" , emit: versions
|
||||||
|
|
||||||
script:
|
script:
|
||||||
def software = getSoftwareName(task.process)
|
|
||||||
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||||
"""
|
"""
|
||||||
echo "${meta.id}" > sample_name.list
|
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
|
| bcftools view --output-file ${prefix}.vcf.gz --output-type z $options.args3
|
||||||
tabix -p vcf -f ${prefix}.vcf.gz
|
tabix -p vcf -f ${prefix}.vcf.gz
|
||||||
bcftools stats ${prefix}.vcf.gz > ${prefix}.bcftools_stats.txt
|
bcftools stats ${prefix}.vcf.gz > ${prefix}.bcftools_stats.txt
|
||||||
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
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,10 +43,10 @@ output:
|
||||||
type: file
|
type: file
|
||||||
description: Text output file containing stats
|
description: Text output file containing stats
|
||||||
pattern: "*{stats.txt}"
|
pattern: "*{stats.txt}"
|
||||||
- version:
|
- versions:
|
||||||
type: file
|
type: file
|
||||||
description: File containing software version
|
description: File containing software versions
|
||||||
pattern: "*.{version.txt}"
|
pattern: "versions.yml"
|
||||||
authors:
|
authors:
|
||||||
- "@joseespinosa"
|
- "@joseespinosa"
|
||||||
- "@drpatelh"
|
- "@drpatelh"
|
||||||
|
|
|
@ -9,6 +9,13 @@ def getSoftwareName(task_process) {
|
||||||
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
|
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
|
// Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
|
||||||
//
|
//
|
||||||
|
@ -37,32 +44,35 @@ def getPathFromList(path_list) {
|
||||||
// Function to save/publish module results
|
// Function to save/publish module results
|
||||||
//
|
//
|
||||||
def saveFiles(Map args) {
|
def saveFiles(Map args) {
|
||||||
if (!args.filename.endsWith('.version.txt')) {
|
def ioptions = initOptions(args.options)
|
||||||
def ioptions = initOptions(args.options)
|
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
||||||
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
|
||||||
if (ioptions.publish_by_meta) {
|
// Do not publish versions.yml unless running from pytest workflow
|
||||||
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
|
||||||
for (key in key_list) {
|
return null
|
||||||
if (args.meta && key instanceof String) {
|
}
|
||||||
def path = key
|
if (ioptions.publish_by_meta) {
|
||||||
if (args.meta.containsKey(key)) {
|
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
||||||
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
|
for (key in key_list) {
|
||||||
}
|
if (args.meta && key instanceof String) {
|
||||||
path = path instanceof String ? path : ''
|
def path = key
|
||||||
path_list.add(path)
|
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 (ioptions.publish_files instanceof Map) {
|
||||||
if (args.filename.endsWith(ext.key)) {
|
for (ext in ioptions.publish_files) {
|
||||||
def ext_list = path_list.collect()
|
if (args.filename.endsWith(ext.key)) {
|
||||||
ext_list.add(ext.value)
|
def ext_list = path_list.collect()
|
||||||
return "${getPathFromList(ext_list)}/$args.filename"
|
ext_list.add(ext.value)
|
||||||
}
|
return "${getPathFromList(ext_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
} else if (ioptions.publish_files == null) {
|
}
|
||||||
return "${getPathFromList(path_list)}/$args.filename"
|
} else if (ioptions.publish_files == null) {
|
||||||
}
|
return "${getPathFromList(path_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Import generic module functions
|
// Import generic module functions
|
||||||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
|
||||||
|
|
||||||
params.options = [:]
|
params.options = [:]
|
||||||
options = initOptions(params.options)
|
options = initOptions(params.options)
|
||||||
|
@ -24,10 +24,9 @@ process BCFTOOLS_NORM {
|
||||||
|
|
||||||
output:
|
output:
|
||||||
tuple val(meta), path("*.gz") , emit: vcf
|
tuple val(meta), path("*.gz") , emit: vcf
|
||||||
path "*.version.txt" , emit: version
|
path "versions.yml" , emit: versions
|
||||||
|
|
||||||
script:
|
script:
|
||||||
def software = getSoftwareName(task.process)
|
|
||||||
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||||
"""
|
"""
|
||||||
bcftools norm \\
|
bcftools norm \\
|
||||||
|
@ -37,6 +36,9 @@ process BCFTOOLS_NORM {
|
||||||
--threads $task.cpus \\
|
--threads $task.cpus \\
|
||||||
${vcf}
|
${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
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,9 +37,9 @@ output:
|
||||||
type: file
|
type: file
|
||||||
description: VCF normalized output file
|
description: VCF normalized output file
|
||||||
pattern: "*.{vcf.gz}"
|
pattern: "*.{vcf.gz}"
|
||||||
- version:
|
- versions:
|
||||||
type: file
|
type: file
|
||||||
description: File containing software version
|
description: File containing software versions
|
||||||
pattern: "*.{version.txt}"
|
pattern: "versions.yml"
|
||||||
authors:
|
authors:
|
||||||
- "@abhi18av"
|
- "@abhi18av"
|
||||||
|
|
|
@ -9,6 +9,13 @@ def getSoftwareName(task_process) {
|
||||||
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
|
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
|
// Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
|
||||||
//
|
//
|
||||||
|
@ -37,32 +44,35 @@ def getPathFromList(path_list) {
|
||||||
// Function to save/publish module results
|
// Function to save/publish module results
|
||||||
//
|
//
|
||||||
def saveFiles(Map args) {
|
def saveFiles(Map args) {
|
||||||
if (!args.filename.endsWith('.version.txt')) {
|
def ioptions = initOptions(args.options)
|
||||||
def ioptions = initOptions(args.options)
|
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
||||||
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
|
||||||
if (ioptions.publish_by_meta) {
|
// Do not publish versions.yml unless running from pytest workflow
|
||||||
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
|
||||||
for (key in key_list) {
|
return null
|
||||||
if (args.meta && key instanceof String) {
|
}
|
||||||
def path = key
|
if (ioptions.publish_by_meta) {
|
||||||
if (args.meta.containsKey(key)) {
|
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
||||||
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
|
for (key in key_list) {
|
||||||
}
|
if (args.meta && key instanceof String) {
|
||||||
path = path instanceof String ? path : ''
|
def path = key
|
||||||
path_list.add(path)
|
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 (ioptions.publish_files instanceof Map) {
|
||||||
if (args.filename.endsWith(ext.key)) {
|
for (ext in ioptions.publish_files) {
|
||||||
def ext_list = path_list.collect()
|
if (args.filename.endsWith(ext.key)) {
|
||||||
ext_list.add(ext.value)
|
def ext_list = path_list.collect()
|
||||||
return "${getPathFromList(ext_list)}/$args.filename"
|
ext_list.add(ext.value)
|
||||||
}
|
return "${getPathFromList(ext_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
} else if (ioptions.publish_files == null) {
|
}
|
||||||
return "${getPathFromList(path_list)}/$args.filename"
|
} else if (ioptions.publish_files == null) {
|
||||||
}
|
return "${getPathFromList(path_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Import generic module functions
|
// Import generic module functions
|
||||||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
|
||||||
|
|
||||||
params.options = [:]
|
params.options = [:]
|
||||||
options = initOptions(params.options)
|
options = initOptions(params.options)
|
||||||
|
@ -26,10 +26,9 @@ process BCFTOOLS_QUERY {
|
||||||
|
|
||||||
output:
|
output:
|
||||||
tuple val(meta), path("*.gz") , emit: vcf
|
tuple val(meta), path("*.gz") , emit: vcf
|
||||||
path "*.version.txt" , emit: version
|
path "versions.yml" , emit: versions
|
||||||
|
|
||||||
script:
|
script:
|
||||||
def software = getSoftwareName(task.process)
|
|
||||||
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||||
def regions_file = regions ? "--regions-file ${regions}" : ""
|
def regions_file = regions ? "--regions-file ${regions}" : ""
|
||||||
def targets_file = targets ? "--targets-file ${targets}" : ""
|
def targets_file = targets ? "--targets-file ${targets}" : ""
|
||||||
|
@ -44,6 +43,9 @@ process BCFTOOLS_QUERY {
|
||||||
$options.args \\
|
$options.args \\
|
||||||
${vcf}
|
${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
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,9 +53,9 @@ output:
|
||||||
type: file
|
type: file
|
||||||
description: VCF query output file
|
description: VCF query output file
|
||||||
pattern: "*.{vcf.gz}"
|
pattern: "*.{vcf.gz}"
|
||||||
- version:
|
- versions:
|
||||||
type: file
|
type: file
|
||||||
description: File containing software version
|
description: File containing software versions
|
||||||
pattern: "*.{version.txt}"
|
pattern: "versions.yml"
|
||||||
authors:
|
authors:
|
||||||
- "@abhi18av"
|
- "@abhi18av"
|
||||||
|
|
|
@ -9,6 +9,13 @@ def getSoftwareName(task_process) {
|
||||||
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
|
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
|
// Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
|
||||||
//
|
//
|
||||||
|
@ -37,32 +44,35 @@ def getPathFromList(path_list) {
|
||||||
// Function to save/publish module results
|
// Function to save/publish module results
|
||||||
//
|
//
|
||||||
def saveFiles(Map args) {
|
def saveFiles(Map args) {
|
||||||
if (!args.filename.endsWith('.version.txt')) {
|
def ioptions = initOptions(args.options)
|
||||||
def ioptions = initOptions(args.options)
|
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
||||||
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
|
||||||
if (ioptions.publish_by_meta) {
|
// Do not publish versions.yml unless running from pytest workflow
|
||||||
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
|
||||||
for (key in key_list) {
|
return null
|
||||||
if (args.meta && key instanceof String) {
|
}
|
||||||
def path = key
|
if (ioptions.publish_by_meta) {
|
||||||
if (args.meta.containsKey(key)) {
|
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
||||||
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
|
for (key in key_list) {
|
||||||
}
|
if (args.meta && key instanceof String) {
|
||||||
path = path instanceof String ? path : ''
|
def path = key
|
||||||
path_list.add(path)
|
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 (ioptions.publish_files instanceof Map) {
|
||||||
if (args.filename.endsWith(ext.key)) {
|
for (ext in ioptions.publish_files) {
|
||||||
def ext_list = path_list.collect()
|
if (args.filename.endsWith(ext.key)) {
|
||||||
ext_list.add(ext.value)
|
def ext_list = path_list.collect()
|
||||||
return "${getPathFromList(ext_list)}/$args.filename"
|
ext_list.add(ext.value)
|
||||||
}
|
return "${getPathFromList(ext_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
} else if (ioptions.publish_files == null) {
|
}
|
||||||
return "${getPathFromList(path_list)}/$args.filename"
|
} else if (ioptions.publish_files == null) {
|
||||||
}
|
return "${getPathFromList(path_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Import generic module functions
|
// Import generic module functions
|
||||||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
|
||||||
|
|
||||||
params.options = [:]
|
params.options = [:]
|
||||||
options = initOptions(params.options)
|
options = initOptions(params.options)
|
||||||
|
@ -25,10 +25,9 @@ process BCFTOOLS_REHEADER {
|
||||||
|
|
||||||
output:
|
output:
|
||||||
tuple val(meta), path("*.vcf.gz"), emit: vcf
|
tuple val(meta), path("*.vcf.gz"), emit: vcf
|
||||||
path "*.version.txt" , emit: version
|
path "versions.yml" , emit: versions
|
||||||
|
|
||||||
script:
|
script:
|
||||||
def software = getSoftwareName(task.process)
|
|
||||||
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||||
def update_sequences = fai ? "-f $fai" : ""
|
def update_sequences = fai ? "-f $fai" : ""
|
||||||
def new_header = header ? "-h $header" : ""
|
def new_header = header ? "-h $header" : ""
|
||||||
|
@ -42,6 +41,9 @@ process BCFTOOLS_REHEADER {
|
||||||
-o ${prefix}.vcf.gz \\
|
-o ${prefix}.vcf.gz \\
|
||||||
$vcf
|
$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
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,10 +38,10 @@ output:
|
||||||
description: |
|
description: |
|
||||||
Groovy Map containing sample information
|
Groovy Map containing sample information
|
||||||
e.g. [ id:'test', single_end:false ]
|
e.g. [ id:'test', single_end:false ]
|
||||||
- version:
|
- versions:
|
||||||
type: file
|
type: file
|
||||||
description: File containing software version
|
description: File containing software versions
|
||||||
pattern: "*.{version.txt}"
|
pattern: "versions.yml"
|
||||||
- vcf:
|
- vcf:
|
||||||
type: file
|
type: file
|
||||||
description: VCF with updated header
|
description: VCF with updated header
|
||||||
|
|
|
@ -9,6 +9,13 @@ def getSoftwareName(task_process) {
|
||||||
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
|
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
|
// Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
|
||||||
//
|
//
|
||||||
|
@ -37,32 +44,35 @@ def getPathFromList(path_list) {
|
||||||
// Function to save/publish module results
|
// Function to save/publish module results
|
||||||
//
|
//
|
||||||
def saveFiles(Map args) {
|
def saveFiles(Map args) {
|
||||||
if (!args.filename.endsWith('.version.txt')) {
|
def ioptions = initOptions(args.options)
|
||||||
def ioptions = initOptions(args.options)
|
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
||||||
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
|
||||||
if (ioptions.publish_by_meta) {
|
// Do not publish versions.yml unless running from pytest workflow
|
||||||
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
|
||||||
for (key in key_list) {
|
return null
|
||||||
if (args.meta && key instanceof String) {
|
}
|
||||||
def path = key
|
if (ioptions.publish_by_meta) {
|
||||||
if (args.meta.containsKey(key)) {
|
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
||||||
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
|
for (key in key_list) {
|
||||||
}
|
if (args.meta && key instanceof String) {
|
||||||
path = path instanceof String ? path : ''
|
def path = key
|
||||||
path_list.add(path)
|
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 (ioptions.publish_files instanceof Map) {
|
||||||
if (args.filename.endsWith(ext.key)) {
|
for (ext in ioptions.publish_files) {
|
||||||
def ext_list = path_list.collect()
|
if (args.filename.endsWith(ext.key)) {
|
||||||
ext_list.add(ext.value)
|
def ext_list = path_list.collect()
|
||||||
return "${getPathFromList(ext_list)}/$args.filename"
|
ext_list.add(ext.value)
|
||||||
}
|
return "${getPathFromList(ext_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
} else if (ioptions.publish_files == null) {
|
}
|
||||||
return "${getPathFromList(path_list)}/$args.filename"
|
} else if (ioptions.publish_files == null) {
|
||||||
}
|
return "${getPathFromList(path_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Import generic module functions
|
// Import generic module functions
|
||||||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
|
||||||
|
|
||||||
params.options = [:]
|
params.options = [:]
|
||||||
options = initOptions(params.options)
|
options = initOptions(params.options)
|
||||||
|
@ -23,13 +23,15 @@ process BCFTOOLS_STATS {
|
||||||
|
|
||||||
output:
|
output:
|
||||||
tuple val(meta), path("*stats.txt"), emit: stats
|
tuple val(meta), path("*stats.txt"), emit: stats
|
||||||
path "*.version.txt" , emit: version
|
path "versions.yml" , emit: versions
|
||||||
|
|
||||||
script:
|
script:
|
||||||
def software = getSoftwareName(task.process)
|
|
||||||
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||||
"""
|
"""
|
||||||
bcftools stats $options.args $vcf > ${prefix}.bcftools_stats.txt
|
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
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,10 +32,10 @@ output:
|
||||||
type: file
|
type: file
|
||||||
description: Text output file containing stats
|
description: Text output file containing stats
|
||||||
pattern: "*_{stats.txt}"
|
pattern: "*_{stats.txt}"
|
||||||
- version:
|
- versions:
|
||||||
type: file
|
type: file
|
||||||
description: File containing software version
|
description: File containing software versions
|
||||||
pattern: "*.{version.txt}"
|
pattern: "versions.yml"
|
||||||
authors:
|
authors:
|
||||||
- "@joseespinosa"
|
- "@joseespinosa"
|
||||||
- "@drpatelh"
|
- "@drpatelh"
|
||||||
|
|
|
@ -9,6 +9,13 @@ def getSoftwareName(task_process) {
|
||||||
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
|
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
|
// Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
|
||||||
//
|
//
|
||||||
|
@ -37,32 +44,35 @@ def getPathFromList(path_list) {
|
||||||
// Function to save/publish module results
|
// Function to save/publish module results
|
||||||
//
|
//
|
||||||
def saveFiles(Map args) {
|
def saveFiles(Map args) {
|
||||||
if (!args.filename.endsWith('.version.txt')) {
|
def ioptions = initOptions(args.options)
|
||||||
def ioptions = initOptions(args.options)
|
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
||||||
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
|
||||||
if (ioptions.publish_by_meta) {
|
// Do not publish versions.yml unless running from pytest workflow
|
||||||
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
|
||||||
for (key in key_list) {
|
return null
|
||||||
if (args.meta && key instanceof String) {
|
}
|
||||||
def path = key
|
if (ioptions.publish_by_meta) {
|
||||||
if (args.meta.containsKey(key)) {
|
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
||||||
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
|
for (key in key_list) {
|
||||||
}
|
if (args.meta && key instanceof String) {
|
||||||
path = path instanceof String ? path : ''
|
def path = key
|
||||||
path_list.add(path)
|
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 (ioptions.publish_files instanceof Map) {
|
||||||
if (args.filename.endsWith(ext.key)) {
|
for (ext in ioptions.publish_files) {
|
||||||
def ext_list = path_list.collect()
|
if (args.filename.endsWith(ext.key)) {
|
||||||
ext_list.add(ext.value)
|
def ext_list = path_list.collect()
|
||||||
return "${getPathFromList(ext_list)}/$args.filename"
|
ext_list.add(ext.value)
|
||||||
}
|
return "${getPathFromList(ext_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
} else if (ioptions.publish_files == null) {
|
}
|
||||||
return "${getPathFromList(path_list)}/$args.filename"
|
} else if (ioptions.publish_files == null) {
|
||||||
}
|
return "${getPathFromList(path_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Import generic module functions
|
// Import generic module functions
|
||||||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
|
||||||
|
|
||||||
params.options = [:]
|
params.options = [:]
|
||||||
options = initOptions(params.options)
|
options = initOptions(params.options)
|
||||||
|
@ -26,10 +26,9 @@ process BCFTOOLS_VIEW {
|
||||||
|
|
||||||
output:
|
output:
|
||||||
tuple val(meta), path("*.gz") , emit: vcf
|
tuple val(meta), path("*.gz") , emit: vcf
|
||||||
path "*.version.txt" , emit: version
|
path "versions.yml" , emit: versions
|
||||||
|
|
||||||
script:
|
script:
|
||||||
def software = getSoftwareName(task.process)
|
|
||||||
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||||
def regions_file = regions ? "--regions-file ${regions}" : ""
|
def regions_file = regions ? "--regions-file ${regions}" : ""
|
||||||
def targets_file = targets ? "--targets-file ${targets}" : ""
|
def targets_file = targets ? "--targets-file ${targets}" : ""
|
||||||
|
@ -46,6 +45,9 @@ process BCFTOOLS_VIEW {
|
||||||
--threads $task.cpus \\
|
--threads $task.cpus \\
|
||||||
${vcf}
|
${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
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,9 +54,9 @@ output:
|
||||||
type: file
|
type: file
|
||||||
description: VCF normalized output file
|
description: VCF normalized output file
|
||||||
pattern: "*.{vcf.gz}"
|
pattern: "*.{vcf.gz}"
|
||||||
- version:
|
- versions:
|
||||||
type: file
|
type: file
|
||||||
description: File containing software version
|
description: File containing software versions
|
||||||
pattern: "*.{version.txt}"
|
pattern: "versions.yml"
|
||||||
authors:
|
authors:
|
||||||
- "@abhi18av"
|
- "@abhi18av"
|
||||||
|
|
|
@ -9,6 +9,13 @@ def getSoftwareName(task_process) {
|
||||||
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
|
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
|
// Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
|
||||||
//
|
//
|
||||||
|
@ -37,32 +44,35 @@ def getPathFromList(path_list) {
|
||||||
// Function to save/publish module results
|
// Function to save/publish module results
|
||||||
//
|
//
|
||||||
def saveFiles(Map args) {
|
def saveFiles(Map args) {
|
||||||
if (!args.filename.endsWith('.version.txt')) {
|
def ioptions = initOptions(args.options)
|
||||||
def ioptions = initOptions(args.options)
|
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
||||||
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
|
||||||
if (ioptions.publish_by_meta) {
|
// Do not publish versions.yml unless running from pytest workflow
|
||||||
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
|
||||||
for (key in key_list) {
|
return null
|
||||||
if (args.meta && key instanceof String) {
|
}
|
||||||
def path = key
|
if (ioptions.publish_by_meta) {
|
||||||
if (args.meta.containsKey(key)) {
|
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
||||||
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
|
for (key in key_list) {
|
||||||
}
|
if (args.meta && key instanceof String) {
|
||||||
path = path instanceof String ? path : ''
|
def path = key
|
||||||
path_list.add(path)
|
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 (ioptions.publish_files instanceof Map) {
|
||||||
if (args.filename.endsWith(ext.key)) {
|
for (ext in ioptions.publish_files) {
|
||||||
def ext_list = path_list.collect()
|
if (args.filename.endsWith(ext.key)) {
|
||||||
ext_list.add(ext.value)
|
def ext_list = path_list.collect()
|
||||||
return "${getPathFromList(ext_list)}/$args.filename"
|
ext_list.add(ext.value)
|
||||||
}
|
return "${getPathFromList(ext_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
} else if (ioptions.publish_files == null) {
|
}
|
||||||
return "${getPathFromList(path_list)}/$args.filename"
|
} else if (ioptions.publish_files == null) {
|
||||||
}
|
return "${getPathFromList(path_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Import generic module functions
|
// Import generic module functions
|
||||||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
|
||||||
|
|
||||||
params.options = [:]
|
params.options = [:]
|
||||||
options = initOptions(params.options)
|
options = initOptions(params.options)
|
||||||
|
@ -23,10 +23,9 @@ process BEDTOOLS_BAMTOBED {
|
||||||
|
|
||||||
output:
|
output:
|
||||||
tuple val(meta), path("*.bed"), emit: bed
|
tuple val(meta), path("*.bed"), emit: bed
|
||||||
path "*.version.txt" , emit: version
|
path "versions.yml" , emit: versions
|
||||||
|
|
||||||
script:
|
script:
|
||||||
def software = getSoftwareName(task.process)
|
|
||||||
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||||
"""
|
"""
|
||||||
bedtools \\
|
bedtools \\
|
||||||
|
@ -35,6 +34,9 @@ process BEDTOOLS_BAMTOBED {
|
||||||
-i $bam \\
|
-i $bam \\
|
||||||
| bedtools sort > ${prefix}.bed
|
| 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
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,10 +28,10 @@ output:
|
||||||
type: file
|
type: file
|
||||||
description: Bed file containing genomic intervals.
|
description: Bed file containing genomic intervals.
|
||||||
pattern: "*.{bed}"
|
pattern: "*.{bed}"
|
||||||
- version:
|
- versions:
|
||||||
type: file
|
type: file
|
||||||
description: File containing software version
|
description: File containing software versions
|
||||||
pattern: "*.{version.txt}"
|
pattern: "versions.yml"
|
||||||
authors:
|
authors:
|
||||||
- "@yuukiiwa"
|
- "@yuukiiwa"
|
||||||
- "@drpatelh"
|
- "@drpatelh"
|
||||||
|
|
|
@ -9,6 +9,13 @@ def getSoftwareName(task_process) {
|
||||||
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
|
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
|
// Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
|
||||||
//
|
//
|
||||||
|
@ -37,32 +44,35 @@ def getPathFromList(path_list) {
|
||||||
// Function to save/publish module results
|
// Function to save/publish module results
|
||||||
//
|
//
|
||||||
def saveFiles(Map args) {
|
def saveFiles(Map args) {
|
||||||
if (!args.filename.endsWith('.version.txt')) {
|
def ioptions = initOptions(args.options)
|
||||||
def ioptions = initOptions(args.options)
|
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
||||||
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
|
||||||
if (ioptions.publish_by_meta) {
|
// Do not publish versions.yml unless running from pytest workflow
|
||||||
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
|
||||||
for (key in key_list) {
|
return null
|
||||||
if (args.meta && key instanceof String) {
|
}
|
||||||
def path = key
|
if (ioptions.publish_by_meta) {
|
||||||
if (args.meta.containsKey(key)) {
|
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
||||||
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
|
for (key in key_list) {
|
||||||
}
|
if (args.meta && key instanceof String) {
|
||||||
path = path instanceof String ? path : ''
|
def path = key
|
||||||
path_list.add(path)
|
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 (ioptions.publish_files instanceof Map) {
|
||||||
if (args.filename.endsWith(ext.key)) {
|
for (ext in ioptions.publish_files) {
|
||||||
def ext_list = path_list.collect()
|
if (args.filename.endsWith(ext.key)) {
|
||||||
ext_list.add(ext.value)
|
def ext_list = path_list.collect()
|
||||||
return "${getPathFromList(ext_list)}/$args.filename"
|
ext_list.add(ext.value)
|
||||||
}
|
return "${getPathFromList(ext_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
} else if (ioptions.publish_files == null) {
|
}
|
||||||
return "${getPathFromList(path_list)}/$args.filename"
|
} else if (ioptions.publish_files == null) {
|
||||||
}
|
return "${getPathFromList(path_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Import generic module functions
|
// Import generic module functions
|
||||||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
|
||||||
|
|
||||||
params.options = [:]
|
params.options = [:]
|
||||||
options = initOptions(params.options)
|
options = initOptions(params.options)
|
||||||
|
@ -24,10 +24,9 @@ process BEDTOOLS_COMPLEMENT {
|
||||||
|
|
||||||
output:
|
output:
|
||||||
tuple val(meta), path('*.bed'), emit: bed
|
tuple val(meta), path('*.bed'), emit: bed
|
||||||
path '*.version.txt' , emit: version
|
path "versions.yml" , emit: versions
|
||||||
|
|
||||||
script:
|
script:
|
||||||
def software = getSoftwareName(task.process)
|
|
||||||
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||||
"""
|
"""
|
||||||
bedtools \\
|
bedtools \\
|
||||||
|
@ -37,6 +36,9 @@ process BEDTOOLS_COMPLEMENT {
|
||||||
$options.args \\
|
$options.args \\
|
||||||
> ${prefix}.bed
|
> ${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
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,10 +32,10 @@ output:
|
||||||
type: file
|
type: file
|
||||||
description: Bed file with all genomic intervals that are not covered by at least one record from the input file.
|
description: Bed file with all genomic intervals that are not covered by at least one record from the input file.
|
||||||
pattern: "*.{bed}"
|
pattern: "*.{bed}"
|
||||||
- version:
|
- versions:
|
||||||
type: file
|
type: file
|
||||||
description: File containing software version
|
description: File containing software versions
|
||||||
pattern: "*.{version.txt}"
|
pattern: "versions.yml"
|
||||||
authors:
|
authors:
|
||||||
- "@Emiller88"
|
- "@Emiller88"
|
||||||
- "@sruthipsuresh"
|
- "@sruthipsuresh"
|
||||||
|
|
|
@ -9,6 +9,13 @@ def getSoftwareName(task_process) {
|
||||||
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
|
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
|
// Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
|
||||||
//
|
//
|
||||||
|
@ -37,32 +44,35 @@ def getPathFromList(path_list) {
|
||||||
// Function to save/publish module results
|
// Function to save/publish module results
|
||||||
//
|
//
|
||||||
def saveFiles(Map args) {
|
def saveFiles(Map args) {
|
||||||
if (!args.filename.endsWith('.version.txt')) {
|
def ioptions = initOptions(args.options)
|
||||||
def ioptions = initOptions(args.options)
|
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
||||||
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
|
||||||
if (ioptions.publish_by_meta) {
|
// Do not publish versions.yml unless running from pytest workflow
|
||||||
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
|
||||||
for (key in key_list) {
|
return null
|
||||||
if (args.meta && key instanceof String) {
|
}
|
||||||
def path = key
|
if (ioptions.publish_by_meta) {
|
||||||
if (args.meta.containsKey(key)) {
|
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
||||||
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
|
for (key in key_list) {
|
||||||
}
|
if (args.meta && key instanceof String) {
|
||||||
path = path instanceof String ? path : ''
|
def path = key
|
||||||
path_list.add(path)
|
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 (ioptions.publish_files instanceof Map) {
|
||||||
if (args.filename.endsWith(ext.key)) {
|
for (ext in ioptions.publish_files) {
|
||||||
def ext_list = path_list.collect()
|
if (args.filename.endsWith(ext.key)) {
|
||||||
ext_list.add(ext.value)
|
def ext_list = path_list.collect()
|
||||||
return "${getPathFromList(ext_list)}/$args.filename"
|
ext_list.add(ext.value)
|
||||||
}
|
return "${getPathFromList(ext_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
} else if (ioptions.publish_files == null) {
|
}
|
||||||
return "${getPathFromList(path_list)}/$args.filename"
|
} else if (ioptions.publish_files == null) {
|
||||||
}
|
return "${getPathFromList(path_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Import generic module functions
|
// Import generic module functions
|
||||||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
|
||||||
|
|
||||||
params.options = [:]
|
params.options = [:]
|
||||||
options = initOptions(params.options)
|
options = initOptions(params.options)
|
||||||
|
@ -25,10 +25,9 @@ process BEDTOOLS_GENOMECOV {
|
||||||
|
|
||||||
output:
|
output:
|
||||||
tuple val(meta), path("*.${extension}"), emit: genomecov
|
tuple val(meta), path("*.${extension}"), emit: genomecov
|
||||||
path "*.version.txt" , emit: version
|
path "versions.yml" , emit: versions
|
||||||
|
|
||||||
script:
|
script:
|
||||||
def software = getSoftwareName(task.process)
|
|
||||||
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||||
if (intervals.name =~ /\.bam/) {
|
if (intervals.name =~ /\.bam/) {
|
||||||
"""
|
"""
|
||||||
|
@ -38,7 +37,10 @@ process BEDTOOLS_GENOMECOV {
|
||||||
$options.args \\
|
$options.args \\
|
||||||
> ${prefix}.${extension}
|
> ${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 {
|
} else {
|
||||||
"""
|
"""
|
||||||
|
@ -49,7 +51,10 @@ process BEDTOOLS_GENOMECOV {
|
||||||
$options.args \\
|
$options.args \\
|
||||||
> ${prefix}.${extension}
|
> ${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
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,10 +35,10 @@ output:
|
||||||
type: file
|
type: file
|
||||||
description: Computed genome coverage file
|
description: Computed genome coverage file
|
||||||
pattern: "*.${extension}"
|
pattern: "*.${extension}"
|
||||||
- version:
|
- versions:
|
||||||
type: file
|
type: file
|
||||||
description: File containing software version
|
description: File containing software versions
|
||||||
pattern: "*.{version.txt}"
|
pattern: "versions.yml"
|
||||||
authors:
|
authors:
|
||||||
- "@Emiller88"
|
- "@Emiller88"
|
||||||
- "@sruthipsuresh"
|
- "@sruthipsuresh"
|
||||||
|
|
|
@ -9,6 +9,13 @@ def getSoftwareName(task_process) {
|
||||||
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
|
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
|
// Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
|
||||||
//
|
//
|
||||||
|
@ -37,32 +44,35 @@ def getPathFromList(path_list) {
|
||||||
// Function to save/publish module results
|
// Function to save/publish module results
|
||||||
//
|
//
|
||||||
def saveFiles(Map args) {
|
def saveFiles(Map args) {
|
||||||
if (!args.filename.endsWith('.version.txt')) {
|
def ioptions = initOptions(args.options)
|
||||||
def ioptions = initOptions(args.options)
|
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
||||||
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
|
||||||
if (ioptions.publish_by_meta) {
|
// Do not publish versions.yml unless running from pytest workflow
|
||||||
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
|
||||||
for (key in key_list) {
|
return null
|
||||||
if (args.meta && key instanceof String) {
|
}
|
||||||
def path = key
|
if (ioptions.publish_by_meta) {
|
||||||
if (args.meta.containsKey(key)) {
|
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
||||||
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
|
for (key in key_list) {
|
||||||
}
|
if (args.meta && key instanceof String) {
|
||||||
path = path instanceof String ? path : ''
|
def path = key
|
||||||
path_list.add(path)
|
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 (ioptions.publish_files instanceof Map) {
|
||||||
if (args.filename.endsWith(ext.key)) {
|
for (ext in ioptions.publish_files) {
|
||||||
def ext_list = path_list.collect()
|
if (args.filename.endsWith(ext.key)) {
|
||||||
ext_list.add(ext.value)
|
def ext_list = path_list.collect()
|
||||||
return "${getPathFromList(ext_list)}/$args.filename"
|
ext_list.add(ext.value)
|
||||||
}
|
return "${getPathFromList(ext_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
} else if (ioptions.publish_files == null) {
|
}
|
||||||
return "${getPathFromList(path_list)}/$args.filename"
|
} else if (ioptions.publish_files == null) {
|
||||||
}
|
return "${getPathFromList(path_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Import generic module functions
|
// Import generic module functions
|
||||||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
|
||||||
|
|
||||||
params.options = [:]
|
params.options = [:]
|
||||||
options = initOptions(params.options)
|
options = initOptions(params.options)
|
||||||
|
@ -24,10 +24,9 @@ process BEDTOOLS_GETFASTA {
|
||||||
|
|
||||||
output:
|
output:
|
||||||
path "*.fa" , emit: fasta
|
path "*.fa" , emit: fasta
|
||||||
path "*.version.txt", emit: version
|
path "versions.yml" , emit: versions
|
||||||
|
|
||||||
script:
|
script:
|
||||||
def software = getSoftwareName(task.process)
|
|
||||||
def prefix = options.suffix ? "${bed.baseName}${options.suffix}" : "${bed.baseName}"
|
def prefix = options.suffix ? "${bed.baseName}${options.suffix}" : "${bed.baseName}"
|
||||||
"""
|
"""
|
||||||
bedtools \\
|
bedtools \\
|
||||||
|
@ -37,6 +36,9 @@ process BEDTOOLS_GETFASTA {
|
||||||
-bed $bed \\
|
-bed $bed \\
|
||||||
-fo ${prefix}.fa
|
-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
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,10 +24,10 @@ output:
|
||||||
type: file
|
type: file
|
||||||
description: Output fasta file with extracted sequences
|
description: Output fasta file with extracted sequences
|
||||||
pattern: "*.{fa}"
|
pattern: "*.{fa}"
|
||||||
- version:
|
- versions:
|
||||||
type: file
|
type: file
|
||||||
description: File containing software version
|
description: File containing software versions
|
||||||
pattern: "*.{version.txt}"
|
pattern: "versions.yml"
|
||||||
authors:
|
authors:
|
||||||
- "@joseespinosa"
|
- "@joseespinosa"
|
||||||
- "@drpatelh"
|
- "@drpatelh"
|
||||||
|
|
|
@ -9,6 +9,13 @@ def getSoftwareName(task_process) {
|
||||||
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
|
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
|
// Function to initialise default values and to generate a Groovy Map of available options for nf-core modules
|
||||||
//
|
//
|
||||||
|
@ -37,32 +44,35 @@ def getPathFromList(path_list) {
|
||||||
// Function to save/publish module results
|
// Function to save/publish module results
|
||||||
//
|
//
|
||||||
def saveFiles(Map args) {
|
def saveFiles(Map args) {
|
||||||
if (!args.filename.endsWith('.version.txt')) {
|
def ioptions = initOptions(args.options)
|
||||||
def ioptions = initOptions(args.options)
|
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
||||||
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
|
||||||
if (ioptions.publish_by_meta) {
|
// Do not publish versions.yml unless running from pytest workflow
|
||||||
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
if (args.filename.equals('versions.yml') && !System.getenv("NF_CORE_MODULES_TEST")) {
|
||||||
for (key in key_list) {
|
return null
|
||||||
if (args.meta && key instanceof String) {
|
}
|
||||||
def path = key
|
if (ioptions.publish_by_meta) {
|
||||||
if (args.meta.containsKey(key)) {
|
def key_list = ioptions.publish_by_meta instanceof List ? ioptions.publish_by_meta : args.publish_by_meta
|
||||||
path = args.meta[key] instanceof Boolean ? "${key}_${args.meta[key]}".toString() : args.meta[key]
|
for (key in key_list) {
|
||||||
}
|
if (args.meta && key instanceof String) {
|
||||||
path = path instanceof String ? path : ''
|
def path = key
|
||||||
path_list.add(path)
|
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 (ioptions.publish_files instanceof Map) {
|
||||||
if (args.filename.endsWith(ext.key)) {
|
for (ext in ioptions.publish_files) {
|
||||||
def ext_list = path_list.collect()
|
if (args.filename.endsWith(ext.key)) {
|
||||||
ext_list.add(ext.value)
|
def ext_list = path_list.collect()
|
||||||
return "${getPathFromList(ext_list)}/$args.filename"
|
ext_list.add(ext.value)
|
||||||
}
|
return "${getPathFromList(ext_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
} else if (ioptions.publish_files == null) {
|
}
|
||||||
return "${getPathFromList(path_list)}/$args.filename"
|
} else if (ioptions.publish_files == null) {
|
||||||
}
|
return "${getPathFromList(path_list)}/$args.filename"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// Import generic module functions
|
// Import generic module functions
|
||||||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
|
||||||
|
|
||||||
params.options = [:]
|
params.options = [:]
|
||||||
options = initOptions(params.options)
|
options = initOptions(params.options)
|
||||||
|
@ -24,10 +24,9 @@ process BEDTOOLS_INTERSECT {
|
||||||
|
|
||||||
output:
|
output:
|
||||||
tuple val(meta), path("*.${extension}"), emit: intersect
|
tuple val(meta), path("*.${extension}"), emit: intersect
|
||||||
path '*.version.txt' , emit: version
|
path "versions.yml" , emit: versions
|
||||||
|
|
||||||
script:
|
script:
|
||||||
def software = getSoftwareName(task.process)
|
|
||||||
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||||
"""
|
"""
|
||||||
bedtools \\
|
bedtools \\
|
||||||
|
@ -37,6 +36,9 @@ process BEDTOOLS_INTERSECT {
|
||||||
$options.args \\
|
$options.args \\
|
||||||
> ${prefix}.${extension}
|
> ${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
Loading…
Reference in a new issue