Skip to content

Commit

Permalink
Skip blastn if there are no chunks
Browse files Browse the repository at this point in the history
The filter in SEQTK_SUBSEQ is not sufficient because some BLOBTOOLKIT_CHUNK further excludes masked regions
  • Loading branch information
muffato committed Aug 15, 2024
1 parent 1c0bf53 commit e1ef451
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions subworkflows/local/run_blastn.nf
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,14 @@ workflow RUN_BLASTN {
BLOBTOOLKIT_CHUNK ( SEQTK_SUBSEQ.out.sequences, [[],[]] )
ch_versions = ch_versions.mix ( BLOBTOOLKIT_CHUNK.out.versions.first() )

// Check that there are still sequences left after chunking (which excludes masked regions)
BLOBTOOLKIT_CHUNK.out.chunks
| filter { it[1].size() > 0 }
| set { ch_chunks }

// Run blastn search
// run blastn excluding taxon_id
BLASTN_TAXON ( BLOBTOOLKIT_CHUNK.out.chunks, blastn, 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
Expand All @@ -56,7 +60,8 @@ workflow RUN_BLASTN {
| set { ch_blastn_taxon_out }

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

Expand Down

0 comments on commit e1ef451

Please sign in to comment.