Re-Export of sample metadata from artifacts/visualizations

I am looking for a way to export sample metadata files (the metadata describing the experiment) from q2 artifacts and/or visualizations accompanying papers as SI. E.g. 'q2 feature-table summarize' can add sample metadata to the visualization, which are available as the metadata category in the interactive sample detail tab. Same applies to taxa barplots, or PCA plots. Sample metadate information is often present in these data. Is there a way to re-export sample metadata as tsv tables from these q2 data?

There's a couple of different ways to do this. Check out these docs to get started, and let us know if you have any other questions: :outbox_tray:

1 Like

Hi @colinbrislawn ,
Thank you for linking to the exporting tutorial. However, there are no sample metadata present in these artifacts. Export results in abundance tables and newick trees, respectively.
I am interested in 'sample metadata': An example of such kind of data are in the 'moving pictures' tutorial. If I open the core-metrics-results/bray_curtis_emperor.qzv in q2 viewer, I can select specific samle metadata (e.g. body-site, day, month, etc.) to color the PCA plot. These data were specified by '--m-metadata-file sample-metadata.tsv ' in the 'qiime diversity core-metrics-phylogenetic' step.
My question is: If we publish qiime2 visualizations such as bray-curtis-plots, taxa-barplots, RPCA-biplots, etc. as electronic supplements to manuscripts, how can a colleague export 'sample metadata' information from such visualizations.

Thank you for you suggestions!

1 Like

Hi @arwqiime - the section of the tutorial that @colinbrislawn shared that you should take a closer look at is this part:

You'll want to extract your QZA/QZV - then you'll have access to the sample (or feature) metadata. Here is a brief example, using the Moving Pictures dataset:

qiime tools extract --input-path bray_curtis_emperor.qzv --output-path extracted/
head extracted/8b43bcab-dddf-4bcb-8cb8-9c8310b13d92/provenance/action/metadata.tsv

The result is:

sample-id       barcode-sequence        body-site       year    month   day     subject reported-antibiotic-usage       days-since-experiment-start
#q2:types       categorical     categorical     numeric numeric numeric categorical     categorical     numeric
L1S8    AGCTGACTAGTC    gut     2008    10      28      subject-1       Yes     0
L1S57   ACACACTATGGC    gut     2009    1       20      subject-1       No      84
L1S76   ACTACGTGTGGT    gut     2009    2       17      subject-1       No      112
L1S105  AGTGCGATGCGT    gut     2009    3       17      subject-1       No      140
L2S155  ACGATGCGACCA    left palm       2009    1       20      subject-1       No      84
L2S175  AGCTATCCACGA    left palm       2009    2       17      subject-1       No      112
L2S204  ATGCAGCTCAGT    left palm       2009    3       17      subject-1       No      140
L2S222  CACGTGACATGT    left palm       2009    4       14      subject-1       No      168

I hope that helps!


Hi @thermokarst and @colinbrislawn
Thank you for pointing me to the /provenance/action subfolders, I overlooked the metadate there...

1 Like

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.