Trouble viewing a summary of joined data using Artifact API

Hello, I have trouble viewing a summary of joined data using Artifact API.

I tried to do the QIIME tutorial named “Alternative methods of read-joining in QIIME 2” using Artifact API.

However, I got some error messages.

# My codes    
# Joining reads
from qiime2.plugins.vsearch.methods import join_pairs
from qiime2 import Artifact
demux=Artifact.load('demux.qza')
demuxJoined = join_pairs(demultiplexed_seqs=demux)

# Viewing a summary of joined data with read quality
from qiime2.plugins.demux.visualizers import summarize
demuxJoinedVis = summarize(data=demuxJoined)

TypeError Traceback (most recent call last)
in
1 # Viewing a summary of joined data with read quality
2 from qiime2.plugins.demux.visualizers import summarize
----> 3 demuxJoinedVis = summarize(data=demuxJoined)

in summarize(data, n)

/bin/miniconda2/envs/qiime2-2020.8/lib/python3.6/site-packages/qiime2/sdk/action.py in bound_callable(*args, **kwargs)
206
207 # Type management
→ 208 self.signature.check_types(**user_input)
209 output_types = self.signature.solve_output(**user_input)
210 callable_args = {}

/bin/miniconda2/envs/qiime2-2020.8/lib/python3.6/site-packages/qiime2/core/type/signature.py in check_types(self, **kwargs)
352 "Parameter %r received %r as an argument, which is "
353 “incompatible with parameter type: %r”
→ 354 % (name, parameter, spec.qiime_type))
355
356 def solve_output(self, **kwargs):

TypeError: Parameter ‘data’ received Results (name = value)

joined_sequences = <artifact: SampleData[JoinedSequencesWithQuality] uuid: 49b150cb-cd5b-47d7-8e84-657b4b384894> as an argument, which is incompatible with parameter type: SampleData[SequencesWithQuality | PairedEndSequencesWithQuality | JoinedSequencesWithQuality]

Thanks for reading!

Hi @Jay!

The issue is that all QIIME 2 Actions will return a Results object, which contains Artifacts (or Visualizations).

You could do one of two things:

# Option 1: use python's built-in unpacking
#    Note the extra comma after `demuxJoined` and `demuxJoinedVis`.
#    This option takes advantage of the fact the `Results` is
#    basically a `namedtuple`.
...
demuxJoined, = join_pairs(demultiplexed_seqs=demux)
...
demuxJoinedVis, = summarize(data=demuxJoined)

####################################################

# Option 2: reference the Artifact on the Results object
#     Note, I changed the variable names here, for clarity.
...
demuxJoinedResults = join_pairs(demultiplexed_seqs=demux)
...
demuxJoinedVisResults = summarize(data=demuxJoinedResults.joined_sequences)

Hope that helps, and let us know if you have any questions!

:qiime2:

4 Likes

Thank you so much for your help! I could learn useful knowledge and tips.

2 Likes

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