Gneiss -- Cannot Convert Float NaN to integer

Hi there,

I have encountered an error that I have been unable to troubleshoot using the gneiss workflow.

    qiime gneiss correlation-clustering \
      --i-table $input_table \
      --o-clustering hierarchy.qza
    qiime gneiss ilr-hierarchical \
      --i-table $input_table \
      --i-tree hierarchy.qza \
      --o-balances balances.qza

Both of these work and generate balances and heirarchy files.

    qiime gneiss ols-regression \
      --p-formula "Sample_type" \
      --i-table balances.qza \
      --i-tree hierarchy.qza \
      --m-metadata-file $metadatapath \
      --verbose \
      --o-visualization regression_summary_Sample_type.qzv

However, this command fails with the error below.

I thought maybe this was because there were some 0 balances, however when I run:

qiime tools export --input-path balances.qza --output exportbalances
biom summarize-table -i exportbalances/feature-table.biom -o exportbalances/summarized.txt

/local/one/CSTAIRS/CONDA/env/qiime2-2018.8/lib/python3.5/site-packages/gneiss-0.4.4-py3.5.egg/gneiss/regression/ RuntimeWarning: invalid value encountered in sqrt
/local/one/CSTAIRS/CONDA/env/qiime2-2018.8/lib/python3.5/site-packages/gneiss-0.4.4-py3.5.egg/gneiss/regression/ RuntimeWarning: invalid value encountered in true_divide
/local/one/CSTAIRS/CONDA/env/qiime2-2018.8/lib/python3.5/site-packages/scipy/stats/ RuntimeWarning: invalid value encountered in greater
return (self.a < x) & (x < self.b)
/local/one/CSTAIRS/CONDA/env/qiime2-2018.8/lib/python3.5/site-packages/scipy/stats/ RuntimeWarning: invalid value encountered in less
return (self.a < x) & (x < self.b)
/local/one/CSTAIRS/CONDA/env/qiime2-2018.8/lib/python3.5/site-packages/scipy/stats/ RuntimeWarning: invalid value encountered in less_equal
cond2 = cond0 & (x <= self.a)
/local/one/CSTAIRS/CONDA/env/qiime2-2018.8/lib/python3.5/site-packages/gneiss-0.4.4-py3.5.egg/gneiss/regression/ RuntimeWarning: invalid value encountered in double_scalars
/local/one/CSTAIRS/CONDA/env/qiime2-2018.8/lib/python3.5/site-packages/statsmodels/stats/ RuntimeWarning: invalid value encountered in less_equal
reject = pvals_sorted <= ecdffactor*alpha
Traceback (most recent call last):
File “/local/one/CSTAIRS/CONDA/env/qiime2-2018.8/lib/python3.5/site-packages/q2cli/”, line 274, in call
results = action(**arguments)
File “”, line 2, in ols_regression
File “/local/one/CSTAIRS/CONDA/env/qiime2-2018.8/lib/python3.5/site-packages/qiime2/sdk/”, line 231, in bound_callable
output_types, provenance)
File “/local/one/CSTAIRS/CONDA/env/qiime2-2018.8/lib/python3.5/site-packages/qiime2/sdk/”, line 424, in callable_executor
ret_val = self._callable(output_dir=temp_dir, **view_args)
File “/local/one/CSTAIRS/CONDA/env/qiime2-2018.8/lib/python3.5/site-packages/q2_gneiss/regression/”, line 34, in ols_regression
ols_summary(output_dir, res, tree)
File “/local/one/CSTAIRS/CONDA/env/qiime2-2018.8/lib/python3.5/site-packages/gneiss-0.4.4-py3.5.egg/gneiss/plot/”, line 302, in ols_summary
hm_p = _heatmap_summary(model.pvalues.T, model.coefficients().T)
File “/local/one/CSTAIRS/CONDA/env/qiime2-2018.8/lib/python3.5/site-packages/gneiss-0.4.4-py3.5.egg/gneiss/plot/”, line 186, in _heatmap_summary
ind = int(np.floor((x - _min) / (_max - _min) * (N - 1)))
ValueError: cannot convert float NaN to integer

Plugin error from gneiss:

cannot convert float NaN to integer

See above for debug info.

Hi @courtneystairs - I saw you flagged this post for removal because you solved it --- I have rejected the flag - how about instead you share what you did to solve the problem, that way other future users can benefit from this. Thanks! :qiime2:

Oh of course… Its a really silly issue. Turns out both of the Gneiss problems I had (this one and the one posted earlier: QIIME2 view of regression summary empty CSV) were related to the same issue.

I have posted a reply on this post – its still pending, but hopefully gets approved soon.

In summary, I was trying to generate the regression summary using a metadata file that contained more samples than those i was trying to compare.

I had generated the balances and hierarchy files using a filtered features table. When I went to generated the regression summary, I would get the above error. However, when I used a metadata file containing only my samples of interest, it worked. As with the FDR table in the other post.

I’m pretty new to QIIME2 and do not routinely do these sorts of analyses, I’m simply running these analyses for colleagues who do not know how to use linux, so perhaps this was a newbie error. I’ve learned quite a bit over the last few weeks - the documentation is very well done and this forum is an amazing resource. So thank you for that!!


I had the same issue until I found your post after sifting through several other posts and trying a whole bunch of other stuff. Thanks for posting the solution!

To the qiime gods, if there’s a way to get the gneiss error message to be more specific to the problem at hand, that would be very helpful! Thanks–it’s amazing.