Skip to content

Commit

Permalink
BUG: fixes #717
Browse files Browse the repository at this point in the history
  • Loading branch information
wasade committed Nov 5, 2016
1 parent 1d935a2 commit 8409a43
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ New Features:
* `Table.sort_order` was performing an implicit cast to dense, and not leveraging fancy indexing. A substantial performance gain was acheived. See [PR #720](https://github.com/biocore/biom-format/pull/720)

Bug fixes:

* ``-o`` is now a required parameter of ``biom from-uc``. This was not the case previously, which resulted in a cryptic error message if ``-o`` was not provided. See [issue #683](https://github.com/biocore/biom-format/issues/683).
* Matrices are now cast to csr on `Table` construction if the data evaluate as `isspmatrix`. This fixes [#717](https://github.com/biocore/biom-format/issues/717) where some API methods assumed the data were csc or csr.

biom 2.1.5
----------
Expand Down
10 changes: 10 additions & 0 deletions tests/test_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import numpy.testing as npt
import numpy as np
from scipy.sparse import lil_matrix, csr_matrix, csc_matrix
import scipy.sparse

from biom import example_table
from biom.exception import (UnknownAxisError, UnknownIDError, TableException,
Expand Down Expand Up @@ -1711,6 +1712,15 @@ def test_update_ids_cache_bug(self):
exp_index = {'x': 0, 'y': 1}
self.assertEqual(obs._sample_index, exp_index)

def test_other_spmatrix_type(self):
# I dont actually remember what bug stemmed from this...
ss = scipy.sparse
for c in [ss.lil_matrix, ss.bsr_matrix, ss.coo_matrix, ss.dia_matrix,
ss.dok_matrix, ss.csc_matrix, ss.csr_matrix]:
mat = c((2, 2))
t = Table(mat, ['a', 'b'], [1, 2])
self.assertTrue(isinstance(t.matrix_data, (csr_matrix, csc_matrix)))

def test_sort_order(self):
"""sorts tables by arbitrary order"""
# sort by observations arbitrary order
Expand Down

0 comments on commit 8409a43

Please sign in to comment.