1
0
Fork 0
mirror of https://github.com/MillironX/taxprofiler.git synced 2024-09-21 04:22:04 +00:00

Fix adapterremoval adapter conflict and add optional adapter list file

This commit is contained in:
James A. Fellows Yates 2022-10-27 12:17:19 +00:00
parent 63c260bfbc
commit 76a662ecc5
8 changed files with 69 additions and 24 deletions

View file

@ -100,8 +100,7 @@ process {
withName: ADAPTERREMOVAL_SINGLE { withName: ADAPTERREMOVAL_SINGLE {
ext.args = [ ext.args = [
// trimming options // trimming options
params.shortread_qc_skipadaptertrim ? "--adapter1 '' --adapter2 ''" : "", params.shortread_qc_skipadaptertrim ? "--adapter1 ''" : params.shortread_qc_adapterlist ? "" : params.shortread_qc_adapter1 ? "--adapter1 ${params.shortread_qc_adapter1}" : "",
params.shortread_qc_adapter1 ? "--adapter1 ${params.shortread_qc_adapter1}" : "",
// filtering options // filtering options
"--minlength ${params.shortread_qc_minlength}" "--minlength ${params.shortread_qc_minlength}"
].join(' ').trim() ].join(' ').trim()
@ -119,9 +118,8 @@ process {
// collapsing options // collapsing options
params.shortread_qc_mergepairs ? "--collapse" : "", params.shortread_qc_mergepairs ? "--collapse" : "",
// trimming options // trimming options
params.shortread_qc_skipadaptertrim ? "--adapter1 '' --adapter2 ''" : "", params.shortread_qc_skipadaptertrim ? "--adapter1 ''" : params.shortread_qc_adapterlist ? "" : params.shortread_qc_adapter1 ? "--adapter1 ${params.shortread_qc_adapter1}" : "", // adding adapter list happens at module input channel level
params.shortread_qc_adapter1 ? "--adapter1 ${params.shortread_qc_adapter1}" : "", params.shortread_qc_skipadaptertrim ? "--adapter2 ''" : params.shortread_qc_adapterlist ? "" : params.shortread_qc_adapter2 ? "--adapter2 ${params.shortread_qc_adapter2}" : "",
params.shortread_qc_adapter2 ? "--adapter2 ${params.shortread_qc_adapter2}" : "",
// filtering options // filtering options
"--minlength ${params.shortread_qc_minlength}" "--minlength ${params.shortread_qc_minlength}"
].join(' ').trim() ].join(' ').trim()

View file

@ -7,7 +7,7 @@
"nf-core": { "nf-core": {
"adapterremoval": { "adapterremoval": {
"branch": "master", "branch": "master",
"git_sha": "5e34754d42cd2d5d248ca8673c0a53cdf5624905" "git_sha": "ce7cf27e377fdacf7ebe8e75903ec70405ea1659"
}, },
"bbmap/bbduk": { "bbmap/bbduk": {
"branch": "master", "branch": "master",

View file

@ -34,7 +34,7 @@ process ADAPTERREMOVAL {
AdapterRemoval \\ AdapterRemoval \\
--file1 $reads \\ --file1 $reads \\
$args \\ $args \\
$adapterlist \\ $list \\
--basename ${prefix} \\ --basename ${prefix} \\
--threads ${task.cpus} \\ --threads ${task.cpus} \\
--seed 42 \\ --seed 42 \\
@ -61,7 +61,7 @@ process ADAPTERREMOVAL {
--file1 ${reads[0]} \\ --file1 ${reads[0]} \\
--file2 ${reads[1]} \\ --file2 ${reads[1]} \\
$args \\ $args \\
$adapterlist \\ $list \\
--basename ${prefix} \\ --basename ${prefix} \\
--threads $task.cpus \\ --threads $task.cpus \\
--seed 42 \\ --seed 42 \\

View file

@ -59,9 +59,9 @@ params {
// Databases // Databases
databases = null databases = null
// FASTQ preprocessing
preprocessing_qc_tool = 'fastqc' preprocessing_qc_tool = 'fastqc'
// FASTQ preprocessing
perform_shortread_qc = false perform_shortread_qc = false
shortread_qc_tool = 'fastp' shortread_qc_tool = 'fastp'
shortread_qc_skipadaptertrim = false shortread_qc_skipadaptertrim = false
@ -69,6 +69,7 @@ params {
shortread_qc_excludeunmerged = false shortread_qc_excludeunmerged = false
shortread_qc_adapter1 = null shortread_qc_adapter1 = null
shortread_qc_adapter2 = null shortread_qc_adapter2 = null
shortread_qc_adapterlist = null // TODO Add for FASTP
shortread_qc_minlength = 15 shortread_qc_minlength = 15
perform_longread_qc = false perform_longread_qc = false

View file

@ -10,7 +10,11 @@
"type": "object", "type": "object",
"fa_icon": "fas fa-terminal", "fa_icon": "fas fa-terminal",
"description": "Define where the pipeline should find input data and save output data.", "description": "Define where the pipeline should find input data and save output data.",
"required": ["input", "outdir", "databases"], "required": [
"input",
"databases",
"outdir"
],
"properties": { "properties": {
"input": { "input": {
"type": "string", "type": "string",
@ -80,7 +84,10 @@
"shortread_qc_tool": { "shortread_qc_tool": {
"type": "string", "type": "string",
"default": "fastp", "default": "fastp",
"enum": ["fastp", "adapterremoval"], "enum": [
"fastp",
"adapterremoval"
],
"fa_icon": "fas fa-tools", "fa_icon": "fas fa-tools",
"description": "Specify which tool to use for short-read QC" "description": "Specify which tool to use for short-read QC"
}, },
@ -104,6 +111,12 @@
"description": "Specify adapter 2 nucleotide sequence", "description": "Specify adapter 2 nucleotide sequence",
"help_text": "Specify a custom reverse or R2 adapter sequence to be removed from reads. \n\nIf not set, the selected short-read QC tool's defaults will be used.\n\n> Modifies tool parameter(s):\n> - fastp: `--adapter_sequence`. fastp default: `AGATCGGAAGAGCGTCGTGTAGGGAAAGAGTGT`\n> - AdapterRemoval: `--adapter1`. AdapteRemoval2 default: `AGATCGGAAGAGCGTCGTGTAGGGAAAGAGTGTAGATCTCGGTGGTCGCCGTATCATT`" "help_text": "Specify a custom reverse or R2 adapter sequence to be removed from reads. \n\nIf not set, the selected short-read QC tool's defaults will be used.\n\n> Modifies tool parameter(s):\n> - fastp: `--adapter_sequence`. fastp default: `AGATCGGAAGAGCGTCGTGTAGGGAAAGAGTGT`\n> - AdapterRemoval: `--adapter1`. AdapteRemoval2 default: `AGATCGGAAGAGCGTCGTGTAGGGAAAGAGTGTAGATCTCGGTGGTCGCCGTATCATT`"
}, },
"shortread_qc_adapterlist": {
"type": "string",
"default": "None",
"fa_icon": "fas fa-list-ul",
"help_text": "This affects AdapterRemoval. It will replace default adapters or whatever is supplied in `--shortread_qc_adapter{1,2}`.\n\nThis allows you to mix libraries built with different adapters into one run.\n\n> Modifies tool parameter(s):\n> - AdapterRemoval: `--adapter-list`."
},
"shortread_qc_mergepairs": { "shortread_qc_mergepairs": {
"type": "boolean", "type": "boolean",
"fa_icon": "fas fa-toggle-on", "fa_icon": "fas fa-toggle-on",
@ -133,7 +146,11 @@
"shortread_complexityfilter_tool": { "shortread_complexityfilter_tool": {
"type": "string", "type": "string",
"default": "bbduk", "default": "bbduk",
"enum": ["bbduk", "prinseqplusplus", "fastp"], "enum": [
"bbduk",
"prinseqplusplus",
"fastp"
],
"fa_icon": "fas fa-hammer", "fa_icon": "fas fa-hammer",
"description": "Specify which tool to use for complexity filtering" "description": "Specify which tool to use for complexity filtering"
}, },
@ -167,7 +184,10 @@
"shortread_complexityfilter_prinseqplusplus_mode": { "shortread_complexityfilter_prinseqplusplus_mode": {
"type": "string", "type": "string",
"default": "entropy", "default": "entropy",
"enum": ["entropy", "dust"], "enum": [
"entropy",
"dust"
],
"fa_icon": "fas fa-check-square", "fa_icon": "fas fa-check-square",
"description": "Specify the complexity filter mode for PRINSEQ++" "description": "Specify the complexity filter mode for PRINSEQ++"
}, },
@ -341,7 +361,15 @@
"diamond_output_format": { "diamond_output_format": {
"type": "string", "type": "string",
"default": "tsv", "default": "tsv",
"enum": ["blast", "xml", "txt", "daa", "sam", "tsv", "paf"], "enum": [
"blast",
"xml",
"txt",
"daa",
"sam",
"tsv",
"paf"
],
"fa_icon": "fas fa-file", "fa_icon": "fas fa-file",
"description": "Specify output format from DIAMOND profiling.", "description": "Specify output format from DIAMOND profiling.",
"help_text": "DIAMOND can produce output in a number of different formats, you can specify here which to produce.\n\nNote that DIAMOND can only produce one format at a time, and depending on which you pick, some downstream steps may not be executed. For example, selecting `daa` or `sam` will mean you will not get a tabular taxonomic profile as with the other tools.\n\nWill be overriden by `--diamond_save_reads.`\n\n> Modifies tool parameter(s):\n> - diamond blastx: `--outfmt`" "help_text": "DIAMOND can produce output in a number of different formats, you can specify here which to produce.\n\nNote that DIAMOND can only produce one format at a time, and depending on which you pick, some downstream steps may not be executed. For example, selecting `daa` or `sam` will mean you will not get a tabular taxonomic profile as with the other tools.\n\nWill be overriden by `--diamond_save_reads.`\n\n> Modifies tool parameter(s):\n> - diamond blastx: `--outfmt`"
@ -360,7 +388,14 @@
"kaiju_taxon_rank": { "kaiju_taxon_rank": {
"type": "string", "type": "string",
"default": "species", "default": "species",
"enum": ["phylum", "class", "order", "family", "genus", "species"], "enum": [
"phylum",
"class",
"order",
"family",
"genus",
"species"
],
"fa_icon": "fas fa-tag", "fa_icon": "fas fa-tag",
"description": "Specify taxonomic rank to be displayed in Kaiju taxon table", "description": "Specify taxonomic rank to be displayed in Kaiju taxon table",
"help_text": "Specify the taxonomic level(s) to be displayed in the resulting Kaiju taxon table, as generated by the kaiju2table helper tool.\n\nThis can be either a single level (e.g. `species`), or a comma separated list to display the full taxonomic path (e.g. `superkingdom,phylum,class,order,family,genus,species.`).\n\n> Modifies tool parameter(s):\n> - kaiju2table: `-l`" "help_text": "Specify the taxonomic level(s) to be displayed in the resulting Kaiju taxon table, as generated by the kaiju2table helper tool.\n\nThis can be either a single level (e.g. `species`), or a comma separated list to display the full taxonomic path (e.g. `superkingdom,phylum,class,order,family,genus,species.`).\n\n> Modifies tool parameter(s):\n> - kaiju2table: `-l`"
@ -555,7 +590,14 @@
"description": "Method used to save pipeline results to output directory.", "description": "Method used to save pipeline results to output directory.",
"help_text": "The Nextflow `publishDir` option specifies which intermediate files should be saved to the output directory. This option tells the pipeline what method should be used to move these files. See [Nextflow docs](https://www.nextflow.io/docs/latest/process.html#publishdir) for details.", "help_text": "The Nextflow `publishDir` option specifies which intermediate files should be saved to the output directory. This option tells the pipeline what method should be used to move these files. See [Nextflow docs](https://www.nextflow.io/docs/latest/process.html#publishdir) for details.",
"fa_icon": "fas fa-copy", "fa_icon": "fas fa-copy",
"enum": ["symlink", "rellink", "link", "copy", "copyNoFollow", "move"], "enum": [
"symlink",
"rellink",
"link",
"copy",
"copyNoFollow",
"move"
],
"hidden": true "hidden": true
}, },
"email_on_fail": { "email_on_fail": {
@ -711,10 +753,7 @@
"properties": { "properties": {
"preprocessing_qc_tool": { "preprocessing_qc_tool": {
"type": "string", "type": "string",
"default": "fastqc", "default": "fastqc"
"enum": ["fastqc", "falco"],
"help_text": "Falco is designed as a drop-in replacement for FastQC but written in C++ for faster computation. We particularly recommend using falco when using long reads (due to reduced memory constraints), however is also applicable for short reads.",
"description": "Specify the tool used for quality control of raw sequencing reads"
} }
} }
} }

View file

@ -10,6 +10,7 @@ workflow SHORTREAD_ADAPTERREMOVAL {
take: take:
reads // [[meta], [reads]] reads // [[meta], [reads]]
adapterlist // file
main: main:
ch_versions = Channel.empty() ch_versions = Channel.empty()
@ -21,8 +22,8 @@ workflow SHORTREAD_ADAPTERREMOVAL {
paired: !it[0].single_end paired: !it[0].single_end
} }
ADAPTERREMOVAL_SINGLE ( ch_input_for_adapterremoval.single, [] ) ADAPTERREMOVAL_SINGLE ( ch_input_for_adapterremoval.single, adapterlist )
ADAPTERREMOVAL_PAIRED ( ch_input_for_adapterremoval.paired, [] ) ADAPTERREMOVAL_PAIRED ( ch_input_for_adapterremoval.paired, adapterlist )
/* /*
* Due to the ~slightly~ very ugly output implementation of the current AdapterRemoval2 version, each file * Due to the ~slightly~ very ugly output implementation of the current AdapterRemoval2 version, each file

View file

@ -11,6 +11,7 @@ include { FALCO as FALCO_PROCESSED } from '../../modules/nf-core/falco/main'
workflow SHORTREAD_PREPROCESSING { workflow SHORTREAD_PREPROCESSING {
take: take:
reads // [ [ meta ], [ reads ] ] reads // [ [ meta ], [ reads ] ]
adapterlist // file
main: main:
ch_versions = Channel.empty() ch_versions = Channel.empty()

View file

@ -12,7 +12,8 @@ WorkflowTaxprofiler.initialise(params, log)
// TODO nf-core: Add all file path parameters for the pipeline to the list below // TODO nf-core: Add all file path parameters for the pipeline to the list below
// Check input path parameters to see if they exist // Check input path parameters to see if they exist
def checkPathParamList = [ params.input, params.databases, params.hostremoval_reference, def checkPathParamList = [ params.input, params.databases, params.hostremoval_reference,
params.shortread_hostremoval_index, params.multiqc_config params.shortread_hostremoval_index, params.multiqc_config,
params.shortread_qc_adapterlist
] ]
for (param in checkPathParamList) { if (param) { file(param, checkIfExists: true) } } for (param in checkPathParamList) { if (param) { file(param, checkIfExists: true) } }
@ -102,6 +103,7 @@ workflow TAXPROFILER {
ch_versions = Channel.empty() ch_versions = Channel.empty()
ch_multiqc_logo= Channel.fromPath("$projectDir/docs/images/nf-core-taxprofiler_logo_custom_light.png") ch_multiqc_logo= Channel.fromPath("$projectDir/docs/images/nf-core-taxprofiler_logo_custom_light.png")
ch_adapterlist_for_shortreadqc = params.shortread_qc_adapterlist ? file(params.shortread_qc_adapterlist) : []
/* /*
SUBWORKFLOW: Read in samplesheet, validate and stage input files SUBWORKFLOW: Read in samplesheet, validate and stage input files
@ -131,8 +133,11 @@ workflow TAXPROFILER {
/* /*
SUBWORKFLOW: PERFORM PREPROCESSING SUBWORKFLOW: PERFORM PREPROCESSING
*/ */
ch_adapterlist_for_shortreadqc
if ( params.perform_shortread_qc ) { if ( params.perform_shortread_qc ) {
ch_shortreads_preprocessed = SHORTREAD_PREPROCESSING ( INPUT_CHECK.out.fastq ).reads ch_shortreads_preprocessed = SHORTREAD_PREPROCESSING ( INPUT_CHECK.out.fastq, ch_adapterlist_for_shortreadqc ).reads
ch_versions = ch_versions.mix( SHORTREAD_PREPROCESSING.out.versions ) ch_versions = ch_versions.mix( SHORTREAD_PREPROCESSING.out.versions )
} else { } else {
ch_shortreads_preprocessed = INPUT_CHECK.out.fastq ch_shortreads_preprocessed = INPUT_CHECK.out.fastq