Convert Results object into Artifact

Hi @caroline_ng!

This is a great question - thanks for asking!

As @gibsramen mentioned above, all actions in the Artifact API will return Results objects. Every results object is essentially a python namedtuple (8.3. collections — Container datatypes — Python 3.6.15 documentation) - you can access any of the outputs from the action by calling the result.output_name (where output_name is the name of the output you wish to access).

filter_samples_results = filter_samples(table=dada2_table_qza, min_frequency=2000)

taxonomy = Artifact.load(“taxonomy.qza”)

barplot_results = barplot(filter_samples_results.filtered_table, taxonomy=taxonomy, metadata=metadata)

barplot_viz = barplot_results.visualization

Every Results object will have different output parameters (because each Action outputs different things, right?)

ancom_results = ancom(table2k_abund_comp_qza.composition_table, metadata=metadata.get_column(“donor”))

ancom_viz = ancom_results.visualization

See what I did there? The hint is right there in the error message:

(emphasis mine)

Hope that helps!

:qiime2:

1 Like