How to convert a 'Results' object to Artifact? or How to visualize a 'Results' object? in API interfaces

I don’t know how to save the visualizations that are generated as ‘Results’ objects in a API interface. For example:

from qiime2.plugins.diversity.methods import alpha
alpha_chao1 = alpha(table = table, metric = ‘chao1’)
how to save or visualize this in a qza artifact?

from qiime2.plugins.demux.visualizers import summarize
seqs_viz = summarize(paired_end_demux)
how to save or visualize this in a qzv artifact?

from qiime2.plugins.deblur.visualizers import visualize_stats
deblur_stats = visualize_stats(denoise.DeblurStats)
how to save or visualize this in a qzv artifact?

Hi, @Rodrigo_Daniel_Peral

If you print the results, you should see something like this:

>>> print(alpha_chao1)
Results (name = value)
---------------------------------------------------------------------------------------------------------
alpha_diversity = <artifact: SampleData[AlphaDiversity] uuid: .....>

You should be able to just do alpha_chao1.alpha_diversity to get the Artifact which you can save like so:

alpha_chao1.alpha_diversity.save("filepath.qza")

Visualizations should be similar.

4 Likes

Thanks a lot, its works

1 Like

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