Parameter for file path

I need to pass one file-path parameter for my q2-fragment-insertion community plugin to the underlying “binary”. Is it necessary to define a q2 type for this very specific file? (It is a RAxML info file)
If not, what would be the cleanest way to provide this additional parameter? Are there any conventions about parameter name to indicate that it should be a filepath?

Hi @Stefan! You’ll likely need to define a new file format and semantic type, unless there is an existing semantic type that makes sense for these data. See the q2-types plugin code for examples. You can define the type and format within your plugin, it doesn’t have to be added to q2-types. By defining a new type and format, this allows the data to be stored in a QIIME 2 Artifact (e.g. .qza file), and you’ll get all of the benefits that are included with artifacts (e.g. decentralized provenance tracking).

You could hack your plugin to accept a primitive parameter that is type Str (corresponding to a filepath), but I highly discourage this approach as it circumvents the QIIME 2 Artifact system, and won’t work as users would expect from an interface or data management standpoint.

If the data can instead be stored as a QIIME 2 Metadata file (e.g. TSV), you can avoid creating a new type/format and simply have users supply a Metadata file instead. Since it’s a RAxML file, it probably doesn’t fit your use case though; just noting this option for other forum readers.

1 Like