diff --git a/q2_fragment_insertion/_insertion.py b/q2_fragment_insertion/_insertion.py index 710164b..64347dc 100644 --- a/q2_fragment_insertion/_insertion.py +++ b/q2_fragment_insertion/_insertion.py @@ -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 @@ -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' diff --git a/q2_fragment_insertion/plugin_setup.py b/q2_fragment_insertion/plugin_setup.py index f88f694..21a04ab 100644 --- a/q2_fragment_insertion/plugin_setup.py +++ b/q2_fragment_insertion/plugin_setup.py @@ -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, @@ -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 '