I tried to read a similar post but it didn’t give me the answer I need about how to convert a results object into an Artifact
Here is my code:
I am trying to translate the Parkinson Mouse tutorial into API.
The next code is:
taxa_barplot_qzv=barplot(table_2k_qza, taxonomy=Artifact.load(“taxonomy.qza”), metadata=metadata)
The error I get in the next step is : TypeError: Parameter ‘table’ received Results (name = value)
Can someone help me convert table_2k_qza into Artifact? i am stuck
Thank you very much
Typically a command from the Artifact API such as
feature_table.actions.filter_samples will return a
Results object. If you
print the object you should be able to see the identifier of the data contained in the
Results. In the case of
filter_samples I believe it is
print(table_2k_qza) to confirm this is the case.
So for your example I think
taxa_barplot_qzv = barplot(table_2k_qza.filtered_table, taxonomy=Artifact.load(“taxonomy.qza”), metadata=metadata)
should work as you expect.
That’s great! It worked!!
but then, I have the same errpr, which I don’t understand why because it is exactly the same error:
Here is the next code I used:
.filtered_table doesn’t work this time.
and the error : TypeError: Parameter ‘table’ received Results (name = value)
composition_table = <artifact: FeatureTable[Composition] uuid: be2a115a-ba66-4157-802b-5b95fb86a6ef> as an argument, which is incompatible with parameter type: FeatureTable[Composition]
I am sorry if my questions are stupid, I am very grateful for your help.
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
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
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:
Hope that helps!
Thank you so much for your reply ! Now I understand it very well. I will try to do it for the rest of my code. It worked !! I am so happy !! Thanks !!
Thank you. !!! I have understood it well. That was a very clear explanation.
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.