Skip to content

Commit

Permalink
MAINT: add threads/jobs primitives (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
colinvwood authored Feb 13, 2024
1 parent 5dce83d commit 770044b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions q2_fragment_insertion/_insertion.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
DNAFASTAFormat,
DNAIterator)
from q2_types.tree import NewickFormat
from qiime2.plugin import get_available_cores

from q2_fragment_insertion._format import PlacementsFormat, SeppReferenceDirFmt

Expand Down Expand Up @@ -61,6 +62,9 @@ def sepp(representative_sequences: DNASequencesDirectoryFormat,
debug: bool = False,
) -> (NewickFormat, PlacementsFormat):

if threads == 0:
threads = get_available_cores()

placements = 'q2-fragment-insertion_placement.json'
tree = 'q2-fragment-insertion_placement.tog.relabelled.tre'

Expand Down
5 changes: 3 additions & 2 deletions q2_fragment_insertion/plugin_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
'reference_database': SeppReferenceDatabase,
},
parameters={
'threads': qiime2.plugin.Int,
'threads': qiime2.plugin.Threads,
'alignment_subset_size': qiime2.plugin.Int,
'placement_subset_size': qiime2.plugin.Int,
'debug': qiime2.plugin.Bool,
Expand All @@ -55,7 +55,8 @@
'representative sequences into.',
},
parameter_descriptions={
'threads': 'The number of threads to use.',
'threads': 'The number of threads to use. Pass 0 to use one per '
'available core.',
'alignment_subset_size': 'Each placement subset is further broken '
'into subsets of at most these many '
'sequences and a separate HMM is trained on '
Expand Down

0 comments on commit 770044b

Please sign in to comment.