motleystate / moonstone

Library to perform Metagenomics data analysis with Python
https://moonstone.readthedocs.io/en/latest/?badge=latest
MIT License
1 stars 0 forks source link

Bug in _get_grouped_df because np.nan != np.nan #67

Closed AgnesBaud closed 3 years ago

AgnesBaud commented 3 years ago

Describe the bug

As np.nan != np.nan, group_df in _get_grouped_df is an empty dataframe being pass to skbio.diversity.beta_diversity

Expected behavior

2 solutions :

Additional context

DissimilarityMatrixError Traceback (most recent call last) (...) in _get_grouped_df(self, metadata_series) 309 for group in metadata_series.unique(): 310 group_df = self.df.loc[:, metadata_series[metadata_series == group].index] --> 311 beta_div_multi_indexed_df = self.compute_beta_diversity(group_df).to_series().to_frame() 312 if beta_div_multi_indexed_df.empty: # Happens if only one item from the group 313 continue in compute_beta_diversity(self, df) 375 """ 376 # steps to compute the index --> 377 return skbio.diversity.beta_diversity("braycurtis", df.transpose(), df.columns) 378 379 (...) DissimilarityMatrixError: Data must be at least 1x1 in size.