Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed Cutadapt to use nf-core modules #435

Open
wants to merge 12 commits into
base: dev
Choose a base branch
from
28 changes: 16 additions & 12 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Thank you to everyone else that has contributed by reporting bugs, enhancements

### Enhancements & fixes

- [[#299](https://github.com/nf-core/viralrecon/issues/299)] - Add the freyja pipeline as a subworkflow
- [[PR #375](https://github.com/nf-core/viralrecon/pull/375)] - Add the freyja pipeline as a subworkflow
- [[PR #387](https://github.com/nf-core/viralrecon/pull/387)] - Software closes gracefully when encountering an error
- [[PR #395](https://github.com/nf-core/viralrecon/pull/395)] - Remove minia from default assemblers because it is unreliable
- [[PR #393](https://github.com/nf-core/viralrecon/pull/393)] - Changed primer set to params
Expand All @@ -26,21 +26,23 @@ Thank you to everyone else that has contributed by reporting bugs, enhancements
- [[PR #401](https://github.com/nf-core/viralrecon/pull/401)] - Added option to add a custom annotation
- [[PR #417](https://github.com/nf-core/viralrecon/pull/417)] - Allow skipping of Freyja bootstrapping module & freyja module update
- [[PR #434](https://github.com/nf-core/viralrecon/pull/434)] - Add blast result filtering through `min_contig_length` and `min_perc_contig_aligned`.
- [[PR #435](https://github.com/nf-core/viralrecon/pull/435)] - Changed cutadapt to use nf-core modules, added `skip_noninternal_primers` param to allow users to process primers inside the pipeline.
- [[PR #438](https://github.com/nf-core/viralrecon/pull/438)] - Update fastp container to 0.23.4

### Parameters

| Old parameter | New parameter |
| ------------- | --------------------------- |
| | `--skip_freyja` |
| | `--freyja_repeats` |
| | `--freyja_db_name` |
| | `--freyja_barcodes` |
| | `--freyja_lineages` |
| | `--skip_freyja_boot` |
| | `--additional_annotation` |
| | `--min_contig_length` |
| | `--min_perc_contig_aligned` |
| Old parameter | New parameter |
| ------------- | ---------------------------- |
| | `--skip_freyja` |
| | `--freyja_repeats` |
| | `--freyja_db_name` |
| | `--freyja_barcodes` |
| | `--freyja_lineages` |
| | `--skip_freyja_boot` |
| | `--additional_annotation` |
| | `--min_contig_length` |
| | `--min_perc_contig_aligned` |
| | `--skip_noninternal_primers` |

> **NB:** Parameter has been **updated** if both old and new parameter information is present.
> **NB:** Parameter has been **added** if just the new parameter information is present.
Expand All @@ -52,6 +54,8 @@ Note, since the pipeline is now using Nextflow DSL2, each process will be run wi

| Dependency | Old version | New version |
| ---------- | ----------- | ----------- |
| `cutadapt` | | 4.6 |
| `fastp` | 0.23.2 | 0.23.4 |
| `freyja` | | 1.5.0 |
| `multiqc` | 1.14 | 1.19 |
| `fastp` | 0.23.2 | 0.23.4 |
Expand Down
14 changes: 12 additions & 2 deletions conf/modules_illumina.config
Original file line number Diff line number Diff line change
Expand Up @@ -757,9 +757,19 @@ if (!params.skip_assembly) {
enabled: params.save_reference
]
}

withName: 'PREPARE_PRIMER_FASTA' {
ext.args = '^'
ext.prefix = { "${meta.id}"}
publishDir = [
path: { "${params.outdir}/assembly/cutadapt/log" },
enabled: false
]
}
withName: 'CUTADAPT' {
ext.args = '--overlap 5 --minimum-length 30 --error-rate 0.1'
ext.args = { [
"--overlap 5 --minimum-length 30 --error-rate 0.1",
"${meta.single_end}" == true ? "-g file:${meta.primers}" : "-g file:${meta.primers} -G file:${meta.primers}"
].join(' ').trim() }
ext.prefix = { "${meta.id}.primer_trim" }
publishDir = [
path: { "${params.outdir}/assembly/cutadapt/log" },
Expand Down
14 changes: 14 additions & 0 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,20 @@ To learn how to provide additional arguments to a particular tool of the pipelin

[Freyja](https://github.com/andersen-lab/Freyja) relies on a dataset of barcodes that use lineage defining mutations (see [UShER](https://usher-wiki.readthedocs.io/en/latest/#)). By default the most recent barcodes will be downloaded and used. However, if analyses need to be compared across multiple datasets, it might be of interest to re-use the same barcodes, or to rerun all Freyja analyses with the most recent dataset. To do this, specify the barcodes and lineages using the `--freyja_barcodes`, `--freyja_lineages` parameters, respectivly. The boostrapping of Freyja can be skipped by specifying `--skip_freyja_boot`.

### Cutadapt

According to [Cutadapt's documentation regarding adapter types](https://cutadapt.readthedocs.io/en/stable/guide.html#adapter-types), you can have:

- Regular 3’ adapter: `-a ADAPTER`
- Set `--skip_noninternal_primers` to `true`
- Change `modules_illumina.config` > `CUTADAPT` > `ext.args` to use `-a` instead of `-g`
- Regular 5’ adapter: `-g ADAPTER`
- Set `--skip_noninternal_primers` to `true`
- Non-internal 3’ adapter: `-a ADAPTERX`:
- Change `modules_illumina.config` > `PREPARE_PRIMER_FASTA` > `ext.args` to use `$` instead of `^` to add the X at the end of the sequence.
- Change `modules_illumina.config` > `CUTADAPT` > `ext.args` to use `-a` instead of `-g`
- Non-internal 5’ adapter: `-g XADAPTER`: This is the option by default.

### nf-core/configs

In most cases, you will only need to create a custom config as a one-off but if you and others within your organisation are likely to be running nf-core pipelines regularly and need to use the same settings regularly it may be a good idea to request that your custom config file is uploaded to the `nf-core/configs` git repository. Before you do this please can you test that the config file works with your pipeline of choice using the `-c` parameter. You can then create a pull request to the `nf-core/configs` repository with the addition of your config file, associated documentation file (see examples in [`nf-core/configs/docs`](https://github.com/nf-core/configs/tree/master/docs)), and amending [`nfcore_custom.config`](https://github.com/nf-core/configs/blob/master/nfcore_custom.config) to include your custom profile.
Expand Down
5 changes: 5 additions & 0 deletions modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@
"git_sha": "1b0ffa4e5aed5b7e3cd4311af31bd3b2c8345051",
"installed_by": ["modules"]
},
"cutadapt": {
"branch": "master",
"git_sha": "6618151ed69274863dc6fe6d2920afa90abaca1f",
"installed_by": ["modules"]
},
"fastp": {
"branch": "master",
"git_sha": "1ceaa8ba4d0fd886dbca0e545815d905b7407de7",
Expand Down
43 changes: 0 additions & 43 deletions modules/local/cutadapt.nf

This file was deleted.

30 changes: 30 additions & 0 deletions modules/local/prepare_primer_fasta.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
process PREPARE_PRIMER_FASTA {
tag "$adapters"
label 'process_low'

conda "conda-forge::sed=4.7"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/ubuntu:20.04' :
'nf-core/ubuntu:20.04' }"

input:
path adapters

output:
path 'adapters.sub.fa', emit: adapters

when:
task.ext.when == null || task.ext.when

script:
def args = task.ext.args ?: ''

"""
sed -r '/^[ACTGactg]+\$/ s/$args/X/g' $adapters > adapters.sub.fa

cat <<-END_VERSIONS > versions.yml
"${task.process}":
sed: \$(echo \$(sed --version 2>&1) | sed 's/^.*GNU sed) //; s/ .*\$//')
END_VERSIONS
"""
}
7 changes: 7 additions & 0 deletions modules/nf-core/cutadapt/environment.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 51 additions & 0 deletions modules/nf-core/cutadapt/main.nf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 49 additions & 0 deletions modules/nf-core/cutadapt/meta.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

69 changes: 69 additions & 0 deletions modules/nf-core/cutadapt/tests/main.nf.test

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading