Demux summarize TypeError: len() of unsized object

I am attempting to summarize a SampleData[SequencesWithQuality] artifact using the following command:
demux_summary = demux.visualizers.summarize(demux_seqs.per_sample_sequences)

Both the API and CLI fail as below when used on an artifact containing only one sample (which does contain valid seqs, not an empty object), but work on other datasets that contain > 1 sample:

Traceback (most recent call last):
  File "/Users/nbokulich/miniconda3/envs/qiime2-05/bin/qiime", line 6, in <module>
  File "/Users/nbokulich/miniconda3/envs/qiime2-05/lib/python3.5/site-packages/click/", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/Users/nbokulich/miniconda3/envs/qiime2-05/lib/python3.5/site-packages/click/", line 696, in main
    rv = self.invoke(ctx)
  File "/Users/nbokulich/miniconda3/envs/qiime2-05/lib/python3.5/site-packages/click/", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/nbokulich/miniconda3/envs/qiime2-05/lib/python3.5/site-packages/click/", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/nbokulich/miniconda3/envs/qiime2-05/lib/python3.5/site-packages/click/", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/nbokulich/miniconda3/envs/qiime2-05/lib/python3.5/site-packages/click/", line 534, in invoke
    return callback(*args, **kwargs)
  File "/Users/nbokulich/miniconda3/envs/qiime2-05/lib/python3.5/site-packages/q2cli-0.0.6-py3.5.egg/q2cli/", line 210, in __call__
  File "<decorator-gen-191>", line 2, in summarize
  File "/Users/nbokulich/miniconda3/envs/qiime2-05/lib/python3.5/site-packages/qiime-2.0.6-py3.5.egg/qiime/core/", line 227, in callable_wrapper
    output_types, provenance)
  File "/Users/nbokulich/miniconda3/envs/qiime2-05/lib/python3.5/site-packages/qiime-2.0.6-py3.5.egg/qiime/core/", line 426, in _callable_executor_
    ret_val = callable(output_dir=temp_dir, **view_args)
  File "/Users/nbokulich/miniconda3/envs/qiime2-05/lib/python3.5/site-packages/q2_demux-0.0.5-py3.5.egg/q2_demux/", line 113, in summarize
  File "/Users/nbokulich/miniconda3/envs/qiime2-05/lib/python3.5/site-packages/seaborn/", line 209, in distplot
    bins = min(_freedman_diaconis_bins(a), 50)
  File "/Users/nbokulich/miniconda3/envs/qiime2-05/lib/python3.5/site-packages/seaborn/", line 30, in _freedman_diaconis_bins
    h = 2 * iqr(a) / (len(a) ** (1 / 3))
TypeError: len() of unsized object

Given that this command works for other datasets, could this be failing because the artifact only contains one sample?


Just confirmed on a test dataset that the visualizer doesn’t work with a single sample. I created an issue here to track this. Thanks for reporting this @Nicholas_Bokulich, nice debugging!

Thanks @jairideout ! Glad I was able to catch this.

Thanks for reporting this @Nicholas_Bokulich — a fix has just been merged into q2-demux. For artifacts with a single sample we now skip generating the Seaborn plots (and running the distribution stats that were blowing up in your original post here). Thanks!