How to output metadata as an artifact

Long story short, I’m interested in creating some tools that can allow for different types of metadata to be merged together. Here are some use cases (for biplots)

  • Visualizing a biplot with feature metadata such the taxonomies. Doing so requires that you merge / create a metadata table of features.
  • Visualizing genome presence / absence on a biplot, but to do so requires you to have something like genome prediction from picrust to be converted to metadata.
  • Visualizing differential abundance values (from something like DEseq2, aldex2, stray, …) directly on a biplot.
  • Any of the above tasks also apply to phylogenetic tree visualization

I know that Metadata object are now Artifacts. However, I have not seen any examples of plugins outputting metadata. Do these examples exist, or is there additional infrastructure required to make this happen?

2 Likes

TLDR, any format/view type that is viewable as metadata can be used as metadata. So, for example, PCoAResults (represented as OrdinationFormat) can be used as metadata (for example, metadata tabulate). This is because the format is viewable as metadata, which means, there is a transformer defined to go from OrdinationFormat to qiime2.Metadata:

@plugin.register_transformer
def _3(ff: OrdinationFormat) -> qiime2.Metadata:
    df = _ordination_format_to_dataframe(ff)
    return qiime2.Metadata(df)

So, for a point by point breakdown:

This is already supported (--m-feature-metadata-file) — you can provide a FeatureData[Taxonomy] artifact here, because, it is viewable as Metadata.

This would need a transformer defined to go to qiime2.Metadata.

This would need a transformer defined to go to qiime2.Metadata.

Let us know if you have any questions. Thanks! :qiime2:

1 Like

Ok very cool - I didn’t know that you can just pass in FeatureData[Taxonomy] as Metadata!
Now it makes more sense why the new differential type needed a Metadata transformer – so maybe this should just work out of the box??

Glad to see that the infrastructure is in place :slight_smile:

1 Like