Bioenv Plugin error from diversity:could not convert string to float: 'NA'

I'm trying to run beta-diversity analysis using qiime diversity bioenv on dissimilarity matrix but I keep getting this error message:

Plugin error from diversity:

  could not convert string to float: 'NA'

See above for debug info.

The command I run is the following

qiime diversity bioenv 
--i-distance-matrix BetaDissimilarity/HillBetaDissmilarities-q0-Cqn_acari.qza 
--m-metadata-file variables_bioclim_num.tsv 
--o-visualization bioenv.q0.cqn.acari 
--verbose

The matrix is asymmetric but I have already tried using a symmetric matrix and also tried to remove all the NA in both input files. The metadata file has been already checked with Keemei and it is okay.

Debug info are the following:

Traceback (most recent call last):
File "/Users/alexcussigh/miniconda3/envs/qiime2-2022.2/lib/python3.8/site-packages/q2cli/commands.py", line 339, in call
results = action(**arguments)
File "", line 2, in bioenv
File "/Users/alexcussigh/miniconda3/envs/qiime2-2022.2/lib/python3.8/site-packages/qiime2/sdk/action.py", line 234, in bound_callable
callable_args[name] = artifact._view(
File "/Users/alexcussigh/miniconda3/envs/qiime2-2022.2/lib/python3.8/site-packages/qiime2/sdk/result.py", line 331, in _view
result = transformation(self._archiver.data_dir)
File "/Users/alexcussigh/miniconda3/envs/qiime2-2022.2/lib/python3.8/site-packages/qiime2/core/transform.py", line 70, in transformation
new_view = transformer(view)
File "/Users/alexcussigh/miniconda3/envs/qiime2-2022.2/lib/python3.8/site-packages/qiime2/core/transform.py", line 214, in wrapped
return transformer(view.file.view(self._wrapped_view_type))
File "/Users/alexcussigh/miniconda3/envs/qiime2-2022.2/lib/python3.8/site-packages/q2_types/distance_matrix/_transformer.py", line 25, in _2
return skbio.DistanceMatrix.read(str(ff), format='lsmat', verify=False)
File "/Users/alexcussigh/miniconda3/envs/qiime2-2022.2/lib/python3.8/site-packages/skbio/io/registry.py", line 652, in read
return registry.read(file, into=cls, format=format, **kwargs)
File "/Users/alexcussigh/miniconda3/envs/qiime2-2022.2/lib/python3.8/site-packages/skbio/io/registry.py", line 513, in read
return self._read_ret(file, format, into, verify, kwargs)
File "/Users/alexcussigh/miniconda3/envs/qiime2-2022.2/lib/python3.8/site-packages/skbio/io/registry.py", line 520, in _read_ret
return reader(file, **kwargs)
File "/Users/alexcussigh/miniconda3/envs/qiime2-2022.2/lib/python3.8/site-packages/skbio/io/registry.py", line 998, in wrapped_reader
return reader_function(fhs[-1], **kwargs)
File "/Users/alexcussigh/miniconda3/envs/qiime2-2022.2/lib/python3.8/site-packages/skbio/io/format/lsmat.py", line 111, in _lsmat_to_distance_matrix
return _lsmat_to_matrix(DistanceMatrix, fh, delimiter)
File "/Users/alexcussigh/miniconda3/envs/qiime2-2022.2/lib/python3.8/site-packages/skbio/io/format/lsmat.py", line 165, in _lsmat_to_matrix
data[row_idx, :] = np.asarray(row_data, dtype=float)
ValueError: could not convert string to float: 'NA

Hi @alexcussigh0,

Welcome back to the :qiime2: forum!

Would you mind sharing your distance matrix .qza file and associated metadata? If you don't feel comfortable sharing those files publicly on the forum, you can direct message me - but I think it will be easier to debug this one if I can examine the distance matrix on my end.

Thanks! :lizard:

Hi @lizgehret, thank you so much for your kindness!
I have managed to find out the problem, I had left some NA in the matrix!
Thank you again

3 Likes