Plugin dev: Importing function vs ideal name of function & creating sub commands

Ok, these are kind of nit picky but I just want to make sure I keep this development clean as I go.

So in ghost-tree we use "ghost-tree scaffold hybrid-tree" as the full command to build the hybrid gene tree. So I want "qiime ghost-tree scaffold hybrid-tree" in the end.

Question 1: How would I create a "subcommand" or nested command in a QIIME 2 plugin? Whereas "ghost-tree scaffold" doesn't do anything but we wanted to keep "scaffold" it there as a placeholder AND to keep things similar to ghost-tree. So it should be "qiime ghost-tree scaffold hybrid-tree."

Question 2: In ghost-tree the name of the function is called "extensions_onto_foundation" but we made the actual command you use "hybrid-tree". With the way the plugin development works, it uses "extensions-onto-foundation" as the name of the command when you register it but I'd like it to be called "hybrid-tree". Is there an option to change this? We made the command different from the function name for a reason (can't remember why now, but that's why I'm not just changing the function name.) I'd like to keep the plugin as similar to the code in ghost-tree and not just start renaming everything.

Thanks!!

Hey @Jennifer_Fouquier!

This isn’t currently possible. We’ve talked about permitting grouping, but I think we then came up with the idea of using “category tags” instead. But even that doesn’t really help your use-case here, so it’s pretty much up in the air. As for what to do right now, I would recommend just grouping it as part of the name: scaffold_hybrid_tree.

So the plugin system just uses the function name that is registered. If you’d like a different name I would recommend just wrapping the functionality in a new function with the name that you want (you have the opportunity to rename parameters if you do this as well).

3 Likes