Skip to content

Commit

Permalink
Detect thread counts on -j0 and ensure use of less threads than que…
Browse files Browse the repository at this point in the history
…ry blocks
  • Loading branch information
althonos committed Dec 12, 2024
1 parent 8737685 commit e69be7d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions orthoani/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,11 @@ def _hits(
) -> List[BlastRow]:
"""Compute the hits from ``query`` to ``reference``."""

if threads > len(query):
threads = len(query)
if threads == 0:
threads = os.cpu_count() or 1

# initialize blast
blastn = pyncbitk.algo.BlastN(
evalue=1e-15,
Expand Down

0 comments on commit e69be7d

Please sign in to comment.