mirror of
https://github.com/MillironX/nf-core_modules.git
synced 2024-12-22 11:08:17 +00:00
test
This commit is contained in:
commit
14b661d3eb
2118 changed files with 35225 additions and 21192 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 necessary, include test data in your PR.
|
||||
- [ ] Remove all TODO statements.
|
||||
- [ ] Emit the `<SOFTWARE>.version.txt` file.
|
||||
- [ ] Emit the `versions.yml` file.
|
||||
- [ ] Follow the naming conventions.
|
||||
- [ ] Follow the parameters requirements.
|
||||
- [ ] Follow the input/output options guidelines.
|
||||
|
|
82
.github/check_duplicate_md5s.py
vendored
Normal file
82
.github/check_duplicate_md5s.py
vendored
Normal file
|
@ -0,0 +1,82 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from rich import print
|
||||
from rich.table import Table
|
||||
import click
|
||||
import glob
|
||||
import os
|
||||
import yaml
|
||||
|
||||
|
||||
@click.command()
|
||||
@click.option(
|
||||
"--min_dups",
|
||||
default=5,
|
||||
show_default=True,
|
||||
help="Minimum number of duplicates to report",
|
||||
)
|
||||
@click.option(
|
||||
"--search_dir",
|
||||
default=f"{os.path.dirname(__file__)}/../tests/**/test.yml",
|
||||
show_default=True,
|
||||
help="Glob directory pattern used to find test YAML files",
|
||||
)
|
||||
def find_duplicate_md5s(min_dups, search_dir):
|
||||
"""
|
||||
Find duplicate file MD5 sums in test YAML files.
|
||||
"""
|
||||
md5_filenames = {}
|
||||
md5_output_fn_counts = {}
|
||||
module_counts = {}
|
||||
|
||||
# Loop through all files in tests/ called test.yml
|
||||
for test_yml in glob.glob(search_dir, recursive=True):
|
||||
# Open file and parse YAML
|
||||
with open(test_yml, "r") as fh:
|
||||
test_config = yaml.safe_load(fh)
|
||||
# Loop through tests and check for duplicate md5s
|
||||
for test in test_config:
|
||||
for test_file in test.get("files", []):
|
||||
if "md5sum" in test_file:
|
||||
md5 = test_file["md5sum"]
|
||||
md5_filenames[md5] = md5_filenames.get(md5, []) + [
|
||||
os.path.basename(test_file.get("path"))
|
||||
]
|
||||
md5_output_fn_counts[md5] = md5_output_fn_counts.get(md5, 0) + 1
|
||||
# Log the module that this md5 was in
|
||||
modname = os.path.basename(os.path.dirname(test_yml))
|
||||
# If tool/subtool show the whole thing
|
||||
# Ugly code but trying to stat os-agnostic
|
||||
if os.path.basename(
|
||||
os.path.dirname(os.path.dirname(test_yml))
|
||||
) not in ["modules", "config", "subworkflows"]:
|
||||
modname = "{}/{}".format(
|
||||
os.path.basename(
|
||||
os.path.dirname(os.path.dirname(test_yml))
|
||||
),
|
||||
os.path.basename(os.path.dirname(test_yml)),
|
||||
)
|
||||
module_counts[md5] = module_counts.get(md5, []) + [modname]
|
||||
|
||||
# Set up rich table
|
||||
table = Table(title="Duplicate MD5s", row_styles=["dim", ""])
|
||||
table.add_column("MD5", style="cyan", no_wrap=True)
|
||||
table.add_column("Count", style="magenta", justify="right")
|
||||
table.add_column("Num modules", style="blue", justify="right")
|
||||
table.add_column("Filenames", style="green")
|
||||
|
||||
# Add rows - sort md5_output_fn_counts by value
|
||||
for md5 in sorted(md5_output_fn_counts, key=md5_output_fn_counts.get):
|
||||
if md5_output_fn_counts[md5] >= min_dups:
|
||||
table.add_row(
|
||||
md5,
|
||||
str(md5_output_fn_counts[md5]),
|
||||
str(len(set(module_counts[md5]))),
|
||||
", ".join(set(md5_filenames[md5])),
|
||||
)
|
||||
|
||||
print(table)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
find_duplicate_md5s()
|
7
.github/workflows/code-linting.yml
vendored
7
.github/workflows/code-linting.yml
vendored
|
@ -1,5 +1,10 @@
|
|||
name: Code Linting
|
||||
on: [push, pull_request]
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
pull_request:
|
||||
branches: [master]
|
||||
|
||||
|
||||
jobs:
|
||||
Markdown:
|
||||
|
|
11
.github/workflows/nf-core-linting.yml
vendored
11
.github/workflows/nf-core-linting.yml
vendored
|
@ -1,7 +1,11 @@
|
|||
name: nf-core linting
|
||||
# This workflow is triggered on pushes and PRs to the repository.
|
||||
# It runs the `nf-core lint` tests to ensure that the module code meets the nf-core guidelines
|
||||
on: [push, pull_request]
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
pull_request:
|
||||
branches: [master]
|
||||
|
||||
jobs:
|
||||
changes:
|
||||
|
@ -20,9 +24,6 @@ jobs:
|
|||
|
||||
lint:
|
||||
runs-on: ubuntu-20.04
|
||||
env:
|
||||
NXF_VER: 21.04.0
|
||||
|
||||
name: ${{ matrix.tags }}
|
||||
needs: changes
|
||||
if: needs.changes.outputs.modules != '[]'
|
||||
|
@ -66,6 +67,8 @@ jobs:
|
|||
|
||||
- name: Lint ${{ matrix.tags }}
|
||||
run: nf-core modules lint ${{ matrix.tags }}
|
||||
# HACK
|
||||
if: startsWith( matrix.tags, 'subworkflow' ) != true
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
|
|
16
.github/workflows/pytest-workflow.yml
vendored
16
.github/workflows/pytest-workflow.yml
vendored
|
@ -1,5 +1,9 @@
|
|||
name: Pytest-workflow
|
||||
on: [push, pull_request]
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
pull_request:
|
||||
branches: [master]
|
||||
|
||||
jobs:
|
||||
changes:
|
||||
|
@ -19,13 +23,12 @@ jobs:
|
|||
test:
|
||||
runs-on: ubuntu-20.04
|
||||
|
||||
name: ${{ matrix.tags }} ${{ matrix.profile }} ${{ matrix.nxf_version }}
|
||||
name: ${{ matrix.tags }} ${{ matrix.profile }}
|
||||
needs: changes
|
||||
if: needs.changes.outputs.modules != '[]'
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
nxf_version: ["21.04.0"]
|
||||
tags: ["${{ fromJson(needs.changes.outputs.modules) }}"]
|
||||
profile: ["docker", "singularity", "conda"]
|
||||
env:
|
||||
|
@ -56,13 +59,12 @@ jobs:
|
|||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: /usr/local/bin/nextflow
|
||||
key: ${{ runner.os }}-nextflow-${{ matrix.nxf_version }}
|
||||
key: ${{ runner.os }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-nextflow-
|
||||
|
||||
- name: Install Nextflow
|
||||
env:
|
||||
NXF_VER: ${{ matrix.nxf_version }}
|
||||
CAPSULE_LOG: none
|
||||
run: |
|
||||
wget -qO- get.nextflow.io | bash
|
||||
|
@ -95,9 +97,11 @@ jobs:
|
|||
if: failure()
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: logs-${{ matrix.tags }}-${{ matrix.profile }}-${{ matrix.nxf_version }}
|
||||
name: logs-${{ matrix.profile }}
|
||||
path: |
|
||||
/home/runner/pytest_workflow_*/*/.nextflow.log
|
||||
/home/runner/pytest_workflow_*/*/log.out
|
||||
/home/runner/pytest_workflow_*/*/log.err
|
||||
/home/runner/pytest_workflow_*/*/work
|
||||
!/home/runner/pytest_workflow_*/*/work/conda
|
||||
!/home/runner/pytest_workflow_*/*/work/singularity
|
||||
|
|
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -5,5 +5,9 @@ test_output/
|
|||
output/
|
||||
.DS_Store
|
||||
*.code-workspace
|
||||
tests/data/
|
||||
.screenrc
|
||||
.*.sw?
|
||||
__pycache__
|
||||
*.pyo
|
||||
*.pyc
|
||||
|
|
10
.gitpod.yml
Normal file
10
.gitpod.yml
Normal file
|
@ -0,0 +1,10 @@
|
|||
# List the start up tasks. Learn more https://www.gitpod.io/docs/config-start-tasks/
|
||||
tasks:
|
||||
- name: Install Nextflow
|
||||
init: |
|
||||
curl -s https://get.nextflow.io | bash
|
||||
sudo mv nextflow /usr/local/bin
|
||||
|
||||
- name: Install pytest-workflow
|
||||
init: |
|
||||
pip install pytest-workflow
|
9
.nf-core.yml
Normal file
9
.nf-core.yml
Normal file
|
@ -0,0 +1,9 @@
|
|||
bump-versions:
|
||||
rseqc/junctionannotation: False
|
||||
rseqc/bamstat: False
|
||||
rseqc/readduplication: False
|
||||
rseqc/readdistribution: False
|
||||
rseqc/junctionsaturation: False
|
||||
rseqc/inferexperiment: False
|
||||
rseqc/innerdistance: False
|
||||
sortmerna: False
|
411
README.md
411
README.md
|
@ -1,6 +1,6 @@
|
|||
# ![nf-core/modules](docs/images/nfcore-modules_logo.png)
|
||||
|
||||
[![Nextflow](https://img.shields.io/badge/nextflow%20DSL2-%E2%89%A521.04.0-23aa62.svg?labelColor=000000)](https://www.nextflow.io/)
|
||||
[![Nextflow](https://img.shields.io/badge/nextflow%20DSL2-%E2%89%A521.10.3-23aa62.svg?labelColor=000000)](https://www.nextflow.io/)
|
||||
[![run with conda](http://img.shields.io/badge/run%20with-conda-3EB049?labelColor=000000&logo=anaconda)](https://docs.conda.io/en/latest/)
|
||||
[![run with docker](https://img.shields.io/badge/run%20with-docker-0db7ed?labelColor=000000&logo=docker)](https://www.docker.com/)
|
||||
[![run with singularity](https://img.shields.io/badge/run%20with-singularity-1d355c.svg?labelColor=000000)](https://sylabs.io/docs/)
|
||||
|
@ -12,21 +12,13 @@
|
|||
[![Watch on YouTube](http://img.shields.io/badge/youtube-nf--core-FF0000?labelColor=000000&logo=youtube)](https://www.youtube.com/c/nf-core)
|
||||
|
||||
> THIS REPOSITORY IS UNDER ACTIVE DEVELOPMENT. SYNTAX, ORGANISATION AND LAYOUT MAY CHANGE WITHOUT NOTICE!
|
||||
> PLEASE BE KIND TO OUR CODE REVIEWERS AND SUBMIT ONE PULL REQUEST PER MODULE :)
|
||||
|
||||
A repository for hosting [Nextflow DSL2](https://www.nextflow.io/docs/latest/dsl2.html) module files containing tool-specific process definitions and their associated documentation.
|
||||
|
||||
## Table of contents
|
||||
|
||||
- [Using existing modules](#using-existing-modules)
|
||||
- [Adding a new module file](#adding-a-new-module-file)
|
||||
- [Checklist](#checklist)
|
||||
- [nf-core modules create](#nf-core-modules-create)
|
||||
- [Test data](#test-data)
|
||||
- [Running tests manually](#running-tests-manually)
|
||||
- [Uploading to `nf-core/modules`](#uploading-to-nf-coremodules)
|
||||
- [Guidelines](#guidelines)
|
||||
- [Terminology](#terminology)
|
||||
- [Adding new modules](#adding-new-modules)
|
||||
- [Help](#help)
|
||||
- [Citation](#citation)
|
||||
|
||||
|
@ -40,7 +32,7 @@ We have written a helper command in the `nf-core/tools` package that uses the Gi
|
|||
2. List the available modules:
|
||||
|
||||
```console
|
||||
$ nf-core modules list
|
||||
$ nf-core modules list remote
|
||||
|
||||
,--./,-.
|
||||
___ __ __ __ ___ /,-._.--~\
|
||||
|
@ -65,7 +57,7 @@ We have written a helper command in the `nf-core/tools` package that uses the Gi
|
|||
3. Install the module in your pipeline directory:
|
||||
|
||||
```console
|
||||
$ nf-core modules install . --tool fastqc
|
||||
$ nf-core modules install fastqc
|
||||
|
||||
,--./,-.
|
||||
___ __ __ __ ___ /,-._.--~\
|
||||
|
@ -86,13 +78,13 @@ We have written a helper command in the `nf-core/tools` package that uses the Gi
|
|||
|
||||
nextflow.enable.dsl = 2
|
||||
|
||||
include { FASTQC } from './modules/nf-core/modules/fastqc/main' addParams( options: [:] )
|
||||
include { FASTQC } from './modules/nf-core/modules/fastqc/main'
|
||||
```
|
||||
|
||||
5. Remove the module from the pipeline repository if required:
|
||||
|
||||
```console
|
||||
$ nf-core modules remove . --tool fastqc
|
||||
$ nf-core modules remove fastqc
|
||||
|
||||
,--./,-.
|
||||
___ __ __ __ ___ /,-._.--~\
|
||||
|
@ -109,7 +101,7 @@ We have written a helper command in the `nf-core/tools` package that uses the Gi
|
|||
6. Check that a locally installed nf-core module is up-to-date compared to the one hosted in this repo:
|
||||
|
||||
```console
|
||||
$ nf-core modules lint . --tool fastqc
|
||||
$ nf-core modules lint fastqc
|
||||
|
||||
,--./,-.
|
||||
___ __ __ __ ___ /,-._.--~\
|
||||
|
@ -139,394 +131,11 @@ We have written a helper command in the `nf-core/tools` package that uses the Gi
|
|||
╰──────────────────────╯
|
||||
```
|
||||
|
||||
We have plans to add other utility commands to help developers install and maintain modules downloaded from this repository so watch this space e.g. `nf-core modules update` command to automatically check and update modules installed within the pipeline.
|
||||
## Adding new modules
|
||||
|
||||
## Adding a new module file
|
||||
If you wish to contribute a new module, please see the documentation on the [nf-core website](https://nf-co.re/developers/adding_modules).
|
||||
|
||||
If you decide to upload a module to `nf-core/modules` then this will
|
||||
ensure that it will become available to all nf-core pipelines,
|
||||
and to everyone within the Nextflow community! See
|
||||
[`modules/`](modules)
|
||||
for examples.
|
||||
|
||||
### Checklist
|
||||
|
||||
Please check that the module you wish to add isn't already on [`nf-core/modules`](https://github.com/nf-core/modules/tree/master/modules):
|
||||
- Use the [`nf-core modules list`](https://github.com/nf-core/tools#list-modules) command
|
||||
- Check [open pull requests](https://github.com/nf-core/modules/pulls)
|
||||
- Search [open issues](https://github.com/nf-core/modules/issues)
|
||||
|
||||
If the module doesn't exist on `nf-core/modules`:
|
||||
- Please create a [new issue](https://github.com/nf-core/modules/issues/new?assignees=&labels=new%20module&template=new_nodule.md&title=new%20module:) before adding it
|
||||
- Set an appropriate subject for the issue e.g. `new module: fastqc`
|
||||
- Add yourself to the `Assignees` so we can track who is working on the module
|
||||
|
||||
### nf-core modules create
|
||||
|
||||
We have implemented a number of commands in the `nf-core/tools` package to make it incredibly easy for you to create and contribute your own modules to nf-core/modules.
|
||||
|
||||
1. Install the latest version of [`nf-core/tools`](https://github.com/nf-core/tools#installation) (`>=2.0`)
|
||||
2. Install [`Nextflow`](https://www.nextflow.io/docs/latest/getstarted.html#installation) (`>=21.04.0`)
|
||||
3. Install any of [`Docker`](https://docs.docker.com/engine/installation/), [`Singularity`](https://www.sylabs.io/guides/3.0/user-guide/) or [`Conda`](https://conda.io/miniconda.html)
|
||||
4. [Fork and clone this repo locally](#uploading-to-nf-coremodules)
|
||||
5. Set up git by adding a new remote of the nf-core git repo called `upstream`
|
||||
|
||||
```bash
|
||||
git remote add upstream https://github.com/nf-core/modules.git
|
||||
```
|
||||
|
||||
Make a new branch for your module and check it out
|
||||
|
||||
```bash
|
||||
git checkout -b fastqc
|
||||
```
|
||||
|
||||
6. Create a module using the [nf-core DSL2 module template](https://github.com/nf-core/tools/blob/master/nf_core/module-template/modules/main.nf):
|
||||
|
||||
```console
|
||||
$ nf-core modules create . --tool fastqc --author @joebloggs --label process_low --meta
|
||||
|
||||
,--./,-.
|
||||
___ __ __ __ ___ /,-._.--~\
|
||||
|\ | |__ __ / ` / \ |__) |__ } {
|
||||
| \| | \__, \__/ | \ |___ \`-._,-`-,
|
||||
`._,._,'
|
||||
|
||||
nf-core/tools version 2.0
|
||||
|
||||
INFO Using Bioconda package: 'bioconda::fastqc=0.11.9' create.py:130
|
||||
INFO Using Docker / Singularity container with tag: 'fastqc:0.11.9--0' create.py:140
|
||||
INFO Created / edited following files: create.py:218
|
||||
./modules/fastqc/functions.nf
|
||||
./modules/fastqc/main.nf
|
||||
./modules/fastqc/meta.yml
|
||||
./tests/modules/fastqc/main.nf
|
||||
./tests/modules/fastqc/test.yml
|
||||
./tests/config/pytest_modules.yml
|
||||
```
|
||||
|
||||
All of the files required to add the module to `nf-core/modules` will be created/edited in the appropriate places. The 4 files you will need to change are:
|
||||
|
||||
1. [`./modules/fastqc/main.nf`](https://github.com/nf-core/modules/blob/master/modules/fastqc/main.nf)
|
||||
|
||||
This is the main script containing the `process` definition for the module. You will see an extensive number of `TODO` statements to help guide you to fill in the appropriate sections and to ensure that you adhere to the guidelines we have set for module submissions.
|
||||
|
||||
2. [`./modules/fastqc/meta.yml`](https://github.com/nf-core/modules/blob/master/modules/fastqc/meta.yml)
|
||||
|
||||
This file will be used to store general information about the module and author details - the majority of which will already be auto-filled. However, you will need to add a brief description of the files defined in the `input` and `output` section of the main script since these will be unique to each module.
|
||||
|
||||
3. [`./tests/modules/fastqc/main.nf`](https://github.com/nf-core/modules/blob/master/tests/modules/fastqc/main.nf)
|
||||
|
||||
Every module MUST have a test workflow. This file will define one or more Nextflow `workflow` definitions that will be used to unit test the output files created by the module. By default, one `workflow` definition will be added but please feel free to add as many as possible so we can ensure that the module works on different data types / parameters e.g. separate `workflow` for single-end and paired-end data.
|
||||
|
||||
Minimal test data required for your module may already exist within this repository, in which case you may just have to change a couple of paths in this file - see the [Test data](#test-data) section for more info and guidelines for adding new standardised data if required.
|
||||
|
||||
4. [`./tests/modules/fastqc/test.yml`](https://github.com/nf-core/modules/blob/master/tests/modules/fastqc/test.yml)
|
||||
|
||||
This file will contain all of the details required to unit test the main script in the point above using [pytest-workflow](https://pytest-workflow.readthedocs.io/). If possible, any outputs produced by the test workflow(s) MUST be included and listed in this file along with an appropriate check e.g. md5sum. The different test options are listed in the [pytest-workflow docs](https://pytest-workflow.readthedocs.io/en/stable/#test-options).
|
||||
|
||||
As highlighted in the next point, we have added a command to make it much easier to test the workflow(s) defined for the module and to automatically create the `test.yml` with the md5sum hashes for all of the outputs generated by the module.
|
||||
|
||||
`md5sum` checks are the preferable choice of test to determine file changes, however, this may not be possible for all outputs generated by some tools e.g. if they include time stamps or command-related headers. Please do your best to avoid just checking for the file being present e.g. it may still be possible to check that the file contains the appropriate text snippets.
|
||||
|
||||
7. Create a yaml file containing information required for module unit testing
|
||||
|
||||
```console
|
||||
$ nf-core modules create-test-yml
|
||||
|
||||
,--./,-.
|
||||
___ __ __ __ ___ /,-._.--~\
|
||||
|\ | |__ __ / ` / \ |__) |__ } {
|
||||
| \| | \__, \__/ | \ |___ \`-._,-`-,
|
||||
`._,._,'
|
||||
|
||||
nf-core/tools version 2.0
|
||||
|
||||
|
||||
INFO Press enter to use default values (shown in brackets) or type your own responses test_yml_builder.py:51
|
||||
? Tool name: fastqc
|
||||
Test YAML output path (- for stdout) (tests/modules/fastqc/test.yml):
|
||||
INFO Looking for test workflow entry points: 'tests/modules/fastqc/main.nf' test_yml_builder.py:116
|
||||
INFO Building test meta for entry point 'test_fastqc_single_end' test_yml_builder.py:150
|
||||
Test name (fastqc test_fastqc_single_end):
|
||||
Test command (nextflow run tests/modules/fastqc -entry test_fastqc_single_end -c tests/config/nextflow.config):
|
||||
Test tags (comma separated) (fastqc,fastqc_single_end):
|
||||
Test output folder with results (leave blank to run test):
|
||||
? Choose software profile Singularity
|
||||
INFO Setting env var '$PROFILE' to 'singularity' test_yml_builder.py:258
|
||||
INFO Running 'fastqc' test with command: test_yml_builder.py:263
|
||||
nextflow run tests/modules/fastqc -entry test_fastqc_single_end -c tests/config/nextflow.config --outdir /tmp/tmpgbneftf5
|
||||
INFO Test workflow finished! test_yml_builder.py:276
|
||||
INFO Writing to 'tests/modules/fastqc/test.yml' test_yml_builder.py:293
|
||||
```
|
||||
|
||||
> NB: See docs for [running tests manually](#running-tests-manually) if you would like to run the tests manually.
|
||||
|
||||
8. Lint the module locally to check that it adheres to nf-core guidelines before submission
|
||||
|
||||
```console
|
||||
$ nf-core modules lint . --tool fastqc
|
||||
|
||||
,--./,-.
|
||||
___ __ __ __ ___ /,-._.--~\
|
||||
|\ | |__ __ / ` / \ |__) |__ } {
|
||||
| \| | \__, \__/ | \ |___ \`-._,-`-,
|
||||
`._,._,'
|
||||
|
||||
nf-core/tools version 2.0
|
||||
|
||||
INFO Linting modules repo: . lint.py:102
|
||||
INFO Linting module: fastqc lint.py:106
|
||||
|
||||
╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
|
||||
│ [!] 3 Test Warnings │
|
||||
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
|
||||
╭──────────────┬──────────────────────────────────────────────────────────────┬──────────────────────────────────╮
|
||||
│ Module name │ Test message │ File path │
|
||||
├──────────────┼──────────────────────────────────────────────────────────────┼──────────────────────────────────┤
|
||||
│ fastqc │ TODO string in meta.yml: #Add a description of the module... │ modules/nf-core/modules/fastqc/ │
|
||||
│ fastqc │ TODO string in meta.yml: #Add a description and other det... │ modules/nf-core/modules/fastqc/ │
|
||||
│ fastqc │ TODO string in meta.yml: #Add a description of all of the... │ modules/nf-core/modules/fastqc/ │
|
||||
╰──────────────┴──────────────────────────────────────────────────────────────┴──────────────────────────────────╯
|
||||
╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
|
||||
│ [!] 1 Test Failed │
|
||||
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
|
||||
╭──────────────┬──────────────────────────────────────────────────────────────┬──────────────────────────────────╮
|
||||
│ Module name │ Test message │ File path │
|
||||
├──────────────┼──────────────────────────────────────────────────────────────┼──────────────────────────────────┤
|
||||
│ fastqc │ 'meta' map not emitted in output channel(s) │ modules/nf-core/modules/fastqc/ │
|
||||
╰──────────────┴──────────────────────────────────────────────────────────────┴──────────────────────────────────╯
|
||||
╭──────────────────────╮
|
||||
│ LINT RESULTS SUMMARY │
|
||||
├──────────────────────┤
|
||||
│ [✔] 38 Tests Passed │
|
||||
│ [!] 3 Test Warning │
|
||||
│ [✗] 1 Test Failed │
|
||||
╰──────────────────────╯
|
||||
```
|
||||
|
||||
9. Once ready, the code can be pushed and a pull request (PR) created
|
||||
|
||||
On a regular basis you can pull upstream changes into this branch and it is recommended to do so before pushing and creating a pull request - see below. Rather than merging changes directly from upstream the rebase strategy is recommended so that your changes are applied on top of the latest master branch from the nf-core repo. This can be performed as follows
|
||||
|
||||
```bash
|
||||
git pull --rebase upstream master
|
||||
```
|
||||
|
||||
Once you are ready you can push the code and create a PR
|
||||
|
||||
```bash
|
||||
git push -u origin fastqc
|
||||
```
|
||||
|
||||
Once the PR has been accepted you should delete the branch and checkout master again.
|
||||
|
||||
```bash
|
||||
git checkout master
|
||||
git branch -d fastqc
|
||||
```
|
||||
|
||||
In case there are commits on the local branch that didn't make it into the PR (usually commits made after the PR), git will warn about this and not delete the branch. If you are sure you want to delete, use the following command
|
||||
|
||||
```bash
|
||||
git branch -D fastqc
|
||||
```
|
||||
|
||||
### Test data
|
||||
|
||||
In order to test that each module added to `nf-core/modules` is actually working and to be able to track any changes to results files between module updates we have set-up a number of Github Actions CI tests to run each module on a minimal test dataset using Docker, Singularity and Conda.
|
||||
|
||||
- All test data for `nf-core/modules` MUST be added to the `modules` branch of [`nf-core/test-datasets`](https://github.com/nf-core/test-datasets/tree/modules/data) and organised by filename extension.
|
||||
|
||||
- In order to keep the size of this repository as minimal as possible, pre-existing files from [`nf-core/test-datasets`](https://github.com/nf-core/test-datasets/tree/modules/data) MUST be reused if at all possible.
|
||||
|
||||
- Test files MUST be kept as tiny as possible.
|
||||
|
||||
- If the appropriate test data doesn't exist in the `modules` branch of [`nf-core/test-datasets`](https://github.com/nf-core/test-datasets/tree/modules/data) please contact us on the [nf-core Slack `#modules` channel](https://nfcore.slack.com/channels/modules) (you can join with [this invite](https://nf-co.re/join/slack)) to discuss possible options.
|
||||
|
||||
### Running tests manually
|
||||
|
||||
As outlined in the [nf-core modules create](#nf-core-modules-create) section we have made it quite trivial to create an initial yaml file (via the `nf-core modules create-test-yml` command) containing a listing of all of the module output files and their associated md5sums. However, md5sum checks may not be appropriate for all output files if for example they contain timestamps. This is why it is a good idea to re-run the tests locally with `pytest-workflow` before you create your pull request adding the module. If your files do indeed have timestamps or other issues that prevent you from using the md5sum check, then you can edit the `test.yml` file to instead check that the file contains some specific content or as a last resort, if it exists. The different test options are listed in the [pytest-workflow docs](https://pytest-workflow.readthedocs.io/en/stable/#test-options).
|
||||
|
||||
Please follow the steps below to run the tests locally:
|
||||
|
||||
1. Install [`Nextflow`](https://www.nextflow.io/docs/latest/getstarted.html#installation) (`>=21.04.0`)
|
||||
|
||||
2. Install any of [`Docker`](https://docs.docker.com/engine/installation/), [`Singularity`](https://www.sylabs.io/guides/3.0/user-guide/) or [`Conda`](https://conda.io/miniconda.html)
|
||||
|
||||
3. Install [`pytest-workflow`](https://pytest-workflow.readthedocs.io/en/stable/#installation)
|
||||
|
||||
4. Start running your own tests using the appropriate [`tag`](https://github.com/nf-core/modules/blob/3d720a24fd3c766ba56edf3d4e108a1c45d353b2/tests/modules/fastqc/test.yml#L3-L5) defined in the `test.yml`:
|
||||
|
||||
- Typical command with Docker:
|
||||
|
||||
```console
|
||||
cd /path/to/git/clone/of/nf-core/modules/
|
||||
PROFILE=docker pytest --tag fastqc --symlink --keep-workflow-wd
|
||||
```
|
||||
|
||||
- Typical command with Singularity:
|
||||
|
||||
```console
|
||||
cd /path/to/git/clone/of/nf-core/modules/
|
||||
TMPDIR=~ PROFILE=singularity pytest --tag fastqc --symlink --keep-workflow-wd
|
||||
```
|
||||
|
||||
- Typical command with Conda:
|
||||
|
||||
```console
|
||||
cd /path/to/git/clone/of/nf-core/modules/
|
||||
PROFILE=conda pytest --tag fastqc --symlink --keep-workflow-wd
|
||||
```
|
||||
|
||||
- See [docs on running pytest-workflow](https://pytest-workflow.readthedocs.io/en/stable/#running-pytest-workflow) for more info.
|
||||
|
||||
### Uploading to `nf-core/modules`
|
||||
|
||||
[Fork](https://help.github.com/articles/fork-a-repo/) the `nf-core/modules` repository to your own GitHub account. Within the local clone of your fork add the module file to the [`modules/`](modules) directory. Please try and keep PRs as atomic as possible to aid the reviewing process - ideally, one module addition/update per PR.
|
||||
|
||||
Commit and push these changes to your local clone on GitHub, and then [create a pull request](https://help.github.com/articles/creating-a-pull-request-from-a-fork/) on the `nf-core/modules` GitHub repo with the appropriate information.
|
||||
|
||||
We will be notified automatically when you have created your pull request, and providing that everything adheres to nf-core guidelines we will endeavour to approve your pull request as soon as possible.
|
||||
|
||||
### Guidelines
|
||||
|
||||
The key words "MUST", "MUST NOT", "SHOULD", etc. are to be interpreted as described in [RFC 2119](https://tools.ietf.org/html/rfc2119).
|
||||
|
||||
#### General
|
||||
|
||||
- Software that can be piped together SHOULD be added to separate module files
|
||||
unless there is a run-time, storage advantage in implementing in this way. For example,
|
||||
using a combination of `bwa` and `samtools` to output a BAM file instead of a SAM file:
|
||||
|
||||
```bash
|
||||
bwa mem | samtools view -B -T ref.fasta
|
||||
```
|
||||
|
||||
- Where applicable, the usage and generation of compressed files SHOULD be enforced as input and output, respectively:
|
||||
- `*.fastq.gz` and NOT `*.fastq`
|
||||
- `*.bam` and NOT `*.sam`
|
||||
|
||||
- Where applicable, each module command MUST emit a file `<SOFTWARE>.version.txt` containing a single line with the software's version in the format `<VERSION_NUMBER>` or `0.7.17` e.g.
|
||||
|
||||
```bash
|
||||
echo \$(bwa 2>&1) | sed 's/^.*Version: //; s/Contact:.*\$//' > ${software}.version.txt
|
||||
```
|
||||
|
||||
If the software is unable to output a version number on the command-line then a variable called `VERSION` can be manually specified to create this file e.g. [homer/annotatepeaks module](https://github.com/nf-core/modules/blob/master/modules/homer/annotatepeaks/main.nf).
|
||||
|
||||
- The process definition MUST NOT contain a `when` statement.
|
||||
|
||||
#### Naming conventions
|
||||
|
||||
- The directory structure for the module name must be all lowercase e.g. [`modules/bwa/mem/`](modules/bwa/mem/). The name of the software (i.e. `bwa`) and tool (i.e. `mem`) MUST be all one word.
|
||||
|
||||
- The process name in the module file MUST be all uppercase e.g. `process BWA_MEM {`. The name of the software (i.e. `BWA`) and tool (i.e. `MEM`) MUST be all one word separated by an underscore.
|
||||
|
||||
- All parameter names MUST follow the `snake_case` convention.
|
||||
|
||||
- All function names MUST follow the `camelCase` convention.
|
||||
|
||||
#### Module parameters
|
||||
|
||||
- A module file SHOULD only define input and output files as command-line parameters to be executed within the process.
|
||||
|
||||
- All other parameters MUST be provided as a string i.e. `options.args` where `options` is a Groovy Map that MUST be provided via the Nextflow `addParams` option when including the module via `include` in the parent workflow.
|
||||
|
||||
- If the tool supports multi-threading then you MUST provide the appropriate parameter using the Nextflow `task` variable e.g. `--threads $task.cpus`.
|
||||
|
||||
- Any parameters that need to be evaluated in the context of a particular sample e.g. single-end/paired-end data MUST also be defined within the process.
|
||||
|
||||
#### Input/output options
|
||||
|
||||
- Named file extensions MUST be emitted for ALL output channels e.g. `path "*.txt", emit: txt`.
|
||||
|
||||
- Optional inputs are not currently supported by Nextflow. However, "fake files" MAY be used to work around this issue.
|
||||
|
||||
#### Resource requirements
|
||||
|
||||
- An appropriate resource `label` MUST be provided for the module as listed in the [nf-core pipeline template](https://github.com/nf-core/tools/blob/master/nf_core/pipeline-template/conf/base.config#L29-L46) e.g. `process_low`, `process_medium` or `process_high`.
|
||||
|
||||
- If the tool supports multi-threading then you MUST provide the appropriate parameter using the Nextflow `task` variable e.g. `--threads $task.cpus`.
|
||||
|
||||
#### Software requirements
|
||||
|
||||
[BioContainers](https://biocontainers.pro/#/) is a registry of Docker and Singularity containers automatically created from all of the software packages on [Bioconda](https://bioconda.github.io/). Where possible we will use BioContainers to fetch pre-built software containers and Bioconda to install software using Conda.
|
||||
|
||||
- Software requirements SHOULD be declared within the module file using the Nextflow `container` directive. For single-tool BioContainers, the `nf-core modules create` command will automatically fetch and fill-in the appropriate Conda / Docker / Singularity definitions by parsing the information provided in the first part of the module name:
|
||||
|
||||
```nextflow
|
||||
conda (params.enable_conda ? "bioconda::bwa=0.7.17" : null) // Conda package
|
||||
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||
container "https://depot.galaxyproject.org/singularity/bwa:0.7.17--hed695b0_7" // Singularity image
|
||||
} else {
|
||||
container "quay.io/biocontainers/bwa:0.7.17--hed695b0_7" // Docker image
|
||||
}
|
||||
```
|
||||
|
||||
- If the software is available on Conda it MUST also be defined using the Nextflow `conda` directive. Using `bioconda::bwa=0.7.17` as an example, software MUST be pinned to the channel (i.e. `bioconda`) and version (i.e. `0.7.17`). Conda packages MUST not be pinned to a build because they can vary on different platforms.
|
||||
|
||||
- If required, multi-tool containers may also be available on BioContainers e.g. [`bwa` and `samtools`](https://biocontainers.pro/#/tools/mulled-v2-fe8faa35dbf6dc65a0f7f5d4ea12e31a79f73e40). You can install and use the [`galaxy-tool-util`](https://anaconda.org/bioconda/galaxy-tool-util) package to search for both single- and multi-tool containers available in Conda, Docker and Singularity format. e.g. to search for Docker (hosted on Quay.io) and Singularity multi-tool containers with both `bowtie` and `samtools` installed you can use the following command:
|
||||
|
||||
```console
|
||||
mulled-search --destination quay singularity --channel bioconda --search bowtie samtools | grep "mulled"
|
||||
```
|
||||
|
||||
> NB: Build information for all tools within a multi-tool container can be obtained in the `/usr/local/conda-meta/history` file within the container.
|
||||
|
||||
- It is also possible for a new multi-tool container to be built and added to BioContainers by submitting a pull request on their [`multi-package-containers`](https://github.com/BioContainers/multi-package-containers) repository.
|
||||
- Fork the [multi-package-containers repository](https://github.com/BioContainers/multi-package-containers)
|
||||
- Make a change to the `hash.tsv` file in the `combinations` directory see [here](https://github.com/aunderwo/multi-package-containers/blob/master/combinations/hash.tsv#L124) for an example where `pysam=0.16.0.1,biopython=1.78` was added.
|
||||
- Commit the code and then make a pull request to the original repo, for [example](https://github.com/BioContainers/multi-package-containers/pull/1661)
|
||||
- Once the PR has been accepted a container will get built and you can find it using a search tool in the `galaxy-tool-util conda` package
|
||||
|
||||
```console
|
||||
mulled-search --destination quay singularity conda --search pysam biopython | grep "mulled"
|
||||
quay mulled-v2-3a59640f3fe1ed11819984087d31d68600200c3f 185a25ca79923df85b58f42deb48f5ac4481e91f-0 docker pull quay.io/biocontainers/mulled-v2-3a59640f3fe1ed11819984087d31d68600200c3f:185a25ca79923df85b58f42deb48f5ac4481e91f-0
|
||||
singularity mulled-v2-3a59640f3fe1ed11819984087d31d68600200c3f 185a25ca79923df85b58f42deb48f5ac4481e91f-0 wget https://depot.galaxyproject.org/singularity/mulled-v2-3a59640f3fe1ed11819984087d31d68600200c3f:185a25ca79923df85b58f42deb48f5ac4481e91f-0
|
||||
```
|
||||
|
||||
- You can copy and paste the `mulled-*` path into the relevant Docker and Singularity lines in the Nextflow `process` definition of your module
|
||||
- To confirm that this is correct. Spin up a temporary Docker container
|
||||
|
||||
```console
|
||||
docker run --rm -it quay.io/biocontainers/mulled-v2-3a59640f3fe1ed11819984087d31d68600200c3f:185a25ca79923df85b58f42deb48f5ac4481e91f-0 /bin/sh
|
||||
```
|
||||
|
||||
And in the command prompt type
|
||||
|
||||
```console
|
||||
$ grep specs /usr/local/conda-meta/history
|
||||
# update specs: ['biopython=1.78', 'pysam=0.16.0.1']
|
||||
```
|
||||
|
||||
The packages should reflect those added to the multi-package-containers repo `hash.tsv` file
|
||||
|
||||
- If the software is not available on Bioconda a `Dockerfile` MUST be provided within the module directory. We will use GitHub Actions to auto-build the containers on the [GitHub Packages registry](https://github.com/features/packages).
|
||||
|
||||
#### Publishing results
|
||||
|
||||
The [Nextflow `publishDir`](https://www.nextflow.io/docs/latest/process.html#publishdir) definition is currently quite limited in terms of parameter/option evaluation. To overcome this, the publishing logic we have implemented for use with DSL2 modules attempts to minimise changing the `publishDir` directive (default: `params.outdir`) in favour of constructing and appending the appropriate output directory paths via the `saveAs:` statement e.g.
|
||||
|
||||
```nextflow
|
||||
publishDir "${params.outdir}",
|
||||
mode: params.publish_dir_mode,
|
||||
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), publish_id:meta.id) }
|
||||
```
|
||||
|
||||
The `saveFiles` function can be found in the [`functions.nf`](modules/fastqc/functions.nf) file of utility functions that will be copied into all module directories. It uses the various publishing `options` specified as input to the module to construct and append the relevant output path to `params.outdir`.
|
||||
|
||||
We also use a standardised parameter called `params.publish_dir_mode` that can be used to alter the file publishing method (default: `copy`).
|
||||
|
||||
## Terminology
|
||||
|
||||
The features offered by Nextflow DSL2 can be used in various ways depending on the granularity with which you would like to write pipelines. Please see the listing below for the hierarchy and associated terminology we have decided to use when referring to DSL2 components:
|
||||
|
||||
- *Module*: A `process` that can be used within different pipelines and is as atomic as possible i.e. cannot be split into another module. An example of this would be a module file containing the process definition for a single tool such as `FastQC`. At present, this repository has been created to only host atomic module files that should be added to the [`modules/`](modules/) directory along with the required documentation and tests.
|
||||
|
||||
- *Sub-workflow*: A chain of multiple modules that offer a higher-level of functionality within the context of a pipeline. For example, a sub-workflow to run multiple QC tools with FastQ files as input. Sub-workflows should be shipped with the pipeline implementation and if required they should be shared amongst different pipelines directly from there. As it stands, this repository will not host sub-workflows although this may change in the future since well-written sub-workflows will be the most powerful aspect of DSL2.
|
||||
|
||||
- *Workflow*: What DSL1 users would consider an end-to-end pipeline. For example, from one or more inputs to a series of outputs. This can either be implemented using a large monolithic script as with DSL1, or by using a combination of DSL2 individual modules and sub-workflows.
|
||||
> Please be kind to our code reviewers and submit one pull request per module :)
|
||||
|
||||
## Help
|
||||
|
||||
|
|
3
main.nf
Normal file
3
main.nf
Normal file
|
@ -0,0 +1,3 @@
|
|||
/*
|
||||
* not actually used - just a placeholder
|
||||
*/
|
|
@ -1,68 +0,0 @@
|
|||
//
|
||||
// Utility functions used in nf-core DSL2 module files
|
||||
//
|
||||
|
||||
//
|
||||
// Extract name of software tool from process name using $task.process
|
||||
//
|
||||
def getSoftwareName(task_process) {
|
||||
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
|
||||
}
|
||||
|
||||
//
|
||||
// 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) {
|
||||
if (!args.filename.endsWith('.version.txt')) {
|
||||
def ioptions = initOptions(args.options)
|
||||
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,22 +1,11 @@
|
|||
// Import generic module functions
|
||||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||
|
||||
params.options = [:]
|
||||
options = initOptions(params.options)
|
||||
|
||||
process ABACAS {
|
||||
tag "$meta.id"
|
||||
label 'process_medium'
|
||||
publishDir "${params.outdir}",
|
||||
mode: params.publish_dir_mode,
|
||||
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
|
||||
|
||||
conda (params.enable_conda ? "bioconda::abacas=1.3.1" : null)
|
||||
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||
container "https://depot.galaxyproject.org/singularity/abacas:1.3.1--pl526_0"
|
||||
} else {
|
||||
container "quay.io/biocontainers/abacas:1.3.1--pl526_0"
|
||||
}
|
||||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
||||
'https://depot.galaxyproject.org/singularity/abacas:1.3.1--pl526_0' :
|
||||
'quay.io/biocontainers/abacas:1.3.1--pl526_0' }"
|
||||
|
||||
input:
|
||||
tuple val(meta), path(scaffold)
|
||||
|
@ -24,22 +13,25 @@ process ABACAS {
|
|||
|
||||
output:
|
||||
tuple val(meta), path('*.abacas*'), emit: results
|
||||
path '*.version.txt' , emit: version
|
||||
path "versions.yml" , emit: versions
|
||||
|
||||
script:
|
||||
def software = getSoftwareName(task.process)
|
||||
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||
def args = task.ext.args ?: ''
|
||||
def prefix = task.ext.prefix ?: "${meta.id}"
|
||||
"""
|
||||
abacas.pl \\
|
||||
-r $fasta \\
|
||||
-q $scaffold \\
|
||||
$options.args \\
|
||||
$args \\
|
||||
-o ${prefix}.abacas
|
||||
|
||||
mv nucmer.delta ${prefix}.abacas.nucmer.delta
|
||||
mv nucmer.filtered.delta ${prefix}.abacas.nucmer.filtered.delta
|
||||
mv nucmer.tiling ${prefix}.abacas.nucmer.tiling
|
||||
mv unused_contigs.out ${prefix}.abacas.unused.contigs.out
|
||||
echo \$(abacas.pl -v 2>&1) | sed 's/^.*ABACAS.//; s/ .*\$//' > ${software}.version.txt
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${task.process}":
|
||||
abacas: \$(echo \$(abacas.pl -v 2>&1) | sed 's/^.*ABACAS.//; s/ .*\$//')
|
||||
END_VERSIONS
|
||||
"""
|
||||
}
|
||||
|
|
|
@ -48,10 +48,10 @@ output:
|
|||
'test.abacas.MULTIFASTA.fa' ]
|
||||
pattern: "*.{abacas}*"
|
||||
|
||||
- version:
|
||||
- versions:
|
||||
type: file
|
||||
description: File containing software version
|
||||
pattern: "*.{version.txt}"
|
||||
description: File containing software versions
|
||||
pattern: "versions.yml"
|
||||
|
||||
authors:
|
||||
- "@joseespinosa"
|
||||
|
|
|
@ -1,68 +0,0 @@
|
|||
//
|
||||
// Utility functions used in nf-core DSL2 module files
|
||||
//
|
||||
|
||||
//
|
||||
// Extract name of software tool from process name using $task.process
|
||||
//
|
||||
def getSoftwareName(task_process) {
|
||||
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
|
||||
}
|
||||
|
||||
//
|
||||
// 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) {
|
||||
if (!args.filename.endsWith('.version.txt')) {
|
||||
def ioptions = initOptions(args.options)
|
||||
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,21 +1,11 @@
|
|||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||
|
||||
params.options = [:]
|
||||
options = initOptions(params.options)
|
||||
|
||||
process ADAPTERREMOVAL {
|
||||
tag "$meta.id"
|
||||
label 'process_medium'
|
||||
publishDir "${params.outdir}",
|
||||
mode: params.publish_dir_mode,
|
||||
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
|
||||
|
||||
conda (params.enable_conda ? "bioconda::adapterremoval=2.3.2" : null)
|
||||
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||
container "https://depot.galaxyproject.org/singularity/adapterremoval:2.3.2--hb7ba0dd_0"
|
||||
} else {
|
||||
container "quay.io/biocontainers/adapterremoval:2.3.2--hb7ba0dd_0"
|
||||
}
|
||||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
||||
'https://depot.galaxyproject.org/singularity/adapterremoval:2.3.2--hb7ba0dd_0' :
|
||||
'quay.io/biocontainers/adapterremoval:2.3.2--hb7ba0dd_0' }"
|
||||
|
||||
input:
|
||||
tuple val(meta), path(reads)
|
||||
|
@ -23,17 +13,17 @@ process ADAPTERREMOVAL {
|
|||
output:
|
||||
tuple val(meta), path('*.fastq.gz'), emit: reads
|
||||
tuple val(meta), path('*.log') , emit: log
|
||||
path "*.version.txt" , emit: version
|
||||
path "versions.yml" , emit: versions
|
||||
|
||||
script:
|
||||
def software = getSoftwareName(task.process)
|
||||
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||
def args = task.ext.args ?: ''
|
||||
def prefix = task.ext.prefix ?: "${meta.id}"
|
||||
|
||||
if (meta.single_end) {
|
||||
"""
|
||||
AdapterRemoval \\
|
||||
--file1 $reads \\
|
||||
$options.args \\
|
||||
$args \\
|
||||
--basename $prefix \\
|
||||
--threads $task.cpus \\
|
||||
--settings ${prefix}.log \\
|
||||
|
@ -41,14 +31,17 @@ process ADAPTERREMOVAL {
|
|||
--seed 42 \\
|
||||
--gzip \\
|
||||
|
||||
AdapterRemoval --version 2>&1 | sed -e "s/AdapterRemoval ver. //g" > ${software}.version.txt
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${task.process}":
|
||||
adapterremoval: \$(AdapterRemoval --version 2>&1 | sed -e "s/AdapterRemoval ver. //g")
|
||||
END_VERSIONS
|
||||
"""
|
||||
} else if (!meta.single_end && !meta.collapse) {
|
||||
"""
|
||||
AdapterRemoval \\
|
||||
--file1 ${reads[0]} \\
|
||||
--file2 ${reads[0]} \\
|
||||
$options.args \\
|
||||
--file2 ${reads[1]} \\
|
||||
$args \\
|
||||
--basename $prefix \\
|
||||
--threads $task.cpus \\
|
||||
--settings ${prefix}.log \\
|
||||
|
@ -57,15 +50,18 @@ process ADAPTERREMOVAL {
|
|||
--seed 42 \\
|
||||
--gzip \\
|
||||
|
||||
AdapterRemoval --version 2>&1 | sed -e "s/AdapterRemoval ver. //g" > ${software}.version.txt
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${task.process}":
|
||||
adapterremoval: \$(AdapterRemoval --version 2>&1 | sed -e "s/AdapterRemoval ver. //g")
|
||||
END_VERSIONS
|
||||
"""
|
||||
} else {
|
||||
"""
|
||||
AdapterRemoval \\
|
||||
--file1 ${reads[0]} \\
|
||||
--file2 ${reads[0]} \\
|
||||
--file2 ${reads[1]} \\
|
||||
--collapse \\
|
||||
$options.args \\
|
||||
$args \\
|
||||
--basename $prefix \\
|
||||
--threads $task.cpus \\
|
||||
--settings ${prefix}.log \\
|
||||
|
@ -73,7 +69,10 @@ process ADAPTERREMOVAL {
|
|||
--gzip \\
|
||||
|
||||
cat *.collapsed.gz *.collapsed.truncated.gz > ${prefix}.merged.fastq.gz
|
||||
AdapterRemoval --version 2>&1 | sed -e "s/AdapterRemoval ver. //g" > ${software}.version.txt
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${task.process}":
|
||||
adapterremoval: \$(AdapterRemoval --version 2>&1 | sed -e "s/AdapterRemoval ver. //g")
|
||||
END_VERSIONS
|
||||
"""
|
||||
}
|
||||
|
||||
|
|
|
@ -41,10 +41,10 @@ output:
|
|||
type: file
|
||||
description: AdapterRemoval log file
|
||||
pattern: "*.log"
|
||||
- version:
|
||||
- versions:
|
||||
type: file
|
||||
description: File containing software version
|
||||
pattern: "*.{version.txt}"
|
||||
description: File containing software versions
|
||||
pattern: "versions.yml"
|
||||
|
||||
authors:
|
||||
- "@maxibor"
|
||||
|
|
31
modules/agrvate/main.nf
Normal file
31
modules/agrvate/main.nf
Normal file
|
@ -0,0 +1,31 @@
|
|||
process AGRVATE {
|
||||
tag "$meta.id"
|
||||
label 'process_low'
|
||||
|
||||
conda (params.enable_conda ? "bioconda::agrvate=1.0.2" : null)
|
||||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
||||
'https://depot.galaxyproject.org/singularity/agrvate:1.0.2--hdfd78af_0' :
|
||||
'quay.io/biocontainers/agrvate:1.0.2--hdfd78af_0' }"
|
||||
|
||||
input:
|
||||
tuple val(meta), path(fasta)
|
||||
|
||||
output:
|
||||
tuple val(meta), path("${fasta.baseName}-results/${fasta.baseName}-summary.tab"), emit: summary
|
||||
path "${fasta.baseName}-results" , emit: results_dir
|
||||
path "versions.yml" , emit: versions
|
||||
|
||||
script:
|
||||
def args = task.ext.args ?: ''
|
||||
def prefix = task.ext.prefix ?: "${meta.id}"
|
||||
"""
|
||||
agrvate \\
|
||||
$args \\
|
||||
-i $fasta
|
||||
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${task.process}":
|
||||
agrvate: \$(echo \$(agrvate -v 2>&1) | sed 's/agrvate v//;')
|
||||
END_VERSIONS
|
||||
"""
|
||||
}
|
46
modules/agrvate/meta.yml
Normal file
46
modules/agrvate/meta.yml
Normal file
|
@ -0,0 +1,46 @@
|
|||
name: agrvate
|
||||
description: Rapid identification of Staphylococcus aureus agr locus type and agr operon variants
|
||||
keywords:
|
||||
- fasta
|
||||
- virulence
|
||||
- Staphylococcus aureus
|
||||
tools:
|
||||
- agrvate:
|
||||
description: Rapid identification of Staphylococcus aureus agr locus type and agr operon variants.
|
||||
homepage: https://github.com/VishnuRaghuram94/AgrVATE
|
||||
documentation: https://github.com/VishnuRaghuram94/AgrVATE
|
||||
tool_dev_url: https://github.com/VishnuRaghuram94/AgrVATE
|
||||
doi: ""
|
||||
licence: ['MIT']
|
||||
|
||||
input:
|
||||
- meta:
|
||||
type: map
|
||||
description: |
|
||||
Groovy Map containing sample information
|
||||
e.g. [ id:'test', single_end:false ]
|
||||
- fasta:
|
||||
type: file
|
||||
description: A Staphylococcus aureus fasta file.
|
||||
pattern: "*.fasta"
|
||||
|
||||
output:
|
||||
- meta:
|
||||
type: map
|
||||
description: |
|
||||
Groovy Map containing sample information
|
||||
e.g. [ id:'test', single_end:false ]
|
||||
- summary:
|
||||
type: file
|
||||
description: A summary of the agrvate assessement
|
||||
pattern: "*-summary.tab"
|
||||
- results_dir:
|
||||
type: directory
|
||||
description: Results of the agrvate assessement
|
||||
pattern: "*-results"
|
||||
- versions:
|
||||
type: file
|
||||
description: File containing software versions
|
||||
pattern: "versions.yml"
|
||||
authors:
|
||||
- "@abhi18av"
|
|
@ -1,68 +0,0 @@
|
|||
//
|
||||
// Utility functions used in nf-core DSL2 module files
|
||||
//
|
||||
|
||||
//
|
||||
// Extract name of software tool from process name using $task.process
|
||||
//
|
||||
def getSoftwareName(task_process) {
|
||||
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
|
||||
}
|
||||
|
||||
//
|
||||
// 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) {
|
||||
if (!args.filename.endsWith('.version.txt')) {
|
||||
def ioptions = initOptions(args.options)
|
||||
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,41 +1,37 @@
|
|||
// Import generic module functions
|
||||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||
|
||||
params.options = [:]
|
||||
options = initOptions(params.options)
|
||||
|
||||
process ALLELECOUNTER {
|
||||
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::cancerit-allelecount=4.2.1" : null)
|
||||
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||
container "https://depot.galaxyproject.org/singularity/cancerit-allelecount:4.2.1--h3ecb661_0"
|
||||
} else {
|
||||
container "quay.io/biocontainers/cancerit-allelecount:4.2.1--h3ecb661_0"
|
||||
}
|
||||
conda (params.enable_conda ? 'bioconda::cancerit-allelecount=4.3.0' : null)
|
||||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
||||
'https://depot.galaxyproject.org/singularity/cancerit-allelecount:4.3.0--h41abebc_0' :
|
||||
'quay.io/biocontainers/cancerit-allelecount:4.3.0--h41abebc_0' }"
|
||||
|
||||
input:
|
||||
tuple val(meta), path(bam), path(bai)
|
||||
tuple val(meta), path(input), path(input_index)
|
||||
path loci
|
||||
path fasta
|
||||
|
||||
output:
|
||||
tuple val(meta), path("*.alleleCount"), emit: allelecount
|
||||
path "*.version.txt" , emit: version
|
||||
path "versions.yml" , emit: versions
|
||||
|
||||
script:
|
||||
def software = getSoftwareName(task.process)
|
||||
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||
def args = task.ext.args ?: ''
|
||||
def prefix = task.ext.prefix ?: "${meta.id}"
|
||||
def reference_options = fasta ? "-r $fasta": ""
|
||||
|
||||
"""
|
||||
alleleCounter \\
|
||||
$options.args \\
|
||||
$args \\
|
||||
-l $loci \\
|
||||
-b $bam \\
|
||||
-b $input \\
|
||||
$reference_options \\
|
||||
-o ${prefix}.alleleCount
|
||||
|
||||
alleleCounter --version > ${software}.version.txt
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${task.process}":
|
||||
allelecounter: \$(alleleCounter --version)
|
||||
END_VERSIONS
|
||||
"""
|
||||
}
|
||||
|
|
|
@ -19,11 +19,11 @@ input:
|
|||
description: |
|
||||
Groovy Map containing sample information
|
||||
e.g. [ id:'test', single_end:false ]
|
||||
- bam:
|
||||
- input:
|
||||
type: file
|
||||
description: BAM/CRAM/SAM file
|
||||
pattern: "*.{bam,cram,sam}"
|
||||
- bai:
|
||||
- input_index:
|
||||
type: file
|
||||
description: BAM/CRAM/SAM index file
|
||||
pattern: "*.{bai,crai,sai}"
|
||||
|
@ -31,7 +31,9 @@ input:
|
|||
type: file
|
||||
description: loci file <CHR><tab><POS1>
|
||||
pattern: "*.{tsv}"
|
||||
|
||||
- fasta:
|
||||
type: file
|
||||
description: Input genome fasta file. Required when passing CRAM files.
|
||||
|
||||
output:
|
||||
- meta:
|
||||
|
@ -39,10 +41,10 @@ output:
|
|||
description: |
|
||||
Groovy Map containing sample information
|
||||
e.g. [ id:'test', single_end:false ]
|
||||
- version:
|
||||
- versions:
|
||||
type: file
|
||||
description: File containing software version
|
||||
pattern: "*.{version.txt}"
|
||||
description: File containing software versions
|
||||
pattern: "versions.yml"
|
||||
- alleleCount:
|
||||
type: file
|
||||
description: Allele count file
|
||||
|
@ -50,3 +52,4 @@ output:
|
|||
|
||||
authors:
|
||||
- "@fullama"
|
||||
- "@fbdtemme"
|
||||
|
|
37
modules/amps/main.nf
Normal file
37
modules/amps/main.nf
Normal file
|
@ -0,0 +1,37 @@
|
|||
process AMPS {
|
||||
label 'process_low'
|
||||
|
||||
conda (params.enable_conda ? "bioconda::hops=0.35" : null)
|
||||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
||||
'https://depot.galaxyproject.org/singularity/hops:0.35--hdfd78af_1' :
|
||||
'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:
|
||||
def args = task.ext.args ?: ''
|
||||
"""
|
||||
postprocessing.AMPS.r \\
|
||||
-r $maltextract_results \\
|
||||
-n $taxon_list \\
|
||||
-m $filter \\
|
||||
-t $task.cpus \\
|
||||
-j \\
|
||||
$args
|
||||
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${task.process}":
|
||||
amps: \$(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"
|
39
modules/arriba/main.nf
Normal file
39
modules/arriba/main.nf
Normal file
|
@ -0,0 +1,39 @@
|
|||
process ARRIBA {
|
||||
tag "$meta.id"
|
||||
label 'process_medium'
|
||||
|
||||
conda (params.enable_conda ? "bioconda::arriba=2.1.0" : null)
|
||||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
||||
'https://depot.galaxyproject.org/singularity/arriba:2.1.0--h3198e80_1' :
|
||||
'quay.io/biocontainers/arriba:2.1.0--h3198e80_1' }"
|
||||
|
||||
input:
|
||||
tuple val(meta), path(bam)
|
||||
path fasta
|
||||
path gtf
|
||||
|
||||
output:
|
||||
tuple val(meta), path("*.fusions.tsv") , emit: fusions
|
||||
tuple val(meta), path("*.fusions.discarded.tsv"), emit: fusions_fail
|
||||
path "versions.yml" , emit: versions
|
||||
|
||||
script:
|
||||
def args = task.ext.args ?: ''
|
||||
def prefix = task.ext.prefix ?: "${meta.id}"
|
||||
def blacklist = (args.contains('-b')) ? '' : '-f blacklist'
|
||||
"""
|
||||
arriba \\
|
||||
-x $bam \\
|
||||
-a $fasta \\
|
||||
-g $gtf \\
|
||||
-o ${prefix}.fusions.tsv \\
|
||||
-O ${prefix}.fusions.discarded.tsv \\
|
||||
$blacklist \\
|
||||
$args
|
||||
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${task.process}":
|
||||
arriba: \$(arriba -h | grep 'Version:' 2>&1 | sed 's/Version:\s//')
|
||||
END_VERSIONS
|
||||
"""
|
||||
}
|
54
modules/arriba/meta.yml
Normal file
54
modules/arriba/meta.yml
Normal file
|
@ -0,0 +1,54 @@
|
|||
name: arriba
|
||||
description: Arriba is a command-line tool for the detection of gene fusions from RNA-Seq data.
|
||||
keywords:
|
||||
- fusion
|
||||
- arriba
|
||||
tools:
|
||||
- arriba:
|
||||
description: Fast and accurate gene fusion detection from RNA-Seq data
|
||||
homepage: https://github.com/suhrig/arriba
|
||||
documentation: https://arriba.readthedocs.io/en/latest/
|
||||
tool_dev_url: https://github.com/suhrig/arriba
|
||||
doi: "10.1101/gr.257246.119"
|
||||
licence: ['MIT']
|
||||
|
||||
input:
|
||||
- meta:
|
||||
type: map
|
||||
description: |
|
||||
Groovy Map containing sample information
|
||||
e.g. [ id:'test', single_end:false ]
|
||||
- bam:
|
||||
type: file
|
||||
description: BAM/CRAM/SAM file
|
||||
pattern: "*.{bam,cram,sam}"
|
||||
- fasta:
|
||||
type: file
|
||||
description: Assembly FASTA file
|
||||
pattern: "*.{fasta}"
|
||||
- gtf:
|
||||
type: file
|
||||
description: Annotation GTF file
|
||||
pattern: "*.{gtf}"
|
||||
|
||||
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"
|
||||
- fusions:
|
||||
type: file
|
||||
description: File contains fusions which pass all of Arriba's filters.
|
||||
pattern: "*.{fusions.tsv}"
|
||||
- fusions_fail:
|
||||
type: file
|
||||
description: File contains fusions that Arriba classified as an artifact or that are also observed in healthy tissue.
|
||||
pattern: "*.{fusions.discarded.tsv}"
|
||||
|
||||
authors:
|
||||
- "@praveenraj2018"
|
|
@ -1,68 +0,0 @@
|
|||
//
|
||||
// Utility functions used in nf-core DSL2 module files
|
||||
//
|
||||
|
||||
//
|
||||
// Extract name of software tool from process name using $task.process
|
||||
//
|
||||
def getSoftwareName(task_process) {
|
||||
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
|
||||
}
|
||||
|
||||
//
|
||||
// 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) {
|
||||
if (!args.filename.endsWith('.version.txt')) {
|
||||
def ioptions = initOptions(args.options)
|
||||
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,41 +1,33 @@
|
|||
// Import generic module functions
|
||||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||
|
||||
params.options = [:]
|
||||
options = initOptions(params.options)
|
||||
|
||||
process ARTIC_GUPPYPLEX {
|
||||
tag "$meta.id"
|
||||
label 'process_high'
|
||||
publishDir "${params.outdir}",
|
||||
mode: params.publish_dir_mode,
|
||||
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
|
||||
|
||||
conda (params.enable_conda ? "bioconda::artic=1.2.1" : null)
|
||||
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||
container "https://depot.galaxyproject.org/singularity/artic:1.2.1--py_0"
|
||||
} else {
|
||||
container "quay.io/biocontainers/artic:1.2.1--py_0"
|
||||
}
|
||||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
||||
'https://depot.galaxyproject.org/singularity/artic:1.2.1--py_0' :
|
||||
'quay.io/biocontainers/artic:1.2.1--py_0' }"
|
||||
|
||||
input:
|
||||
tuple val(meta), path(fastq_dir)
|
||||
|
||||
output:
|
||||
tuple val(meta), path("*.fastq.gz"), emit: fastq
|
||||
path "*.version.txt" , emit: version
|
||||
path "versions.yml" , emit: versions
|
||||
|
||||
script:
|
||||
def software = getSoftwareName(task.process)
|
||||
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||
def args = task.ext.args ?: ''
|
||||
def prefix = task.ext.prefix ?: "${meta.id}"
|
||||
"""
|
||||
artic \\
|
||||
guppyplex \\
|
||||
$options.args \\
|
||||
$args \\
|
||||
--directory $fastq_dir \\
|
||||
--output ${prefix}.fastq
|
||||
|
||||
pigz -p $task.cpus *.fastq
|
||||
echo \$(artic --version 2>&1) | sed 's/^.*artic //; s/ .*\$//' > ${software}.version.txt
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${task.process}":
|
||||
artic: \$(artic --version 2>&1 | sed 's/^.*artic //; s/ .*\$//')
|
||||
END_VERSIONS
|
||||
"""
|
||||
}
|
||||
|
|
|
@ -34,10 +34,10 @@ output:
|
|||
type: file
|
||||
description: Aggregated FastQ files
|
||||
pattern: "*.{fastq.gz}"
|
||||
- version:
|
||||
- versions:
|
||||
type: file
|
||||
description: File containing software version
|
||||
pattern: "*.{version.txt}"
|
||||
description: File containing software versions
|
||||
pattern: "versions.yml"
|
||||
|
||||
authors:
|
||||
- "@joseespinosa"
|
||||
|
|
|
@ -1,68 +0,0 @@
|
|||
//
|
||||
// Utility functions used in nf-core DSL2 module files
|
||||
//
|
||||
|
||||
//
|
||||
// Extract name of software tool from process name using $task.process
|
||||
//
|
||||
def getSoftwareName(task_process) {
|
||||
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
|
||||
}
|
||||
|
||||
//
|
||||
// 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) {
|
||||
if (!args.filename.endsWith('.version.txt')) {
|
||||
def ioptions = initOptions(args.options)
|
||||
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,22 +1,11 @@
|
|||
// Import generic module functions
|
||||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||
|
||||
params.options = [:]
|
||||
options = initOptions(params.options)
|
||||
|
||||
process ARTIC_MINION {
|
||||
tag "$meta.id"
|
||||
label 'process_high'
|
||||
publishDir "${params.outdir}",
|
||||
mode: params.publish_dir_mode,
|
||||
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
|
||||
|
||||
conda (params.enable_conda ? "bioconda::artic=1.2.1" : null)
|
||||
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||
container "https://depot.galaxyproject.org/singularity/artic:1.2.1--py_0"
|
||||
} else {
|
||||
container "quay.io/biocontainers/artic:1.2.1--py_0"
|
||||
}
|
||||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
||||
'https://depot.galaxyproject.org/singularity/artic:1.2.1--py_0' :
|
||||
'quay.io/biocontainers/artic:1.2.1--py_0' }"
|
||||
|
||||
input:
|
||||
tuple val(meta), path(fastq)
|
||||
|
@ -40,24 +29,24 @@ process ARTIC_MINION {
|
|||
tuple val(meta), path("${prefix}.pass.vcf.gz") , emit: vcf
|
||||
tuple val(meta), path("${prefix}.pass.vcf.gz.tbi") , emit: tbi
|
||||
tuple val(meta), path("*.json"), optional:true , emit: json
|
||||
path "*.version.txt" , emit: version
|
||||
path "versions.yml" , emit: versions
|
||||
|
||||
script:
|
||||
def software = getSoftwareName(task.process)
|
||||
prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||
def args = task.ext.args ?: ''
|
||||
prefix = task.ext.prefix ?: "${meta.id}"
|
||||
def version = scheme_version.toString().toLowerCase().replaceAll('v','')
|
||||
def fast5 = params.fast5_dir ? "--fast5-directory $fast5_dir" : ""
|
||||
def summary = params.sequencing_summary ? "--sequencing-summary $sequencing_summary" : ""
|
||||
def fast5 = fast5_dir ? "--fast5-directory $fast5_dir" : ""
|
||||
def summary = sequencing_summary ? "--sequencing-summary $sequencing_summary" : ""
|
||||
def model = ""
|
||||
if (options.args.tokenize().contains('--medaka')) {
|
||||
if (args.tokenize().contains('--medaka')) {
|
||||
fast5 = ""
|
||||
summary = ""
|
||||
model = file(params.artic_minion_medaka_model).exists() ? "--medaka-model ./$medaka_model" : "--medaka-model $params.artic_minion_medaka_model"
|
||||
model = file(medaka_model).exists() ? "--medaka-model ./$medaka_model" : "--medaka-model $medaka_model"
|
||||
}
|
||||
"""
|
||||
artic \\
|
||||
minion \\
|
||||
$options.args \\
|
||||
$args \\
|
||||
--threads $task.cpus \\
|
||||
--read-file $fastq \\
|
||||
--scheme-directory ./primer-schemes \\
|
||||
|
@ -68,6 +57,9 @@ process ARTIC_MINION {
|
|||
$scheme \\
|
||||
$prefix
|
||||
|
||||
echo \$(artic --version 2>&1) | sed 's/^.*artic //; s/ .*\$//' > ${software}.version.txt
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${task.process}":
|
||||
artic: \$(artic --version 2>&1 | sed 's/^.*artic //; s/ .*\$//')
|
||||
END_VERSIONS
|
||||
"""
|
||||
}
|
||||
|
|
|
@ -103,10 +103,10 @@ output:
|
|||
type: file
|
||||
description: JSON file for MultiQC
|
||||
pattern: "*.json"
|
||||
- version:
|
||||
- versions:
|
||||
type: file
|
||||
description: File containing software version
|
||||
pattern: "*.{version.txt}"
|
||||
description: File containing software versions
|
||||
pattern: "versions.yml"
|
||||
|
||||
authors:
|
||||
- "@joseespinosa"
|
||||
|
|
28
modules/assemblyscan/main.nf
Normal file
28
modules/assemblyscan/main.nf
Normal file
|
@ -0,0 +1,28 @@
|
|||
process ASSEMBLYSCAN {
|
||||
tag "$meta.id"
|
||||
label 'process_low'
|
||||
|
||||
conda (params.enable_conda ? "bioconda::assembly-scan=0.4.1" : null)
|
||||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
||||
'https://depot.galaxyproject.org/singularity/assembly-scan:0.4.1--pyhdfd78af_0' :
|
||||
'quay.io/biocontainers/assembly-scan:0.4.1--pyhdfd78af_0' }"
|
||||
|
||||
input:
|
||||
tuple val(meta), path(assembly)
|
||||
|
||||
output:
|
||||
tuple val(meta), path("*.json"), emit: json
|
||||
path "versions.yml" , emit: versions
|
||||
|
||||
script:
|
||||
def args = task.ext.args ?: ''
|
||||
def prefix = task.ext.prefix ?: "${meta.id}"
|
||||
"""
|
||||
assembly-scan $assembly > ${prefix}.json
|
||||
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${task.process}":
|
||||
assemblyscan: \$( assembly-scan --version 2>&1 | sed 's/^.*assembly-scan //; s/Using.*\$//' )
|
||||
END_VERSIONS
|
||||
"""
|
||||
}
|
43
modules/assemblyscan/meta.yml
Normal file
43
modules/assemblyscan/meta.yml
Normal file
|
@ -0,0 +1,43 @@
|
|||
name: assemblyscan
|
||||
description: Assembly summary statistics in JSON format
|
||||
keywords:
|
||||
- assembly
|
||||
- statistics
|
||||
tools:
|
||||
- assemblyscan:
|
||||
description: Assembly summary statistics in JSON format
|
||||
homepage: https://github.com/rpetit3/assembly-scan
|
||||
documentation: https://github.com/rpetit3/assembly-scan
|
||||
tool_dev_url: https://github.com/rpetit3/assembly-scan
|
||||
doi: ""
|
||||
licence: ['MIT']
|
||||
|
||||
input:
|
||||
- meta:
|
||||
type: map
|
||||
description: |
|
||||
Groovy Map containing sample information
|
||||
e.g. [ id:'test', single_end:false ]
|
||||
- assembly:
|
||||
type: file
|
||||
description: FASTA file for a given assembly
|
||||
pattern: "*.fasta"
|
||||
|
||||
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"
|
||||
- json:
|
||||
type: file
|
||||
description: Assembly statistics in JSON format
|
||||
pattern: "*.json"
|
||||
|
||||
authors:
|
||||
- "@sateeshperi"
|
||||
- "@mjcipriano"
|
47
modules/ataqv/ataqv/main.nf
Normal file
47
modules/ataqv/ataqv/main.nf
Normal file
|
@ -0,0 +1,47 @@
|
|||
process ATAQV_ATAQV {
|
||||
tag "$meta.id"
|
||||
label 'process_medium'
|
||||
|
||||
conda (params.enable_conda ? "bioconda::ataqv=1.2.1" : null)
|
||||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
||||
'https://depot.galaxyproject.org/singularity/ataqv:1.2.1--py39ha23c084_2' :
|
||||
'quay.io/biocontainers/ataqv:1.2.1--py36hfdecbe1_2' }"
|
||||
|
||||
input:
|
||||
tuple val(meta), path(bam), path(bai), path(peak_file)
|
||||
val organism
|
||||
path tss_file
|
||||
path excl_regs_file
|
||||
path autosom_ref_file
|
||||
|
||||
output:
|
||||
tuple val(meta), path("*.ataqv.json"), emit: json
|
||||
tuple val(meta), path("*.problems") , emit: problems, optional: true
|
||||
path "versions.yml" , emit: versions
|
||||
|
||||
script:
|
||||
def args = task.ext.args ?: ''
|
||||
def prefix = task.ext.prefix ?: "${meta.id}"
|
||||
def peak = peak_file ? "--peak-file $peak_file" : ''
|
||||
def tss = tss_file ? "--tss-file $tss_file" : ''
|
||||
def excl_regs = excl_regs_file ? "--excluded-region-file $excl_regs_file" : ''
|
||||
def autosom_ref = autosom_ref_file ? "--autosomal-reference-file $autosom_ref_file" : ''
|
||||
"""
|
||||
ataqv \\
|
||||
$args \\
|
||||
$peak \\
|
||||
$tss \\
|
||||
$excl_regs \\
|
||||
$autosom_ref \\
|
||||
--metrics-file "${prefix}.ataqv.json" \\
|
||||
--threads $task.cpus \\
|
||||
--name $prefix \\
|
||||
$organism \\
|
||||
$bam
|
||||
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${task.process}":
|
||||
ataqv: \$( ataqv --version )
|
||||
END_VERSIONS
|
||||
"""
|
||||
}
|
66
modules/ataqv/ataqv/meta.yml
Normal file
66
modules/ataqv/ataqv/meta.yml
Normal file
|
@ -0,0 +1,66 @@
|
|||
name: ataqv_ataqv
|
||||
description: ataqv function of a corresponding ataqv tool
|
||||
keywords:
|
||||
- ataqv
|
||||
tools:
|
||||
- ataqv:
|
||||
description: ataqv is a toolkit for measuring and comparing ATAC-seq results. It was written to help understand how well ATAC-seq assays have worked, and to make it easier to spot differences that might be caused by library prep or sequencing.
|
||||
homepage: https://github.com/ParkerLab/ataqv/blob/master/README.rst
|
||||
documentation: https://github.com/ParkerLab/ataqv/blob/master/README.rst
|
||||
tool_dev_url: https://github.com/ParkerLab/ataqv
|
||||
doi: "https://doi.org/10.1016/j.cels.2020.02.009"
|
||||
licence: ['GPL v3']
|
||||
|
||||
input:
|
||||
- meta:
|
||||
type: map
|
||||
description: |
|
||||
Groovy Map containing sample information
|
||||
e.g. [ id:'test', single_end:false ]
|
||||
- bam:
|
||||
type: file
|
||||
description: BAM file
|
||||
pattern: "*.bam"
|
||||
- bai:
|
||||
type: file
|
||||
description: BAM index file with the same prefix as bam file. Required if tss_file input is provided.
|
||||
pattern: "*.bam.bai"
|
||||
- peak_file:
|
||||
type: file
|
||||
description: A BED file of peaks called for alignments in the BAM file
|
||||
pattern: "*.bed"
|
||||
- organism:
|
||||
type: string
|
||||
description: The subject of the experiment, which determines the list of autosomes (see "Reference Genome Configuration" section at https://github.com/ParkerLab/ataqv).
|
||||
- tss_file:
|
||||
type: file
|
||||
description: A BED file of transcription start sites for the experiment organism. If supplied, a TSS enrichment score will be calculated according to the ENCODE data standards. This calculation requires that the BAM file of alignments be indexed.
|
||||
pattern: "*.bed"
|
||||
- excl_regs_file:
|
||||
type: file
|
||||
description: A BED file containing excluded regions. Peaks or TSS overlapping these will be ignored.
|
||||
pattern: "*.bed"
|
||||
- autosom_ref_file:
|
||||
type: file
|
||||
description: A file containing autosomal reference names, one per line. The names must match the reference names in the alignment file exactly, or the metrics based on counts of autosomal alignments will be wrong.
|
||||
|
||||
output:
|
||||
- meta:
|
||||
type: map
|
||||
description: |
|
||||
Groovy Map containing sample information
|
||||
e.g. [ id:'test', single_end:false ]
|
||||
- json:
|
||||
type: file
|
||||
description: The JSON file to which metrics will be written.
|
||||
- problems:
|
||||
type: file
|
||||
description: If given, problematic reads will be logged to a file per read group, with names derived from the read group IDs, with ".problems" appended. If no read groups are found, the reads will be written to one file named after the BAM file.
|
||||
pattern: "*.problems"
|
||||
- versions:
|
||||
type: file
|
||||
description: File containing software versions
|
||||
pattern: "versions.yml"
|
||||
|
||||
authors:
|
||||
- "@i-pletenev"
|
67
modules/bakta/main.nf
Normal file
67
modules/bakta/main.nf
Normal file
|
@ -0,0 +1,67 @@
|
|||
process BAKTA {
|
||||
tag "$meta.id"
|
||||
label 'process_medium'
|
||||
|
||||
conda (params.enable_conda ? "bioconda::bakta=1.2.2" : null)
|
||||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
||||
'https://depot.galaxyproject.org/singularity/bakta:1.2.2--pyhdfd78af_0' :
|
||||
'quay.io/biocontainers/bakta:1.2.2--pyhdfd78af_0' }"
|
||||
|
||||
input:
|
||||
tuple val(meta), path(fasta)
|
||||
path db
|
||||
path proteins
|
||||
path prodigal_tf
|
||||
|
||||
output:
|
||||
tuple val(meta), path("${prefix}.embl") , emit: embl
|
||||
tuple val(meta), path("${prefix}.faa") , emit: faa
|
||||
tuple val(meta), path("${prefix}.ffn") , emit: ffn
|
||||
tuple val(meta), path("${prefix}.fna") , emit: fna
|
||||
tuple val(meta), path("${prefix}.gbff") , emit: gbff
|
||||
tuple val(meta), path("${prefix}.gff3") , emit: gff
|
||||
tuple val(meta), path("${prefix}.hypotheticals.tsv"), emit: hypotheticals_tsv
|
||||
tuple val(meta), path("${prefix}.hypotheticals.faa"), emit: hypotheticals_faa
|
||||
tuple val(meta), path("${prefix}.tsv") , emit: tsv
|
||||
path "versions.yml" , emit: versions
|
||||
|
||||
script:
|
||||
def args = task.ext.args ?: ''
|
||||
prefix = task.ext.prefix ?: "${meta.id}"
|
||||
def proteins_opt = proteins ? "--proteins ${proteins[0]}" : ""
|
||||
def prodigal_opt = prodigal_tf ? "--prodigal-tf ${prodigal_tf[0]}" : ""
|
||||
"""
|
||||
bakta \\
|
||||
$args \\
|
||||
--threads $task.cpus \\
|
||||
--prefix $prefix \\
|
||||
--db $db \\
|
||||
$proteins_opt \\
|
||||
$prodigal_tf \\
|
||||
$fasta
|
||||
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${task.process}":
|
||||
bakta: \$( echo \$(bakta --version 2>&1) | sed 's/^.*bakta //' )
|
||||
END_VERSIONS
|
||||
"""
|
||||
|
||||
stub:
|
||||
prefix = task.ext.prefix ?: "${meta.id}"
|
||||
"""
|
||||
touch ${prefix}.embl
|
||||
touch ${prefix}.faa
|
||||
touch ${prefix}.ffn
|
||||
touch ${prefix}.fna
|
||||
touch ${prefix}.gbff
|
||||
touch ${prefix}.gff3
|
||||
touch ${prefix}.hypotheticals.tsv
|
||||
touch ${prefix}.hypotheticals.faa
|
||||
touch ${prefix}.tsv
|
||||
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${task.process}":
|
||||
bakta: \$( echo \$(bakta --version 2>&1) | sed 's/^.*bakta //' )
|
||||
END_VERSIONS
|
||||
"""
|
||||
}
|
85
modules/bakta/meta.yml
Normal file
85
modules/bakta/meta.yml
Normal file
|
@ -0,0 +1,85 @@
|
|||
name: bakta
|
||||
description: Rapid annotation of bacterial genomes & plasmids.
|
||||
keywords:
|
||||
- annotation
|
||||
- fasta
|
||||
- prokaryote
|
||||
tools:
|
||||
- bakta:
|
||||
description: Rapid & standardized annotation of bacterial genomes & plasmids.
|
||||
homepage: https://github.com/oschwengers/bakta
|
||||
documentation: https://github.com/oschwengers/bakta
|
||||
tool_dev_url: https://github.com/oschwengers/bakta
|
||||
doi: "10.1099/mgen.0.000685"
|
||||
licence: ['GPL v3']
|
||||
|
||||
input:
|
||||
- meta:
|
||||
type: map
|
||||
description: |
|
||||
Groovy Map containing sample information
|
||||
e.g. [ id:'test', single_end:false ]
|
||||
- fasta:
|
||||
type: file
|
||||
description: |
|
||||
FASTA file to be annotated. Has to contain at least a non-empty string dummy value.
|
||||
- db:
|
||||
type: file
|
||||
description: |
|
||||
Path to the Bakta database
|
||||
- proteins:
|
||||
type: file
|
||||
description: FASTA file of trusted proteins to first annotate from (optional)
|
||||
- prodigal_tf:
|
||||
type: file
|
||||
description: Training file to use for Prodigal (optional)
|
||||
|
||||
output:
|
||||
- meta:
|
||||
type: map
|
||||
description: |
|
||||
Groovy Map containing sample information
|
||||
e.g. [ id:'test', single_end:false ]
|
||||
- versions:
|
||||
type: file
|
||||
description: File containing software versions
|
||||
pattern: "versions.yml"
|
||||
- tsv:
|
||||
type: file
|
||||
description: annotations as simple human readble tab separated values
|
||||
pattern: "*.tsv"
|
||||
- gff:
|
||||
type: file
|
||||
description: annotations & sequences in GFF3 format
|
||||
pattern: "*.gff3"
|
||||
- gbff:
|
||||
type: file
|
||||
description: annotations & sequences in (multi) GenBank format
|
||||
pattern: "*.gbff"
|
||||
- embl:
|
||||
type: file
|
||||
description: annotations & sequences in (multi) EMBL format
|
||||
pattern: "*.embl"
|
||||
- fna:
|
||||
type: file
|
||||
description: replicon/contig DNA sequences as FASTA
|
||||
pattern: "*.fna"
|
||||
- faa:
|
||||
type: file
|
||||
description: CDS/sORF amino acid sequences as FASTA
|
||||
pattern: "*.faa"
|
||||
- ffn:
|
||||
type: file
|
||||
description: feature nucleotide sequences as FASTA
|
||||
pattern: "*.ffn"
|
||||
- hypotheticals_tsv:
|
||||
type: file
|
||||
description: further information on hypothetical protein CDS as simple human readble tab separated values
|
||||
pattern: "*.hypotheticals.tsv"
|
||||
- hypotheticals_faa:
|
||||
type: file
|
||||
description: hypothetical protein CDS amino acid sequences as FASTA
|
||||
pattern: "*.hypotheticals.faa"
|
||||
|
||||
authors:
|
||||
- "@rpetit3"
|
32
modules/bamaligncleaner/main.nf
Normal file
32
modules/bamaligncleaner/main.nf
Normal file
|
@ -0,0 +1,32 @@
|
|||
process BAMALIGNCLEANER {
|
||||
tag "$meta.id"
|
||||
label 'process_low'
|
||||
|
||||
conda (params.enable_conda ? "bioconda::bamaligncleaner=0.2.1" : null)
|
||||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
||||
'https://depot.galaxyproject.org/singularity/bamaligncleaner:0.2.1--pyhdfd78af_0' :
|
||||
'quay.io/biocontainers/bamaligncleaner:0.2.1--pyhdfd78af_0' }"
|
||||
|
||||
input:
|
||||
tuple val(meta), path(bam)
|
||||
|
||||
output:
|
||||
tuple val(meta), path("*.bam"), emit: bam
|
||||
path "versions.yml" , emit: versions
|
||||
|
||||
script:
|
||||
def args = task.ext.args ?: ''
|
||||
def prefix = task.ext.prefix ?: "${meta.id}"
|
||||
|
||||
"""
|
||||
bamAlignCleaner \\
|
||||
$args \\
|
||||
-o ${prefix}.bam \\
|
||||
${bam}
|
||||
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${task.process}":
|
||||
bamaligncleaner: \$(bamAlignCleaner --version | sed 's/.*version //')
|
||||
END_VERSIONS
|
||||
"""
|
||||
}
|
40
modules/bamaligncleaner/meta.yml
Normal file
40
modules/bamaligncleaner/meta.yml
Normal file
|
@ -0,0 +1,40 @@
|
|||
name: bamaligncleaner
|
||||
description: removes unused references from header of sorted BAM/CRAM files.
|
||||
keywords:
|
||||
- bam
|
||||
tools:
|
||||
- bamaligncleaner:
|
||||
description: Removes unaligned references in aligned BAM alignment file
|
||||
homepage: https://github.com/maxibor/bamAlignCleaner
|
||||
documentation: https://github.com/maxibor/bamAlignCleaner
|
||||
tool_dev_url: https://github.com/maxibor/bamAlignCleaner
|
||||
licence: ['GPL v3']
|
||||
|
||||
input:
|
||||
- meta:
|
||||
type: map
|
||||
description: |
|
||||
Groovy Map containing sample information
|
||||
e.g. [ id:'test', single_end:false ]
|
||||
- bam:
|
||||
type: file
|
||||
description: BAM/CRAM file
|
||||
pattern: "*.{bam,cram}"
|
||||
|
||||
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: Sorted BAM/CRAM file
|
||||
pattern: "*.{bam,cram}"
|
||||
|
||||
authors:
|
||||
- "@jfy133"
|
31
modules/bamtools/split/main.nf
Normal file
31
modules/bamtools/split/main.nf
Normal file
|
@ -0,0 +1,31 @@
|
|||
process BAMTOOLS_SPLIT {
|
||||
tag "$meta.id"
|
||||
label 'process_low'
|
||||
|
||||
conda (params.enable_conda ? "bioconda::bamtools=2.5.1" : null)
|
||||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
||||
'https://depot.galaxyproject.org/singularity/bamtools:2.5.1--h9a82719_9' :
|
||||
'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 args = task.ext.args ?: ''
|
||||
def prefix = task.ext.prefix ?: "${meta.id}"
|
||||
"""
|
||||
bamtools \\
|
||||
split \\
|
||||
-in $bam \\
|
||||
$args
|
||||
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${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"
|
34
modules/bamutil/trimbam/main.nf
Normal file
34
modules/bamutil/trimbam/main.nf
Normal file
|
@ -0,0 +1,34 @@
|
|||
process BAMUTIL_TRIMBAM {
|
||||
tag "$meta.id"
|
||||
label 'process_low'
|
||||
|
||||
conda (params.enable_conda ? "bioconda::bamutil=1.0.15" : null)
|
||||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
||||
'https://depot.galaxyproject.org/singularity/bamutil:1.0.15--h2e03b76_1' :
|
||||
'quay.io/biocontainers/bamutil:1.0.15--h2e03b76_1' }"
|
||||
|
||||
input:
|
||||
tuple val(meta), path(bam), val(trim_left), val(trim_right)
|
||||
|
||||
output:
|
||||
tuple val(meta), path("*.bam"), emit: bam
|
||||
path "versions.yml" , emit: versions
|
||||
|
||||
script:
|
||||
def args = task.ext.args ?: ''
|
||||
def prefix = task.ext.prefix ?: "${meta.id}"
|
||||
"""
|
||||
bam \\
|
||||
trimBam \\
|
||||
$bam \\
|
||||
${prefix}.bam \\
|
||||
$args \\
|
||||
-L $trim_left \\
|
||||
-R $trim_right
|
||||
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${task.process}":
|
||||
bamutil: \$( echo \$( bam trimBam 2>&1 ) | sed 's/^Version: //;s/;.*//' )
|
||||
END_VERSIONS
|
||||
"""
|
||||
}
|
51
modules/bamutil/trimbam/meta.yml
Normal file
51
modules/bamutil/trimbam/meta.yml
Normal file
|
@ -0,0 +1,51 @@
|
|||
name: bamutil_trimbam
|
||||
description: trims the end of reads in a SAM/BAM file, changing read ends to ‘N’ and quality to ‘!’, or by soft clipping
|
||||
keywords:
|
||||
- bam
|
||||
- trim
|
||||
- clipping
|
||||
- bamUtil
|
||||
- trimBam
|
||||
tools:
|
||||
- bamutil:
|
||||
description: Programs that perform operations on SAM/BAM files, all built into a single executable, bam.
|
||||
homepage: https://genome.sph.umich.edu/wiki/BamUtil
|
||||
documentation: https://genome.sph.umich.edu/wiki/BamUtil:_trimBam
|
||||
tool_dev_url: https://github.com/statgen/bamUtil
|
||||
doi: "10.1101/gr.176552.114"
|
||||
licence: ['GPL v3']
|
||||
|
||||
input:
|
||||
- meta:
|
||||
type: map
|
||||
description: |
|
||||
Groovy Map containing sample information
|
||||
e.g. [ id:'test', single_end:false ]
|
||||
- bam:
|
||||
type: file
|
||||
description: BAM file
|
||||
pattern: "*.bam"
|
||||
- trim_left:
|
||||
type: integer
|
||||
description: Number of bases to trim off the right-hand side of a read. Reverse strands are reversed before trimming.
|
||||
- trim_right:
|
||||
type: integer
|
||||
description: Number of bases to trim off the right-hand side of a read. Reverse strands are reversed before trimming.
|
||||
|
||||
output:
|
||||
- meta:
|
||||
type: map
|
||||
description: |
|
||||
Groovy Map containing sample information
|
||||
e.g. [ id:'test', single_end:false ]
|
||||
- versions:
|
||||
type: file
|
||||
description: File containing software versions
|
||||
pattern: "versions.yml"
|
||||
- bam:
|
||||
type: file
|
||||
description: Trimmed but unsorted BAM file
|
||||
pattern: "*.bam"
|
||||
|
||||
authors:
|
||||
- "@jfy133"
|
|
@ -1,68 +0,0 @@
|
|||
//
|
||||
// Utility functions used in nf-core DSL2 module files
|
||||
//
|
||||
|
||||
//
|
||||
// Extract name of software tool from process name using $task.process
|
||||
//
|
||||
def getSoftwareName(task_process) {
|
||||
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
|
||||
}
|
||||
|
||||
//
|
||||
// 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) {
|
||||
if (!args.filename.endsWith('.version.txt')) {
|
||||
def ioptions = initOptions(args.options)
|
||||
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,22 +1,11 @@
|
|||
// Import generic module functions
|
||||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||
|
||||
params.options = [:]
|
||||
options = initOptions(params.options)
|
||||
|
||||
process BANDAGE_IMAGE {
|
||||
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::bandage=0.8.1' : null)
|
||||
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||
container "https://depot.galaxyproject.org/singularity/bandage:0.8.1--hc9558a2_2"
|
||||
} else {
|
||||
container "quay.io/biocontainers/bandage:0.8.1--hc9558a2_2"
|
||||
}
|
||||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
||||
'https://depot.galaxyproject.org/singularity/bandage:0.8.1--hc9558a2_2' :
|
||||
'quay.io/biocontainers/bandage:0.8.1--hc9558a2_2' }"
|
||||
|
||||
input:
|
||||
tuple val(meta), path(gfa)
|
||||
|
@ -24,15 +13,18 @@ process BANDAGE_IMAGE {
|
|||
output:
|
||||
tuple val(meta), path('*.png'), emit: png
|
||||
tuple val(meta), path('*.svg'), emit: svg
|
||||
path '*.version.txt' , emit: version
|
||||
path "versions.yml" , emit: versions
|
||||
|
||||
script:
|
||||
def software = getSoftwareName(task.process)
|
||||
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||
def args = task.ext.args ?: ''
|
||||
def prefix = task.ext.prefix ?: "${meta.id}"
|
||||
"""
|
||||
Bandage image $gfa ${prefix}.png $options.args
|
||||
Bandage image $gfa ${prefix}.svg $options.args
|
||||
Bandage image $gfa ${prefix}.png $args
|
||||
Bandage image $gfa ${prefix}.svg $args
|
||||
|
||||
echo \$(Bandage --version 2>&1) | sed 's/^.*Version: //; s/ .*\$//' > ${software}.version.txt
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${task.process}":
|
||||
bandage: \$(echo \$(Bandage --version 2>&1) | sed 's/^.*Version: //; s/ .*\$//')
|
||||
END_VERSIONS
|
||||
"""
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ tools:
|
|||
Bandage - a Bioinformatics Application for Navigating De novo Assembly Graphs Easily
|
||||
homepage: https://github.com/rrwick/Bandage
|
||||
documentation: https://github.com/rrwick/Bandage
|
||||
licence: ['GPL-3.0-or-later']
|
||||
input:
|
||||
- meta:
|
||||
type: map
|
||||
|
@ -35,9 +36,9 @@ output:
|
|||
type: file
|
||||
description: Bandage image in SVG format
|
||||
pattern: "*.svg"
|
||||
- version:
|
||||
- versions:
|
||||
type: file
|
||||
description: File containing software version
|
||||
pattern: "*.{version.txt}"
|
||||
description: File containing software versions
|
||||
pattern: "versions.yml"
|
||||
authors:
|
||||
- "@heuermh"
|
||||
|
|
55
modules/bbmap/align/main.nf
Normal file
55
modules/bbmap/align/main.nf
Normal file
|
@ -0,0 +1,55 @@
|
|||
process BBMAP_ALIGN {
|
||||
tag "$meta.id"
|
||||
label 'process_medium'
|
||||
|
||||
conda (params.enable_conda ? "bioconda::bbmap=38.92 bioconda::samtools=1.13 pigz=2.6" : null)
|
||||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
||||
'https://depot.galaxyproject.org/singularity/mulled-v2-008daec56b7aaf3f162d7866758142b9f889d690:f5f55fc5623bb7b3f725e8d2f86bedacfd879510-0' :
|
||||
'quay.io/biocontainers/mulled-v2-008daec56b7aaf3f162d7866758142b9f889d690:f5f55fc5623bb7b3f725e8d2f86bedacfd879510-0' }"
|
||||
|
||||
input:
|
||||
tuple val(meta), path(fastq)
|
||||
path ref
|
||||
|
||||
output:
|
||||
tuple val(meta), path("*.bam"), emit: bam
|
||||
tuple val(meta), path("*.log"), emit: log
|
||||
path "versions.yml" , emit: versions
|
||||
|
||||
script:
|
||||
def args = task.ext.args ?: ''
|
||||
def prefix = task.ext.prefix ?: "${meta.id}"
|
||||
|
||||
input = meta.single_end ? "in=${fastq}" : "in=${fastq[0]} in2=${fastq[1]}"
|
||||
|
||||
// Set the db variable to reflect the three possible types of reference input: 1) directory
|
||||
// named 'ref', 2) directory named something else (containg a 'ref' subdir) or 3) a sequence
|
||||
// file in fasta format
|
||||
if ( ref.isDirectory() ) {
|
||||
if ( ref ==~ /(.\/)?ref\/?/ ) {
|
||||
db = ''
|
||||
} else {
|
||||
db = "path=${ref}"
|
||||
}
|
||||
} else {
|
||||
db = "ref=${ref}"
|
||||
}
|
||||
|
||||
"""
|
||||
bbmap.sh \\
|
||||
$db \\
|
||||
$input \\
|
||||
out=${prefix}.bam \\
|
||||
$args \\
|
||||
threads=$task.cpus \\
|
||||
-Xmx${task.memory.toGiga()}g \\
|
||||
&> ${prefix}.bbmap.log
|
||||
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${task.process}":
|
||||
bbmap: \$(bbversion.sh)
|
||||
samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
|
||||
pigz: \$( pigz --version 2>&1 | sed 's/pigz //g' )
|
||||
END_VERSIONS
|
||||
"""
|
||||
}
|
52
modules/bbmap/align/meta.yml
Normal file
52
modules/bbmap/align/meta.yml
Normal file
|
@ -0,0 +1,52 @@
|
|||
name: bbmap_align
|
||||
description: write your description here
|
||||
keywords:
|
||||
- align
|
||||
- map
|
||||
- fasta
|
||||
- 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 ]
|
||||
- fastq:
|
||||
type: file
|
||||
description: |
|
||||
List of input FastQ files of size 1 and 2 for single-end and paired-end data,
|
||||
respectively.
|
||||
- ref:
|
||||
type: file
|
||||
description: |
|
||||
Either "ref" a directory containing an index, the name of another directory
|
||||
with a "ref" subdirectory containing an index or the name of a fasta formatted
|
||||
nucleotide file containg the reference to map to.
|
||||
|
||||
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: BAM file
|
||||
pattern: "*.{bam}"
|
||||
|
||||
authors:
|
||||
- "@erikrikarddaniel"
|
|
@ -1,68 +0,0 @@
|
|||
//
|
||||
// Utility functions used in nf-core DSL2 module files
|
||||
//
|
||||
|
||||
//
|
||||
// Extract name of software tool from process name using $task.process
|
||||
//
|
||||
def getSoftwareName(task_process) {
|
||||
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
|
||||
}
|
||||
|
||||
//
|
||||
// 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) {
|
||||
if (!args.filename.endsWith('.version.txt')) {
|
||||
def ioptions = initOptions(args.options)
|
||||
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,21 +1,11 @@
|
|||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||
|
||||
params.options = [:]
|
||||
options = initOptions(params.options)
|
||||
|
||||
process BBMAP_BBDUK {
|
||||
tag "$meta.id"
|
||||
label 'process_medium'
|
||||
publishDir "${params.outdir}",
|
||||
mode: params.publish_dir_mode,
|
||||
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
|
||||
|
||||
conda (params.enable_conda ? "bioconda::bbmap=38.90" : null)
|
||||
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||
container "https://depot.galaxyproject.org/singularity/bbmap:38.90--he522d1c_1"
|
||||
} else {
|
||||
container "quay.io/biocontainers/bbmap:38.90--he522d1c_1"
|
||||
}
|
||||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
||||
'https://depot.galaxyproject.org/singularity/bbmap:38.90--he522d1c_1' :
|
||||
'quay.io/biocontainers/bbmap:38.90--he522d1c_1' }"
|
||||
|
||||
input:
|
||||
tuple val(meta), path(reads)
|
||||
|
@ -24,11 +14,11 @@ process BBMAP_BBDUK {
|
|||
output:
|
||||
tuple val(meta), path('*.fastq.gz'), emit: reads
|
||||
tuple val(meta), path('*.log') , emit: log
|
||||
path '*.version.txt' , emit: version
|
||||
path "versions.yml" , emit: versions
|
||||
|
||||
script:
|
||||
def software = getSoftwareName(task.process)
|
||||
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||
def args = task.ext.args ?: ''
|
||||
def prefix = task.ext.prefix ?: "${meta.id}"
|
||||
def raw = meta.single_end ? "in=${reads[0]}" : "in1=${reads[0]} in2=${reads[1]}"
|
||||
def trimmed = meta.single_end ? "out=${prefix}.fastq.gz" : "out1=${prefix}_1.fastq.gz out2=${prefix}_2.fastq.gz"
|
||||
def contaminants_fa = contaminants ? "ref=$contaminants" : ''
|
||||
|
@ -39,9 +29,12 @@ process BBMAP_BBDUK {
|
|||
$raw \\
|
||||
$trimmed \\
|
||||
threads=$task.cpus \\
|
||||
$options.args \\
|
||||
$args \\
|
||||
$contaminants_fa \\
|
||||
&> ${prefix}.bbduk.log
|
||||
echo \$(bbversion.sh) > ${software}.version.txt
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${task.process}":
|
||||
bbmap: \$(bbversion.sh)
|
||||
END_VERSIONS
|
||||
"""
|
||||
}
|
||||
|
|
|
@ -39,10 +39,10 @@ output:
|
|||
type: file
|
||||
description: The trimmed/modified fastq reads
|
||||
pattern: "*fastq.gz"
|
||||
- version:
|
||||
- versions:
|
||||
type: file
|
||||
description: File containing software version
|
||||
pattern: "*.{version.txt}"
|
||||
description: File containing software versions
|
||||
pattern: "versions.yml"
|
||||
- log:
|
||||
type: file
|
||||
description: Bbduk log file
|
||||
|
|
84
modules/bbmap/bbsplit/main.nf
Normal file
84
modules/bbmap/bbsplit/main.nf
Normal file
|
@ -0,0 +1,84 @@
|
|||
process BBMAP_BBSPLIT {
|
||||
label 'process_high'
|
||||
|
||||
conda (params.enable_conda ? "bioconda::bbmap=38.93" : null)
|
||||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
||||
'https://depot.galaxyproject.org/singularity/bbmap:38.93--he522d1c_0' :
|
||||
'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 args = task.ext.args ?: ''
|
||||
def prefix = task.ext.prefix ?: "${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 \\
|
||||
$args
|
||||
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${task.process}":
|
||||
bbmap: \$(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 \\
|
||||
$args
|
||||
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${task.process}":
|
||||
bbmap: \$(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"
|
31
modules/bbmap/index/main.nf
Normal file
31
modules/bbmap/index/main.nf
Normal file
|
@ -0,0 +1,31 @@
|
|||
process BBMAP_INDEX {
|
||||
tag "$fasta"
|
||||
label 'process_long'
|
||||
|
||||
conda (params.enable_conda ? "bioconda::bbmap=38.92" : null)
|
||||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
||||
'https://depot.galaxyproject.org/singularity/bbmap:38.92--he522d1c_0' :
|
||||
'quay.io/biocontainers/bbmap:38.92--he522d1c_0' }"
|
||||
|
||||
input:
|
||||
path fasta
|
||||
|
||||
output:
|
||||
path 'ref' , emit: index
|
||||
path "versions.yml" , emit: versions
|
||||
|
||||
script:
|
||||
def args = task.ext.args ?: ''
|
||||
"""
|
||||
bbmap.sh \\
|
||||
ref=${fasta} \\
|
||||
$args \\
|
||||
threads=$task.cpus \\
|
||||
-Xmx${task.memory.toGiga()}g
|
||||
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${task.process}":
|
||||
bbmap: \$(bbversion.sh)
|
||||
END_VERSIONS
|
||||
"""
|
||||
}
|
33
modules/bbmap/index/meta.yml
Normal file
33
modules/bbmap/index/meta.yml
Normal file
|
@ -0,0 +1,33 @@
|
|||
name: bbmap_index
|
||||
description: This module calls bbmap.sh to create an index from a fasta file, ready to be used by bbmap.sh in mapping mode.
|
||||
keywords:
|
||||
- mapping
|
||||
- index
|
||||
- fasta
|
||||
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:
|
||||
- fasta:
|
||||
type: fasta
|
||||
description: fasta formatted file with nucleotide sequences
|
||||
pattern: "*.{fna,fa,fasta}"
|
||||
|
||||
output:
|
||||
- versions:
|
||||
type: file
|
||||
description: File containing software versions
|
||||
pattern: "versions.yml"
|
||||
- db:
|
||||
type: directory
|
||||
description: Directory with index files
|
||||
pattern: "ref"
|
||||
|
||||
authors:
|
||||
- "@daniellundin"
|
32
modules/bcftools/concat/main.nf
Normal file
32
modules/bcftools/concat/main.nf
Normal file
|
@ -0,0 +1,32 @@
|
|||
process BCFTOOLS_CONCAT {
|
||||
tag "$meta.id"
|
||||
label 'process_medium'
|
||||
|
||||
conda (params.enable_conda ? "bioconda::bcftools=1.11" : null)
|
||||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
||||
'https://depot.galaxyproject.org/singularity/bcftools:1.11--h7c999a4_0' :
|
||||
'quay.io/biocontainers/bcftools:1.11--h7c999a4_0' }"
|
||||
|
||||
input:
|
||||
tuple val(meta), path(vcfs)
|
||||
|
||||
output:
|
||||
tuple val(meta), path("*.gz"), emit: vcf
|
||||
path "versions.yml" , emit: versions
|
||||
|
||||
script:
|
||||
def args = task.ext.args ?: ''
|
||||
prefix = task.ext.prefix ?: "${meta.id}"
|
||||
"""
|
||||
bcftools concat \\
|
||||
--output ${prefix}.vcf.gz \\
|
||||
$args \\
|
||||
--threads $task.cpus \\
|
||||
${vcfs}
|
||||
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${task.process}":
|
||||
bcftools: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//')
|
||||
END_VERSIONS
|
||||
"""
|
||||
}
|
43
modules/bcftools/concat/meta.yml
Normal file
43
modules/bcftools/concat/meta.yml
Normal file
|
@ -0,0 +1,43 @@
|
|||
name: bcftools_concat
|
||||
description: Concatenate VCF files
|
||||
keywords:
|
||||
- variant calling
|
||||
- concat
|
||||
- bcftools
|
||||
- VCF
|
||||
|
||||
tools:
|
||||
- concat:
|
||||
description: |
|
||||
Concatenate VCF files.
|
||||
homepage: http://samtools.github.io/bcftools/bcftools.html
|
||||
documentation: http://www.htslib.org/doc/bcftools.html
|
||||
doi: 10.1093/bioinformatics/btp352
|
||||
licence: ['MIT']
|
||||
input:
|
||||
- meta:
|
||||
type: map
|
||||
description: |
|
||||
Groovy Map containing sample information
|
||||
e.g. [ id:'test', single_end:false ]
|
||||
- vcfs:
|
||||
type: files
|
||||
description: |
|
||||
List containing 2 or more vcf files
|
||||
e.g. [ 'file1.vcf', 'file2.vcf' ]
|
||||
output:
|
||||
- meta:
|
||||
type: map
|
||||
description: |
|
||||
Groovy Map containing sample information
|
||||
e.g. [ id:'test', single_end:false ]
|
||||
- vcf:
|
||||
type: file
|
||||
description: VCF concatenated output file
|
||||
pattern: "*.{vcf.gz}"
|
||||
- versions:
|
||||
type: file
|
||||
description: File containing software versions
|
||||
pattern: "versions.yml"
|
||||
authors:
|
||||
- "@abhi18av"
|
|
@ -1,68 +0,0 @@
|
|||
//
|
||||
// Utility functions used in nf-core DSL2 module files
|
||||
//
|
||||
|
||||
//
|
||||
// Extract name of software tool from process name using $task.process
|
||||
//
|
||||
def getSoftwareName(task_process) {
|
||||
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
|
||||
}
|
||||
|
||||
//
|
||||
// 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) {
|
||||
if (!args.filename.endsWith('.version.txt')) {
|
||||
def ioptions = initOptions(args.options)
|
||||
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,38 +1,30 @@
|
|||
// Import generic module functions
|
||||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||
|
||||
params.options = [:]
|
||||
options = initOptions(params.options)
|
||||
|
||||
process BCFTOOLS_CONSENSUS {
|
||||
tag "$meta.id"
|
||||
label 'process_medium'
|
||||
publishDir "${params.outdir}",
|
||||
mode: params.publish_dir_mode,
|
||||
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
|
||||
|
||||
conda (params.enable_conda ? 'bioconda::bcftools=1.11' : null)
|
||||
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||
container 'https://depot.galaxyproject.org/singularity/bcftools:1.11--h7c999a4_0'
|
||||
} else {
|
||||
container 'quay.io/biocontainers/bcftools:1.11--h7c999a4_0'
|
||||
}
|
||||
conda (params.enable_conda ? 'bioconda::bcftools=1.13' : null)
|
||||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
||||
'https://depot.galaxyproject.org/singularity/bcftools:1.13--h3a49de5_0' :
|
||||
'quay.io/biocontainers/bcftools:1.13--h3a49de5_0' }"
|
||||
|
||||
input:
|
||||
tuple val(meta), path(vcf), path(tbi), path(fasta)
|
||||
|
||||
output:
|
||||
tuple val(meta), path('*.fa'), emit: fasta
|
||||
path '*.version.txt' , emit: version
|
||||
path "versions.yml" , emit: versions
|
||||
|
||||
script:
|
||||
def software = getSoftwareName(task.process)
|
||||
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||
def args = task.ext.args ?: ''
|
||||
def prefix = task.ext.prefix ?: "${meta.id}"
|
||||
"""
|
||||
cat $fasta | bcftools consensus $vcf $options.args > ${prefix}.fa
|
||||
cat $fasta | bcftools consensus $vcf $args > ${prefix}.fa
|
||||
header=\$(head -n 1 ${prefix}.fa | sed 's/>//g')
|
||||
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
|
||||
"${task.process}":
|
||||
bcftools: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//')
|
||||
END_VERSIONS
|
||||
"""
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ tools:
|
|||
homepage: http://samtools.github.io/bcftools/bcftools.html
|
||||
documentation: http://www.htslib.org/doc/bcftools.html
|
||||
doi: 10.1093/bioinformatics/btp352
|
||||
licence: ['MIT']
|
||||
input:
|
||||
- meta:
|
||||
type: map
|
||||
|
@ -39,10 +40,10 @@ output:
|
|||
type: file
|
||||
description: FASTA reference consensus file
|
||||
pattern: "*.{fasta,fa}"
|
||||
- version:
|
||||
- versions:
|
||||
type: file
|
||||
description: File containing software version
|
||||
pattern: "*.{version.txt}"
|
||||
description: File containing software versions
|
||||
pattern: "versions.yml"
|
||||
authors:
|
||||
- "@joseespinosa"
|
||||
- "@drpatelh"
|
||||
|
|
|
@ -1,68 +0,0 @@
|
|||
//
|
||||
// Utility functions used in nf-core DSL2 module files
|
||||
//
|
||||
|
||||
//
|
||||
// Extract name of software tool from process name using $task.process
|
||||
//
|
||||
def getSoftwareName(task_process) {
|
||||
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
|
||||
}
|
||||
|
||||
//
|
||||
// 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) {
|
||||
if (!args.filename.endsWith('.version.txt')) {
|
||||
def ioptions = initOptions(args.options)
|
||||
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,39 +1,31 @@
|
|||
// Import generic module functions
|
||||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||
|
||||
params.options = [:]
|
||||
options = initOptions(params.options)
|
||||
|
||||
process BCFTOOLS_FILTER {
|
||||
tag "$meta.id"
|
||||
label 'process_medium'
|
||||
publishDir "${params.outdir}",
|
||||
mode: params.publish_dir_mode,
|
||||
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
|
||||
|
||||
conda (params.enable_conda ? "bioconda::bcftools=1.11" : null)
|
||||
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||
container "https://depot.galaxyproject.org/singularity/bcftools:1.11--h7c999a4_0"
|
||||
} else {
|
||||
container "quay.io/biocontainers/bcftools:1.11--h7c999a4_0"
|
||||
}
|
||||
conda (params.enable_conda ? 'bioconda::bcftools=1.13' : null)
|
||||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
||||
'https://depot.galaxyproject.org/singularity/bcftools:1.13--h3a49de5_0' :
|
||||
'quay.io/biocontainers/bcftools:1.13--h3a49de5_0' }"
|
||||
|
||||
input:
|
||||
tuple val(meta), path(vcf)
|
||||
|
||||
output:
|
||||
tuple val(meta), path("*.gz"), emit: vcf
|
||||
path "*.version.txt" , emit: version
|
||||
path "versions.yml" , emit: versions
|
||||
|
||||
script:
|
||||
def software = getSoftwareName(task.process)
|
||||
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||
def args = task.ext.args ?: ''
|
||||
def prefix = task.ext.prefix ?: "${meta.id}"
|
||||
"""
|
||||
bcftools filter \\
|
||||
--output ${prefix}.vcf.gz \\
|
||||
$options.args \\
|
||||
$args \\
|
||||
$vcf
|
||||
|
||||
echo \$(bcftools --version 2>&1) | sed 's/^.*bcftools //; s/ .*\$//' > ${software}.version.txt
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${task.process}":
|
||||
bcftools: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//')
|
||||
END_VERSIONS
|
||||
"""
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ tools:
|
|||
homepage: http://samtools.github.io/bcftools/bcftools.html
|
||||
documentation: http://www.htslib.org/doc/bcftools.html
|
||||
doi: 10.1093/bioinformatics/btp352
|
||||
licence: ['MIT']
|
||||
input:
|
||||
- meta:
|
||||
type: map
|
||||
|
@ -31,10 +32,10 @@ output:
|
|||
type: file
|
||||
description: VCF filtered output file
|
||||
pattern: "*.{vcf}"
|
||||
- version:
|
||||
- versions:
|
||||
type: file
|
||||
description: File containing software version
|
||||
pattern: "*.{version.txt}"
|
||||
description: File containing software versions
|
||||
pattern: "versions.yml"
|
||||
authors:
|
||||
- "@joseespinosa"
|
||||
- "@drpatelh"
|
||||
|
|
34
modules/bcftools/index/main.nf
Normal file
34
modules/bcftools/index/main.nf
Normal file
|
@ -0,0 +1,34 @@
|
|||
process BCFTOOLS_INDEX {
|
||||
tag "$meta.id"
|
||||
label 'process_low'
|
||||
|
||||
conda (params.enable_conda ? 'bioconda::bcftools=1.13' : null)
|
||||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
||||
'https://depot.galaxyproject.org/singularity/bcftools:1.13--h3a49de5_0' :
|
||||
'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 args = task.ext.args ?: ''
|
||||
def prefix = task.ext.prefix ?: "${meta.id}"
|
||||
|
||||
"""
|
||||
bcftools \\
|
||||
index \\
|
||||
$args \\
|
||||
--threads $task.cpus \\
|
||||
$vcf
|
||||
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${task.process}":
|
||||
bcftools: \$(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: ['MIT', 'GPL-3.0-or-later']
|
||||
|
||||
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"
|
|
@ -1,68 +0,0 @@
|
|||
//
|
||||
// Utility functions used in nf-core DSL2 module files
|
||||
//
|
||||
|
||||
//
|
||||
// Extract name of software tool from process name using $task.process
|
||||
//
|
||||
def getSoftwareName(task_process) {
|
||||
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
|
||||
}
|
||||
|
||||
//
|
||||
// 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) {
|
||||
if (!args.filename.endsWith('.version.txt')) {
|
||||
def ioptions = initOptions(args.options)
|
||||
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,38 +1,30 @@
|
|||
// Import generic module functions
|
||||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||
|
||||
params.options = [:]
|
||||
options = initOptions(params.options)
|
||||
|
||||
process BCFTOOLS_ISEC {
|
||||
tag "$meta.id"
|
||||
label 'process_medium'
|
||||
publishDir "${params.outdir}",
|
||||
mode: params.publish_dir_mode,
|
||||
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
|
||||
|
||||
conda (params.enable_conda ? "bioconda::bcftools=1.11" : null)
|
||||
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||
container "https://depot.galaxyproject.org/singularity/bcftools:1.11--h7c999a4_0"
|
||||
} else {
|
||||
container "quay.io/biocontainers/bcftools:1.11--h7c999a4_0"
|
||||
}
|
||||
conda (params.enable_conda ? 'bioconda::bcftools=1.13' : null)
|
||||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
||||
'https://depot.galaxyproject.org/singularity/bcftools:1.13--h3a49de5_0' :
|
||||
'quay.io/biocontainers/bcftools:1.13--h3a49de5_0' }"
|
||||
|
||||
input:
|
||||
tuple val(meta), path(vcfs), path(tbis)
|
||||
|
||||
output:
|
||||
tuple val(meta), path("${prefix}"), emit: results
|
||||
path "*.version.txt" , emit: version
|
||||
path "versions.yml" , emit: versions
|
||||
|
||||
script:
|
||||
def software = getSoftwareName(task.process)
|
||||
prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||
def args = task.ext.args ?: ''
|
||||
prefix = task.ext.prefix ?: "${meta.id}"
|
||||
"""
|
||||
bcftools isec \\
|
||||
$options.args \\
|
||||
$args \\
|
||||
-p $prefix \\
|
||||
*.vcf.gz
|
||||
echo \$(bcftools --version 2>&1) | sed 's/^.*bcftools //; s/ .*\$//' > ${software}.version.txt
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${task.process}":
|
||||
bcftools: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//')
|
||||
END_VERSIONS
|
||||
"""
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ tools:
|
|||
homepage: http://samtools.github.io/bcftools/bcftools.html
|
||||
documentation: http://www.htslib.org/doc/bcftools.html
|
||||
doi: 10.1093/bioinformatics/btp352
|
||||
licence: ['MIT']
|
||||
input:
|
||||
- meta:
|
||||
type: map
|
||||
|
@ -39,10 +40,10 @@ output:
|
|||
type: directory
|
||||
description: Folder containing the set operations results perform on the vcf files
|
||||
pattern: "${prefix}"
|
||||
- version:
|
||||
- versions:
|
||||
type: file
|
||||
description: File containing software version
|
||||
pattern: "*.{version.txt}"
|
||||
description: File containing software versions
|
||||
pattern: "versions.yml"
|
||||
authors:
|
||||
- "@joseespinosa"
|
||||
- "@drpatelh"
|
||||
|
|
|
@ -1,68 +0,0 @@
|
|||
//
|
||||
// Utility functions used in nf-core DSL2 module files
|
||||
//
|
||||
|
||||
//
|
||||
// Extract name of software tool from process name using $task.process
|
||||
//
|
||||
def getSoftwareName(task_process) {
|
||||
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
|
||||
}
|
||||
|
||||
//
|
||||
// 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) {
|
||||
if (!args.filename.endsWith('.version.txt')) {
|
||||
def ioptions = initOptions(args.options)
|
||||
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,38 +1,30 @@
|
|||
// Import generic module functions
|
||||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||
|
||||
params.options = [:]
|
||||
options = initOptions(params.options)
|
||||
|
||||
process BCFTOOLS_MERGE {
|
||||
tag "$meta.id"
|
||||
label 'process_medium'
|
||||
publishDir "${params.outdir}",
|
||||
mode: params.publish_dir_mode,
|
||||
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
|
||||
|
||||
conda (params.enable_conda ? "bioconda::bcftools=1.11" : null)
|
||||
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||
container "https://depot.galaxyproject.org/singularity/bcftools:1.11--h7c999a4_0"
|
||||
} else {
|
||||
container "quay.io/biocontainers/bcftools:1.11--h7c999a4_0"
|
||||
}
|
||||
conda (params.enable_conda ? 'bioconda::bcftools=1.13' : null)
|
||||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
||||
'https://depot.galaxyproject.org/singularity/bcftools:1.13--h3a49de5_0' :
|
||||
'quay.io/biocontainers/bcftools:1.13--h3a49de5_0' }"
|
||||
|
||||
input:
|
||||
tuple val(meta), path(vcfs), path(tbis)
|
||||
|
||||
output:
|
||||
tuple val(meta), path("*.gz"), emit: vcf
|
||||
path "*.version.txt" , emit: version
|
||||
path "versions.yml" , emit: versions
|
||||
|
||||
script:
|
||||
def software = getSoftwareName(task.process)
|
||||
prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||
def args = task.ext.args ?: ''
|
||||
prefix = task.ext.prefix ?: "${meta.id}"
|
||||
"""
|
||||
bcftools merge -Oz \\
|
||||
--output ${prefix}.vcf.gz \\
|
||||
$options.args \\
|
||||
$args \\
|
||||
*.vcf.gz
|
||||
echo \$(bcftools --version 2>&1) | sed 's/^.*bcftools //; s/ .*\$//' > ${software}.version.txt
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${task.process}":
|
||||
bcftools: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//')
|
||||
END_VERSIONS
|
||||
"""
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ tools:
|
|||
homepage: http://samtools.github.io/bcftools/bcftools.html
|
||||
documentation: http://www.htslib.org/doc/bcftools.html
|
||||
doi: 10.1093/bioinformatics/btp352
|
||||
licence: ['MIT']
|
||||
input:
|
||||
- meta:
|
||||
type: map
|
||||
|
@ -37,10 +38,10 @@ output:
|
|||
type: file
|
||||
description: VCF merged output file
|
||||
pattern: "*.{vcf.gz}"
|
||||
- version:
|
||||
- versions:
|
||||
type: file
|
||||
description: File containing software version
|
||||
pattern: "*.{version.txt}"
|
||||
description: File containing software versions
|
||||
pattern: "versions.yml"
|
||||
authors:
|
||||
- "@joseespinosa"
|
||||
- "@drpatelh"
|
||||
|
|
|
@ -1,68 +0,0 @@
|
|||
//
|
||||
// Utility functions used in nf-core DSL2 module files
|
||||
//
|
||||
|
||||
//
|
||||
// Extract name of software tool from process name using $task.process
|
||||
//
|
||||
def getSoftwareName(task_process) {
|
||||
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
|
||||
}
|
||||
|
||||
//
|
||||
// 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) {
|
||||
if (!args.filename.endsWith('.version.txt')) {
|
||||
def ioptions = initOptions(args.options)
|
||||
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,22 +1,11 @@
|
|||
// Import generic module functions
|
||||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||
|
||||
params.options = [:]
|
||||
options = initOptions(params.options)
|
||||
|
||||
process BCFTOOLS_MPILEUP {
|
||||
tag "$meta.id"
|
||||
label 'process_medium'
|
||||
publishDir "${params.outdir}",
|
||||
mode: params.publish_dir_mode,
|
||||
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
|
||||
|
||||
conda (params.enable_conda ? "bioconda::bcftools=1.11" : null)
|
||||
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||
container "https://depot.galaxyproject.org/singularity/bcftools:1.11--h7c999a4_0"
|
||||
} else {
|
||||
container "quay.io/biocontainers/bcftools:1.11--h7c999a4_0"
|
||||
}
|
||||
conda (params.enable_conda ? 'bioconda::bcftools=1.13' : null)
|
||||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
||||
'https://depot.galaxyproject.org/singularity/bcftools:1.13--h3a49de5_0' :
|
||||
'quay.io/biocontainers/bcftools:1.13--h3a49de5_0' }"
|
||||
|
||||
input:
|
||||
tuple val(meta), path(bam)
|
||||
|
@ -26,22 +15,31 @@ process BCFTOOLS_MPILEUP {
|
|||
tuple val(meta), path("*.gz") , emit: vcf
|
||||
tuple val(meta), path("*.tbi") , emit: tbi
|
||||
tuple val(meta), path("*stats.txt"), emit: stats
|
||||
path "*.version.txt" , emit: version
|
||||
path "versions.yml" , emit: versions
|
||||
|
||||
script:
|
||||
def software = getSoftwareName(task.process)
|
||||
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||
def args = task.ext.args ?: ''
|
||||
def args2 = task.ext.args2 ?: ''
|
||||
def args3 = task.ext.args3 ?: ''
|
||||
def prefix = task.ext.prefix ?: "${meta.id}"
|
||||
"""
|
||||
echo "${meta.id}" > sample_name.list
|
||||
|
||||
bcftools mpileup \\
|
||||
--fasta-ref $fasta \\
|
||||
$options.args \\
|
||||
$args \\
|
||||
$bam \\
|
||||
| bcftools call --output-type v $options.args2 \\
|
||||
| bcftools call --output-type v $args2 \\
|
||||
| bcftools reheader --samples sample_name.list \\
|
||||
| bcftools view --output-file ${prefix}.vcf.gz --output-type z $options.args3
|
||||
| bcftools view --output-file ${prefix}.vcf.gz --output-type z $args3
|
||||
|
||||
tabix -p vcf -f ${prefix}.vcf.gz
|
||||
|
||||
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
|
||||
"${task.process}":
|
||||
bcftools: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//')
|
||||
END_VERSIONS
|
||||
"""
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ tools:
|
|||
homepage: http://samtools.github.io/bcftools/bcftools.html
|
||||
documentation: http://www.htslib.org/doc/bcftools.html
|
||||
doi: 10.1093/bioinformatics/btp352
|
||||
licence: ['MIT']
|
||||
input:
|
||||
- meta:
|
||||
type: map
|
||||
|
@ -43,10 +44,10 @@ output:
|
|||
type: file
|
||||
description: Text output file containing stats
|
||||
pattern: "*{stats.txt}"
|
||||
- version:
|
||||
- versions:
|
||||
type: file
|
||||
description: File containing software version
|
||||
pattern: "*.{version.txt}"
|
||||
description: File containing software versions
|
||||
pattern: "versions.yml"
|
||||
authors:
|
||||
- "@joseespinosa"
|
||||
- "@drpatelh"
|
||||
|
|
34
modules/bcftools/norm/main.nf
Normal file
34
modules/bcftools/norm/main.nf
Normal file
|
@ -0,0 +1,34 @@
|
|||
process BCFTOOLS_NORM {
|
||||
tag "$meta.id"
|
||||
label 'process_medium'
|
||||
|
||||
conda (params.enable_conda ? "bioconda::bcftools=1.13" : null)
|
||||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
||||
'https://depot.galaxyproject.org/singularity/bcftools:1.13--h3a49de5_0' :
|
||||
'quay.io/biocontainers/bcftools:1.13--h3a49de5_0' }"
|
||||
|
||||
input:
|
||||
tuple val(meta), path(vcf)
|
||||
path(fasta)
|
||||
|
||||
output:
|
||||
tuple val(meta), path("*.gz") , emit: vcf
|
||||
path "versions.yml" , emit: versions
|
||||
|
||||
script:
|
||||
def args = task.ext.args ?: ''
|
||||
def prefix = task.ext.prefix ?: "${meta.id}"
|
||||
"""
|
||||
bcftools norm \\
|
||||
--fasta-ref ${fasta} \\
|
||||
--output ${prefix}.vcf.gz \\
|
||||
$args \\
|
||||
--threads $task.cpus \\
|
||||
${vcf}
|
||||
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${task.process}":
|
||||
bcftools: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//')
|
||||
END_VERSIONS
|
||||
"""
|
||||
}
|
46
modules/bcftools/norm/meta.yml
Normal file
46
modules/bcftools/norm/meta.yml
Normal file
|
@ -0,0 +1,46 @@
|
|||
name: bcftools_norm
|
||||
description: Normalize VCF file
|
||||
keywords:
|
||||
- normalize
|
||||
- norm
|
||||
- variant calling
|
||||
- VCF
|
||||
tools:
|
||||
- norm:
|
||||
description: |
|
||||
Normalize VCF files.
|
||||
homepage: http://samtools.github.io/bcftools/bcftools.html
|
||||
documentation: http://www.htslib.org/doc/bcftools.html
|
||||
doi: 10.1093/bioinformatics/btp352
|
||||
licence: ['MIT']
|
||||
input:
|
||||
- meta:
|
||||
type: map
|
||||
description: |
|
||||
Groovy Map containing sample information
|
||||
e.g. [ id:'test', single_end:false ]
|
||||
- vcf:
|
||||
type: file
|
||||
description: |
|
||||
The vcf file to be normalized
|
||||
e.g. 'file1.vcf'
|
||||
- fasta:
|
||||
type: file
|
||||
description: FASTA reference file
|
||||
pattern: "*.{fasta,fa}"
|
||||
output:
|
||||
- meta:
|
||||
type: map
|
||||
description: |
|
||||
Groovy Map containing sample information
|
||||
e.g. [ id:'test', single_end:false ]
|
||||
- vcf:
|
||||
type: file
|
||||
description: VCF normalized output file
|
||||
pattern: "*.{vcf.gz}"
|
||||
- versions:
|
||||
type: file
|
||||
description: File containing software versions
|
||||
pattern: "versions.yml"
|
||||
authors:
|
||||
- "@abhi18av"
|
41
modules/bcftools/query/main.nf
Normal file
41
modules/bcftools/query/main.nf
Normal file
|
@ -0,0 +1,41 @@
|
|||
process BCFTOOLS_QUERY {
|
||||
tag "$meta.id"
|
||||
label 'process_medium'
|
||||
|
||||
conda (params.enable_conda ? "bioconda::bcftools=1.13" : null)
|
||||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
||||
'https://depot.galaxyproject.org/singularity/bcftools:1.13--h3a49de5_0' :
|
||||
'quay.io/biocontainers/bcftools:1.13--h3a49de5_0' }"
|
||||
|
||||
input:
|
||||
tuple val(meta), path(vcf), path(index)
|
||||
path(regions)
|
||||
path(targets)
|
||||
path(samples)
|
||||
|
||||
output:
|
||||
tuple val(meta), path("*.gz") , emit: vcf
|
||||
path "versions.yml" , emit: versions
|
||||
|
||||
script:
|
||||
def args = task.ext.args ?: ''
|
||||
def prefix = task.ext.prefix ?: "${meta.id}"
|
||||
def regions_file = regions ? "--regions-file ${regions}" : ""
|
||||
def targets_file = targets ? "--targets-file ${targets}" : ""
|
||||
def samples_file = samples ? "--samples-file ${samples}" : ""
|
||||
|
||||
"""
|
||||
bcftools query \\
|
||||
--output ${prefix}.vcf.gz \\
|
||||
${regions_file} \\
|
||||
${targets_file} \\
|
||||
${samples_file} \\
|
||||
$args \\
|
||||
${vcf}
|
||||
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${task.process}":
|
||||
bcftools: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//')
|
||||
END_VERSIONS
|
||||
"""
|
||||
}
|
62
modules/bcftools/query/meta.yml
Normal file
62
modules/bcftools/query/meta.yml
Normal file
|
@ -0,0 +1,62 @@
|
|||
name: bcftools_query
|
||||
description: Extracts fields from VCF or BCF files and outputs them in user-defined format.
|
||||
keywords:
|
||||
- query
|
||||
- variant calling
|
||||
- bcftools
|
||||
- VCF
|
||||
tools:
|
||||
- query:
|
||||
description: |
|
||||
Extracts fields from VCF or BCF files and outputs them in user-defined format.
|
||||
homepage: http://samtools.github.io/bcftools/bcftools.html
|
||||
documentation: http://www.htslib.org/doc/bcftools.html
|
||||
doi: 10.1093/bioinformatics/btp352
|
||||
licence: ['MIT']
|
||||
input:
|
||||
- meta:
|
||||
type: map
|
||||
description: |
|
||||
Groovy Map containing sample information
|
||||
e.g. [ id:'test', single_end:false ]
|
||||
- vcf:
|
||||
type: file
|
||||
description: |
|
||||
The vcf file to be qeuried.
|
||||
e.g. 'file.vcf'
|
||||
- index:
|
||||
type: file
|
||||
description: |
|
||||
The tab index for the VCF file to be inspected.
|
||||
e.g. 'file.tbi'
|
||||
- regions:
|
||||
type: file
|
||||
description: |
|
||||
Optionally, restrict the operation to regions listed in this file.
|
||||
e.g. 'file.vcf'
|
||||
- targets:
|
||||
type: file
|
||||
description: |
|
||||
Optionally, restrict the operation to regions listed in this file (doesn't rely upon index files)
|
||||
e.g. 'file.vcf'
|
||||
- samples:
|
||||
type: file
|
||||
description: |
|
||||
Optional, file of sample names to be included or excluded.
|
||||
e.g. 'file.tsv'
|
||||
output:
|
||||
- meta:
|
||||
type: map
|
||||
description: |
|
||||
Groovy Map containing sample information
|
||||
e.g. [ id:'test', single_end:false ]
|
||||
- vcf:
|
||||
type: file
|
||||
description: VCF query output file
|
||||
pattern: "*.{vcf.gz}"
|
||||
- versions:
|
||||
type: file
|
||||
description: File containing software versions
|
||||
pattern: "versions.yml"
|
||||
authors:
|
||||
- "@abhi18av"
|
39
modules/bcftools/reheader/main.nf
Normal file
39
modules/bcftools/reheader/main.nf
Normal file
|
@ -0,0 +1,39 @@
|
|||
process BCFTOOLS_REHEADER {
|
||||
tag "$meta.id"
|
||||
label 'process_low'
|
||||
|
||||
conda (params.enable_conda ? "bioconda::bcftools=1.13" : null)
|
||||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
||||
'https://depot.galaxyproject.org/singularity/bcftools:1.13--h3a49de5_0' :
|
||||
'quay.io/biocontainers/bcftools:1.13--h3a49de5_0' }"
|
||||
|
||||
input:
|
||||
tuple val(meta), path(vcf)
|
||||
path fai
|
||||
path header
|
||||
|
||||
output:
|
||||
tuple val(meta), path("*.vcf.gz"), emit: vcf
|
||||
path "versions.yml" , emit: versions
|
||||
|
||||
script:
|
||||
def args = task.ext.args ?: ''
|
||||
def prefix = task.ext.prefix ?: "${meta.id}"
|
||||
def update_sequences = fai ? "-f $fai" : ""
|
||||
def new_header = header ? "-h $header" : ""
|
||||
"""
|
||||
bcftools \\
|
||||
reheader \\
|
||||
$update_sequences \\
|
||||
$new_header \\
|
||||
$args \\
|
||||
--threads $task.cpus \\
|
||||
-o ${prefix}.vcf.gz \\
|
||||
$vcf
|
||||
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${task.process}":
|
||||
bcftools: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//')
|
||||
END_VERSIONS
|
||||
"""
|
||||
}
|
51
modules/bcftools/reheader/meta.yml
Normal file
51
modules/bcftools/reheader/meta.yml
Normal file
|
@ -0,0 +1,51 @@
|
|||
name: bcftools_reheader
|
||||
description: Reheader a VCF file
|
||||
keywords:
|
||||
- reheader
|
||||
- vcf
|
||||
- update header
|
||||
tools:
|
||||
- reheader:
|
||||
description: |
|
||||
Modify header of VCF/BCF files, change sample names.
|
||||
homepage: http://samtools.github.io/bcftools/bcftools.html
|
||||
documentation: http://samtools.github.io/bcftools/bcftools.html#reheader
|
||||
doi: 10.1093/gigascience/giab008
|
||||
licence: ['MIT']
|
||||
|
||||
input:
|
||||
- meta:
|
||||
type: map
|
||||
description: |
|
||||
Groovy Map containing sample information
|
||||
e.g. [ id:'test', single_end:false ]
|
||||
- vcf:
|
||||
type: file
|
||||
description: VCF/BCF file
|
||||
pattern: "*.{vcf.gz,vcf,bcf}"
|
||||
- fai:
|
||||
type: file
|
||||
description: Fasta index to update header sequences with
|
||||
pattern: "*.{fai}"
|
||||
- header:
|
||||
type: file
|
||||
description: New header to add to the VCF
|
||||
pattern: "*.{header.txt}"
|
||||
|
||||
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"
|
||||
- vcf:
|
||||
type: file
|
||||
description: VCF with updated header
|
||||
pattern: "*.{vcf.gz}"
|
||||
|
||||
authors:
|
||||
- "@bjohnnyd"
|
|
@ -1,68 +0,0 @@
|
|||
//
|
||||
// Utility functions used in nf-core DSL2 module files
|
||||
//
|
||||
|
||||
//
|
||||
// Extract name of software tool from process name using $task.process
|
||||
//
|
||||
def getSoftwareName(task_process) {
|
||||
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
|
||||
}
|
||||
|
||||
//
|
||||
// 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) {
|
||||
if (!args.filename.endsWith('.version.txt')) {
|
||||
def ioptions = initOptions(args.options)
|
||||
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,35 +1,27 @@
|
|||
// Import generic module functions
|
||||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||
|
||||
params.options = [:]
|
||||
options = initOptions(params.options)
|
||||
|
||||
process BCFTOOLS_STATS {
|
||||
tag "$meta.id"
|
||||
label 'process_medium'
|
||||
publishDir "${params.outdir}",
|
||||
mode: params.publish_dir_mode,
|
||||
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
|
||||
|
||||
conda (params.enable_conda ? "bioconda::bcftools=1.11" : null)
|
||||
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||
container "https://depot.galaxyproject.org/singularity/bcftools:1.11--h7c999a4_0"
|
||||
} else {
|
||||
container "quay.io/biocontainers/bcftools:1.11--h7c999a4_0"
|
||||
}
|
||||
conda (params.enable_conda ? 'bioconda::bcftools=1.13' : null)
|
||||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
||||
'https://depot.galaxyproject.org/singularity/bcftools:1.13--h3a49de5_0' :
|
||||
'quay.io/biocontainers/bcftools:1.13--h3a49de5_0' }"
|
||||
|
||||
input:
|
||||
tuple val(meta), path(vcf)
|
||||
|
||||
output:
|
||||
tuple val(meta), path("*stats.txt"), emit: stats
|
||||
path "*.version.txt" , emit: version
|
||||
path "versions.yml" , emit: versions
|
||||
|
||||
script:
|
||||
def software = getSoftwareName(task.process)
|
||||
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||
def args = task.ext.args ?: ''
|
||||
def prefix = task.ext.prefix ?: "${meta.id}"
|
||||
"""
|
||||
bcftools stats $options.args $vcf > ${prefix}.bcftools_stats.txt
|
||||
echo \$(bcftools --version 2>&1) | sed 's/^.*bcftools //; s/ .*\$//' > ${software}.version.txt
|
||||
bcftools stats $args $vcf > ${prefix}.bcftools_stats.txt
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${task.process}":
|
||||
bcftools: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//')
|
||||
END_VERSIONS
|
||||
"""
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ tools:
|
|||
homepage: http://samtools.github.io/bcftools/bcftools.html
|
||||
documentation: http://www.htslib.org/doc/bcftools.html
|
||||
doi: 10.1093/bioinformatics/btp352
|
||||
licence: ['MIT']
|
||||
input:
|
||||
- meta:
|
||||
type: map
|
||||
|
@ -32,10 +33,10 @@ output:
|
|||
type: file
|
||||
description: Text output file containing stats
|
||||
pattern: "*_{stats.txt}"
|
||||
- version:
|
||||
- versions:
|
||||
type: file
|
||||
description: File containing software version
|
||||
pattern: "*.{version.txt}"
|
||||
description: File containing software versions
|
||||
pattern: "versions.yml"
|
||||
authors:
|
||||
- "@joseespinosa"
|
||||
- "@drpatelh"
|
||||
|
|
41
modules/bcftools/view/main.nf
Normal file
41
modules/bcftools/view/main.nf
Normal file
|
@ -0,0 +1,41 @@
|
|||
process BCFTOOLS_VIEW {
|
||||
tag "$meta.id"
|
||||
label 'process_medium'
|
||||
|
||||
conda (params.enable_conda ? "bioconda::bcftools=1.13" : null)
|
||||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
||||
'https://depot.galaxyproject.org/singularity/bcftools:1.13--h3a49de5_0' :
|
||||
'quay.io/biocontainers/bcftools:1.13--h3a49de5_0' }"
|
||||
|
||||
input:
|
||||
tuple val(meta), path(vcf), path(index)
|
||||
path(regions)
|
||||
path(targets)
|
||||
path(samples)
|
||||
|
||||
output:
|
||||
tuple val(meta), path("*.gz") , emit: vcf
|
||||
path "versions.yml" , emit: versions
|
||||
|
||||
script:
|
||||
def args = task.ext.args ?: ''
|
||||
def prefix = task.ext.prefix ?: "${meta.id}"
|
||||
def regions_file = regions ? "--regions-file ${regions}" : ""
|
||||
def targets_file = targets ? "--targets-file ${targets}" : ""
|
||||
def samples_file = samples ? "--samples-file ${samples}" : ""
|
||||
"""
|
||||
bcftools view \\
|
||||
--output ${prefix}.vcf.gz \\
|
||||
${regions_file} \\
|
||||
${targets_file} \\
|
||||
${samples_file} \\
|
||||
$args \\
|
||||
--threads $task.cpus \\
|
||||
${vcf}
|
||||
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${task.process}":
|
||||
bcftools: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//')
|
||||
END_VERSIONS
|
||||
"""
|
||||
}
|
63
modules/bcftools/view/meta.yml
Normal file
63
modules/bcftools/view/meta.yml
Normal file
|
@ -0,0 +1,63 @@
|
|||
name: bcftools_view
|
||||
description: View, subset and filter VCF or BCF files by position and filtering expression. Convert between VCF and BCF
|
||||
keywords:
|
||||
- variant calling
|
||||
- view
|
||||
- bcftools
|
||||
- VCF
|
||||
|
||||
tools:
|
||||
- view:
|
||||
description: |
|
||||
View, subset and filter VCF or BCF files by position and filtering expression. Convert between VCF and BCF
|
||||
homepage: http://samtools.github.io/bcftools/bcftools.html
|
||||
documentation: http://www.htslib.org/doc/bcftools.html
|
||||
doi: 10.1093/bioinformatics/btp352
|
||||
licence: ['MIT']
|
||||
input:
|
||||
- meta:
|
||||
type: map
|
||||
description: |
|
||||
Groovy Map containing sample information
|
||||
e.g. [ id:'test', single_end:false ]
|
||||
- vcf:
|
||||
type: file
|
||||
description: |
|
||||
The vcf file to be inspected.
|
||||
e.g. 'file.vcf'
|
||||
- index:
|
||||
type: file
|
||||
description: |
|
||||
The tab index for the VCF file to be inspected.
|
||||
e.g. 'file.tbi'
|
||||
- regions:
|
||||
type: file
|
||||
description: |
|
||||
Optionally, restrict the operation to regions listed in this file.
|
||||
e.g. 'file.vcf'
|
||||
- targets:
|
||||
type: file
|
||||
description: |
|
||||
Optionally, restrict the operation to regions listed in this file (doesn't rely upon index files)
|
||||
e.g. 'file.vcf'
|
||||
- samples:
|
||||
type: file
|
||||
description: |
|
||||
Optional, file of sample names to be included or excluded.
|
||||
e.g. 'file.tsv'
|
||||
output:
|
||||
- meta:
|
||||
type: map
|
||||
description: |
|
||||
Groovy Map containing sample information
|
||||
e.g. [ id:'test', single_end:false ]
|
||||
- vcf:
|
||||
type: file
|
||||
description: VCF normalized output file
|
||||
pattern: "*.{vcf.gz}"
|
||||
- versions:
|
||||
type: file
|
||||
description: File containing software versions
|
||||
pattern: "versions.yml"
|
||||
authors:
|
||||
- "@abhi18av"
|
|
@ -1,68 +0,0 @@
|
|||
//
|
||||
// Utility functions used in nf-core DSL2 module files
|
||||
//
|
||||
|
||||
//
|
||||
// Extract name of software tool from process name using $task.process
|
||||
//
|
||||
def getSoftwareName(task_process) {
|
||||
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
|
||||
}
|
||||
|
||||
//
|
||||
// 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) {
|
||||
if (!args.filename.endsWith('.version.txt')) {
|
||||
def ioptions = initOptions(args.options)
|
||||
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,40 +1,32 @@
|
|||
// Import generic module functions
|
||||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||
|
||||
params.options = [:]
|
||||
options = initOptions(params.options)
|
||||
|
||||
process BEDTOOLS_BAMTOBED {
|
||||
tag "$meta.id"
|
||||
label 'process_medium'
|
||||
publishDir "${params.outdir}",
|
||||
mode: params.publish_dir_mode,
|
||||
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
|
||||
|
||||
conda (params.enable_conda ? "bioconda::bedtools=2.30.0" : null)
|
||||
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||
container "https://depot.galaxyproject.org/singularity/bedtools:2.30.0--hc088bd4_0"
|
||||
} else {
|
||||
container "quay.io/biocontainers/bedtools:2.30.0--hc088bd4_0"
|
||||
}
|
||||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
||||
'https://depot.galaxyproject.org/singularity/bedtools:2.30.0--hc088bd4_0' :
|
||||
'quay.io/biocontainers/bedtools:2.30.0--hc088bd4_0' }"
|
||||
|
||||
input:
|
||||
tuple val(meta), path(bam)
|
||||
|
||||
output:
|
||||
tuple val(meta), path("*.bed"), emit: bed
|
||||
path "*.version.txt" , emit: version
|
||||
path "versions.yml" , emit: versions
|
||||
|
||||
script:
|
||||
def software = getSoftwareName(task.process)
|
||||
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||
def args = task.ext.args ?: ''
|
||||
def prefix = task.ext.prefix ?: "${meta.id}"
|
||||
"""
|
||||
bedtools \\
|
||||
bamtobed \\
|
||||
$options.args \\
|
||||
$args \\
|
||||
-i $bam \\
|
||||
| bedtools sort > ${prefix}.bed
|
||||
|
||||
bedtools --version | sed -e "s/bedtools v//g" > ${software}.version.txt
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${task.process}":
|
||||
bedtools: \$(bedtools --version | sed -e "s/bedtools v//g")
|
||||
END_VERSIONS
|
||||
"""
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ tools:
|
|||
description: |
|
||||
A set of tools for genomic analysis tasks, specifically enabling genome arithmetic (merge, count, complement) on various file types.
|
||||
documentation: https://bedtools.readthedocs.io/en/latest/content/tools/complement.html
|
||||
licence: ['MIT']
|
||||
input:
|
||||
- meta:
|
||||
type: map
|
||||
|
@ -28,10 +29,10 @@ output:
|
|||
type: file
|
||||
description: Bed file containing genomic intervals.
|
||||
pattern: "*.{bed}"
|
||||
- version:
|
||||
- versions:
|
||||
type: file
|
||||
description: File containing software version
|
||||
pattern: "*.{version.txt}"
|
||||
description: File containing software versions
|
||||
pattern: "versions.yml"
|
||||
authors:
|
||||
- "@yuukiiwa"
|
||||
- "@drpatelh"
|
||||
|
|
|
@ -1,68 +0,0 @@
|
|||
//
|
||||
// Utility functions used in nf-core DSL2 module files
|
||||
//
|
||||
|
||||
//
|
||||
// Extract name of software tool from process name using $task.process
|
||||
//
|
||||
def getSoftwareName(task_process) {
|
||||
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
|
||||
}
|
||||
|
||||
//
|
||||
// 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) {
|
||||
if (!args.filename.endsWith('.version.txt')) {
|
||||
def ioptions = initOptions(args.options)
|
||||
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,22 +1,11 @@
|
|||
// Import generic module functions
|
||||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||
|
||||
params.options = [:]
|
||||
options = initOptions(params.options)
|
||||
|
||||
process BEDTOOLS_COMPLEMENT {
|
||||
tag "$meta.id"
|
||||
label 'process_medium'
|
||||
publishDir "${params.outdir}",
|
||||
mode: params.publish_dir_mode,
|
||||
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
|
||||
|
||||
conda (params.enable_conda ? "bioconda::bedtools=2.30.0" : null)
|
||||
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||
container "https://depot.galaxyproject.org/singularity/bedtools:2.30.0--hc088bd4_0"
|
||||
} else {
|
||||
container "quay.io/biocontainers/bedtools:2.30.0--hc088bd4_0"
|
||||
}
|
||||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
||||
'https://depot.galaxyproject.org/singularity/bedtools:2.30.0--hc088bd4_0' :
|
||||
'quay.io/biocontainers/bedtools:2.30.0--hc088bd4_0' }"
|
||||
|
||||
input:
|
||||
tuple val(meta), path(bed)
|
||||
|
@ -24,19 +13,22 @@ process BEDTOOLS_COMPLEMENT {
|
|||
|
||||
output:
|
||||
tuple val(meta), path('*.bed'), emit: bed
|
||||
path '*.version.txt' , emit: version
|
||||
path "versions.yml" , emit: versions
|
||||
|
||||
script:
|
||||
def software = getSoftwareName(task.process)
|
||||
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||
def args = task.ext.args ?: ''
|
||||
def prefix = task.ext.prefix ?: "${meta.id}"
|
||||
"""
|
||||
bedtools \\
|
||||
complement \\
|
||||
-i $bed \\
|
||||
-g $sizes \\
|
||||
$options.args \\
|
||||
$args \\
|
||||
> ${prefix}.bed
|
||||
|
||||
bedtools --version | sed -e "s/bedtools v//g" > ${software}.version.txt
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${task.process}":
|
||||
bedtools: \$(bedtools --version | sed -e "s/bedtools v//g")
|
||||
END_VERSIONS
|
||||
"""
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ tools:
|
|||
description: |
|
||||
A set of tools for genomic analysis tasks, specifically enabling genome arithmetic (merge, count, complement) on various file types.
|
||||
documentation: https://bedtools.readthedocs.io/en/latest/content/tools/complement.html
|
||||
licence: ['MIT']
|
||||
input:
|
||||
- meta:
|
||||
type: map
|
||||
|
@ -32,10 +33,10 @@ output:
|
|||
type: file
|
||||
description: Bed file with all genomic intervals that are not covered by at least one record from the input file.
|
||||
pattern: "*.{bed}"
|
||||
- version:
|
||||
- versions:
|
||||
type: file
|
||||
description: File containing software version
|
||||
pattern: "*.{version.txt}"
|
||||
description: File containing software versions
|
||||
pattern: "versions.yml"
|
||||
authors:
|
||||
- "@Emiller88"
|
||||
- "@sruthipsuresh"
|
||||
|
|
|
@ -1,68 +0,0 @@
|
|||
//
|
||||
// Utility functions used in nf-core DSL2 module files
|
||||
//
|
||||
|
||||
//
|
||||
// Extract name of software tool from process name using $task.process
|
||||
//
|
||||
def getSoftwareName(task_process) {
|
||||
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
|
||||
}
|
||||
|
||||
//
|
||||
// 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) {
|
||||
if (!args.filename.endsWith('.version.txt')) {
|
||||
def ioptions = initOptions(args.options)
|
||||
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,44 +1,42 @@
|
|||
// Import generic module functions
|
||||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||
|
||||
params.options = [:]
|
||||
options = initOptions(params.options)
|
||||
|
||||
process BEDTOOLS_GENOMECOV {
|
||||
tag "$meta.id"
|
||||
label 'process_medium'
|
||||
publishDir "${params.outdir}",
|
||||
mode: params.publish_dir_mode,
|
||||
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
|
||||
|
||||
conda (params.enable_conda ? "bioconda::bedtools=2.30.0" : null)
|
||||
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||
container "https://depot.galaxyproject.org/singularity/bedtools:2.30.0--hc088bd4_0"
|
||||
} else {
|
||||
container "quay.io/biocontainers/bedtools:2.30.0--hc088bd4_0"
|
||||
}
|
||||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
||||
'https://depot.galaxyproject.org/singularity/bedtools:2.30.0--hc088bd4_0' :
|
||||
'quay.io/biocontainers/bedtools:2.30.0--hc088bd4_0' }"
|
||||
|
||||
input:
|
||||
tuple val(meta), path(intervals)
|
||||
tuple val(meta), path(intervals), val(scale)
|
||||
path sizes
|
||||
val extension
|
||||
|
||||
output:
|
||||
tuple val(meta), path("*.${extension}"), emit: genomecov
|
||||
path "*.version.txt" , emit: version
|
||||
path "versions.yml" , emit: versions
|
||||
|
||||
script:
|
||||
def software = getSoftwareName(task.process)
|
||||
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||
def args = task.ext.args ?: ''
|
||||
def args_list = args.tokenize()
|
||||
args += (scale > 0 && scale != 1) ? " -scale $scale" : ""
|
||||
if (!args_list.contains('-bg') && (scale > 0 && scale != 1)) {
|
||||
args += " -bg"
|
||||
}
|
||||
|
||||
def prefix = task.ext.prefix ?: "${meta.id}"
|
||||
if (intervals.name =~ /\.bam/) {
|
||||
"""
|
||||
bedtools \\
|
||||
genomecov \\
|
||||
-ibam $intervals \\
|
||||
$options.args \\
|
||||
$args \\
|
||||
> ${prefix}.${extension}
|
||||
|
||||
bedtools --version | sed -e "s/bedtools v//g" > ${software}.version.txt
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${task.process}":
|
||||
bedtools: \$(bedtools --version | sed -e "s/bedtools v//g")
|
||||
END_VERSIONS
|
||||
"""
|
||||
} else {
|
||||
"""
|
||||
|
@ -46,10 +44,13 @@ process BEDTOOLS_GENOMECOV {
|
|||
genomecov \\
|
||||
-i $intervals \\
|
||||
-g $sizes \\
|
||||
$options.args \\
|
||||
$args \\
|
||||
> ${prefix}.${extension}
|
||||
|
||||
bedtools --version | sed -e "s/bedtools v//g" > ${software}.version.txt
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${task.process}":
|
||||
bedtools: \$(bedtools --version | sed -e "s/bedtools v//g")
|
||||
END_VERSIONS
|
||||
"""
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ tools:
|
|||
description: |
|
||||
A set of tools for genomic analysis tasks, specifically enabling genome arithmetic (merge, count, complement) on various file types.
|
||||
documentation: https://bedtools.readthedocs.io/en/latest/content/tools/genomecov.html
|
||||
licence: ['MIT']
|
||||
input:
|
||||
- meta:
|
||||
type: map
|
||||
|
@ -19,6 +20,9 @@ input:
|
|||
type: file
|
||||
description: BAM/BED/GFF/VCF
|
||||
pattern: "*.{bam|bed|gff|vcf}"
|
||||
- scale:
|
||||
type: value
|
||||
description: Number containing the scale factor for the output. Set to 1 to disable. Setting to a value other than 1 will also get the -bg bedgraph output format as this is required for this command switch
|
||||
- sizes:
|
||||
type: file
|
||||
description: Tab-delimited table of chromosome names in the first column and chromosome sizes in the second column
|
||||
|
@ -35,12 +39,13 @@ output:
|
|||
type: file
|
||||
description: Computed genome coverage file
|
||||
pattern: "*.${extension}"
|
||||
- version:
|
||||
- versions:
|
||||
type: file
|
||||
description: File containing software version
|
||||
pattern: "*.{version.txt}"
|
||||
description: File containing software versions
|
||||
pattern: "versions.yml"
|
||||
authors:
|
||||
- "@Emiller88"
|
||||
- "@sruthipsuresh"
|
||||
- "@drpatelh"
|
||||
- "@sidorov-si"
|
||||
- "@chris-cheshire"
|
||||
|
|
|
@ -1,68 +0,0 @@
|
|||
//
|
||||
// Utility functions used in nf-core DSL2 module files
|
||||
//
|
||||
|
||||
//
|
||||
// Extract name of software tool from process name using $task.process
|
||||
//
|
||||
def getSoftwareName(task_process) {
|
||||
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
|
||||
}
|
||||
|
||||
//
|
||||
// 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) {
|
||||
if (!args.filename.endsWith('.version.txt')) {
|
||||
def ioptions = initOptions(args.options)
|
||||
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,22 +1,11 @@
|
|||
// Import generic module functions
|
||||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||
|
||||
params.options = [:]
|
||||
options = initOptions(params.options)
|
||||
|
||||
process BEDTOOLS_GETFASTA {
|
||||
tag "$bed"
|
||||
label 'process_medium'
|
||||
publishDir "${params.outdir}",
|
||||
mode: params.publish_dir_mode,
|
||||
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:[:], publish_by_meta:[]) }
|
||||
|
||||
conda (params.enable_conda ? "bioconda::bedtools=2.30.0" : null)
|
||||
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||
container "https://depot.galaxyproject.org/singularity/bedtools:2.30.0--hc088bd4_0"
|
||||
} else {
|
||||
container "quay.io/biocontainers/bedtools:2.30.0--hc088bd4_0"
|
||||
}
|
||||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
||||
'https://depot.galaxyproject.org/singularity/bedtools:2.30.0--hc088bd4_0' :
|
||||
'quay.io/biocontainers/bedtools:2.30.0--hc088bd4_0' }"
|
||||
|
||||
input:
|
||||
path bed
|
||||
|
@ -24,19 +13,22 @@ process BEDTOOLS_GETFASTA {
|
|||
|
||||
output:
|
||||
path "*.fa" , emit: fasta
|
||||
path "*.version.txt", emit: version
|
||||
path "versions.yml" , emit: versions
|
||||
|
||||
script:
|
||||
def software = getSoftwareName(task.process)
|
||||
def prefix = options.suffix ? "${bed.baseName}${options.suffix}" : "${bed.baseName}"
|
||||
def args = task.ext.args ?: ''
|
||||
def prefix = task.ext.prefix ?: "${bed.baseName}"
|
||||
"""
|
||||
bedtools \\
|
||||
getfasta \\
|
||||
$options.args \\
|
||||
$args \\
|
||||
-fi $fasta \\
|
||||
-bed $bed \\
|
||||
-fo ${prefix}.fa
|
||||
|
||||
bedtools --version | sed -e "s/bedtools v//g" > ${software}.version.txt
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${task.process}":
|
||||
bedtools: \$(bedtools --version | sed -e "s/bedtools v//g")
|
||||
END_VERSIONS
|
||||
"""
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ tools:
|
|||
description: |
|
||||
A set of tools for genomic analysis tasks, specifically enabling genome arithmetic (merge, count, complement) on various file types.
|
||||
documentation: https://bedtools.readthedocs.io/en/latest/content/tools/intersect.html
|
||||
licence: ['MIT']
|
||||
input:
|
||||
- bed:
|
||||
type: file
|
||||
|
@ -24,10 +25,10 @@ output:
|
|||
type: file
|
||||
description: Output fasta file with extracted sequences
|
||||
pattern: "*.{fa}"
|
||||
- version:
|
||||
- versions:
|
||||
type: file
|
||||
description: File containing software version
|
||||
pattern: "*.{version.txt}"
|
||||
description: File containing software versions
|
||||
pattern: "versions.yml"
|
||||
authors:
|
||||
- "@joseespinosa"
|
||||
- "@drpatelh"
|
||||
|
|
|
@ -1,68 +0,0 @@
|
|||
//
|
||||
// Utility functions used in nf-core DSL2 module files
|
||||
//
|
||||
|
||||
//
|
||||
// Extract name of software tool from process name using $task.process
|
||||
//
|
||||
def getSoftwareName(task_process) {
|
||||
return task_process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()
|
||||
}
|
||||
|
||||
//
|
||||
// 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) {
|
||||
if (!args.filename.endsWith('.version.txt')) {
|
||||
def ioptions = initOptions(args.options)
|
||||
def path_list = [ ioptions.publish_dir ?: args.publish_dir ]
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,22 +1,11 @@
|
|||
// Import generic module functions
|
||||
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||
|
||||
params.options = [:]
|
||||
options = initOptions(params.options)
|
||||
|
||||
process BEDTOOLS_INTERSECT {
|
||||
tag "$meta.id"
|
||||
label 'process_medium'
|
||||
publishDir "${params.outdir}",
|
||||
mode: params.publish_dir_mode,
|
||||
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
|
||||
|
||||
conda (params.enable_conda ? "bioconda::bedtools=2.30.0" : null)
|
||||
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||
container "https://depot.galaxyproject.org/singularity/bedtools:2.30.0--hc088bd4_0"
|
||||
} else {
|
||||
container "quay.io/biocontainers/bedtools:2.30.0--hc088bd4_0"
|
||||
}
|
||||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
||||
'https://depot.galaxyproject.org/singularity/bedtools:2.30.0--hc088bd4_0' :
|
||||
'quay.io/biocontainers/bedtools:2.30.0--hc088bd4_0' }"
|
||||
|
||||
input:
|
||||
tuple val(meta), path(intervals1), path(intervals2)
|
||||
|
@ -24,19 +13,22 @@ process BEDTOOLS_INTERSECT {
|
|||
|
||||
output:
|
||||
tuple val(meta), path("*.${extension}"), emit: intersect
|
||||
path '*.version.txt' , emit: version
|
||||
path "versions.yml" , emit: versions
|
||||
|
||||
script:
|
||||
def software = getSoftwareName(task.process)
|
||||
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||
def args = task.ext.args ?: ''
|
||||
def prefix = task.ext.prefix ?: "${meta.id}"
|
||||
"""
|
||||
bedtools \\
|
||||
intersect \\
|
||||
-a $intervals1 \\
|
||||
-b $intervals2 \\
|
||||
$options.args \\
|
||||
$args \\
|
||||
> ${prefix}.${extension}
|
||||
|
||||
bedtools --version | sed -e "s/bedtools v//g" > ${software}.version.txt
|
||||
cat <<-END_VERSIONS > versions.yml
|
||||
"${task.process}":
|
||||
bedtools: \$(bedtools --version | sed -e "s/bedtools v//g")
|
||||
END_VERSIONS
|
||||
"""
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ tools:
|
|||
description: |
|
||||
A set of tools for genomic analysis tasks, specifically enabling genome arithmetic (merge, count, complement) on various file types.
|
||||
documentation: https://bedtools.readthedocs.io/en/latest/content/tools/intersect.html
|
||||
licence: ['MIT']
|
||||
input:
|
||||
- meta:
|
||||
type: map
|
||||
|
@ -35,10 +36,10 @@ output:
|
|||
type: file
|
||||
description: File containing the description of overlaps found between the two features
|
||||
pattern: "*.${extension}"
|
||||
- version:
|
||||
- versions:
|
||||
type: file
|
||||
description: File containing software version
|
||||
pattern: "*.{version.txt}"
|
||||
description: File containing software versions
|
||||
pattern: "versions.yml"
|
||||
authors:
|
||||
- "@Emiller88"
|
||||
- "@sruthipsuresh"
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue