Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAINT: add threads/jobs primitives #87

Merged
merged 2 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading