mirror of
https://github.com/MillironX/nf-core_modules.git
synced 2024-11-14 05:43:08 +00:00
Merge remote-tracking branch 'nf-core/master'
This commit is contained in:
commit
4866421777
165 changed files with 5879 additions and 503 deletions
2
.github/workflows/pytest-workflow.yml
vendored
2
.github/workflows/pytest-workflow.yml
vendored
|
@ -95,7 +95,7 @@ jobs:
|
||||||
if: failure()
|
if: failure()
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
with:
|
with:
|
||||||
name: logs-${{ matrix.tags }}-${{ matrix.profile }}-${{ matrix.nxf_version }}
|
name: logs-${{ matrix.profile }}-${{ matrix.nxf_version }}
|
||||||
path: |
|
path: |
|
||||||
/home/runner/pytest_workflow_*/*/.nextflow.log
|
/home/runner/pytest_workflow_*/*/.nextflow.log
|
||||||
/home/runner/pytest_workflow_*/*/log.out
|
/home/runner/pytest_workflow_*/*/log.out
|
||||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -7,3 +7,4 @@ output/
|
||||||
*.code-workspace
|
*.code-workspace
|
||||||
.screenrc
|
.screenrc
|
||||||
.*.sw?
|
.*.sw?
|
||||||
|
tests/data/
|
||||||
|
|
|
@ -7,4 +7,3 @@ bump-versions:
|
||||||
rseqc/inferexperiment: False
|
rseqc/inferexperiment: False
|
||||||
rseqc/innerdistance: False
|
rseqc/innerdistance: False
|
||||||
sortmerna: False
|
sortmerna: False
|
||||||
malt/build: False
|
|
||||||
|
|
419
README.md
419
README.md
|
@ -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)
|
[![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!
|
> 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.
|
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
|
## Table of contents
|
||||||
|
|
||||||
- [Using existing modules](#using-existing-modules)
|
- [Using existing modules](#using-existing-modules)
|
||||||
- [Adding a new module file](#adding-a-new-module-file)
|
- [Adding new modules](#adding-new-modules)
|
||||||
- [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)
|
|
||||||
- [Help](#help)
|
- [Help](#help)
|
||||||
- [Citation](#citation)
|
- [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:
|
2. List the available modules:
|
||||||
|
|
||||||
```console
|
```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:
|
3. Install the module in your pipeline directory:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nf-core modules install . --tool fastqc
|
$ nf-core modules install fastqc
|
||||||
|
|
||||||
,--./,-.
|
,--./,-.
|
||||||
___ __ __ __ ___ /,-._.--~\
|
___ __ __ __ ___ /,-._.--~\
|
||||||
|
@ -92,7 +84,7 @@ We have written a helper command in the `nf-core/tools` package that uses the Gi
|
||||||
5. Remove the module from the pipeline repository if required:
|
5. Remove the module from the pipeline repository if required:
|
||||||
|
|
||||||
```console
|
```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:
|
6. Check that a locally installed nf-core module is up-to-date compared to the one hosted in this repo:
|
||||||
|
|
||||||
```console
|
```console
|
||||||
$ nf-core modules lint . --tool fastqc
|
$ nf-core modules lint fastqc
|
||||||
|
|
||||||
,--./,-.
|
,--./,-.
|
||||||
___ __ __ __ ___ /,-._.--~\
|
___ __ __ __ ___ /,-._.--~\
|
||||||
|
@ -139,406 +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
|
> Please be kind to our code reviewers and submit one pull request per module :)
|
||||||
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.
|
|
||||||
|
|
||||||
> :warning: if you have a module named `build` this can conflict with some pytest internal behaviour. This results in no tests being run (i.e. recieving a message of `collected 0 items`). In this case rename the `tests/<module>/build` directry to `tests/<module>/build_test`, and update the corresponding `test.yml` accordingly. An example can be seen with the [`bowtie2/build` module tests](https://github.com/nf-core/modules/tree/master/tests/modules/bowtie2/build_test).
|
|
||||||
|
|
||||||
### 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
|
|
||||||
|
|
||||||
- All non-mandatory command-line tool options 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.
|
|
||||||
|
|
||||||
- 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.
|
|
||||||
|
|
||||||
#### Input/output options
|
|
||||||
|
|
||||||
- Input channel declarations MUST be defined for all _possible_ input files (i.e. both required and optional files).
|
|
||||||
- Directly associated auxiliary files to an input file MAY be defined within the same input channel alongside the main input channel (e.g. [BAM and BAI](https://github.com/nf-core/modules/blob/e937c7950af70930d1f34bb961403d9d2aa81c7d/modules/samtools/flagstat/main.nf#L22)).
|
|
||||||
- Other generic auxiliary files used across different input files (e.g. common reference sequences) MAY be defined using a dedicated input channel (e.g. [reference files](https://github.com/nf-core/modules/blob/3cabc95d0ed8a5a4e07b8f9b1d1f7ff9a70f61e1/modules/bwa/mem/main.nf#L21-L23)).
|
|
||||||
|
|
||||||
- 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, passing an empty list (`[]`) instead of a file as a module parameter can be used to work around this issue.
|
|
||||||
|
|
||||||
#### Module parameters
|
|
||||||
|
|
||||||
- A module file SHOULD only define input and output files as command-line parameters to be executed within the process.
|
|
||||||
|
|
||||||
- All `params` within the module MUST be initialised and used in the local context of the module. In other words, named `params` defined in the parent workflow MUST NOT be assumed to be passed to the module to allow developers to call their parameters whatever they want. In general, it may be more suitable to use additional `input` value channels to cater for such scenarios.
|
|
||||||
|
|
||||||
- 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.
|
|
||||||
|
|
||||||
#### 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`.
|
|
||||||
|
|
||||||
- If a module contains _multiple_ tools that supports multi-threading (e.g. [piping output into a samtools command](https://github.com/nf-core/modules/blob/28b023e6f4d0d2745406d9dc6e38006882804e67/modules/bowtie2/align/main.nf#L32-L46)), you MUST assign cpus per tool such that the total number of used CPUs does not exceed `task.cpus`.
|
|
||||||
- For example, combining two (or more) tools that both (all) have multi-threading, this can be assigned to the variable [`split_cpus`](https://github.com/nf-core/modules/blob/28b023e6f4d0d2745406d9dc6e38006882804e67/modules/bowtie2/align/main.nf#L32)
|
|
||||||
- If one tool is multi-threaded and another uses a single thread, you can specify directly in the command itself e.g. with [`${task.cpus - 1}`](https://github.com/nf-core/modules/blob/6e68c1af9a514bb056c0513ebba6764efd6750fc/modules/bwa/sampe/main.nf#L42-L43)
|
|
||||||
|
|
||||||
#### 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.
|
|
||||||
|
|
||||||
## Help
|
## Help
|
||||||
|
|
||||||
|
|
68
modules/agrvate/functions.nf
Normal file
68
modules/agrvate/functions.nf
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
//
|
||||||
|
// 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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
39
modules/agrvate/main.nf
Normal file
39
modules/agrvate/main.nf
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
// Import generic module functions
|
||||||
|
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||||
|
|
||||||
|
params.options = [:]
|
||||||
|
options = initOptions(params.options)
|
||||||
|
|
||||||
|
process AGRVATE {
|
||||||
|
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::agrvate=1.0.1" : null)
|
||||||
|
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||||
|
container "https://depot.galaxyproject.org/singularity/agrvate:1.0.1--hdfd78af_0"
|
||||||
|
} else {
|
||||||
|
container "quay.io/biocontainers/agrvate:1.0.1--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 "*.version.txt" , emit: version
|
||||||
|
|
||||||
|
script:
|
||||||
|
def software = getSoftwareName(task.process)
|
||||||
|
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||||
|
"""
|
||||||
|
agrvate \\
|
||||||
|
$options.args \\
|
||||||
|
-i $fasta
|
||||||
|
|
||||||
|
echo \$(agrvate -v 2>&1) | sed 's/agrvate //;' > ${software}.version.txt
|
||||||
|
"""
|
||||||
|
}
|
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"
|
||||||
|
- version:
|
||||||
|
type: file
|
||||||
|
description: File containing software version
|
||||||
|
pattern: "*.{version.txt}"
|
||||||
|
authors:
|
||||||
|
- "@abhi18av"
|
68
modules/bamaligncleaner/functions.nf
Normal file
68
modules/bamaligncleaner/functions.nf
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
//
|
||||||
|
// 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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
40
modules/bamaligncleaner/main.nf
Normal file
40
modules/bamaligncleaner/main.nf
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
// Import generic module functions
|
||||||
|
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||||
|
|
||||||
|
params.options = [:]
|
||||||
|
options = initOptions(params.options)
|
||||||
|
|
||||||
|
process BAMALIGNCLEANER {
|
||||||
|
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::bamaligncleaner=0.2.1" : null)
|
||||||
|
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||||
|
container "https://depot.galaxyproject.org/singularity/bamaligncleaner:0.2.1--pyhdfd78af_0"
|
||||||
|
} else {
|
||||||
|
container "quay.io/biocontainers/bamaligncleaner:0.2.1--pyhdfd78af_0"
|
||||||
|
}
|
||||||
|
|
||||||
|
input:
|
||||||
|
tuple val(meta), path(bam)
|
||||||
|
|
||||||
|
output:
|
||||||
|
tuple val(meta), path("*.bam"), emit: bam
|
||||||
|
path "*.version.txt" , emit: version
|
||||||
|
|
||||||
|
script:
|
||||||
|
def software = getSoftwareName(task.process)
|
||||||
|
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||||
|
|
||||||
|
"""
|
||||||
|
bamAlignCleaner \\
|
||||||
|
$options.args \\
|
||||||
|
-o ${prefix}.bam \\
|
||||||
|
${bam}
|
||||||
|
|
||||||
|
echo \$(bamAlignCleaner --version) | sed 's/.*version //' > ${software}.version.txt
|
||||||
|
"""
|
||||||
|
}
|
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 ]
|
||||||
|
- version:
|
||||||
|
type: file
|
||||||
|
description: File containing software version
|
||||||
|
pattern: "*.{version.txt}"
|
||||||
|
- bam:
|
||||||
|
type: file
|
||||||
|
description: Sorted BAM/CRAM file
|
||||||
|
pattern: "*.{bam,cram}"
|
||||||
|
|
||||||
|
authors:
|
||||||
|
- "@jfy133"
|
68
modules/bbmap/align/functions.nf
Normal file
68
modules/bbmap/align/functions.nf
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
//
|
||||||
|
// 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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
59
modules/bbmap/align/main.nf
Normal file
59
modules/bbmap/align/main.nf
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
// Import generic module functions
|
||||||
|
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||||
|
|
||||||
|
params.options = [:]
|
||||||
|
options = initOptions(params.options)
|
||||||
|
|
||||||
|
process BBMAP_ALIGN {
|
||||||
|
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.92 bioconda::samtools=1.13 pigz=2.6" : null)
|
||||||
|
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||||
|
container "https://depot.galaxyproject.org/singularity/mulled-v2-008daec56b7aaf3f162d7866758142b9f889d690:f5f55fc5623bb7b3f725e8d2f86bedacfd879510-0"
|
||||||
|
} else {
|
||||||
|
container "quay.io/biocontainers/mulled-v2-008daec56b7aaf3f162d7866758142b9f889d690:f5f55fc5623bb7b3f725e8d2f86bedacfd879510-0"
|
||||||
|
}
|
||||||
|
|
||||||
|
input:
|
||||||
|
tuple val(meta), path(fastq)
|
||||||
|
path ref
|
||||||
|
|
||||||
|
output:
|
||||||
|
tuple val(meta), path("*.bam"), emit: bam
|
||||||
|
path "*.version.txt" , emit: version
|
||||||
|
|
||||||
|
script:
|
||||||
|
def software = getSoftwareName(task.process)
|
||||||
|
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||||
|
|
||||||
|
input = meta.single_end ? "in=${fastq}" : "in=${fastq[0]} in2=${fastq[1]}"
|
||||||
|
|
||||||
|
// 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 \\
|
||||||
|
$options.args \\
|
||||||
|
threads=$task.cpus \\
|
||||||
|
-Xmx${task.memory.toGiga()}g
|
||||||
|
|
||||||
|
echo \$(bbversion.sh) > ${software}.version.txt
|
||||||
|
"""
|
||||||
|
}
|
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 ]
|
||||||
|
- version:
|
||||||
|
type: file
|
||||||
|
description: File containing software version
|
||||||
|
pattern: "*.{version.txt}"
|
||||||
|
- bam:
|
||||||
|
type: file
|
||||||
|
description: BAM file
|
||||||
|
pattern: "*.{bam}"
|
||||||
|
|
||||||
|
authors:
|
||||||
|
- "@erikrikarddaniel"
|
68
modules/bbmap/index/functions.nf
Normal file
68
modules/bbmap/index/functions.nf
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
//
|
||||||
|
// 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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
39
modules/bbmap/index/main.nf
Normal file
39
modules/bbmap/index/main.nf
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
// Import generic module functions
|
||||||
|
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||||
|
|
||||||
|
params.options = [:]
|
||||||
|
options = initOptions(params.options)
|
||||||
|
|
||||||
|
process BBMAP_INDEX {
|
||||||
|
tag "$fasta"
|
||||||
|
label 'process_long'
|
||||||
|
publishDir "${params.outdir}",
|
||||||
|
mode: params.publish_dir_mode,
|
||||||
|
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:[:], publish_by_meta:[]) }
|
||||||
|
|
||||||
|
conda (params.enable_conda ? "bioconda::bbmap=38.92" : null)
|
||||||
|
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||||
|
container "https://depot.galaxyproject.org/singularity/bbmap:38.92--he522d1c_0"
|
||||||
|
} else {
|
||||||
|
container "quay.io/biocontainers/bbmap:38.92--he522d1c_0"
|
||||||
|
}
|
||||||
|
|
||||||
|
input:
|
||||||
|
path fasta
|
||||||
|
|
||||||
|
output:
|
||||||
|
path 'ref' , emit: index
|
||||||
|
path "*.version.txt" , emit: version
|
||||||
|
|
||||||
|
script:
|
||||||
|
def software = getSoftwareName(task.process)
|
||||||
|
"""
|
||||||
|
bbmap.sh \\
|
||||||
|
ref=${fasta} \\
|
||||||
|
$options.args \\
|
||||||
|
threads=$task.cpus \\
|
||||||
|
-Xmx${task.memory.toGiga()}g
|
||||||
|
|
||||||
|
echo \$(bbversion.sh) > ${software}.version.txt
|
||||||
|
"""
|
||||||
|
}
|
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:
|
||||||
|
- version:
|
||||||
|
type: file
|
||||||
|
description: File containing software version
|
||||||
|
pattern: "*.{version.txt}"
|
||||||
|
- db:
|
||||||
|
type: directory
|
||||||
|
description: Directory with index files
|
||||||
|
pattern: "ref"
|
||||||
|
|
||||||
|
authors:
|
||||||
|
- "@daniellundin"
|
68
modules/bcftools/query/functions.nf
Normal file
68
modules/bcftools/query/functions.nf
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
//
|
||||||
|
// 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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
49
modules/bcftools/query/main.nf
Normal file
49
modules/bcftools/query/main.nf
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
// Import generic module functions
|
||||||
|
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||||
|
|
||||||
|
params.options = [:]
|
||||||
|
options = initOptions(params.options)
|
||||||
|
|
||||||
|
process BCFTOOLS_QUERY {
|
||||||
|
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.13" : null)
|
||||||
|
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||||
|
container "https://depot.galaxyproject.org/singularity/bcftools:1.13--h3a49de5_0"
|
||||||
|
} else {
|
||||||
|
container "quay.io/biocontainers/bcftools:1.13--h3a49de5_0"
|
||||||
|
}
|
||||||
|
|
||||||
|
input:
|
||||||
|
tuple val(meta), path(vcf), path(index)
|
||||||
|
path(regions)
|
||||||
|
path(targets)
|
||||||
|
path(samples)
|
||||||
|
|
||||||
|
output:
|
||||||
|
tuple val(meta), path("*.gz") , emit: vcf
|
||||||
|
path "*.version.txt" , emit: version
|
||||||
|
|
||||||
|
script:
|
||||||
|
def software = getSoftwareName(task.process)
|
||||||
|
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||||
|
def regions_file = regions ? "--regions-file ${regions}" : ""
|
||||||
|
def targets_file = targets ? "--targets-file ${targets}" : ""
|
||||||
|
def samples_file = samples ? "--samples-file ${samples}" : ""
|
||||||
|
|
||||||
|
"""
|
||||||
|
bcftools query \\
|
||||||
|
--output ${prefix}.vcf.gz \\
|
||||||
|
${regions_file} \\
|
||||||
|
${targets_file} \\
|
||||||
|
${samples_file} \\
|
||||||
|
$options.args \\
|
||||||
|
${vcf}
|
||||||
|
|
||||||
|
echo \$(bcftools --version 2>&1) | sed 's/^.*bcftools //; s/ .*\$//' > ${software}.version.txt
|
||||||
|
"""
|
||||||
|
}
|
61
modules/bcftools/query/meta.yml
Normal file
61
modules/bcftools/query/meta.yml
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
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
|
||||||
|
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}"
|
||||||
|
- version:
|
||||||
|
type: file
|
||||||
|
description: File containing software version
|
||||||
|
pattern: "*.{version.txt}"
|
||||||
|
authors:
|
||||||
|
- "@abhi18av"
|
68
modules/bcftools/view/functions.nf
Normal file
68
modules/bcftools/view/functions.nf
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
//
|
||||||
|
// 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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
51
modules/bcftools/view/main.nf
Normal file
51
modules/bcftools/view/main.nf
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
// Import generic module functions
|
||||||
|
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||||
|
|
||||||
|
params.options = [:]
|
||||||
|
options = initOptions(params.options)
|
||||||
|
|
||||||
|
process BCFTOOLS_VIEW {
|
||||||
|
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.13" : null)
|
||||||
|
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||||
|
container "https://depot.galaxyproject.org/singularity/bcftools:1.13--h3a49de5_0"
|
||||||
|
} else {
|
||||||
|
container "quay.io/biocontainers/bcftools:1.13--h3a49de5_0"
|
||||||
|
}
|
||||||
|
|
||||||
|
input:
|
||||||
|
tuple val(meta), path(vcf), path(index)
|
||||||
|
path(regions)
|
||||||
|
path(targets)
|
||||||
|
path(samples)
|
||||||
|
|
||||||
|
output:
|
||||||
|
tuple val(meta), path("*.gz") , emit: vcf
|
||||||
|
path "*.version.txt" , emit: version
|
||||||
|
|
||||||
|
script:
|
||||||
|
def software = getSoftwareName(task.process)
|
||||||
|
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||||
|
def regions_file = regions ? "--regions-file ${regions}" : ""
|
||||||
|
def targets_file = targets ? "--targets-file ${targets}" : ""
|
||||||
|
def samples_file = samples ? "--samples-file ${samples}" : ""
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
|
bcftools view \\
|
||||||
|
--output ${prefix}.vcf.gz \\
|
||||||
|
${regions_file} \\
|
||||||
|
${targets_file} \\
|
||||||
|
${samples_file} \\
|
||||||
|
$options.args \\
|
||||||
|
--threads $task.cpus \\
|
||||||
|
${vcf}
|
||||||
|
|
||||||
|
echo \$(bcftools --version 2>&1) | sed 's/^.*bcftools //; s/ .*\$//' > ${software}.version.txt
|
||||||
|
"""
|
||||||
|
}
|
62
modules/bcftools/view/meta.yml
Normal file
62
modules/bcftools/view/meta.yml
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
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
|
||||||
|
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}"
|
||||||
|
- version:
|
||||||
|
type: file
|
||||||
|
description: File containing software version
|
||||||
|
pattern: "*.{version.txt}"
|
||||||
|
authors:
|
||||||
|
- "@abhi18av"
|
68
modules/bedtools/makewindows/functions.nf
Normal file
68
modules/bedtools/makewindows/functions.nf
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
//
|
||||||
|
// 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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
42
modules/bedtools/makewindows/main.nf
Normal file
42
modules/bedtools/makewindows/main.nf
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
// Import generic module functions
|
||||||
|
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||||
|
|
||||||
|
params.options = [:]
|
||||||
|
options = initOptions(params.options)
|
||||||
|
|
||||||
|
process BEDTOOLS_MAKEWINDOWS {
|
||||||
|
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::bedtools=2.30.0" : null)
|
||||||
|
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||||
|
container "https://depot.galaxyproject.org/singularity/bedtools:2.30.0--h7d7f7ad_1"
|
||||||
|
} else {
|
||||||
|
container "quay.io/biocontainers/bedtools:2.30.0--h7d7f7ad_1"
|
||||||
|
}
|
||||||
|
|
||||||
|
input:
|
||||||
|
tuple val(meta), path(regions)
|
||||||
|
val(use_bed)
|
||||||
|
|
||||||
|
output:
|
||||||
|
tuple val(meta), path("*.tab"), emit: tab
|
||||||
|
path "*.version.txt" , emit: version
|
||||||
|
|
||||||
|
script:
|
||||||
|
def software = getSoftwareName(task.process)
|
||||||
|
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||||
|
def arg_input = use_bed ? "-b $regions" : "-g $regions"
|
||||||
|
"""
|
||||||
|
bedtools \\
|
||||||
|
makewindows \\
|
||||||
|
${arg_input} \\
|
||||||
|
$options.args \\
|
||||||
|
> ${prefix}.tab
|
||||||
|
|
||||||
|
echo \$(bedtools --version) | sed -e "s/bedtools v//g" > ${software}.version.txt
|
||||||
|
"""
|
||||||
|
}
|
43
modules/bedtools/makewindows/meta.yml
Normal file
43
modules/bedtools/makewindows/meta.yml
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
name: bedtools_makewindows
|
||||||
|
|
||||||
|
description: Makes adjacent or sliding windows across a genome or BED file.
|
||||||
|
keywords:
|
||||||
|
- bed
|
||||||
|
- windows
|
||||||
|
tools:
|
||||||
|
- bedtools:
|
||||||
|
description: A set of tools for genomic analysis tasks, specifically enabling genome arithmetic (merge, count, complement) on various file types.
|
||||||
|
homepage: https://bedtools.readthedocs.io
|
||||||
|
documentation: https://bedtools.readthedocs.io/en/latest/content/tools/makewindows.html
|
||||||
|
tool_dev_url: None
|
||||||
|
doi: "10.1093/bioinformatics/btq033"
|
||||||
|
licence: ['GPL v2']
|
||||||
|
input:
|
||||||
|
- meta:
|
||||||
|
type: map
|
||||||
|
description: |
|
||||||
|
Groovy Map containing sample information
|
||||||
|
e.g. [ id:'test', single_end:false ]
|
||||||
|
- regions:
|
||||||
|
type: file
|
||||||
|
description: BED file OR Genome details file (<chromName><TAB><chromSize>)
|
||||||
|
pattern: "*.{bed,fai,tab}"
|
||||||
|
- use_bed:
|
||||||
|
type: boolean
|
||||||
|
description: true = input is a BED file; false = input is a genome details file
|
||||||
|
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: "*.{version.txt}"
|
||||||
|
- tab:
|
||||||
|
type: file
|
||||||
|
description: Windows TAB file (BED or BED-like format)
|
||||||
|
pattern: "*.tab"
|
||||||
|
authors:
|
||||||
|
- "@kevbrick"
|
68
modules/cat/cat/functions.nf
Normal file
68
modules/cat/cat/functions.nf
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
//
|
||||||
|
// 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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
53
modules/cat/cat/main.nf
Normal file
53
modules/cat/cat/main.nf
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
// Import generic module functions
|
||||||
|
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||||
|
|
||||||
|
params.options = [:]
|
||||||
|
options = initOptions(params.options)
|
||||||
|
|
||||||
|
process CAT_CAT {
|
||||||
|
label 'process_low'
|
||||||
|
publishDir "${params.outdir}",
|
||||||
|
mode: params.publish_dir_mode,
|
||||||
|
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:[:], publish_by_meta:[]) }
|
||||||
|
|
||||||
|
conda (params.enable_conda ? "conda-forge::pigz=2.3.4" : null)
|
||||||
|
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||||
|
container "https://depot.galaxyproject.org/singularity/pigz:2.3.4"
|
||||||
|
} else {
|
||||||
|
container "quay.io/biocontainers/pigz:2.3.4"
|
||||||
|
}
|
||||||
|
|
||||||
|
input:
|
||||||
|
path files_in
|
||||||
|
val file_out
|
||||||
|
|
||||||
|
output:
|
||||||
|
path "${file_out}*" , emit: file_out
|
||||||
|
path "*.version.txt", emit: version
|
||||||
|
|
||||||
|
script:
|
||||||
|
def file_list = files_in.collect { it.toString() }
|
||||||
|
if (file_list.size > 1) {
|
||||||
|
|
||||||
|
// | input | output | command1 | command2 |
|
||||||
|
// |-----------|------------|----------|----------|
|
||||||
|
// | gzipped | gzipped | cat | |
|
||||||
|
// | ungzipped | ungzipped | cat | |
|
||||||
|
// | gzipped | ungzipped | zcat | |
|
||||||
|
// | ungzipped | gzipped | cat | pigz |
|
||||||
|
|
||||||
|
def in_zip = file_list[0].endsWith('.gz')
|
||||||
|
def out_zip = file_out.endsWith('.gz')
|
||||||
|
def command1 = (in_zip && !out_zip) ? 'zcat' : 'cat'
|
||||||
|
def command2 = (!in_zip && out_zip) ? "| pigz -c -p $task.cpus $options.args2" : ''
|
||||||
|
"""
|
||||||
|
$command1 \\
|
||||||
|
$options.args \\
|
||||||
|
${file_list.join(' ')} \\
|
||||||
|
$command2 \\
|
||||||
|
> $file_out
|
||||||
|
|
||||||
|
echo \$(pigz --version 2>&1) | sed 's/pigz //g' > pigz.version.txt
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
}
|
34
modules/cat/cat/meta.yml
Normal file
34
modules/cat/cat/meta.yml
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
name: cat_cat
|
||||||
|
description: A module for concatenation of gzipped or uncompressed files
|
||||||
|
keywords:
|
||||||
|
- concatenate
|
||||||
|
- gzip
|
||||||
|
- cat
|
||||||
|
tools:
|
||||||
|
- cat:
|
||||||
|
description: Just concatenation
|
||||||
|
homepage: None
|
||||||
|
documentation: https://man7.org/linux/man-pages/man1/cat.1.html
|
||||||
|
tool_dev_url: None
|
||||||
|
|
||||||
|
input:
|
||||||
|
- files_in:
|
||||||
|
type: file
|
||||||
|
description: List of compressed / uncompressed files
|
||||||
|
pattern: "*"
|
||||||
|
- file_out:
|
||||||
|
type: value
|
||||||
|
description: Full name of output file with or without .gz extension
|
||||||
|
|
||||||
|
output:
|
||||||
|
- version:
|
||||||
|
type: file
|
||||||
|
description: File containing version of the pigz software
|
||||||
|
pattern: "*.{version.txt}"
|
||||||
|
- file_out:
|
||||||
|
type: file
|
||||||
|
description: Concatenated file. Will be gzipped if file_out ends with ".gz"
|
||||||
|
pattern: "${file_out}"
|
||||||
|
|
||||||
|
authors:
|
||||||
|
- "@erikrikarddaniel"
|
68
modules/chromap/chromap/functions.nf
Normal file
68
modules/chromap/chromap/functions.nf
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
//
|
||||||
|
// 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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
93
modules/chromap/chromap/main.nf
Normal file
93
modules/chromap/chromap/main.nf
Normal file
|
@ -0,0 +1,93 @@
|
||||||
|
// Import generic module functions
|
||||||
|
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||||
|
|
||||||
|
params.options = [:]
|
||||||
|
options = initOptions(params.options)
|
||||||
|
|
||||||
|
def VERSION = 0.1 // No version information printed
|
||||||
|
|
||||||
|
process CHROMAP_CHROMAP {
|
||||||
|
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::chromap=0.1 bioconda::samtools=1.13" : null)
|
||||||
|
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||||
|
container "https://depot.galaxyproject.org/singularity/mulled-v2-1f09f39f20b1c4ee36581dc81cc323c70e661633:2cad7c5aa775241887eff8714259714a39baf016-0"
|
||||||
|
} else {
|
||||||
|
container "quay.io/biocontainers/mulled-v2-1f09f39f20b1c4ee36581dc81cc323c70e661633:2cad7c5aa775241887eff8714259714a39baf016-0"
|
||||||
|
}
|
||||||
|
|
||||||
|
input:
|
||||||
|
tuple val(meta), path(reads)
|
||||||
|
path fasta
|
||||||
|
path index
|
||||||
|
path barcodes
|
||||||
|
path whitelist
|
||||||
|
path chr_order
|
||||||
|
path pairs_chr_order
|
||||||
|
|
||||||
|
output:
|
||||||
|
tuple val(meta), path("*.bed.gz") , optional:true, emit: bed
|
||||||
|
tuple val(meta), path("*.bam") , optional:true, emit: bam
|
||||||
|
tuple val(meta), path("*.tagAlign.gz"), optional:true, emit: tagAlign
|
||||||
|
tuple val(meta), path("*.pairs.gz") , optional:true, emit: pairs
|
||||||
|
path "*.version.txt" , emit: version
|
||||||
|
|
||||||
|
script:
|
||||||
|
def software = getSoftwareName(task.process)
|
||||||
|
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||||
|
def args = options.args.tokenize()
|
||||||
|
|
||||||
|
def file_extension = options.args.contains("--SAM")? 'sam' :
|
||||||
|
options.args.contains("--TagAlign")? 'tagAlign' :
|
||||||
|
options.args.contains("--pairs")? 'pairs' : 'bed'
|
||||||
|
if (barcodes) {
|
||||||
|
args << "-b ${barcodes.join(',')}"
|
||||||
|
if (whitelist) {
|
||||||
|
args << "--barcode-whitelist $whitelist"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (chr_order) {
|
||||||
|
args << "--chr-order $chr_order"
|
||||||
|
}
|
||||||
|
if (pairs_chr_order){
|
||||||
|
args << "--pairs-natural-chr-order $pairs_chr_order"
|
||||||
|
}
|
||||||
|
def compression_cmds = """
|
||||||
|
gzip ${prefix}.${file_extension}
|
||||||
|
"""
|
||||||
|
if (options.args.contains("--SAM")) {
|
||||||
|
compression_cmds = """
|
||||||
|
samtools view $options.args2 -@ ${task.cpus} -bh \\
|
||||||
|
-o ${prefix}.bam ${prefix}.${file_extension}
|
||||||
|
rm ${prefix}.${file_extension}
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
if (meta.single_end) {
|
||||||
|
"""
|
||||||
|
chromap ${args.join(' ')} \\
|
||||||
|
-t $task.cpus \\
|
||||||
|
-x $index \\
|
||||||
|
-r $fasta \\
|
||||||
|
-1 ${reads.join(',')} \\
|
||||||
|
-o ${prefix}.${file_extension}
|
||||||
|
|
||||||
|
echo "$VERSION" > ${software}.version.txt
|
||||||
|
""" + compression_cmds
|
||||||
|
} else {
|
||||||
|
"""
|
||||||
|
chromap ${args.join(' ')} \\
|
||||||
|
-t $task.cpus \\
|
||||||
|
-x $index \\
|
||||||
|
-r $fasta \\
|
||||||
|
-1 ${reads[0]} \\
|
||||||
|
-2 ${reads[1]} \\
|
||||||
|
-o ${prefix}.${file_extension}
|
||||||
|
|
||||||
|
echo "$VERSION" > ${software}.version.txt
|
||||||
|
""" + compression_cmds
|
||||||
|
}
|
||||||
|
}
|
88
modules/chromap/chromap/meta.yml
Normal file
88
modules/chromap/chromap/meta.yml
Normal file
|
@ -0,0 +1,88 @@
|
||||||
|
name: chromap_chromap
|
||||||
|
description: |
|
||||||
|
Performs preprocessing and alignment of chromatin fastq files to
|
||||||
|
fasta reference files using chromap.
|
||||||
|
keywords:
|
||||||
|
- chromap
|
||||||
|
- alignment
|
||||||
|
- map
|
||||||
|
- fastq
|
||||||
|
- bam
|
||||||
|
- sam
|
||||||
|
- hi-c
|
||||||
|
- atac-seq
|
||||||
|
- chip-seq
|
||||||
|
- trimming
|
||||||
|
- duplicate removal
|
||||||
|
tools:
|
||||||
|
- chromap:
|
||||||
|
description: Fast alignment and preprocessing of chromatin profiles
|
||||||
|
homepage: https://github.com/haowenz/chromap
|
||||||
|
documentation: https://github.com/haowenz/chromap
|
||||||
|
tool_dev_url: https://github.com/haowenz/chromap
|
||||||
|
doi: ""
|
||||||
|
licence: ['GPL v3']
|
||||||
|
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.
|
||||||
|
- fasta:
|
||||||
|
type: file
|
||||||
|
description: |
|
||||||
|
The fasta reference file.
|
||||||
|
- index:
|
||||||
|
type: file
|
||||||
|
description: |
|
||||||
|
Chromap genome index files (*.index)
|
||||||
|
- barcodes:
|
||||||
|
type: file
|
||||||
|
description: |
|
||||||
|
Cell barcode files
|
||||||
|
- whitelist:
|
||||||
|
type: file
|
||||||
|
description: |
|
||||||
|
Cell barcode whitelist file
|
||||||
|
- chr_order:
|
||||||
|
type: file
|
||||||
|
description: |
|
||||||
|
Custom chromosome order
|
||||||
|
- pairs_chr_order:
|
||||||
|
type: file
|
||||||
|
description: |
|
||||||
|
Natural chromosome order for pairs flipping
|
||||||
|
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: "*.{version.txt}"
|
||||||
|
- bed:
|
||||||
|
type: file
|
||||||
|
description: BED file
|
||||||
|
pattern: "*.bed.gz"
|
||||||
|
- bam:
|
||||||
|
type: file
|
||||||
|
description: BAM file
|
||||||
|
pattern: "*.bam"
|
||||||
|
- tagAlign:
|
||||||
|
type: file
|
||||||
|
description: tagAlign file
|
||||||
|
pattern: "*.tagAlign.gz"
|
||||||
|
- pairs:
|
||||||
|
type: file
|
||||||
|
description: pairs file
|
||||||
|
pattern: "*.pairs.gz"
|
||||||
|
|
||||||
|
authors:
|
||||||
|
- "@mahesh-panchal"
|
68
modules/chromap/index/functions.nf
Normal file
68
modules/chromap/index/functions.nf
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
//
|
||||||
|
// 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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
40
modules/chromap/index/main.nf
Normal file
40
modules/chromap/index/main.nf
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
// Import generic module functions
|
||||||
|
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||||
|
|
||||||
|
params.options = [:]
|
||||||
|
options = initOptions(params.options)
|
||||||
|
|
||||||
|
def VERSION = 0.1 // No version information printed
|
||||||
|
|
||||||
|
process CHROMAP_INDEX {
|
||||||
|
tag '$fasta'
|
||||||
|
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::chromap=0.1 bioconda::samtools=1.13" : null)
|
||||||
|
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||||
|
container "https://depot.galaxyproject.org/singularity/mulled-v2-1f09f39f20b1c4ee36581dc81cc323c70e661633:2cad7c5aa775241887eff8714259714a39baf016-0"
|
||||||
|
} else {
|
||||||
|
container "quay.io/biocontainers/mulled-v2-1f09f39f20b1c4ee36581dc81cc323c70e661633:2cad7c5aa775241887eff8714259714a39baf016-0"
|
||||||
|
}
|
||||||
|
|
||||||
|
input:
|
||||||
|
path fasta
|
||||||
|
|
||||||
|
output:
|
||||||
|
path "*.index" , emit: index
|
||||||
|
path "*.version.txt", emit: version
|
||||||
|
|
||||||
|
script:
|
||||||
|
def software = getSoftwareName(task.process)
|
||||||
|
def prefix = fasta.baseName
|
||||||
|
"""
|
||||||
|
chromap -i $options.args \\
|
||||||
|
-t $task.cpus \\
|
||||||
|
-r $fasta \\
|
||||||
|
-o ${prefix}.index
|
||||||
|
echo "$VERSION" > ${software}.version.txt
|
||||||
|
"""
|
||||||
|
}
|
33
modules/chromap/index/meta.yml
Normal file
33
modules/chromap/index/meta.yml
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
name: chromap_index
|
||||||
|
description: Indexes a fasta reference genome ready for chromatin profiling.
|
||||||
|
keywords:
|
||||||
|
- index
|
||||||
|
- fasta
|
||||||
|
- genome
|
||||||
|
- reference
|
||||||
|
tools:
|
||||||
|
- chromap:
|
||||||
|
description: Fast alignment and preprocessing of chromatin profiles
|
||||||
|
homepage: https://github.com/haowenz/chromap
|
||||||
|
documentation: https://github.com/haowenz/chromap
|
||||||
|
tool_dev_url: https://github.com/haowenz/chromap
|
||||||
|
doi: ""
|
||||||
|
licence: ['GPL v3']
|
||||||
|
|
||||||
|
input:
|
||||||
|
- fasta:
|
||||||
|
type: file
|
||||||
|
description: Fasta reference file.
|
||||||
|
|
||||||
|
output:
|
||||||
|
- version:
|
||||||
|
type: file
|
||||||
|
description: File containing software version
|
||||||
|
pattern: "*.{version.txt}"
|
||||||
|
- index:
|
||||||
|
type: file
|
||||||
|
description: Index file of the reference genome
|
||||||
|
pattern: "*.{index}"
|
||||||
|
|
||||||
|
authors:
|
||||||
|
- "@mahesh-panchal"
|
68
modules/diamond/blastp/functions.nf
Normal file
68
modules/diamond/blastp/functions.nf
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
//
|
||||||
|
// 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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
47
modules/diamond/blastp/main.nf
Normal file
47
modules/diamond/blastp/main.nf
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
// Import generic module functions
|
||||||
|
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||||
|
|
||||||
|
params.options = [:]
|
||||||
|
options = initOptions(params.options)
|
||||||
|
|
||||||
|
process DIAMOND_BLASTP {
|
||||||
|
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']) }
|
||||||
|
|
||||||
|
// Dimaond is limited to v2.0.9 because there is not a
|
||||||
|
// singularity version higher than this at the current time.
|
||||||
|
conda (params.enable_conda ? "bioconda::diamond=2.0.9" : null)
|
||||||
|
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||||
|
container 'https://depot.galaxyproject.org/singularity/diamond:2.0.9--hdcc8f71_0'
|
||||||
|
} else {
|
||||||
|
container "quay.io/biocontainers/diamond:2.0.9--hdcc8f71_0"
|
||||||
|
}
|
||||||
|
|
||||||
|
input:
|
||||||
|
tuple val(meta), path(fasta)
|
||||||
|
path db
|
||||||
|
|
||||||
|
output:
|
||||||
|
tuple val(meta), path('*.txt'), emit: txt
|
||||||
|
path '*.version.txt' , emit: version
|
||||||
|
|
||||||
|
script:
|
||||||
|
def software = getSoftwareName(task.process)
|
||||||
|
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||||
|
"""
|
||||||
|
DB=`find -L ./ -name "*.dmnd" | sed 's/.dmnd//'`
|
||||||
|
|
||||||
|
diamond \\
|
||||||
|
blastp \\
|
||||||
|
--threads $task.cpus \\
|
||||||
|
--db \$DB \\
|
||||||
|
--query $fasta \\
|
||||||
|
$options.args \\
|
||||||
|
--out ${prefix}.txt
|
||||||
|
|
||||||
|
echo \$(diamond --version 2>&1) | tail -n 1 | sed 's/^diamond version //' > ${software}.version.txt
|
||||||
|
"""
|
||||||
|
}
|
43
modules/diamond/blastp/meta.yml
Normal file
43
modules/diamond/blastp/meta.yml
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
name: diamond_blastp
|
||||||
|
description: Queries a DIAMOND database using blastp mode
|
||||||
|
keywords:
|
||||||
|
- fasta
|
||||||
|
- diamond
|
||||||
|
- blastp
|
||||||
|
- DNA sequence
|
||||||
|
tools:
|
||||||
|
- diamond:
|
||||||
|
description: Accelerated BLAST compatible local sequence aligner
|
||||||
|
homepage: https://github.com/bbuchfink/diamond
|
||||||
|
documentation: https://github.com/bbuchfink/diamond/wiki
|
||||||
|
tool_dev_url: https://github.com/bbuchfink/diamond
|
||||||
|
doi: "doi:10.1038/s41592-021-01101-x"
|
||||||
|
licence: ['GPL v3.0']
|
||||||
|
|
||||||
|
input:
|
||||||
|
- meta:
|
||||||
|
type: map
|
||||||
|
description: |
|
||||||
|
Groovy Map containing sample information
|
||||||
|
e.g. [ id:'test', single_end:false ]
|
||||||
|
- fasta:
|
||||||
|
type: file
|
||||||
|
description: Input fasta file containing query sequences
|
||||||
|
pattern: "*.{fa,fasta}"
|
||||||
|
- db:
|
||||||
|
type: directory
|
||||||
|
description: Directory containing the protein blast database
|
||||||
|
pattern: "*"
|
||||||
|
|
||||||
|
output:
|
||||||
|
- txt:
|
||||||
|
type: file
|
||||||
|
description: File containing blastp hits
|
||||||
|
pattern: "*.{blastp.txt}"
|
||||||
|
- version:
|
||||||
|
type: file
|
||||||
|
description: File containing software version
|
||||||
|
pattern: "*.{version.txt}"
|
||||||
|
|
||||||
|
authors:
|
||||||
|
- "@spficklin"
|
68
modules/diamond/blastx/functions.nf
Normal file
68
modules/diamond/blastx/functions.nf
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
//
|
||||||
|
// 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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
47
modules/diamond/blastx/main.nf
Normal file
47
modules/diamond/blastx/main.nf
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
// Import generic module functions
|
||||||
|
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||||
|
|
||||||
|
params.options = [:]
|
||||||
|
options = initOptions(params.options)
|
||||||
|
|
||||||
|
process DIAMOND_BLASTX {
|
||||||
|
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']) }
|
||||||
|
|
||||||
|
// Dimaond is limited to v2.0.9 because there is not a
|
||||||
|
// singularity version higher than this at the current time.
|
||||||
|
conda (params.enable_conda ? "bioconda::diamond=2.0.9" : null)
|
||||||
|
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||||
|
container 'https://depot.galaxyproject.org/singularity/diamond:2.0.9--hdcc8f71_0'
|
||||||
|
} else {
|
||||||
|
container "quay.io/biocontainers/diamond:2.0.9--hdcc8f71_0"
|
||||||
|
}
|
||||||
|
|
||||||
|
input:
|
||||||
|
tuple val(meta), path(fasta)
|
||||||
|
path db
|
||||||
|
|
||||||
|
output:
|
||||||
|
tuple val(meta), path('*.txt'), emit: txt
|
||||||
|
path '*.version.txt' , emit: version
|
||||||
|
|
||||||
|
script:
|
||||||
|
def software = getSoftwareName(task.process)
|
||||||
|
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||||
|
"""
|
||||||
|
DB=`find -L ./ -name "*.dmnd" | sed 's/.dmnd//'`
|
||||||
|
|
||||||
|
diamond \\
|
||||||
|
blastx \\
|
||||||
|
--threads $task.cpus \\
|
||||||
|
--db \$DB \\
|
||||||
|
--query $fasta \\
|
||||||
|
$options.args \\
|
||||||
|
--out ${prefix}.txt
|
||||||
|
|
||||||
|
echo \$(diamond --version 2>&1) | tail -n 1 | sed 's/^diamond version //' > ${software}.version.txt
|
||||||
|
"""
|
||||||
|
}
|
43
modules/diamond/blastx/meta.yml
Normal file
43
modules/diamond/blastx/meta.yml
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
name: diamond_blastx
|
||||||
|
description: Queries a DIAMOND database using blastx mode
|
||||||
|
keywords:
|
||||||
|
- fasta
|
||||||
|
- diamond
|
||||||
|
- blastx
|
||||||
|
- DNA sequence
|
||||||
|
tools:
|
||||||
|
- diamond:
|
||||||
|
description: Accelerated BLAST compatible local sequence aligner
|
||||||
|
homepage: https://github.com/bbuchfink/diamond
|
||||||
|
documentation: https://github.com/bbuchfink/diamond/wiki
|
||||||
|
tool_dev_url: https://github.com/bbuchfink/diamond
|
||||||
|
doi: "doi:10.1038/s41592-021-01101-x"
|
||||||
|
licence: ['GPL v3.0']
|
||||||
|
|
||||||
|
input:
|
||||||
|
- meta:
|
||||||
|
type: map
|
||||||
|
description: |
|
||||||
|
Groovy Map containing sample information
|
||||||
|
e.g. [ id:'test', single_end:false ]
|
||||||
|
- fasta:
|
||||||
|
type: file
|
||||||
|
description: Input fasta file containing query sequences
|
||||||
|
pattern: "*.{fa,fasta}"
|
||||||
|
- db:
|
||||||
|
type: directory
|
||||||
|
description: Directory containing the nucelotide blast database
|
||||||
|
pattern: "*"
|
||||||
|
|
||||||
|
output:
|
||||||
|
- txt:
|
||||||
|
type: file
|
||||||
|
description: File containing blastx hits
|
||||||
|
pattern: "*.{blastx.txt}"
|
||||||
|
- version:
|
||||||
|
type: file
|
||||||
|
description: File containing software version
|
||||||
|
pattern: "*.{version.txt}"
|
||||||
|
|
||||||
|
authors:
|
||||||
|
- "@spficklin"
|
68
modules/diamond/makedb/functions.nf
Normal file
68
modules/diamond/makedb/functions.nf
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
//
|
||||||
|
// 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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
42
modules/diamond/makedb/main.nf
Normal file
42
modules/diamond/makedb/main.nf
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
// Import generic module functions
|
||||||
|
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||||
|
|
||||||
|
params.options = [:]
|
||||||
|
options = initOptions(params.options)
|
||||||
|
|
||||||
|
process DIAMOND_MAKEDB {
|
||||||
|
tag "$fasta"
|
||||||
|
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:[]) }
|
||||||
|
|
||||||
|
// Dimaond is limited to v2.0.9 because there is not a
|
||||||
|
// singularity version higher than this at the current time.
|
||||||
|
conda (params.enable_conda ? 'bioconda::diamond=2.0.9' : null)
|
||||||
|
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||||
|
container 'https://depot.galaxyproject.org/singularity/diamond:2.0.9--hdcc8f71_0'
|
||||||
|
} else {
|
||||||
|
container 'quay.io/biocontainers/diamond:2.0.9--hdcc8f71_0'
|
||||||
|
}
|
||||||
|
|
||||||
|
input:
|
||||||
|
path fasta
|
||||||
|
|
||||||
|
output:
|
||||||
|
path "${fasta}.dmnd", emit: db
|
||||||
|
path '*.version.txt', emit: version
|
||||||
|
|
||||||
|
script:
|
||||||
|
def software = getSoftwareName(task.process)
|
||||||
|
"""
|
||||||
|
diamond \\
|
||||||
|
makedb \\
|
||||||
|
--threads $task.cpus \\
|
||||||
|
--in $fasta \\
|
||||||
|
-d $fasta \\
|
||||||
|
$options.args
|
||||||
|
|
||||||
|
echo \$(diamond --version 2>&1) | tail -n 1 | sed 's/^diamond version //' > ${software}.version.txt
|
||||||
|
"""
|
||||||
|
}
|
34
modules/diamond/makedb/meta.yml
Normal file
34
modules/diamond/makedb/meta.yml
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
name: diamond_makedb
|
||||||
|
description: Builds a DIAMOND database
|
||||||
|
keywords:
|
||||||
|
- fasta
|
||||||
|
- diamond
|
||||||
|
- index
|
||||||
|
- database
|
||||||
|
tools:
|
||||||
|
- diamond:
|
||||||
|
description: Accelerated BLAST compatible local sequence aligner
|
||||||
|
homepage: https://github.com/bbuchfink/diamond
|
||||||
|
documentation: https://github.com/bbuchfink/diamond/wiki
|
||||||
|
tool_dev_url: https://github.com/bbuchfink/diamond
|
||||||
|
doi: "doi:10.1038/s41592-021-01101-x"
|
||||||
|
licence: ['GPL v3.0']
|
||||||
|
|
||||||
|
input:
|
||||||
|
- fasta:
|
||||||
|
type: file
|
||||||
|
description: Input fasta file
|
||||||
|
pattern: "*.{fa,fasta}"
|
||||||
|
|
||||||
|
output:
|
||||||
|
- db:
|
||||||
|
type: file
|
||||||
|
description: File of the indexed DIAMOND database
|
||||||
|
pattern: "*.{dmnd}"
|
||||||
|
- version:
|
||||||
|
type: file
|
||||||
|
description: File containing software version
|
||||||
|
pattern: "*.{version.txt}"
|
||||||
|
|
||||||
|
authors:
|
||||||
|
- "@spficklin"
|
68
modules/fastani/functions.nf
Normal file
68
modules/fastani/functions.nf
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
//
|
||||||
|
// 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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
52
modules/fastani/main.nf
Normal file
52
modules/fastani/main.nf
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
// Import generic module functions
|
||||||
|
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||||
|
|
||||||
|
params.options = [:]
|
||||||
|
options = initOptions(params.options)
|
||||||
|
|
||||||
|
process FASTANI {
|
||||||
|
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::fastani=1.32" : null)
|
||||||
|
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||||
|
container "https://depot.galaxyproject.org/singularity/fastani:1.32--he1c1bb9_0"
|
||||||
|
} else {
|
||||||
|
container "quay.io/biocontainers/fastani:1.32--he1c1bb9_0"
|
||||||
|
}
|
||||||
|
|
||||||
|
input:
|
||||||
|
tuple val(meta), path(query)
|
||||||
|
path reference
|
||||||
|
|
||||||
|
output:
|
||||||
|
tuple val(meta), path("*.ani.txt"), emit: ani
|
||||||
|
path "*.version.txt" , emit: version
|
||||||
|
|
||||||
|
script:
|
||||||
|
def software = getSoftwareName(task.process)
|
||||||
|
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||||
|
|
||||||
|
if (meta.batch_input) {
|
||||||
|
"""
|
||||||
|
fastANI \\
|
||||||
|
-ql $query \\
|
||||||
|
-rl $reference \\
|
||||||
|
-o ${prefix}.ani.txt
|
||||||
|
|
||||||
|
echo \$(fastANI --version 2>&1) | sed 's/version//;' > ${software}.version.txt
|
||||||
|
"""
|
||||||
|
} else {
|
||||||
|
"""
|
||||||
|
fastANI \\
|
||||||
|
-q $query \\
|
||||||
|
-r $reference \\
|
||||||
|
-o ${prefix}.ani.txt
|
||||||
|
|
||||||
|
echo \$(fastANI --version 2>&1) | sed 's/version//;' > ${software}.version.txt
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
}
|
43
modules/fastani/meta.yml
Normal file
43
modules/fastani/meta.yml
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
name: fastani
|
||||||
|
description: write your description here
|
||||||
|
keywords:
|
||||||
|
- fastani
|
||||||
|
tools:
|
||||||
|
- fastani:
|
||||||
|
description: FastANI is developed for fast alignment-free computation of whole-genome Average Nucleotide Identity (ANI).
|
||||||
|
homepage: https://github.com/ParBLiSS/FastANI
|
||||||
|
documentation: https://github.com/ParBLiSS/FastANI
|
||||||
|
tool_dev_url: https://github.com/ParBLiSS/FastANI
|
||||||
|
doi: 10.1038/s41467-018-07641-9
|
||||||
|
licence: ['Apache-2.0']
|
||||||
|
|
||||||
|
input:
|
||||||
|
- meta:
|
||||||
|
type: map
|
||||||
|
description: |
|
||||||
|
Groovy Map containing sample information
|
||||||
|
e.g. [ id:'test', single_end:false ]
|
||||||
|
- query:
|
||||||
|
type: file
|
||||||
|
description: Fasta file(s) to be queried
|
||||||
|
pattern: "*.fasta"
|
||||||
|
- reference:
|
||||||
|
type: file
|
||||||
|
description: Fasta file(s) to be used as reference for the query
|
||||||
|
pattern: "*.fasta"
|
||||||
|
output:
|
||||||
|
- meta:
|
||||||
|
type: map
|
||||||
|
description: |
|
||||||
|
Groovy Map containing sample information
|
||||||
|
e.g. [ id:'test', single_end:false ]
|
||||||
|
- ani:
|
||||||
|
type: file
|
||||||
|
description: Results of the query
|
||||||
|
pattern: "*.ani.txt"
|
||||||
|
- version:
|
||||||
|
type: file
|
||||||
|
description: File containing software version
|
||||||
|
pattern: "*.{version.txt}"
|
||||||
|
authors:
|
||||||
|
- "@abhi18av"
|
68
modules/gatk4/getpileupsummaries/functions.nf
Normal file
68
modules/gatk4/getpileupsummaries/functions.nf
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
//
|
||||||
|
// 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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
48
modules/gatk4/getpileupsummaries/main.nf
Normal file
48
modules/gatk4/getpileupsummaries/main.nf
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
// Import generic module functions
|
||||||
|
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||||
|
|
||||||
|
params.options = [:]
|
||||||
|
options = initOptions(params.options)
|
||||||
|
|
||||||
|
process GATK4_GETPILEUPSUMMARIES {
|
||||||
|
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::gatk4=4.2.0.0" : null)
|
||||||
|
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||||
|
container "https://depot.galaxyproject.org/singularity/gatk4:4.2.0.0--0"
|
||||||
|
} else {
|
||||||
|
container "quay.io/biocontainers/gatk4:4.2.0.0--0"
|
||||||
|
}
|
||||||
|
|
||||||
|
input:
|
||||||
|
tuple val(meta), path(bam), path(bai)
|
||||||
|
path variants
|
||||||
|
path variants_idx
|
||||||
|
path sites
|
||||||
|
|
||||||
|
output:
|
||||||
|
tuple val(meta), path('*.pileups.table'), emit: table
|
||||||
|
path '*.version.txt' , emit: version
|
||||||
|
|
||||||
|
script:
|
||||||
|
def software = getSoftwareName(task.process)
|
||||||
|
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||||
|
def sitesCommand = ''
|
||||||
|
|
||||||
|
sitesCommand = sites ? " -L ${sites} " : " -L ${variants} "
|
||||||
|
|
||||||
|
"""
|
||||||
|
gatk GetPileupSummaries \\
|
||||||
|
-I $bam \\
|
||||||
|
-V $variants \\
|
||||||
|
$sitesCommand \\
|
||||||
|
-O ${prefix}.pileups.table \\
|
||||||
|
$options.args
|
||||||
|
|
||||||
|
echo \$(gatk --version 2>&1) | sed 's/^.*(GATK) v//; s/ .*\$//' > ${software}.version.txt
|
||||||
|
"""
|
||||||
|
}
|
57
modules/gatk4/getpileupsummaries/meta.yml
Normal file
57
modules/gatk4/getpileupsummaries/meta.yml
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
name: gatk4_getpileupsummaries
|
||||||
|
description: |
|
||||||
|
Summarizes counts of reads that support reference, alternate and other alleles for given sites. Results can be used with CalculateContamination. Requires a common germline variant sites file, such as from gnomAD.
|
||||||
|
keywords:
|
||||||
|
- gatk4
|
||||||
|
- getpileupsumaries
|
||||||
|
- readcountssummary
|
||||||
|
- germlinevariantsites
|
||||||
|
tools:
|
||||||
|
- gatk4:
|
||||||
|
description: |
|
||||||
|
Developed in the Data Sciences Platform at the Broad Institute, the toolkit offers a wide variety of tools
|
||||||
|
with a primary focus on variant discovery and genotyping. Its powerful processing engine
|
||||||
|
and high-performance computing features make it capable of taking on projects of any size.
|
||||||
|
homepage: https://gatk.broadinstitute.org/hc/en-us
|
||||||
|
documentation: https://gatk.broadinstitute.org/hc/en-us/categories/360002369672s
|
||||||
|
doi: 10.1158/1538-7445.AM2017-3590
|
||||||
|
|
||||||
|
input:
|
||||||
|
- meta:
|
||||||
|
type: map
|
||||||
|
description: |
|
||||||
|
Groovy Map containing sample information
|
||||||
|
e.g. [ id:'test' ]
|
||||||
|
- bam:
|
||||||
|
type: file
|
||||||
|
description: BAM file to be summarised.
|
||||||
|
pattern: "*.bam"
|
||||||
|
- bai:
|
||||||
|
type: file
|
||||||
|
description: BAM file index.
|
||||||
|
pattern: "*.bam.bai"
|
||||||
|
- variants:
|
||||||
|
type: file
|
||||||
|
description: Population vcf of germline sequencing, containing allele fractions. Is also used as sites file if no separate sites file is specified.
|
||||||
|
pattern: "*.vcf.gz"
|
||||||
|
- variants_idx:
|
||||||
|
type: file
|
||||||
|
description: Index file for the germline resource.
|
||||||
|
pattern: "*.vcf.gz.tbi"
|
||||||
|
- sites:
|
||||||
|
type: file
|
||||||
|
description: File containing specified sites to be used for the summary. If this option is not specified, variants file is used instead automatically.
|
||||||
|
pattern: "*.interval_list"
|
||||||
|
|
||||||
|
output:
|
||||||
|
- pileup:
|
||||||
|
type: file
|
||||||
|
description: File containing the pileup summary table.
|
||||||
|
pattern: "*.pileups.table"
|
||||||
|
- version:
|
||||||
|
type: file
|
||||||
|
description: File containing software version
|
||||||
|
pattern: "*.version.txt"
|
||||||
|
|
||||||
|
authors:
|
||||||
|
- "@GCJMackenzie"
|
68
modules/gatk4/mutect2/functions.nf
Normal file
68
modules/gatk4/mutect2/functions.nf
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
//
|
||||||
|
// 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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
77
modules/gatk4/mutect2/main.nf
Normal file
77
modules/gatk4/mutect2/main.nf
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
// Import generic module functions
|
||||||
|
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||||
|
|
||||||
|
params.options = [:]
|
||||||
|
options = initOptions(params.options)
|
||||||
|
|
||||||
|
process GATK4_MUTECT2 {
|
||||||
|
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::gatk4=4.2.0.0" : null)
|
||||||
|
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||||
|
container "https://depot.galaxyproject.org/singularity/gatk4:4.2.0.0--0"
|
||||||
|
} else {
|
||||||
|
container "quay.io/biocontainers/gatk4:4.2.0.0--0"
|
||||||
|
}
|
||||||
|
|
||||||
|
input:
|
||||||
|
tuple val(meta) , path(bam) , path(bai) , val(which_norm)
|
||||||
|
val run_single
|
||||||
|
val run_pon
|
||||||
|
path fasta
|
||||||
|
path fastaidx
|
||||||
|
path dict
|
||||||
|
path germline_resource
|
||||||
|
path germline_resource_idx
|
||||||
|
path panel_of_normals
|
||||||
|
path panel_of_normals_idx
|
||||||
|
|
||||||
|
output:
|
||||||
|
tuple val(meta), path("*.vcf.gz") , emit: vcf
|
||||||
|
tuple val(meta), path("*.tbi") , emit: tbi
|
||||||
|
tuple val(meta), path("*.stats") , emit: stats
|
||||||
|
tuple val(meta), path("*.f1r2.tar.gz"), optional:true, emit: f1r2
|
||||||
|
path "*.version.txt" , emit: version
|
||||||
|
|
||||||
|
script:
|
||||||
|
def software = getSoftwareName(task.process)
|
||||||
|
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||||
|
def inputsList = []
|
||||||
|
def normalsList = []
|
||||||
|
def inputsCommand = ''
|
||||||
|
def panelsCommand = ''
|
||||||
|
def normalsCommand = ''
|
||||||
|
|
||||||
|
bam.each() {a -> inputsList.add(" -I " + a ) }
|
||||||
|
inputsCommand = inputsList.join( ' ')
|
||||||
|
|
||||||
|
if(run_pon) {
|
||||||
|
panelsCommand = ''
|
||||||
|
normalsCommand = ''
|
||||||
|
|
||||||
|
} else if(run_single) {
|
||||||
|
panelsCommand = " --germline-resource $germline_resource --panel-of-normals $panel_of_normals"
|
||||||
|
normalsCommand = ''
|
||||||
|
|
||||||
|
} else {
|
||||||
|
panelsCommand = " --germline-resource $germline_resource --panel-of-normals $panel_of_normals --f1r2-tar-gz ${prefix}.f1r2.tar.gz"
|
||||||
|
which_norm.each() {a -> normalsList.add(" -normal " + a ) }
|
||||||
|
normalsCommand = normalsList.join( ' ')
|
||||||
|
}
|
||||||
|
|
||||||
|
"""
|
||||||
|
gatk Mutect2 \\
|
||||||
|
-R ${fasta} \\
|
||||||
|
${inputsCommand} \\
|
||||||
|
${normalsCommand} \\
|
||||||
|
${panelsCommand} \\
|
||||||
|
-O ${prefix}.vcf.gz \\
|
||||||
|
$options.args
|
||||||
|
|
||||||
|
echo \$(gatk --version 2>&1) | sed 's/^.*(GATK) v//; s/ .*\$//' > ${software}.version.txt
|
||||||
|
"""
|
||||||
|
}
|
93
modules/gatk4/mutect2/meta.yml
Normal file
93
modules/gatk4/mutect2/meta.yml
Normal file
|
@ -0,0 +1,93 @@
|
||||||
|
name: gatk4_mutect2
|
||||||
|
description: Call somatic SNVs and indels via local assembly of haplotypes.
|
||||||
|
keywords:
|
||||||
|
- gatk4
|
||||||
|
- mutect2
|
||||||
|
- haplotype
|
||||||
|
- somatic
|
||||||
|
tools:
|
||||||
|
- gatk4:
|
||||||
|
description: |
|
||||||
|
Developed in the Data Sciences Platform at the Broad Institute, the toolkit offers a wide variety of tools
|
||||||
|
with a primary focus on variant discovery and genotyping. Its powerful processing engine
|
||||||
|
and high-performance computing features make it capable of taking on projects of any size.
|
||||||
|
homepage: https://gatk.broadinstitute.org/hc/en-us
|
||||||
|
documentation: https://gatk.broadinstitute.org/hc/en-us/categories/360002369672s
|
||||||
|
doi: 10.1158/1538-7445.AM2017-3590
|
||||||
|
|
||||||
|
input:
|
||||||
|
- meta:
|
||||||
|
type: map
|
||||||
|
description: |
|
||||||
|
Groovy Map containing sample information
|
||||||
|
e.g. [ id:'test']
|
||||||
|
- bam:
|
||||||
|
type: list
|
||||||
|
description: list of BAM files
|
||||||
|
pattern: "*.bam"
|
||||||
|
- bai:
|
||||||
|
type: list
|
||||||
|
description: list of BAM file indexes
|
||||||
|
pattern: "*.bam.bai"
|
||||||
|
- which_norm:
|
||||||
|
type: list
|
||||||
|
description: optional list of sample headers contained in the normal sample bam files (these are required for tumor_normal_pair mode)
|
||||||
|
- run_single:
|
||||||
|
type: boolean
|
||||||
|
description: Specify whether or not to run in tumor_single mode instead of tumor_normal_pair mode (will be ignored if run_pon is also true)
|
||||||
|
- run_pon:
|
||||||
|
type: boolean
|
||||||
|
description: Specify whether or not to run in panel_of_normal mode instead of tumor_normal_pair mode
|
||||||
|
- fasta:
|
||||||
|
type: file
|
||||||
|
description: The reference fasta file
|
||||||
|
pattern: "*.fasta"
|
||||||
|
- fastaidx:
|
||||||
|
type: file
|
||||||
|
description: Index of reference fasta file
|
||||||
|
pattern: "fasta.fai"
|
||||||
|
- dict:
|
||||||
|
type: file
|
||||||
|
description: GATK sequence dictionary
|
||||||
|
pattern: "*.dict"
|
||||||
|
- germline_resource:
|
||||||
|
type: file
|
||||||
|
description: Population vcf of germline sequencing, containing allele fractions.
|
||||||
|
pattern: "*.vcf.gz"
|
||||||
|
- germline_resource_idx:
|
||||||
|
type: file
|
||||||
|
description: Index file for the germline resource.
|
||||||
|
pattern: "*.vcf.gz_tbi"
|
||||||
|
- panel_of_normals:
|
||||||
|
type: file
|
||||||
|
description: vcf file to be used as a panel of normals.
|
||||||
|
pattern: "*.vcf.gz"
|
||||||
|
- panel_of_normals_idx:
|
||||||
|
type: file
|
||||||
|
description: Index for the panel of normals.
|
||||||
|
pattern: "*.vcf.gz_tbi"
|
||||||
|
|
||||||
|
output:
|
||||||
|
- vcf:
|
||||||
|
type: file
|
||||||
|
description: compressed vcf file
|
||||||
|
pattern: "*.vcf.gz"
|
||||||
|
- tbi:
|
||||||
|
type: file
|
||||||
|
description: Index of vcf file
|
||||||
|
pattern: "*vcf.gz.tbi"
|
||||||
|
- stats:
|
||||||
|
type: file
|
||||||
|
description: Stats file that pairs with output vcf file
|
||||||
|
pattern: "*vcf.gz.stats"
|
||||||
|
- f1r2:
|
||||||
|
type: file
|
||||||
|
description: file containing information to be passed to LearnReadOrientationModel (only outputted when tumor_normal_pair mode is run)
|
||||||
|
pattern: "*.f1r2.tar.gz"
|
||||||
|
- version:
|
||||||
|
type: file
|
||||||
|
description: File containing software version
|
||||||
|
pattern: "*.version.txt"
|
||||||
|
|
||||||
|
authors:
|
||||||
|
- "@GCJMackenzie"
|
|
@ -27,8 +27,12 @@ process GFFREAD {
|
||||||
|
|
||||||
script:
|
script:
|
||||||
def software = getSoftwareName(task.process)
|
def software = getSoftwareName(task.process)
|
||||||
|
def prefix = options.suffix ? "${gff.baseName}${options.suffix}" : "${gff.baseName}"
|
||||||
"""
|
"""
|
||||||
gffread $gff $options.args -o ${gff.baseName}.gtf
|
gffread \\
|
||||||
|
$gff \\
|
||||||
|
$options.args \\
|
||||||
|
-o ${prefix}.gtf
|
||||||
echo \$(gffread --version 2>&1) > ${software}.version.txt
|
echo \$(gffread --version 2>&1) > ${software}.version.txt
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,26 +14,16 @@ tools:
|
||||||
licence: ['MIT']
|
licence: ['MIT']
|
||||||
|
|
||||||
input:
|
input:
|
||||||
- meta:
|
|
||||||
type: map
|
|
||||||
description: |
|
|
||||||
Groovy Map containing sample information
|
|
||||||
e.g. [ id:'test', single_end:false ]
|
|
||||||
- gff:
|
- gff:
|
||||||
type: file
|
type: file
|
||||||
description: A GFF file in either the GFF3 or GFF2 format.
|
description: A reference file in either the GFF3, GFF2 or GTF format.
|
||||||
patter: "*.gff"
|
pattern: "*.{gff, gtf}"
|
||||||
|
|
||||||
output:
|
output:
|
||||||
- meta:
|
|
||||||
type: map
|
|
||||||
description: |
|
|
||||||
Groovy Map containing sample information
|
|
||||||
e.g. [ id:'test', single_end:false ]
|
|
||||||
- gtf:
|
- gtf:
|
||||||
type: file
|
type: file
|
||||||
description: GTF file resulting from the conversion of the GFF input file
|
description: GTF file resulting from the conversion of the GFF input file
|
||||||
pattern: "*.gtf"
|
pattern: "*.{gtf}"
|
||||||
- version:
|
- version:
|
||||||
type: file
|
type: file
|
||||||
description: File containing software version
|
description: File containing software version
|
||||||
|
|
68
modules/glnexus/functions.nf
Normal file
68
modules/glnexus/functions.nf
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
//
|
||||||
|
// 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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
49
modules/glnexus/main.nf
Normal file
49
modules/glnexus/main.nf
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
// Import generic module functions
|
||||||
|
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||||
|
|
||||||
|
params.options = [:]
|
||||||
|
options = initOptions(params.options)
|
||||||
|
|
||||||
|
process GLNEXUS {
|
||||||
|
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::glnexus=1.4.1" : null)
|
||||||
|
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||||
|
container "https://depot.galaxyproject.org/singularity/glnexus:1.4.1--h40d77a6_0"
|
||||||
|
} else {
|
||||||
|
container "quay.io/biocontainers/glnexus:1.4.1--h40d77a6_0"
|
||||||
|
}
|
||||||
|
|
||||||
|
input:
|
||||||
|
tuple val(meta), path(gvcfs)
|
||||||
|
|
||||||
|
output:
|
||||||
|
tuple val(meta), path("*.bcf"), emit: bcf
|
||||||
|
path "*.version.txt" , emit: version
|
||||||
|
|
||||||
|
script:
|
||||||
|
def software = getSoftwareName(task.process)
|
||||||
|
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||||
|
|
||||||
|
// Make list of GVCFs to merge
|
||||||
|
def input = gvcfs.collect { it.toString() }
|
||||||
|
def avail_mem = 3
|
||||||
|
if (!task.memory) {
|
||||||
|
log.info '[Glnexus] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.'
|
||||||
|
} else {
|
||||||
|
avail_mem = task.memory.giga
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
glnexus_cli \\
|
||||||
|
--threads $task.cpus \\
|
||||||
|
--mem-gbytes $avail_mem \\
|
||||||
|
$options.args \\
|
||||||
|
${input.join(' ')} \\
|
||||||
|
> ${prefix}.bcf
|
||||||
|
echo \$(glnexus_cli 2>&1) | head -n 1 | sed 's/^.*release //; s/ .*\$//' > ${software}.version.txt
|
||||||
|
"""
|
||||||
|
}
|
36
modules/glnexus/meta.yml
Normal file
36
modules/glnexus/meta.yml
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
name: glnexus
|
||||||
|
description: merge gVCF files and perform joint variant calling
|
||||||
|
keywords:
|
||||||
|
- merge
|
||||||
|
- gvcf
|
||||||
|
tools:
|
||||||
|
- glnexus:
|
||||||
|
description: scalable gVCF merging and joint variant calling for population sequencing projects.
|
||||||
|
homepage: https://github.com/dnanexus-rnd/GLnexus
|
||||||
|
documentation: https://github.com/dnanexus-rnd/GLnexus/wiki/Getting-Started
|
||||||
|
tool_dev_url: None
|
||||||
|
doi: https://doi.org/10.1101/343970
|
||||||
|
licence: ['Apache License 2.0']
|
||||||
|
|
||||||
|
input:
|
||||||
|
- meta:
|
||||||
|
type: map
|
||||||
|
description: |
|
||||||
|
Groovy Map containing sample information
|
||||||
|
e.g. [ id:'test' ]
|
||||||
|
- gvcfs:
|
||||||
|
type: list
|
||||||
|
description: Input genomic vcf files
|
||||||
|
pattern: "*.{gvcf,gvcf.gz,g.vcf,g.vcf.gz}"
|
||||||
|
|
||||||
|
output:
|
||||||
|
- version:
|
||||||
|
type: file
|
||||||
|
description: File containing software version
|
||||||
|
pattern: "*.{version.txt}"
|
||||||
|
- bcf:
|
||||||
|
type: file
|
||||||
|
description: merged BCF file
|
||||||
|
pattern: "*.bcf"
|
||||||
|
authors:
|
||||||
|
- "@ramprasadn"
|
|
@ -1,11 +1,11 @@
|
||||||
name: homer_annotatepeaks
|
name: homer_annotatepeaks
|
||||||
description: Annotate peaks with homer
|
description: Annotate peaks with HOMER suite
|
||||||
keywords:
|
keywords:
|
||||||
- annotations
|
- annotations
|
||||||
- peaks
|
- peaks
|
||||||
- bed
|
- bed
|
||||||
tools:
|
tools:
|
||||||
- cuatadapt:
|
- homer:
|
||||||
description: |
|
description: |
|
||||||
HOMER (Hypergeometric Optimization of Motif EnRichment) is a suite of tools for Motif Discovery and next-gen sequencing analysis.
|
HOMER (Hypergeometric Optimization of Motif EnRichment) is a suite of tools for Motif Discovery and next-gen sequencing analysis.
|
||||||
documentation: http://homer.ucsd.edu/homer/
|
documentation: http://homer.ucsd.edu/homer/
|
||||||
|
|
68
modules/homer/findpeaks/functions.nf
Normal file
68
modules/homer/findpeaks/functions.nf
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
//
|
||||||
|
// 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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
42
modules/homer/findpeaks/main.nf
Normal file
42
modules/homer/findpeaks/main.nf
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
// Import generic module functions
|
||||||
|
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||||
|
|
||||||
|
params.options = [:]
|
||||||
|
def options = initOptions(params.options)
|
||||||
|
|
||||||
|
def VERSION = '4.11'
|
||||||
|
|
||||||
|
process HOMER_FINDPEAKS {
|
||||||
|
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::homer=4.11=pl526hc9558a2_3" : null)
|
||||||
|
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||||
|
container "https://depot.galaxyproject.org/singularity/homer:4.11--pl526hc9558a2_3"
|
||||||
|
} else {
|
||||||
|
container "quay.io/biocontainers/homer:4.11--pl526hc9558a2_3"
|
||||||
|
}
|
||||||
|
|
||||||
|
input:
|
||||||
|
tuple val(meta), path(tagDir)
|
||||||
|
|
||||||
|
output:
|
||||||
|
tuple val(meta), path("*peaks.txt"), emit: txt
|
||||||
|
path "*.version.txt" , emit: version
|
||||||
|
|
||||||
|
script:
|
||||||
|
def software = getSoftwareName(task.process)
|
||||||
|
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||||
|
"""
|
||||||
|
|
||||||
|
findPeaks \\
|
||||||
|
$tagDir \\
|
||||||
|
$options.args \\
|
||||||
|
-o ${prefix}.peaks.txt
|
||||||
|
|
||||||
|
echo $VERSION > ${software}.version.txt
|
||||||
|
"""
|
||||||
|
}
|
37
modules/homer/findpeaks/meta.yml
Normal file
37
modules/homer/findpeaks/meta.yml
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
name: homer_findpeaks
|
||||||
|
description: Find peaks with HOMER suite
|
||||||
|
keywords:
|
||||||
|
- annotations
|
||||||
|
- peaks
|
||||||
|
tools:
|
||||||
|
- homer:
|
||||||
|
description: |
|
||||||
|
HOMER (Hypergeometric Optimization of Motif EnRichment) is a suite of tools for Motif Discovery and next-gen sequencing analysis.
|
||||||
|
documentation: http://homer.ucsd.edu/homer/
|
||||||
|
doi: 10.1016/j.molcel.2010.05.004.
|
||||||
|
input:
|
||||||
|
- meta:
|
||||||
|
type: map
|
||||||
|
description: |
|
||||||
|
Groovy Map containing sample information
|
||||||
|
e.g. [ id:'test', single_end:false ]
|
||||||
|
- tagDir:
|
||||||
|
type: directory
|
||||||
|
description: "The 'Tag Directory'"
|
||||||
|
pattern: "tagDir"
|
||||||
|
output:
|
||||||
|
- meta:
|
||||||
|
type: map
|
||||||
|
description: |
|
||||||
|
Groovy Map containing sample information
|
||||||
|
e.g. [ id:'test', single_end:false ]
|
||||||
|
- peaks:
|
||||||
|
type: file
|
||||||
|
description: The found peaks
|
||||||
|
pattern: "*peaks.txt"
|
||||||
|
- version:
|
||||||
|
type: file
|
||||||
|
description: File containing software version
|
||||||
|
pattern: "*.{version.txt}"
|
||||||
|
authors:
|
||||||
|
- "@EMiller88"
|
68
modules/homer/maketagdirectory/functions.nf
Normal file
68
modules/homer/maketagdirectory/functions.nf
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
//
|
||||||
|
// 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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
43
modules/homer/maketagdirectory/main.nf
Normal file
43
modules/homer/maketagdirectory/main.nf
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
// Import generic module functions
|
||||||
|
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||||
|
|
||||||
|
params.options = [:]
|
||||||
|
def options = initOptions(params.options)
|
||||||
|
|
||||||
|
def VERSION = '4.11'
|
||||||
|
|
||||||
|
process HOMER_MAKETAGDIRECTORY {
|
||||||
|
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::homer=4.11=pl526hc9558a2_3" : null)
|
||||||
|
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||||
|
container "https://depot.galaxyproject.org/singularity/homer:4.11--pl526hc9558a2_3"
|
||||||
|
} else {
|
||||||
|
container "quay.io/biocontainers/homer:4.11--pl526hc9558a2_3"
|
||||||
|
}
|
||||||
|
|
||||||
|
input:
|
||||||
|
tuple val(meta), path(bed)
|
||||||
|
path fasta
|
||||||
|
|
||||||
|
output:
|
||||||
|
tuple val(meta), path("tag_dir"), emit: tagdir
|
||||||
|
path "*.version.txt" , emit: version
|
||||||
|
|
||||||
|
script:
|
||||||
|
def software = getSoftwareName(task.process)
|
||||||
|
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||||
|
"""
|
||||||
|
makeTagDirectory \\
|
||||||
|
tag_dir \\
|
||||||
|
$options.args \\
|
||||||
|
$bed \\
|
||||||
|
-genome $fasta
|
||||||
|
|
||||||
|
echo $VERSION > ${software}.version.txt
|
||||||
|
"""
|
||||||
|
}
|
41
modules/homer/maketagdirectory/meta.yml
Normal file
41
modules/homer/maketagdirectory/meta.yml
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
name: homer_maketagdirectory
|
||||||
|
description: Create a tag directory with the HOMER suite
|
||||||
|
keywords:
|
||||||
|
- peaks
|
||||||
|
- bed
|
||||||
|
tools:
|
||||||
|
- homer:
|
||||||
|
description: |
|
||||||
|
HOMER (Hypergeometric Optimization of Motif EnRichment) is a suite of tools for Motif Discovery and next-gen sequencing analysis.
|
||||||
|
documentation: http://homer.ucsd.edu/homer/
|
||||||
|
doi: 10.1016/j.molcel.2010.05.004.
|
||||||
|
input:
|
||||||
|
- meta:
|
||||||
|
type: map
|
||||||
|
description: |
|
||||||
|
Groovy Map containing sample information
|
||||||
|
e.g. [ id:'test', single_end:false ]
|
||||||
|
- bed:
|
||||||
|
type: file
|
||||||
|
description: The peak files in bed format
|
||||||
|
pattern: "*.bed"
|
||||||
|
- fasta:
|
||||||
|
type: file
|
||||||
|
description: Fasta file of reference genome
|
||||||
|
pattern: "*.fasta"
|
||||||
|
output:
|
||||||
|
- meta:
|
||||||
|
type: map
|
||||||
|
description: |
|
||||||
|
Groovy Map containing sample information
|
||||||
|
e.g. [ id:'test', single_end:false ]
|
||||||
|
- tag_dir:
|
||||||
|
type: directory
|
||||||
|
description: The "Tag Directory"
|
||||||
|
pattern: "tag_dir"
|
||||||
|
- version:
|
||||||
|
type: file
|
||||||
|
description: File containing software version
|
||||||
|
pattern: "*.{version.txt}"
|
||||||
|
authors:
|
||||||
|
- "@EMiller88"
|
68
modules/homer/makeucscfile/functions.nf
Normal file
68
modules/homer/makeucscfile/functions.nf
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
//
|
||||||
|
// 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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
41
modules/homer/makeucscfile/main.nf
Normal file
41
modules/homer/makeucscfile/main.nf
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
// Import generic module functions
|
||||||
|
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||||
|
|
||||||
|
params.options = [:]
|
||||||
|
def options = initOptions(params.options)
|
||||||
|
|
||||||
|
def VERSION = '4.11'
|
||||||
|
|
||||||
|
process HOMER_MAKEUCSCFILE {
|
||||||
|
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::homer=4.11=pl526hc9558a2_3" : null)
|
||||||
|
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||||
|
container "https://depot.galaxyproject.org/singularity/homer:4.11--pl526hc9558a2_3"
|
||||||
|
} else {
|
||||||
|
container "quay.io/biocontainers/homer:4.11--pl526hc9558a2_3"
|
||||||
|
}
|
||||||
|
|
||||||
|
input:
|
||||||
|
tuple val(meta), path(tagDir)
|
||||||
|
|
||||||
|
output:
|
||||||
|
tuple val(meta), path("tag_dir/*ucsc.bedGraph.gz"), emit: bedGraph
|
||||||
|
path "*.version.txt" , emit: version
|
||||||
|
|
||||||
|
script:
|
||||||
|
def software = getSoftwareName(task.process)
|
||||||
|
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||||
|
"""
|
||||||
|
makeUCSCfile \\
|
||||||
|
$tagDir \\
|
||||||
|
-o auto
|
||||||
|
$options.args
|
||||||
|
|
||||||
|
echo $VERSION > ${software}.version.txt
|
||||||
|
"""
|
||||||
|
}
|
38
modules/homer/makeucscfile/meta.yml
Normal file
38
modules/homer/makeucscfile/meta.yml
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
name: homer_makeucscfile
|
||||||
|
description: Create a UCSC bed graph with the HOMER suite
|
||||||
|
keywords:
|
||||||
|
- peaks
|
||||||
|
- bed
|
||||||
|
- bedGraph
|
||||||
|
tools:
|
||||||
|
- homer:
|
||||||
|
description: |
|
||||||
|
HOMER (Hypergeometric Optimization of Motif EnRichment) is a suite of tools for Motif Discovery and next-gen sequencing analysis.
|
||||||
|
documentation: http://homer.ucsd.edu/homer/
|
||||||
|
doi: 10.1016/j.molcel.2010.05.004.
|
||||||
|
input:
|
||||||
|
- meta:
|
||||||
|
type: map
|
||||||
|
description: |
|
||||||
|
Groovy Map containing sample information
|
||||||
|
e.g. [ id:'test', single_end:false ]
|
||||||
|
- tagDir:
|
||||||
|
type: directory
|
||||||
|
description: "The 'Tag Directory'"
|
||||||
|
pattern: "tagDir"
|
||||||
|
output:
|
||||||
|
- meta:
|
||||||
|
type: map
|
||||||
|
description: |
|
||||||
|
Groovy Map containing sample information
|
||||||
|
e.g. [ id:'test', single_end:false ]
|
||||||
|
- bedGraph:
|
||||||
|
type: file
|
||||||
|
description: The UCSC bed graph
|
||||||
|
pattern: "tag_dir/*ucsc.bedGraph.gz"
|
||||||
|
- version:
|
||||||
|
type: file
|
||||||
|
description: File containing software version
|
||||||
|
pattern: "*.{version.txt}"
|
||||||
|
authors:
|
||||||
|
- "@EMiller88"
|
|
@ -51,6 +51,6 @@ process KALLISTOBUSTOOLS_COUNT {
|
||||||
${reads[0]} \\
|
${reads[0]} \\
|
||||||
${reads[1]}
|
${reads[1]}
|
||||||
|
|
||||||
echo \$(kb 2>&1) | sed 's/^kb_python //; s/Usage.*\$//' > ${software}.version.txt
|
echo \$(kb 2>&1) | sed 's/^.*kb_python //;s/positional arguments.*\$//' > ${software}.version.txt
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ process KALLISTOBUSTOOLS_REF {
|
||||||
$fasta \\
|
$fasta \\
|
||||||
$gtf
|
$gtf
|
||||||
|
|
||||||
echo \$(kb 2>&1) | sed 's/^kb_python //; s/Usage.*\$//' > ${software}.version.txt
|
echo \$(kb 2>&1) | sed 's/^.*kb_python //;s/positional arguments.*\$//' > ${software}.version.txt
|
||||||
"""
|
"""
|
||||||
} else {
|
} else {
|
||||||
"""
|
"""
|
||||||
|
@ -61,7 +61,7 @@ process KALLISTOBUSTOOLS_REF {
|
||||||
$fasta \\
|
$fasta \\
|
||||||
$gtf
|
$gtf
|
||||||
|
|
||||||
echo \$(kb 2>&1) | sed 's/^kb_python //; s/Usage.*\$//' > ${software}.version.txt
|
echo \$(kb 2>&1) | sed 's/^.*kb_python //;s/positional arguments.*\$//' > ${software}.version.txt
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
68
modules/kleborate/functions.nf
Normal file
68
modules/kleborate/functions.nf
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
//
|
||||||
|
// 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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
39
modules/kleborate/main.nf
Normal file
39
modules/kleborate/main.nf
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
// Import generic module functions
|
||||||
|
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||||
|
|
||||||
|
params.options = [:]
|
||||||
|
options = initOptions(params.options)
|
||||||
|
|
||||||
|
process KLEBORATE {
|
||||||
|
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::kleborate=2.1.0" : null)
|
||||||
|
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||||
|
container "https://depot.galaxyproject.org/singularity/kleborate:2.1.0--pyhdfd78af_1"
|
||||||
|
} else {
|
||||||
|
container "quay.io/biocontainers/kleborate:2.1.0--pyhdfd78af_1"
|
||||||
|
}
|
||||||
|
|
||||||
|
input:
|
||||||
|
tuple val(meta), path(fastas)
|
||||||
|
|
||||||
|
output:
|
||||||
|
tuple val(meta), path("*.txt"), emit: txt
|
||||||
|
path "*.version.txt" , emit: version
|
||||||
|
|
||||||
|
script:
|
||||||
|
def software = getSoftwareName(task.process)
|
||||||
|
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||||
|
"""
|
||||||
|
kleborate \\
|
||||||
|
$options.args \\
|
||||||
|
--outfile ${prefix}.results.txt \\
|
||||||
|
--assemblies *.fasta
|
||||||
|
|
||||||
|
echo \$(kleborate -v 2>&1) | sed 's/kleborate //;' > ${software}.version.txt
|
||||||
|
"""
|
||||||
|
}
|
43
modules/kleborate/meta.yml
Normal file
43
modules/kleborate/meta.yml
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
name: kleborate
|
||||||
|
description: Kleborate is a tool to screen genome assemblies of Klebsiella pneumoniae and the Klebsiella pneumoniae species complex (KpSC).
|
||||||
|
keywords:
|
||||||
|
- screening assemblies
|
||||||
|
- Klebsiella pneumoniae
|
||||||
|
tools:
|
||||||
|
- kleborate:
|
||||||
|
description: Screening Klebsiella genome assemblies for MLST, sub-species, and other Klebsiella related genes of interest
|
||||||
|
homepage: https://github.com/katholt/Kleborate
|
||||||
|
documentation: https://github.com/katholt/Kleborate/wiki
|
||||||
|
tool_dev_url: https://github.com/katholt/Kleborate
|
||||||
|
doi: 10.1038/s41467-021-24448-3
|
||||||
|
licence: ['GPL v3 or later (GPL v3+)']
|
||||||
|
|
||||||
|
input:
|
||||||
|
- meta:
|
||||||
|
type: map
|
||||||
|
description: |
|
||||||
|
Groovy Map containing sample information
|
||||||
|
e.g. [ id:'test', single_end:false ]
|
||||||
|
- fastas:
|
||||||
|
type: files
|
||||||
|
description: Klebsiella genome assemblies to be screened
|
||||||
|
pattern: "*.fasta"
|
||||||
|
|
||||||
|
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: "*.{version.txt}"
|
||||||
|
- txt:
|
||||||
|
type: file
|
||||||
|
description: Result file generated after screening
|
||||||
|
pattern: "*.txt"
|
||||||
|
|
||||||
|
authors:
|
||||||
|
- "@abhi18av"
|
||||||
|
- "@rpetit3"
|
|
@ -11,13 +11,11 @@ process MALT_BUILD {
|
||||||
mode: params.publish_dir_mode,
|
mode: params.publish_dir_mode,
|
||||||
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:[:], publish_by_meta:[]) }
|
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:[:], publish_by_meta:[]) }
|
||||||
|
|
||||||
// Do not **auto-bump** due to problem with change of version numbering between 0.4.1 and 0.5.2
|
conda (params.enable_conda ? "bioconda::malt=0.53" : null)
|
||||||
// (originally 0.4.1 was listed as 0.41, so is always selected as 'latest' even though it is not!)
|
|
||||||
conda (params.enable_conda ? "bioconda::malt=0.5.2" : null)
|
|
||||||
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||||
container "https://depot.galaxyproject.org/singularity/malt:0.5.2--0"
|
container "https://depot.galaxyproject.org/singularity/malt:0.53--hdfd78af_0"
|
||||||
} else {
|
} else {
|
||||||
container "quay.io/biocontainers/malt:0.5.2--0"
|
container "quay.io/biocontainers/malt:0.53--hdfd78af_0"
|
||||||
}
|
}
|
||||||
|
|
||||||
input:
|
input:
|
||||||
|
|
|
@ -11,11 +11,11 @@ process MALT_RUN {
|
||||||
mode: params.publish_dir_mode,
|
mode: params.publish_dir_mode,
|
||||||
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:[:], publish_by_meta:[]) }
|
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:[:], publish_by_meta:[]) }
|
||||||
|
|
||||||
conda (params.enable_conda ? "bioconda::malt=0.5.2" : null)
|
conda (params.enable_conda ? "bioconda::malt=0.53" : null)
|
||||||
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||||
container "https://depot.galaxyproject.org/singularity/malt:0.5.2--0"
|
container "https://depot.galaxyproject.org/singularity/malt:0.53--hdfd78af_0"
|
||||||
} else {
|
} else {
|
||||||
container "quay.io/biocontainers/malt:0.5.2--0"
|
container "quay.io/biocontainers/malt:0.53--hdfd78af_0"
|
||||||
}
|
}
|
||||||
|
|
||||||
input:
|
input:
|
||||||
|
|
68
modules/maltextract/functions.nf
Normal file
68
modules/maltextract/functions.nf
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
//
|
||||||
|
// 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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
44
modules/maltextract/main.nf
Normal file
44
modules/maltextract/main.nf
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
// Import generic module functions
|
||||||
|
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||||
|
|
||||||
|
params.options = [:]
|
||||||
|
options = initOptions(params.options)
|
||||||
|
|
||||||
|
process MALTEXTRACT {
|
||||||
|
|
||||||
|
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::hops=0.35" : null)
|
||||||
|
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||||
|
container "https://depot.galaxyproject.org/singularity/hops:0.35--hdfd78af_1"
|
||||||
|
} else {
|
||||||
|
container "quay.io/biocontainers/hops:0.35--hdfd78af_1"
|
||||||
|
}
|
||||||
|
|
||||||
|
input:
|
||||||
|
path rma6
|
||||||
|
path taxon_list
|
||||||
|
path ncbi_dir
|
||||||
|
|
||||||
|
output:
|
||||||
|
path "results" , emit: results
|
||||||
|
path "*.version.txt", emit: version
|
||||||
|
|
||||||
|
script:
|
||||||
|
def software = getSoftwareName(task.process)
|
||||||
|
"""
|
||||||
|
MaltExtract \\
|
||||||
|
-Xmx${task.memory.toGiga()}g \\
|
||||||
|
-p $task.cpus \\
|
||||||
|
-i ${rma6.join(' ')} \\
|
||||||
|
-t $taxon_list \\
|
||||||
|
-r $ncbi_dir \\
|
||||||
|
-o results/ \\
|
||||||
|
$options.args
|
||||||
|
|
||||||
|
echo \$(MaltExtract --help | head -n 2 | tail -n 1) | sed 's/MaltExtract version//' > ${software}.version.txt
|
||||||
|
"""
|
||||||
|
}
|
51
modules/maltextract/meta.yml
Normal file
51
modules/maltextract/meta.yml
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
name: maltextract
|
||||||
|
description: Tool for evaluation of MALT results for true positives of ancient metagenomic taxonomic screening
|
||||||
|
keywords:
|
||||||
|
- malt
|
||||||
|
- MaltExtract
|
||||||
|
- HOPS
|
||||||
|
- alignment
|
||||||
|
- metagenomics
|
||||||
|
- ancient DNA
|
||||||
|
- aDNA
|
||||||
|
- palaeogenomics
|
||||||
|
- archaeogenomics
|
||||||
|
- microbiome
|
||||||
|
- authentication
|
||||||
|
- damage
|
||||||
|
- edit distance
|
||||||
|
tools:
|
||||||
|
- maltextract:
|
||||||
|
description: Java tool to work with ancient metagenomics
|
||||||
|
homepage: https://github.com/rhuebler/hops
|
||||||
|
documentation: https://github.com/rhuebler/hops
|
||||||
|
tool_dev_url: https://github.com/rhuebler/hops
|
||||||
|
doi: "https://doi.org/10.1186/s13059-019-1903-0"
|
||||||
|
licence: ['GPL 3']
|
||||||
|
|
||||||
|
input:
|
||||||
|
- rma6:
|
||||||
|
type: file
|
||||||
|
description: RMA6 files from MALT
|
||||||
|
pattern: "*.rma6"
|
||||||
|
- taxon_list:
|
||||||
|
type: file
|
||||||
|
description: List of target taxa to evaluate
|
||||||
|
pattern: "*.txt"
|
||||||
|
- ncbi_dir:
|
||||||
|
type: directory
|
||||||
|
description: Directory containing NCBI taxonomy map and tre files
|
||||||
|
pattern: "${ncbi_dir}/"
|
||||||
|
|
||||||
|
output:
|
||||||
|
- version:
|
||||||
|
type: file
|
||||||
|
description: File containing software version
|
||||||
|
pattern: "*.{version.txt}"
|
||||||
|
- results:
|
||||||
|
type: directory
|
||||||
|
description: Directory containing MaltExtract text results files
|
||||||
|
pattern: "*.rma6"
|
||||||
|
|
||||||
|
authors:
|
||||||
|
- "@jfy133"
|
|
@ -11,11 +11,11 @@ process PANGOLIN {
|
||||||
mode: params.publish_dir_mode,
|
mode: params.publish_dir_mode,
|
||||||
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
|
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
|
||||||
|
|
||||||
conda (params.enable_conda ? 'bioconda::pangolin=3.1.7' : null)
|
conda (params.enable_conda ? 'bioconda::pangolin=3.1.11' : null)
|
||||||
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||||
container 'https://depot.galaxyproject.org/singularity/pangolin:3.1.7--pyhdfd78af_0'
|
container 'https://depot.galaxyproject.org/singularity/pangolin:3.1.11--pyhdfd78af_1'
|
||||||
} else {
|
} else {
|
||||||
container 'quay.io/biocontainers/pangolin:3.1.7--pyhdfd78af_0'
|
container 'quay.io/biocontainers/pangolin:3.1.11--pyhdfd78af_1'
|
||||||
}
|
}
|
||||||
|
|
||||||
input:
|
input:
|
||||||
|
|
68
modules/pbccs/functions.nf
Normal file
68
modules/pbccs/functions.nf
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
//
|
||||||
|
// 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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
54
modules/pbccs/main.nf
Normal file
54
modules/pbccs/main.nf
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
// Import generic module functions
|
||||||
|
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||||
|
|
||||||
|
params.options = [:]
|
||||||
|
options = initOptions(params.options)
|
||||||
|
|
||||||
|
process PBCCS {
|
||||||
|
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::pbccs=6.0.0" : null)
|
||||||
|
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||||
|
container "https://depot.galaxyproject.org/singularity/pbccs:6.0.0--h9ee0642_2"
|
||||||
|
} else {
|
||||||
|
container "quay.io/biocontainers/pbccs:6.0.0--h9ee0642_2"
|
||||||
|
}
|
||||||
|
|
||||||
|
input:
|
||||||
|
tuple val(meta), path(bam), path(pbi)
|
||||||
|
val chunk_num
|
||||||
|
val chunk_on
|
||||||
|
|
||||||
|
output:
|
||||||
|
tuple val(meta), path("*.ccs.bam") , emit: bam
|
||||||
|
tuple val(meta), path("*.ccs.bam.pbi") , emit: pbi
|
||||||
|
tuple val(meta), path("*.ccs_report.txt" ) , emit: ccs_report_txt
|
||||||
|
tuple val(meta), path("*.ccs_report.json" ) , emit: ccs_report_json
|
||||||
|
tuple val(meta), path("*.zmw_metrics.json.gz"), emit: zmw_metrics
|
||||||
|
tuple val(meta), path("*.version.txt" ) , emit: version
|
||||||
|
|
||||||
|
script:
|
||||||
|
def software = getSoftwareName(task.process)
|
||||||
|
// def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||||
|
def ccs = bam.toString().replaceAll(/bam$/, '') + chunk_num + '.ccs.bam'
|
||||||
|
def report_txt = bam.toString().replaceAll(/bam$/, '') + chunk_num + '.ccs_report.txt'
|
||||||
|
def report_json = bam.toString().replaceAll(/bam$/, '') + chunk_num + '.ccs_report.json'
|
||||||
|
def zmw_metrics = bam.toString().replaceAll(/bam$/, '') + chunk_num + '.zmw_metrics.json.gz'
|
||||||
|
"""
|
||||||
|
ccs \\
|
||||||
|
$bam \\
|
||||||
|
$ccs \\
|
||||||
|
--report-file $report_txt \\
|
||||||
|
--report-json $report_json \\
|
||||||
|
--metrics-json $zmw_metrics \\
|
||||||
|
--chunk $chunk_num/$chunk_on \\
|
||||||
|
-j $task.cpus \\
|
||||||
|
$options.args
|
||||||
|
|
||||||
|
echo \$(ccs --version 2>&1) | grep -e 'commit' > ${software}.version.txt
|
||||||
|
"""
|
||||||
|
}
|
51
modules/pbccs/meta.yml
Normal file
51
modules/pbccs/meta.yml
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
name: pbccs
|
||||||
|
description: Pacbio ccs - Generate Higly Accurate Single-Molecule Consensus Reads
|
||||||
|
keywords:
|
||||||
|
- ccs
|
||||||
|
tools:
|
||||||
|
- pbccs:
|
||||||
|
description: pbccs - Generate Highly Accurate Single-Molecule Consensus Reads (HiFi Reads)
|
||||||
|
homepage: https://github.com/PacificBiosciences/pbbioconda
|
||||||
|
documentation: https://ccs.how/
|
||||||
|
tool_dev_url: https://github.com/PacificBiosciences/ccs
|
||||||
|
doi: ""
|
||||||
|
licence: ['BSD-3-clause-Clear']
|
||||||
|
|
||||||
|
input:
|
||||||
|
- meta:
|
||||||
|
type: map
|
||||||
|
description: |
|
||||||
|
Groovy Map containing sample information
|
||||||
|
e.g. [ id:'test', single_end:false ]
|
||||||
|
- bam:
|
||||||
|
type: file
|
||||||
|
description: Raw subreads bam
|
||||||
|
pattern: "*.subreads.bam"
|
||||||
|
- pbi:
|
||||||
|
type: file
|
||||||
|
description: Pacbio BAM Index
|
||||||
|
pattern: "*.pbi"
|
||||||
|
- chunk_num:
|
||||||
|
-type: integer
|
||||||
|
-description: BAM part to process
|
||||||
|
- chunk_on:
|
||||||
|
-type: integer
|
||||||
|
-description: Total number of bam parts to process
|
||||||
|
|
||||||
|
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: "*.{version.txt}"
|
||||||
|
- css:
|
||||||
|
type: file
|
||||||
|
description: Consensus sequences
|
||||||
|
pattern: "*.ccs.bam"
|
||||||
|
|
||||||
|
authors:
|
||||||
|
- "@sguizard"
|
|
@ -23,6 +23,7 @@ process PICARD_MARKDUPLICATES {
|
||||||
|
|
||||||
output:
|
output:
|
||||||
tuple val(meta), path("*.bam") , emit: bam
|
tuple val(meta), path("*.bam") , emit: bam
|
||||||
|
tuple val(meta), path("*.bai") , optional:true, emit: bai
|
||||||
tuple val(meta), path("*.metrics.txt"), emit: metrics
|
tuple val(meta), path("*.metrics.txt"), emit: metrics
|
||||||
path "*.version.txt" , emit: version
|
path "*.version.txt" , emit: version
|
||||||
|
|
||||||
|
@ -40,9 +41,9 @@ process PICARD_MARKDUPLICATES {
|
||||||
-Xmx${avail_mem}g \\
|
-Xmx${avail_mem}g \\
|
||||||
MarkDuplicates \\
|
MarkDuplicates \\
|
||||||
$options.args \\
|
$options.args \\
|
||||||
INPUT=$bam \\
|
-I $bam \\
|
||||||
OUTPUT=${prefix}.bam \\
|
-O ${prefix}.bam \\
|
||||||
METRICS_FILE=${prefix}.MarkDuplicates.metrics.txt
|
-M ${prefix}.MarkDuplicates.metrics.txt
|
||||||
|
|
||||||
echo \$(picard MarkDuplicates --version 2>&1) | grep -o 'Version:.*' | cut -f2- -d: > ${software}.version.txt
|
echo \$(picard MarkDuplicates --version 2>&1) | grep -o 'Version:.*' | cut -f2- -d: > ${software}.version.txt
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -1,46 +1,51 @@
|
||||||
name: picard_markduplicates
|
name: picard_markduplicates
|
||||||
description: Locate and tag duplicate reads in a BAM file
|
description: Locate and tag duplicate reads in a BAM file
|
||||||
keywords:
|
keywords:
|
||||||
- markduplicates
|
- markduplicates
|
||||||
- pcr
|
- pcr
|
||||||
- duplicates
|
- duplicates
|
||||||
- bam
|
- bam
|
||||||
- sam
|
- sam
|
||||||
- cram
|
- cram
|
||||||
tools:
|
tools:
|
||||||
- picard:
|
- picard:
|
||||||
description: |
|
description: |
|
||||||
A set of command line tools (in Java) for manipulating high-throughput sequencing (HTS)
|
A set of command line tools (in Java) for manipulating high-throughput sequencing (HTS)
|
||||||
data and formats such as SAM/BAM/CRAM and VCF.
|
data and formats such as SAM/BAM/CRAM and VCF.
|
||||||
homepage: https://broadinstitute.github.io/picard/
|
homepage: https://broadinstitute.github.io/picard/
|
||||||
documentation: https://broadinstitute.github.io/picard/
|
documentation: https://broadinstitute.github.io/picard/
|
||||||
input:
|
input:
|
||||||
- meta:
|
- meta:
|
||||||
type: map
|
type: map
|
||||||
description: |
|
description: |
|
||||||
Groovy Map containing sample information
|
Groovy Map containing sample information
|
||||||
e.g. [ id:'test', single_end:false ]
|
e.g. [ id:'test', single_end:false ]
|
||||||
- bam:
|
- bam:
|
||||||
type: file
|
type: file
|
||||||
description: BAM file
|
description: BAM file
|
||||||
pattern: "*.{bam}"
|
pattern: "*.{bam}"
|
||||||
output:
|
output:
|
||||||
- meta:
|
- meta:
|
||||||
type: map
|
type: map
|
||||||
description: |
|
description: |
|
||||||
Groovy Map containing sample information
|
Groovy Map containing sample information
|
||||||
e.g. [ id:'test', single_end:false ]
|
e.g. [ id:'test', single_end:false ]
|
||||||
- bam:
|
- bam:
|
||||||
type: file
|
type: file
|
||||||
description: BAM file with duplicate reads marked/removed
|
description: BAM file with duplicate reads marked/removed
|
||||||
pattern: "*.{bam}"
|
pattern: "*.{bam}"
|
||||||
- metrics:
|
- bai:
|
||||||
type: file
|
type: file
|
||||||
description: Duplicate metrics file generated by picard
|
description: An optional BAM index file. If desired, --CREATE_INDEX must be passed as a flag
|
||||||
pattern: "*.{metrics.txt}"
|
pattern: "*.{bai}"
|
||||||
- version:
|
- metrics:
|
||||||
type: file
|
type: file
|
||||||
description: File containing software version
|
description: Duplicate metrics file generated by picard
|
||||||
pattern: "*.{version.txt}"
|
pattern: "*.{metrics.txt}"
|
||||||
|
- version:
|
||||||
|
type: file
|
||||||
|
description: File containing software version
|
||||||
|
pattern: "*.{version.txt}"
|
||||||
authors:
|
authors:
|
||||||
- "@drpatelh"
|
- "@drpatelh"
|
||||||
|
- "@projectoriented"
|
||||||
|
|
68
modules/plink/vcf/functions.nf
Normal file
68
modules/plink/vcf/functions.nf
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
//
|
||||||
|
// 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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
44
modules/plink/vcf/main.nf
Normal file
44
modules/plink/vcf/main.nf
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
// Import generic module functions
|
||||||
|
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||||
|
|
||||||
|
params.options = [:]
|
||||||
|
options = initOptions(params.options)
|
||||||
|
|
||||||
|
process PLINK_VCF {
|
||||||
|
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::plink=1.90b6.21" : null)
|
||||||
|
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||||
|
container "https://depot.galaxyproject.org/singularity/plink:1.90b6.21--h779adbc_1"
|
||||||
|
} else {
|
||||||
|
container "quay.io/biocontainers/plink:1.90b6.21--h779adbc_1"
|
||||||
|
}
|
||||||
|
|
||||||
|
input:
|
||||||
|
tuple val(meta), path(vcf)
|
||||||
|
|
||||||
|
output:
|
||||||
|
tuple val(meta), path("*.bed"), emit: bed, optional: true
|
||||||
|
tuple val(meta), path("*.bim"), emit: bim, optional: true
|
||||||
|
tuple val(meta), path("*.fam"), emit: fam, optional: true
|
||||||
|
|
||||||
|
path "*.version.txt", emit: version
|
||||||
|
|
||||||
|
script:
|
||||||
|
def software = getSoftwareName(task.process)
|
||||||
|
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||||
|
|
||||||
|
"""
|
||||||
|
plink \\
|
||||||
|
--vcf ${vcf} \\
|
||||||
|
$options.args \\
|
||||||
|
--threads $task.cpus \\
|
||||||
|
--out ${prefix}
|
||||||
|
|
||||||
|
echo \$(plink --version 2>&1) | sed 's/^PLINK //' | sed 's/..-bit.*//'> ${software}.version.txt
|
||||||
|
"""
|
||||||
|
}
|
53
modules/plink/vcf/meta.yml
Normal file
53
modules/plink/vcf/meta.yml
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
name: plink_vcf
|
||||||
|
description: Analyses variant calling files using plink
|
||||||
|
keywords:
|
||||||
|
- plink
|
||||||
|
- vcf
|
||||||
|
tools:
|
||||||
|
- plink:
|
||||||
|
description: |
|
||||||
|
Whole genome association analysis toolset, designed to perform a range
|
||||||
|
of basic, large-scale analyses in a computationally efficient manner
|
||||||
|
homepage: "https://www.cog-genomics.org/plink"
|
||||||
|
documentation: None
|
||||||
|
tool_dev_url: "https://www.cog-genomics.org/plink/1.9/dev"
|
||||||
|
doi: ""
|
||||||
|
licence: ['GPL']
|
||||||
|
|
||||||
|
input:
|
||||||
|
- meta:
|
||||||
|
type: map
|
||||||
|
description: |
|
||||||
|
Groovy Map containing sample information
|
||||||
|
e.g. [ id:'test', single_end:false ]
|
||||||
|
- vcf:
|
||||||
|
type: file
|
||||||
|
description: Variant calling file (vcf)
|
||||||
|
pattern: "*.{vcf}"
|
||||||
|
|
||||||
|
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: "*.{version.txt}"
|
||||||
|
- bed:
|
||||||
|
type: file
|
||||||
|
description: PLINK binary biallelic genotype table
|
||||||
|
pattern: "*.{bed}"
|
||||||
|
- bim:
|
||||||
|
type: file
|
||||||
|
description: PLINK extended MAP file
|
||||||
|
pattern: "*.{bim}"
|
||||||
|
- fam:
|
||||||
|
type: file
|
||||||
|
description: PLINK sample information file
|
||||||
|
pattern: "*.{fam}"
|
||||||
|
|
||||||
|
authors:
|
||||||
|
- "@Mxrcon"
|
||||||
|
- "@abhi18av"
|
68
modules/pydamage/analyze/functions.nf
Normal file
68
modules/pydamage/analyze/functions.nf
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
//
|
||||||
|
// 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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
40
modules/pydamage/analyze/main.nf
Normal file
40
modules/pydamage/analyze/main.nf
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
// Import generic module functions
|
||||||
|
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||||
|
|
||||||
|
params.options = [:]
|
||||||
|
options = initOptions(params.options)
|
||||||
|
|
||||||
|
process PYDAMAGE_ANALYZE {
|
||||||
|
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::pydamage=0.62" : null)
|
||||||
|
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||||
|
container "https://depot.galaxyproject.org/singularity/pydamage:0.62--pyhdfd78af_0"
|
||||||
|
} else {
|
||||||
|
container "quay.io/biocontainers/pydamage:0.62--pyhdfd78af_0"
|
||||||
|
}
|
||||||
|
|
||||||
|
input:
|
||||||
|
tuple val(meta), path(bam), path(bai)
|
||||||
|
|
||||||
|
output:
|
||||||
|
tuple val(meta), path("pydamage_results/pydamage_results.csv"), emit: csv
|
||||||
|
path "*.version.txt" , emit: version
|
||||||
|
|
||||||
|
script:
|
||||||
|
def software = getSoftwareName(task.process)
|
||||||
|
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||||
|
"""
|
||||||
|
pydamage \\
|
||||||
|
analyze \\
|
||||||
|
$options.args \\
|
||||||
|
-p $task.cpus \\
|
||||||
|
$bam
|
||||||
|
|
||||||
|
echo \$(pydamage --version 2>&1) | sed -e 's/pydamage, version //g' > ${software}.version.txt
|
||||||
|
"""
|
||||||
|
}
|
55
modules/pydamage/analyze/meta.yml
Normal file
55
modules/pydamage/analyze/meta.yml
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
name: pydamage_analyze
|
||||||
|
description: Damage parameter estimation for ancient DNA
|
||||||
|
keywords:
|
||||||
|
- ancient DNA
|
||||||
|
- aDNA
|
||||||
|
- de novo assembly
|
||||||
|
- filtering
|
||||||
|
- damage
|
||||||
|
- deamination
|
||||||
|
- miscoding lesions
|
||||||
|
- C to T
|
||||||
|
- palaeogenomics
|
||||||
|
- archaeogenomics
|
||||||
|
- palaeogenetics
|
||||||
|
- archaeogenetics
|
||||||
|
tools:
|
||||||
|
- pydamage:
|
||||||
|
description: Damage parameter estimation for ancient DNA
|
||||||
|
homepage: https://github.com/maxibor/pydamage
|
||||||
|
documentation: https://pydamage.readthedocs.io/
|
||||||
|
tool_dev_url: https://github.com/maxibor/pydamage
|
||||||
|
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/SAM file
|
||||||
|
pattern: "*.{bam,cram,sam}"
|
||||||
|
- bai:
|
||||||
|
type: file
|
||||||
|
description: BAM/CRAM/SAM index file
|
||||||
|
pattern: "*.{bai,crai,sai}"
|
||||||
|
|
||||||
|
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: "*.{version.txt}"
|
||||||
|
- csv:
|
||||||
|
type: file
|
||||||
|
description: PyDamage results as csv files
|
||||||
|
pattern: "*.csv"
|
||||||
|
|
||||||
|
authors:
|
||||||
|
- "@maxibor"
|
68
modules/pydamage/filter/functions.nf
Normal file
68
modules/pydamage/filter/functions.nf
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
//
|
||||||
|
// 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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
40
modules/pydamage/filter/main.nf
Normal file
40
modules/pydamage/filter/main.nf
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
// Import generic module functions
|
||||||
|
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||||
|
|
||||||
|
params.options = [:]
|
||||||
|
options = initOptions(params.options)
|
||||||
|
|
||||||
|
process PYDAMAGE_FILTER {
|
||||||
|
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::pydamage=0.62" : null)
|
||||||
|
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||||
|
container "https://depot.galaxyproject.org/singularity/pydamage:0.62--pyhdfd78af_0"
|
||||||
|
} else {
|
||||||
|
container "quay.io/biocontainers/pydamage:0.62--pyhdfd78af_0"
|
||||||
|
}
|
||||||
|
|
||||||
|
input:
|
||||||
|
tuple val(meta), path(csv)
|
||||||
|
|
||||||
|
output:
|
||||||
|
tuple val(meta), path("pydamage_results/pydamage_filtered_results.csv"), emit: csv
|
||||||
|
path "*.version.txt" , emit: version
|
||||||
|
|
||||||
|
script:
|
||||||
|
def software = getSoftwareName(task.process)
|
||||||
|
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||||
|
"""
|
||||||
|
|
||||||
|
pydamage \\
|
||||||
|
filter \\
|
||||||
|
$options.args \\
|
||||||
|
$csv
|
||||||
|
|
||||||
|
echo \$(pydamage --version 2>&1) | sed -e 's/pydamage, version //g' > ${software}.version.txt
|
||||||
|
"""
|
||||||
|
}
|
51
modules/pydamage/filter/meta.yml
Normal file
51
modules/pydamage/filter/meta.yml
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
name: pydamage_filter
|
||||||
|
description: Damage parameter estimation for ancient DNA
|
||||||
|
keywords:
|
||||||
|
- ancient DNA
|
||||||
|
- aDNA
|
||||||
|
- de novo assembly
|
||||||
|
- filtering
|
||||||
|
- damage
|
||||||
|
- deamination
|
||||||
|
- miscoding lesions
|
||||||
|
- C to T
|
||||||
|
- palaeogenomics
|
||||||
|
- archaeogenomics
|
||||||
|
- palaeogenetics
|
||||||
|
- archaeogenetics
|
||||||
|
tools:
|
||||||
|
- pydamage:
|
||||||
|
description: Damage parameter estimation for ancient DNA
|
||||||
|
homepage: https://github.com/maxibor/pydamage
|
||||||
|
documentation: https://pydamage.readthedocs.io/
|
||||||
|
tool_dev_url: https://github.com/maxibor/pydamage
|
||||||
|
licence: ['GPL v3']
|
||||||
|
|
||||||
|
input:
|
||||||
|
- meta:
|
||||||
|
type: map
|
||||||
|
description: |
|
||||||
|
Groovy Map containing sample information
|
||||||
|
e.g. [ id:'test', single_end:false ]
|
||||||
|
- csv:
|
||||||
|
type: file
|
||||||
|
description: csv file from pydamage analyze
|
||||||
|
pattern: "*.csv"
|
||||||
|
|
||||||
|
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: "*.{version.txt}"
|
||||||
|
- csv:
|
||||||
|
type: file
|
||||||
|
description: PyDamage filtered results as csv file
|
||||||
|
pattern: "*.csv"
|
||||||
|
|
||||||
|
authors:
|
||||||
|
- "@maxibor"
|
|
@ -3,7 +3,7 @@ include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||||
params.options = [:]
|
params.options = [:]
|
||||||
options = initOptions(params.options)
|
options = initOptions(params.options)
|
||||||
|
|
||||||
def VERSION = '0.4.1'
|
def VERSION = '0.7.1'
|
||||||
|
|
||||||
process SEQWISH_INDUCE {
|
process SEQWISH_INDUCE {
|
||||||
tag "$meta.id"
|
tag "$meta.id"
|
||||||
|
|
|
@ -36,7 +36,7 @@ output:
|
||||||
e.g. [ id:'test', single_end:false ]
|
e.g. [ id:'test', single_end:false ]
|
||||||
- gfa:
|
- gfa:
|
||||||
type: file
|
type: file
|
||||||
description: Variation graph in GFA1 format
|
description: Variation graph in GFA 1.0 format
|
||||||
pattern: "*.{gfa}"
|
pattern: "*.{gfa}"
|
||||||
- version:
|
- version:
|
||||||
type: file
|
type: file
|
||||||
|
|
68
modules/snpdists/functions.nf
Normal file
68
modules/snpdists/functions.nf
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
//
|
||||||
|
// 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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
38
modules/snpdists/main.nf
Normal file
38
modules/snpdists/main.nf
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
// Import generic module functions
|
||||||
|
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||||
|
|
||||||
|
params.options = [:]
|
||||||
|
options = initOptions(params.options)
|
||||||
|
|
||||||
|
process SNPDISTS {
|
||||||
|
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::snp-dists=0.8.2" : null)
|
||||||
|
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||||
|
container "https://depot.galaxyproject.org/singularity/snp-dists:0.8.2--h5bf99c6_0"
|
||||||
|
} else {
|
||||||
|
container "quay.io/biocontainers/snp-dists:0.8.2--h5bf99c6_0"
|
||||||
|
}
|
||||||
|
|
||||||
|
input:
|
||||||
|
tuple val(meta), path(alignment)
|
||||||
|
|
||||||
|
output:
|
||||||
|
tuple val(meta), path("*.tsv"), emit: tsv
|
||||||
|
path "*.version.txt" , emit: version
|
||||||
|
|
||||||
|
script:
|
||||||
|
def software = getSoftwareName(task.process)
|
||||||
|
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||||
|
"""
|
||||||
|
snp-dists \\
|
||||||
|
$options.args \\
|
||||||
|
$alignment > ${prefix}.tsv
|
||||||
|
|
||||||
|
echo \$(snp-dists -v 2>&1) | sed 's/snp-dists //;' > ${software}.version.txt
|
||||||
|
"""
|
||||||
|
}
|
41
modules/snpdists/meta.yml
Normal file
41
modules/snpdists/meta.yml
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
name: snpdists
|
||||||
|
description: Pairwise SNP distance matrix from a FASTA sequence alignment
|
||||||
|
keywords:
|
||||||
|
- snp-dists
|
||||||
|
- distance-matrix
|
||||||
|
tools:
|
||||||
|
- snpdists:
|
||||||
|
description: Convert a FASTA alignment to SNP distance matrix
|
||||||
|
homepage: https://github.com/tseemann/snp-dists
|
||||||
|
documentation: https://github.com/tseemann/snp-dists
|
||||||
|
tool_dev_url: https://github.com/tseemann/snp-dists
|
||||||
|
doi: ""
|
||||||
|
licence: ['GPL v3']
|
||||||
|
|
||||||
|
input:
|
||||||
|
- meta:
|
||||||
|
type: map
|
||||||
|
description: |
|
||||||
|
Groovy Map containing sample information
|
||||||
|
e.g. [ id:'test', single_end:false ]
|
||||||
|
- alignment:
|
||||||
|
type: file
|
||||||
|
description: The input FASTA sequence alignment file
|
||||||
|
pattern: "*.{fasta,fasta.gz}"
|
||||||
|
|
||||||
|
output:
|
||||||
|
- meta:
|
||||||
|
type: map
|
||||||
|
description: |
|
||||||
|
Groovy Map containing sample information
|
||||||
|
e.g. [ id:'test', single_end:false ]
|
||||||
|
- tsv:
|
||||||
|
type: file
|
||||||
|
description: The output TSV file containing SNP distance matrix
|
||||||
|
pattern: "*.tsv"
|
||||||
|
- version:
|
||||||
|
type: file
|
||||||
|
description: File containing software version
|
||||||
|
pattern: "*.{version.txt}"
|
||||||
|
authors:
|
||||||
|
- "@abhi18av"
|
68
modules/staphopiasccmec/functions.nf
Normal file
68
modules/staphopiasccmec/functions.nf
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
//
|
||||||
|
// 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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
36
modules/staphopiasccmec/main.nf
Normal file
36
modules/staphopiasccmec/main.nf
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
// Import generic module functions
|
||||||
|
include { initOptions; saveFiles; getSoftwareName } from './functions'
|
||||||
|
|
||||||
|
params.options = [:]
|
||||||
|
options = initOptions(params.options)
|
||||||
|
|
||||||
|
process STAPHOPIASCCMEC {
|
||||||
|
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::staphopia-sccmec=1.0.0" : null)
|
||||||
|
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
||||||
|
container "https://depot.galaxyproject.org/singularity/staphopia-sccmec:1.0.0--hdfd78af_0"
|
||||||
|
} else {
|
||||||
|
container "quay.io/biocontainers/staphopia-sccmec:1.0.0--hdfd78af_0"
|
||||||
|
}
|
||||||
|
|
||||||
|
input:
|
||||||
|
tuple val(meta), path(fasta)
|
||||||
|
|
||||||
|
output:
|
||||||
|
tuple val(meta), path("*.tsv"), emit: tsv
|
||||||
|
path "*.version.txt" , emit: version
|
||||||
|
|
||||||
|
script:
|
||||||
|
def software = getSoftwareName(task.process)
|
||||||
|
def prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
|
||||||
|
"""
|
||||||
|
staphopia-sccmec --assembly $fasta $options.args > ${prefix}.tsv
|
||||||
|
|
||||||
|
echo \$(staphopia-sccmec --version 2>&1) | sed 's/^.*staphopia-sccmec //' > ${software}.version.txt
|
||||||
|
"""
|
||||||
|
}
|
44
modules/staphopiasccmec/meta.yml
Normal file
44
modules/staphopiasccmec/meta.yml
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
name: staphopiasccmec
|
||||||
|
description: Predicts Staphylococcus aureus SCCmec type based on primers.
|
||||||
|
keywords:
|
||||||
|
- amr
|
||||||
|
- fasta
|
||||||
|
- sccmec
|
||||||
|
|
||||||
|
tools:
|
||||||
|
- staphopiasccmec:
|
||||||
|
description: Predicts Staphylococcus aureus SCCmec type based on primers.
|
||||||
|
homepage: https://staphopia.emory.edu
|
||||||
|
documentation: https://github.com/staphopia/staphopia-sccmec
|
||||||
|
tool_dev_url: https://github.com/staphopia/staphopia-sccmec
|
||||||
|
doi: https://doi.org/10.7717/peerj.5261
|
||||||
|
licence: ['MIT']
|
||||||
|
|
||||||
|
input:
|
||||||
|
- meta:
|
||||||
|
type: map
|
||||||
|
description: |
|
||||||
|
Groovy Map containing sample information
|
||||||
|
e.g. [ id:'test', single_end:false ]
|
||||||
|
- fasta:
|
||||||
|
type: file
|
||||||
|
description: FASTA assembly file
|
||||||
|
pattern: "*.{fasta,fasta.gz,fa,fa.gz,fna,fna.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: "*.{version.txt}"
|
||||||
|
- tsv:
|
||||||
|
type: file
|
||||||
|
description: Tab-delimited results
|
||||||
|
pattern: "*.{tsv}"
|
||||||
|
|
||||||
|
authors:
|
||||||
|
- "@rpetit3"
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue