Show allowed option choices for a plugin parameter

Hi all,

I am in the process of adding a couple of IQ-TREE methods to q2-phylogeny. See here. IQ-TREE allows upwards of 286 DNA substitution models. I would like to allow the user to specify any one of these, and provide an error message if the option they enter is not available / supported. It does not make sense to show all of these as a set of choices when calling --help. I want something like --show-importable-types for the qiime tools import command.

I am having trouble figuring out how to handle this for the iqtree plugin, as I could not quite follow what was going on in similar cases, e.g. the qiime tools import code. Is there another example that I missed? Other advice?

Here is a screen shot of qiime phylogeny iqtree --help


Thanks in advance!

1 Like

Hey there @SoilRotifer!

I imagine you are talking about this list, right?

Import that list in your and wire it in as a Choices parameter, like this!

This will handle the validation, so if a user specifies "peanut-the-dog" as a choice, they will be alerted as to their error! :peanuts: :dog:

Did I misunderstand your question? Let us know how it goes! Thanks! :t_rex: :qiime2:


Yes sir, it is. I've moved the list to

When I do that, I get this ugly mess:

Is there a way to limit the list of Choices shown to only the first few, or not show them at all? I am looking for a way to set-up a flag like --show-substitution-models, which would work analogously to the --show-importable-types command I referred to earlier. This way the user is not bombarded with all the text each time they call --help. :slight_smile:

Hopefully, this helps clarify my question.


:laughing: - I see what you mean!

That ugly mess is q2cli’s problem (see this open issue). I would say go for it as-is now, this really shouldn’t be your problem to fix, but rather something the q2cli should do better in the future. Remember, other interfaces consume those choices as well, so I wouldn’t advise circumventing this for the case of the CLI.

Sorry, I wish I had a better answer for you! :jack_o_lantern: