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

Add alternative trimmer: AdapterRemoval #285

Merged
merged 6 commits into from
Mar 24, 2022
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
strategy:
matrix:
# Run remaining test profiles with minimum nextflow version
profile: [test_host_rm, test_hybrid, test_hybrid_host_rm, test_busco_auto, test_ancient_dna]
profile: [test_host_rm, test_hybrid, test_hybrid_host_rm, test_busco_auto, test_ancient_dna, test_adapterremoval]
steps:
- name: Check out pipeline code
uses: actions/checkout@v2
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [#263](https://github.com/nf-core/mag/pull/263) - Restructure binning subworkflow in preparation for aDNA workflow and extended binning
- [#247](https://github.com/nf-core/mag/pull/247) - Add ancient DNA subworkflow
- [#263](https://github.com/nf-core/mag/pull/263) - Add MaxBin2 as second contig binning tool
- [#264](https://github.com/nf-core/mag/pull/265) - Add AdapterRemoval2 as an alternative read trimmer
jfy133 marked this conversation as resolved.
Show resolved Hide resolved

### `Changed`

Expand Down
5 changes: 5 additions & 0 deletions assets/multiqc_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ top_modules:
name: 'FastQC: raw reads'
path_filters_exclude:
- '*trimmed*'
- 'fastp'
- 'adapterRemoval':
- custom_content
- 'fastqc':
name: 'FastQC: after preprocessing'
Expand All @@ -42,6 +44,9 @@ custom_data:
sp:
host_removal:
fn: 'host_removal_metrics.tsv'
adapterRemoval:
fn: '*_ar2_*.log'

extra_fn_clean_exts:
- '.bowtie2'
- '_ar2'
33 changes: 32 additions & 1 deletion conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ process {
"-q ${params.fastp_qualified_quality}",
"--cut_front",
"--cut_tail",
"--cut_mean_quality ${params.fastp_cut_mean_quality}"
"--cut_mean_quality ${params.fastp_cut_mean_quality}",
"--length_required ${params.reads_minlength} "
jfy133 marked this conversation as resolved.
Show resolved Hide resolved
].join(' ').trim()
publishDir = [
path: { "${params.outdir}/QC_shortreads/fastp/${meta.id}" },
Expand All @@ -43,6 +44,36 @@ process {
]
}

withName: ADAPTERREMOVAL_PE {
ext.args = [
"--minlength ${params.reads_minlength}",
"--adapter1 ${params.adapterremoval_adapter1} --adapter2 ${params.adapterremoval_adapter2}",
"--minquality ${params.adapterremoval_minquality} --trimns",
params.adapterremoval_trim_quality_stretch ? "--trim_qualities" : "--trimwindows 4"
].join(' ').trim()
publishDir = [
path: { "${params.outdir}/QC_shortreads/adapterremoval/${meta.id}" },
mode: 'copy',
pattern: "*.{log}"
]
ext.prefix = { "${meta.id}_ar2" }
}

withName: ADAPTERREMOVAL_SE {
ext.args = [
"--minlength ${params.reads_minlength}",
"--adapter1 ${params.adapterremoval_adapter1}",
"--minquality ${params.adapterremoval_minquality} --trimns",
params.adapterremoval_trim_quality_stretch ? "--trim_qualities" : "--trimwindows 4"
].join(' ').trim()
publishDir = [
path: { "${params.outdir}/QC_shortreads/adapterremoval/${meta.id}" },
mode: 'copy',
pattern: "*.{log}"
]
ext.prefix = { "${meta.id}_ar2" }
}

withName: BOWTIE2_PHIX_REMOVAL_ALIGN {
ext.suffix = "phix_removed"
publishDir = [
Expand Down
32 changes: 32 additions & 0 deletions conf/test_adapterremoval.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
========================================================================================
Nextflow config file for running minimal tests
========================================================================================
Defines input files and everything required to run a fast and simple pipeline test.

Use as follows:
nextflow run nf-core/mag -profile test,<docker/singularity>

----------------------------------------------------------------------------------------
*/

params {
config_profile_name = 'Test profile for running with AdapterRemoval'
config_profile_description = 'Minimal test dataset to check pipeline function with AdapterRemoval data'

// Limit resources so that this can run on GitHub Actions
max_cpus = 2
max_memory = '6.GB'
max_time = '6.h'

// Input data
input = 'https://raw.githubusercontent.com/nf-core/test-datasets/mag/samplesheets/samplesheet.csv'
centrifuge_db = "https://raw.githubusercontent.com/nf-core/test-datasets/mag/test_data/minigut_cf.tar.gz"
kraken2_db = "https://raw.githubusercontent.com/nf-core/test-datasets/mag/test_data/minigut_kraken.tgz"
skip_krona = true
min_length_unbinned_contigs = 1
max_unbinned_contigs = 2
busco_reference = "https://busco-data.ezlab.org/v5/data/lineages/bacteria_odb10.2020-03-06.tar.gz"
gtdb = false
clip_tool = 'adapterremoval'
}
14 changes: 14 additions & 0 deletions docs/output.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,20 @@ FastQC is run for visualising the general quality metrics of the sequencing runs

</details>

### AdapterRemoval2

[fastp](https://github.com/OpenGene/fastp) is a all-in-one fastq preprocessor for read/adapter trimming and quality control. It is used in this pipeline for trimming adapter sequences and discard low-quality reads. Its output is in the results folder and part of the MultiQC report.
jfy133 marked this conversation as resolved.
Show resolved Hide resolved

[AdapterRemoval](https://adapterremoval.readthedocs.io/en/stable/) searches for and removes remnant adapter sequences from High-Throughput Sequencing (HTS) data and (optionally) trims low quality bases from the 3' end of reads following adapter removal. It is popular in the field of palaeogenomics. The output logs are stored in the results folder, and as a part of the MultiQC report.

<details markdown="1">
<summary>Output files</summary>

* `QC_shortreads/adapterremoval/[sample]/`
* `[sample]_ar2.log`: AdapterRemoval log file (normally called `.settings` by AdapterRemoval.)

</details>

### Remove PhiX sequences from short reads

The pipeline uses bowtie2 to map the reads against PhiX and removes mapped reads.
Expand Down
3 changes: 3 additions & 0 deletions modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
"homePage": "https://github.com/nf-core/mag",
"repos": {
"nf-core/modules": {
"adapterremoval": {
"git_sha": "f0800157544a82ae222931764483331a81812012"
},
"bcftools/consensus": {
"git_sha": "20d8250d9f39ddb05dfb437603aaf99b5c0b2b41"
},
Expand Down
8 changes: 4 additions & 4 deletions modules/local/multiqc.nf
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
process MULTIQC {
label 'process_medium'

conda (params.enable_conda ? "bioconda::multiqc=1.11" : null)
conda (params.enable_conda ? "bioconda::multiqc=1.12" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/multiqc:1.11--pyhdfd78af_0' :
'quay.io/biocontainers/multiqc:1.11--pyhdfd78af_0' }"
'https://depot.galaxyproject.org/singularity/multiqc:1.12--pyhdfd78af_0' :
'quay.io/biocontainers/multiqc:1.12--pyhdfd78af_0' }"

input:
path multiqc_files
path mqc_custom_config
path 'fastqc_raw/*'
path 'fastp/*'
path 'fastqc_trimmed/*'
path host_removal
path 'quast*/*'
path 'bowtie2log/*'
path short_summary
path additional

output:
path "*multiqc_report.html", emit: report
Expand Down
70 changes: 70 additions & 0 deletions modules/nf-core/modules/adapterremoval/main.nf

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

90 changes: 90 additions & 0 deletions modules/nf-core/modules/adapterremoval/meta.yml

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

14 changes: 11 additions & 3 deletions nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,17 @@ params {
single_end = false

// short read preprocessing options
save_trimmed_fail = false
clip_tool = 'fastp'
reads_minlength = 15
fastp_save_trimmed_fail = false
fastp_qualified_quality = 15
fastp_cut_mean_quality = 15
adapterremoval_minquality = 2
adapterremoval_adapter1 = 'AGATCGGAAGAGCACACGTCTGAACTCCAGTCACNNNNNNATCTCGTATGCCGTCTTCTGCTTG'
adapterremoval_adapter2 = 'AGATCGGAAGAGCGTCGTGTAGGGAAAGAGTGTAGATCTCGGTGGTCGCCGTATCATT'
adapterremoval_trim_quality_stretch = false
keep_phix = false
// phix_reference = "ftp://ftp.ncbi.nlm.nih.gov/genomes/genbank/viral/Enterobacteria_phage_phiX174_sensu_lato/all_assembly_versions/GCA_002596845.1_ASM259684v1/GCA_002596845.1_ASM259684v1_genomic.fna.gz"
// phix_reference = "ftp://ftp.ncbi.nlm.nih.gov/genomes/genbank/viral/Enterobacteria_phage_phiX174_sensu_lato/all_assembly_versions/GCA_002596845.1_ASM259684v1/GCA_002596845.1_ASM259684v1_genomic.fna.gz"
phix_reference = "${baseDir}/assets/data/GCA_002596845.1_ASM259684v1_genomic.fna.gz"
host_fasta = null
host_genome = null
Expand Down Expand Up @@ -196,7 +202,9 @@ profiles {
test_hybrid_host_rm { includeConfig 'conf/test_hybrid_host_rm.config' }
test_busco_auto { includeConfig 'conf/test_busco_auto.config' }
test_full { includeConfig 'conf/test_full.config' }
test_ancient_dna { includeConfig 'conf/test_ancient_dna.config' }
test_ancient_dna { includeConfig 'conf/test_ancient_dna.config' }
test_adapterremoval { includeConfig 'conf/test_adapterremoval.config' }

}

// Load igenomes.config if required
Expand Down
Loading