Skip to content

Commit

Permalink
Merge pull request #435 from BU-ISCIII/cutadapt
Browse files Browse the repository at this point in the history
Changed Cutadapt to use nf-core modules
  • Loading branch information
maxulysse authored Oct 25, 2024
2 parents e1eb311 + e963569 commit 402fad8
Show file tree
Hide file tree
Showing 18 changed files with 399 additions and 59 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ jobs:
- "--skip_plasmidid false --skip_asciigenome"
- "--additional_annotation ./GCA_009858895.3_ASM985889v3_genomic.gtf.gz"
- "--bowtie2_index ./GCA_009858895.3_ASM985889v3_genomic.200409.bt2.index.tar.gz"
- "--skip_noninternal_primers --threeprime_adapters"
isMaster:
- ${{ github.base_ref == 'master' }}
# Exclude conda and singularity on dev
Expand Down
28 changes: 16 additions & 12 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,23 @@ Thank you to everyone else that has contributed by reporting bugs, enhancements
- [[PR #434](https://github.com/nf-core/viralrecon/pull/434)] - Add blast result filtering through `min_contig_length` and `min_perc_contig_aligned`.
- [[PR #438](https://github.com/nf-core/viralrecon/pull/438)] - Update fastp container to 0.23.4
- [[PR #439](https://github.com/nf-core/viralrecon/pull/439)] - Fix cardinality issue when using `--bowtie2_index`
- [[PR #435](https://github.com/nf-core/viralrecon/pull/435)] - Changed to a patched cutadapt from nf-core modules, added `skip_noninternal_primers` param to allow users to process primers inside the pipeline, and added `threeprime_adapters` to determine whether primers are 3' or 5' adapters.

### 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` |
| | `--threeprime_adapters` |

> **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 @@ -53,9 +56,10 @@ 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 |

> **NB:** Dependency has been **updated** if both old and new version information is present.
>
Expand Down
9 changes: 8 additions & 1 deletion conf/modules_illumina.config
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,14 @@ 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.prefix = { "${meta.id}.primer_trim" }
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`
- Set `--threeprime_adapters` to `true`
- 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.
- Set `--threeprime_adapters` to `true`
- **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": "666652151335353eef2fcd58880bcef5bc2928e1",
"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
"""
}
46 changes: 46 additions & 0 deletions modules/nf-core/cutadapt/cutadapt.diff

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

5 changes: 5 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.

66 changes: 66 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.

58 changes: 58 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.

Loading

0 comments on commit 402fad8

Please sign in to comment.