q2 boots error "diagonal can only contain zeros"

Dear qiime2 forum,

I'm feeling a little stumped cause I ran this on a different dataset and it ran successfully. However, when I try to run on a different feature table I am getting the following error (I tried running it twice and got the same thing both times):

Plugin error from boots:

  Data must be hollow (i.e., the diagonal can only contain zeros).

**Debug info has been saved to /var/folders/j7/ksdpj9r10_d5lczrxc_6j3nm0000gp/T/qiime2-q2cli-err-bmtc8wlv.log**

This is what I ran:

qiime boots beta \
  --i-table /Users/zoewilliams/Desktop/q2boots/exercise/input_qiime2/ps_exercise_feature-table.qza \
  --p-sampling-depth 49190 \
  --p-metric aitchison \
  --p-n 1000 \
  --p-no-replacement \
  --p-average-method non-metric-mean \
  --o-average-distance-matrix /Users/zoewilliams/Desktop/q2boots/exercise/output_qiime2/q2_boots_diversity/aitchison_avg_distance

Debug info is as follows:

Traceback (most recent call last):
  File "/opt/anaconda3/envs/q2-boots-amplicon-2025.4/lib/python3.10/site-packages/q2cli/commands.py", line 529, in __call__
    results = self._execute_action(
  File "/opt/anaconda3/envs/q2-boots-amplicon-2025.4/lib/python3.10/site-packages/q2cli/commands.py", line 607, in _execute_action
    results = action(**arguments)
  File "<decorator-gen-255>", line 2, in beta
  File "/opt/anaconda3/envs/q2-boots-amplicon-2025.4/lib/python3.10/site-packages/qiime2/sdk/action.py", line 221, in bound_callable
    outputs = self._callable_executor_(
  File "/opt/anaconda3/envs/q2-boots-amplicon-2025.4/lib/python3.10/site-packages/qiime2/sdk/action.py", line 440, in _callable_executor_
    outputs = self._callable(ctx, **view_args)
  File "/opt/anaconda3/envs/q2-boots-amplicon-2025.4/lib/python3.10/site-packages/q2_boots/_beta.py", line 79, in beta
    dms, = beta_collection_action(table=table,
  File "<decorator-gen-1008>", line 2, in beta_collection
  File "/opt/anaconda3/envs/q2-boots-amplicon-2025.4/lib/python3.10/site-packages/qiime2/sdk/context/base.py", line 90, in _callable_action_
    return self._dispatch_(args, kwargs)
  File "/opt/anaconda3/envs/q2-boots-amplicon-2025.4/lib/python3.10/site-packages/qiime2/sdk/context/base.py", line 45, in _dispatch_
    results = exe(*args, **kwargs)
  File "<decorator-gen-1011>", line 2, in beta_collection
  File "/opt/anaconda3/envs/q2-boots-amplicon-2025.4/lib/python3.10/site-packages/qiime2/sdk/action.py", line 221, in bound_callable
    outputs = self._callable_executor_(
  File "/opt/anaconda3/envs/q2-boots-amplicon-2025.4/lib/python3.10/site-packages/qiime2/sdk/action.py", line 440, in _callable_executor_
    outputs = self._callable(ctx, **view_args)
  File "/opt/anaconda3/envs/q2-boots-amplicon-2025.4/lib/python3.10/site-packages/q2_boots/_beta.py", line 66, in beta_collection
    results = _beta_collection_from_tables(tables, beta_metric_action)
  File "/opt/anaconda3/envs/q2-boots-amplicon-2025.4/lib/python3.10/site-packages/q2_boots/_beta.py", line 156, in _beta_collection_from_tables
    results.append(beta_metric_action(table=table)[0])
  File "<decorator-gen-1015>", line 2, in beta
  File "/opt/anaconda3/envs/q2-boots-amplicon-2025.4/lib/python3.10/site-packages/qiime2/sdk/context/base.py", line 90, in _callable_action_
    return self._dispatch_(args, kwargs)
  File "/opt/anaconda3/envs/q2-boots-amplicon-2025.4/lib/python3.10/site-packages/qiime2/sdk/context/base.py", line 45, in _dispatch_
    results = exe(*args, **kwargs)
  File "<decorator-gen-2424>", line 2, in beta
  File "/opt/anaconda3/envs/q2-boots-amplicon-2025.4/lib/python3.10/site-packages/qiime2/sdk/action.py", line 221, in bound_callable
    outputs = self._callable_executor_(
  File "/opt/anaconda3/envs/q2-boots-amplicon-2025.4/lib/python3.10/site-packages/qiime2/sdk/action.py", line 440, in _callable_executor_
    outputs = self._callable(ctx, **view_args)
  File "/opt/anaconda3/envs/q2-boots-amplicon-2025.4/lib/python3.10/site-packages/q2_diversity/_beta/_pipeline.py", line 51, in beta
    dm, = action(table=table, metric=metric, pseudocount=pseudocount,
  File "<decorator-gen-2425>", line 2, in beta_passthrough
  File "/opt/anaconda3/envs/q2-boots-amplicon-2025.4/lib/python3.10/site-packages/qiime2/sdk/context/base.py", line 90, in _callable_action_
    return self._dispatch_(args, kwargs)
  File "/opt/anaconda3/envs/q2-boots-amplicon-2025.4/lib/python3.10/site-packages/qiime2/sdk/context/base.py", line 45, in _dispatch_
    results = exe(*args, **kwargs)
  File "<decorator-gen-2426>", line 2, in beta_passthrough
  File "/opt/anaconda3/envs/q2-boots-amplicon-2025.4/lib/python3.10/site-packages/qiime2/sdk/action.py", line 221, in bound_callable
    outputs = self._callable_executor_(
  File "/opt/anaconda3/envs/q2-boots-amplicon-2025.4/lib/python3.10/site-packages/qiime2/sdk/action.py", line 359, in _callable_executor_
    output_views = self._callable(**view_args)
  File "<decorator-gen-211>", line 2, in beta_passthrough
  File "/opt/anaconda3/envs/q2-boots-amplicon-2025.4/lib/python3.10/site-packages/q2_diversity_lib/_util.py", line 75, in _validate_tables
    return wrapped_function(*args, **kwargs)
  File "<decorator-gen-210>", line 2, in beta_passthrough
  File "/opt/anaconda3/envs/q2-boots-amplicon-2025.4/lib/python3.10/site-packages/q2_diversity_lib/_util.py", line 118, in _validate_requested_cpus
    return wrapped_function(*bound_arguments.args, **bound_arguments.kwargs)
  File "/opt/anaconda3/envs/q2-boots-amplicon-2025.4/lib/python3.10/site-packages/q2_diversity_lib/beta.py", line 85, in beta_passthrough
    return skbio.diversity.beta_diversity(
  File "/opt/anaconda3/envs/q2-boots-amplicon-2025.4/lib/python3.10/site-packages/skbio/diversity/_driver.py", line 486, in beta_diversity
    return DistanceMatrix(distances, ids)
  File "/opt/anaconda3/envs/q2-boots-amplicon-2025.4/lib/python3.10/site-packages/skbio/stats/distance/_base.py", line 157, in __init__
    self._validate(data, ids)
  File "/opt/anaconda3/envs/q2-boots-amplicon-2025.4/lib/python3.10/site-packages/skbio/stats/distance/_base.py", line 1162, in _validate
    raise DistanceMatrixError(
skbio.stats.distance._base.DistanceMatrixError: Data must be hollow (i.e., the diagonal can only contain zeros).

Any suggestions would be greatly appreciated! I'm wondering if a possible issue could be choosing non-metric-mean rather than median resulting in small non zero values, however if this were the case I would have expected it to have the same issue regardless of the feature table used.

Thank you so much in advance!
Zoë

1 Like

Hello @zippyzo,

Have you tested your theory about the average methods? If you run the command with --p-average-method non-metric-median, does it pass? I don't think I would expect it to make a difference, but it could be worth a look.

1 Like

Hello @Oddant1 ,

Thanks for your reply! I just tried running it again with the non-metric-median and it sadly did not fix the problem:

(q2-boots-amplicon-2025.4) zoewilliams@Zos-MacBook-Air ~ % qiime boots beta \
  --i-table /Users/zoewilliams/Desktop/q2boots/exercise/input_qiime2/ps_exercise_feature-table.qza \
  --p-sampling-depth 49190 \
  --p-metric aitchison \
  --p-n 1000 \
  --p-no-replacement \
  --p-average-method non-metric-median \
  --o-average-distance-matrix /Users/zoewilliams/Desktop/q2boots/exercise/output_qiime2/q2_boots_diversity/aitchison_avg_distance

Plugin error from boots:

  Data must be hollow (i.e., the diagonal can only contain zeros).

Debug info has been saved to /var/folders/j7/ksdpj9r10_d5lczrxc_6j3nm0000gp/T/qiime2-q2cli-err-6_za8j0w.log

@zippyzo, I'm not sure what's going on here offhand.

First though, my understanding is that aitchison distance is not intended to be used with rarefaction. I don't think this would lead to the issue you're experiencing, but I first want to give you a heads-up to look into that if you haven't already.

To troubleshoot this though, I think the next step would be to take q2-boots out of the equation, and see if this is an issue with the underlying distance calculation. Could you try running the following:

qiime diversity beta \
  --i-table ps_exercise_feature-table.qza \
  --p-sampling-depth 49190 \
  --o-rarefied-table ps_exercise_feature-table-49190.qza

qiime diversity beta \
  --i-table ps_exercise_feature-table-49190.qza \
  --p-metric aitchison \
  --o-distance-matrix aitchison-distance.qza

(Note: I haven't tested those commands, so they might have typos.)

I'll be curious to know if that works.

(@Oddant1, thanks for the help and feel free to jump back in here! My replies might be delayed due to travel.)

3 Likes

Hello @gregcaporaso,

Thank you for your help and for the reminder about Aitchison not being used with rarefaction -- that had completely slipped my mind! I will make sure to proceed with Euclidian instead.

Interestingly, I ran qiime boots beta with euclidian and it ran successfully. I will try qiime diversity beta with aitchison for interests sake, but as going forward I am using euclidian instead, and that is running successfully, it's all grand!

Thank you, and safe travels!
Zoë

2 Likes