Diversity bioenv Column(s) in the data frame could not be scaled

This post is mostly just a test of the new forum. I think my issue is actually that bioenv should accept explicit metadata categories to test, and can put in a new issue request once we verify whether that’s the problem here. See the error output below. Column(s) in the data frame could not be scaled, likely because the column(s) had no variance — yeah, that sounds about right, but it would be convenient to not need to pick through my mapping file and create a new map minus all columns with 0 variance. I can verify that this approach works — but just specifying metadata to test would be nicer.

$ qiime diversity bioenv --i-distance-matrix unweighted_unifrac_distance_matrix.qza --m-metadata-file map.tsv --o-visualization unweighted_unifrac_bioenv Traceback (most recent call last): File "/Users/nbokulich/miniconda3/envs/qiime2-05/bin/qiime", line 6, in <module> sys.exit(q2cli.__main__.qiime()) File "/Users/nbokulich/miniconda3/envs/qiime2-05/lib/python3.5/site-packages/click/core.py", line 716, in __call__ return self.main(*args, **kwargs) File "/Users/nbokulich/miniconda3/envs/qiime2-05/lib/python3.5/site-packages/click/core.py", line 696, in main rv = self.invoke(ctx) File "/Users/nbokulich/miniconda3/envs/qiime2-05/lib/python3.5/site-packages/click/core.py", 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/core.py", 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/core.py", line 889, in invoke return ctx.invoke(self.callback, **ctx.params) File "/Users/nbokulich/miniconda3/envs/qiime2-05/lib/python3.5/site-packages/click/core.py", line 534, in invoke return callback(*args, **kwargs) File "/Users/nbokulich/miniconda3/envs/qiime2-05/lib/python3.5/site-packages/q2cli-0.0.5-py3.5.egg/q2cli/commands.py", line 210, in __call__ File "<decorator-gen-137>", line 2, in bioenv File "/Users/nbokulich/miniconda3/envs/qiime2-05/lib/python3.5/site-packages/qiime-2.0.5-py3.5.egg/qiime/core/callable.py", line 221, in callable_wrapper output_types) File "/Users/nbokulich/miniconda3/envs/qiime2-05/lib/python3.5/site-packages/qiime-2.0.5-py3.5.egg/qiime/core/callable.py", line 418, 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_diversity/_beta/_visualizer.py", line 42, in bioenv result = skbio.stats.distance.bioenv(distance_matrix, df) File "/Users/nbokulich/miniconda3/envs/qiime2-05/lib/python3.5/site-packages/skbio/stats/distance/_bioenv.py", line 187, in bioenv vars_array = _scale(vars_df).values File "/Users/nbokulich/miniconda3/envs/qiime2-05/lib/python3.5/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.

1 Like

I agree - this shouldn't need to be something that the user has to worry about. What we should probably do is detect these columns, not include them in the analysis, and print a warning in the resulting visualization about columns that were excluded, similar to what we do in the other visualizations in this plugin. For example:

@Nicholas_Bokulich, would you create an issue for this on q2-diversity?

Thanks for confirming! I will create a new issue and link to this discussion.

I like the new forum format, btw — better than reddit and seems to have some useful features that the old forum did not.

I also like that it supports markdown.

3 Likes

Thanks @Nicholas_Bokulich! This has been resolved through this pull request.

1 Like

An off-topic reply has been split into a new topic: Scaling error while running bioenv

Please keep replies on-topic in the future.