Skip to content

Commit

Permalink
refactor: Increase parameterization in preprocess and host-removal (#31)
Browse files Browse the repository at this point in the history
* refactor: Remove host check for preprocess

* feat: Add skip host removal

* feat: Add flag to skip preprocess

* refactor: Also skip fastx with skip preprocess

* fix: Remove repeated line

* docs: Add host removal to schema
  • Loading branch information
jvfe authored Mar 24, 2024
1 parent 9d85097 commit fc6877c
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 16 deletions.
1 change: 1 addition & 0 deletions docs/params.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Choose to skip pipeline steps
| `skip_classification` | Skip taxonomic classification | `boolean` | | | |
| `skip_alignment` | Skip alignment | `boolean` | | | |
| `skip_functional` | Skip functional annotation | `boolean` | | | |
| `skip_host_removal` | Skip host removal | `boolean` | | | |

## Decontamination

Expand Down
1 change: 1 addition & 0 deletions nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ params {
maximum_evalue = 0.0001

// Skips
skip_host_removal = false
skip_classification = false
skip_functional = false
skip_alignment = false
Expand Down
29 changes: 24 additions & 5 deletions nextflow_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
"type": "object",
"fa_icon": "fas fa-terminal",
"description": "Define where the pipeline should find input data and save output data.",
"required": ["input", "outdir"],
"required": [
"input",
"outdir"
],
"properties": {
"input": {
"type": "string",
Expand Down Expand Up @@ -66,6 +69,11 @@
"type": "boolean",
"fa_icon": "fas fa-database",
"description": "Skip functional annotation"
},
"skip_host_removal": {
"type": "boolean",
"description": "Skip host removal",
"fa_icon": "fab fa-ioxhost"
}
},
"fa_icon": "fas fa-angle-double-right"
Expand Down Expand Up @@ -136,7 +144,9 @@
"description": "Run Kraken2 classifier"
}
},
"required": ["kaiju_db"],
"required": [
"kaiju_db"
],
"fa_icon": "fab fa-pagelines"
},
"functional": {
Expand Down Expand Up @@ -170,7 +180,9 @@
"description": "Maximum evalue of a match to be used for annotation"
}
},
"required": ["id_mapping"],
"required": [
"id_mapping"
],
"fa_icon": "fas fa-gavel"
},
"assembly": {
Expand Down Expand Up @@ -278,7 +290,14 @@
"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.",
"fa_icon": "fas fa-copy",
"enum": ["symlink", "rellink", "link", "copy", "copyNoFollow", "move"],
"enum": [
"symlink",
"rellink",
"link",
"copy",
"copyNoFollow",
"move"
],
"hidden": true
},
"email_on_fail": {
Expand Down Expand Up @@ -394,4 +413,4 @@
"$ref": "#/definitions/generic_options"
}
]
}
}
21 changes: 10 additions & 11 deletions workflows/euryale.nf
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ def multiqc_report = []

workflow EURYALE {
if (params.reference_fasta == null && params.diamond_db == null) { exit 1, 'A reference fasta (--reference_fasta) or a DIAMOND db (--diamond_db) must be specified' }
if (params.host_fasta == null && params.bowtie2_db == null) {exit 1, 'Either a host reference FASTA (--host_fasta) or a pre-built bowtie2 index (--bowtie2_db) must be specified'}
if (params.run_kaiju == true && params.kaiju_db == null) {exit 1, 'A Kaiju tar.gz database must be specified with --kaiju_db'}
if (params.run_kraken2 == true && params.kraken2_db == null) {exit 1, 'A Kraken2 database must be specified with --kraken2_db'}
if (params.host_fasta == null && params.bowtie2_db == null && params.skip_host_removal == false) {exit 1, 'Either a host reference FASTA (--host_fasta) or a pre-built bowtie2 index (--bowtie2_db) must be specified'}

ch_versions = Channel.empty()
ch_kraken_db = params.run_kraken2 ? file(params.kraken2_db) : []
Expand All @@ -96,19 +96,18 @@ workflow EURYALE {
ch_versions = ch_versions.mix(INPUT_CHECK.out.versions)
INPUT_CHECK.out.reads.set { reads }

PREPROCESS (
reads
)
ch_versions = ch_versions.mix(PREPROCESS.out.versions)
if (params.skip_preprocess) {
clean_reads = reads
} else {
PREPROCESS (
reads
)
ch_versions = ch_versions.mix(PREPROCESS.out.versions)

if (ch_host_reference) {
PREPROCESS.out.reads
.set { clean_reads }
} else {
PREPROCESS.out.merged_reads
.set { clean_reads }
ch_multiqc_files = ch_multiqc_files.mix(PREPROCESS.out.multiqc_files.collect())
}
ch_multiqc_files = ch_multiqc_files.mix(PREPROCESS.out.multiqc_files.collect())

if (ch_host_reference || ch_bowtie2_db) {
HOST_REMOVAL (
Expand All @@ -132,7 +131,7 @@ workflow EURYALE {
ch_versions = ch_versions.mix(ASSEMBLY.out.versions)
}

if (!params.assembly_based) {
if (!params.assembly_based && !params.skip_preprocess) {
GUNZIP (
clean_reads
)
Expand Down

0 comments on commit fc6877c

Please sign in to comment.