qiime diversity bioenv error when running through "Atacama Soil Microbiome" tutorial

Hello,

I am running QIIME 2 Core - 2020.2 in VirtualBox.
I am going through the Atacama Soil Microbiome tutorial and am getting an error when trying to run the qiime diversity bioenv command. I am working on question 2 where it says “For exploring associations between continuous metadata and sample composition, the commands qiime metadata distance-matrix in combination with qiime diversity mantel and qiime diversity bioenv will be useful.”

Just testing it out with one continuous variable I have run this so far:

qiime metadata distance-matrix
–m-metadata-file sample-metadata.tsv
–m-metadata-column elevation
–o-distance-matrix core-metrics-results/elevation-distance-matrix.qza

qiime diversity mantel
–i-dm1 core-metrics-results/elevation-distance-matrix.qza
–i-dm2 core-metrics-results/unweighted_unifrac_distance_matrix.qza
–p-intersect-ids
–p-label1 ‘Elevation’
–p-label2 ‘UniFrac distance matrix’
–o-visualization core-metrics-results/diversity-mantel-elevation-unifrac.qzv

This works fine. Then I run the following command and get an error:

qiime diversity bioenv
–i-distance-matrix core-metrics-results/elevation-distance-matrix.qza
–m-metadata-file sample-metadata.tsv
–o-visualization bioenv-elevation.qzv

When run with the --verbose command this is the debug info:

Traceback (most recent call last):
File “/home/qiime2/miniconda/envs/qiime2-2020.2/lib/python3.6/site-packages/q2cli/commands.py”, line 328, in call
results = action(**arguments)
File “</home/qiime2/miniconda/envs/qiime2-2020.2/lib/python3.6/site-packages/decorator.py:decorator-gen-404>”, line 2, in bioenv
File “/home/qiime2/miniconda/envs/qiime2-2020.2/lib/python3.6/site-packages/qiime2/sdk/action.py”, line 245, in bound_callable
output_types, provenance)
File “/home/qiime2/miniconda/envs/qiime2-2020.2/lib/python3.6/site-packages/qiime2/sdk/action.py”, line 452, in callable_executor
ret_val = self._callable(output_dir=temp_dir, **view_args)
File “/home/qiime2/miniconda/envs/qiime2-2020.2/lib/python3.6/site-packages/q2_diversity/_beta/_visualizer.py”, line 62, in bioenv
result = skbio.stats.distance.bioenv(distance_matrix, df)
File “/home/qiime2/miniconda/envs/qiime2-2020.2/lib/python3.6/site-packages/skbio/stats/distance/_bioenv.py”, line 187, in bioenv
vars_array = _scale(vars_df).values
File “/home/qiime2/miniconda/envs/qiime2-2020.2/lib/python3.6/site-packages/skbio/stats/distance/_bioenv.py”, line 231, in _scale
raise ValueError("Column(s) in the data frame could not be scaled, "
ValueError: Column(s) in the data frame could not be scaled, likely because the column(s) had no variance.

My colleagues are also working on this and they have run it with other continuous variables and it always returns the same error.

Hello @capy, did you run core-metrics-phylogenetic? If so can you paste the exact command you ran here here so I can properly replicate it? If not then can you post the command(s) that produced your core-metrics-results/unweigthed_unifrac_distance_matrix.qza? Thank you.

1 Like

Yes, here is the code I used

qiime diversity core-metrics-phylogenetic
–i-phylogeny rooted-tree.qza
–i-table table.qza
–p-sampling-depth 1446
–m-metadata-file sample-metadata.tsv
–output-dir core-metrics-results

1 Like

Alright I know what the problem is.

Before creating the viz we drop all rows from the metadata that contain any empty cells. This just so happens to remove all metadata rows with a depth value of anything other than 2. Then when we go to create the viz skbio complains because the depth column has 0 variance (because all values in the column are 2). There is a safeguard that is meant to prevent this, but it is failing because it only checks for 0 variance columns before we remove the rows containing empty cells.

I’ll look into more permanently resolving this issue, but for now if you delete the depth column from the metadata the method should work.

1 Like

Thank you, I deleted the depth column and tried it again and it worked :slightly_smiling_face:

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