Requiring another file if a different data type is given as plugin input

Hi there,

This is pretty ghost-tree related, but I am trying to make some overdue enhancements prior to finishing q2-ghost-tree, hence asking here.

Originally ghost-tree accepted an alignment file that contained taxonomy in the seq description as the foundation file. This was default for the DB we used, but I’m not even sure this is standard.

But now I added the option to use a phylogenetic tree as input and route accordingly using skbio’s sniffer (.nwk vs .fasta as foundation). Phylogenetic trees generally contain accession IDs and not taxonomy info, so I need to require users to provide both .nwk trees AND a foundation taxonomy file if they want to use the phylogenetic tree as a foundation. I should also allow the option to provide an alignment file that does not contain taxonomy in the .fasta file.

I couldn’t find anything in Click to help me with all this routing. Any pointers or best practice?

Thank you,


Hi @Jennifer_Fouquier! There aren’t any hard-and-fast rules here, but what I’d recommend is to provide two methods in q2-ghost-tree. The first method is what you have already, where the user provides an alignment FASTA file containing taxonomy info in the headers. The second method would support an alignment FASTA file (without taxonomy header info), a taxonomy file, and a phylogenetic tree – all three of the files would be required input. Would that work for what you’re wanting to accomplish?

You could also solely support the second method I described, since users will already have artifacts with the necessary semantic types and data formats: FeatureData[AlignedSequence], FeatureData[Taxonomy], and Phylogeny[Rooted | Unrooted]. That’d be the least amount of development effort for you, and would make it pretty easy for existing QIIME 2 users to start trying out q2-ghost-tree! :tada:


Thanks @jairideout. This helps. A big part of why I’ve been having writer’s block with the plugin is that an OtuMap was required for ghost-tree but now that I’m doing microbiome research again I realize I’ve been out of the loop about that. So I’m going to remove the OtuMap as a requirement (make it an option) which changes a lot of the original code + testing + docs. I’ll do some reworking on ghost-tree before q2-ghost-tree. I’ve been busy so these long intervals between looking at this are a pain for me too. haha. Thanks to you and @ebolyen for your patience and help!