Skip to content

Commit

Permalink
Added an option to skip filtering hits from the same species
Browse files Browse the repository at this point in the history
  • Loading branch information
muffato committed Aug 22, 2024
1 parent 70f961c commit e9d3a64
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 21 deletions.
11 changes: 7 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,16 @@ The pipeline has now been validated for draft (unpublished) assemblies.
automatically selecting based on the taxonomy.
- All parameters are now passed the regular Nextflow way. There is no support
for the original Yaml configuration files of the Snakemake version.
- New option `--skip_taxon_filtering` to skip the taxon filtering in blast searches.
Mostly relevant for draft assemblies.

### Parameters

| Old parameter | New parameter |
| ------------- | ---------------- |
| --yaml | |
| | --busco_lineages |
| Old parameter | New parameter |
| ------------- | ---------------------- |
| --yaml | |
| | --busco_lineages |
| | --skip_taxon_filtering |

> **NB:** Parameter has been **updated** if both old and new parameter information is present. </br> **NB:** Parameter has been **added** if just the new parameter information is present. </br> **NB:** Parameter has been **removed** if new parameter information isn't present.
Expand Down
1 change: 1 addition & 0 deletions nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ params {
blastp = null
blastx = null
blastn = null
skip_taxon_filtering = false

// MultiQC options
multiqc_config = null
Expand Down
5 changes: 5 additions & 0 deletions nextflow_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@
"description": "Turn on optional genome masking if needed.",
"fa_icon": "fas fa-toggle-off"
},
"skip_taxon_filtering": {
"type": "boolean",
"description": "Skip filtering out hits from the same species in blast* searches.",
"fa_icon": "fas fa-toggle-off"
},
"fetchngs_samplesheet": {
"type": "boolean",
"description": "Turn on the conversion from a nf-core/fetchngs samplesheet.",
Expand Down
3 changes: 2 additions & 1 deletion subworkflows/local/input_check.nf
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,10 @@ workflow INPUT_CHECK {


//
// Get the taxon ID
// Get the taxon ID if we do taxon filtering in blast* searches
//
ch_parsed_csv.taxon_id
| map { params.skip_taxon_filtering ? '' : it }
| first
| set { ch_taxon_id }

Expand Down
46 changes: 30 additions & 16 deletions subworkflows/local/run_blastn.nf
Original file line number Diff line number Diff line change
Expand Up @@ -47,23 +47,37 @@ workflow RUN_BLASTN {
| set { ch_chunks }

// Run blastn search
// run blastn excluding taxon_id
BLASTN_TAXON ( ch_chunks, blastn, taxon_id )
ch_versions = ch_versions.mix ( BLASTN_TAXON.out.versions.first() )

// check if blastn output table is empty
BLASTN_TAXON.out.txt
| branch { meta, txt ->
empty: txt.isEmpty()
not_empty: true
}
| set { ch_blastn_taxon_out }
if (params.skip_taxon_filtering) {

// skip BLASTN_TAXON
ch_blast_blastn_input = ch_chunks

// fake ch_blastn_taxon_out.not_empty
ch_blastn_taxon_out = [
not_empty: Channel.empty()
]

} else {

// repeat the blastn search without excluding taxon_id
ch_blastn_taxon_out.empty
| join ( ch_chunks )
| map { meta, txt, fasta -> [meta, fasta] }
| set { ch_blast_blastn_input }
// run blastn excluding taxon_id
BLASTN_TAXON ( ch_chunks, blastn, taxon_id )
ch_versions = ch_versions.mix ( BLASTN_TAXON.out.versions.first() )

// check if blastn output table is empty
BLASTN_TAXON.out.txt
| branch { meta, txt ->
empty: txt.isEmpty()
not_empty: true
}
| set { ch_blastn_taxon_out }

// repeat the blastn search without excluding taxon_id
ch_blastn_taxon_out.empty
| join ( ch_chunks )
| map { meta, txt, fasta -> [meta, fasta] }
| set { ch_blast_blastn_input }

}

BLAST_BLASTN ( ch_blast_blastn_input, blastn, [] )
ch_versions = ch_versions.mix ( BLAST_BLASTN.out.versions.first() )
Expand Down

0 comments on commit e9d3a64

Please sign in to comment.