diff --git a/loompy/loom_layer.py b/loompy/loom_layer.py index c2f433a..7194582 100644 --- a/loompy/loom_layer.py +++ b/loompy/loom_layer.py @@ -120,7 +120,7 @@ def sparse(self, rows: np.ndarray = None, cols: np.ndarray = None) -> scipy.spar vals = view.layers[self.name][rows, :] else: vals = view.layers[self.name][:, :] - nonzeros = np.where(vals > 0) + nonzeros = np.where(vals != 0) data.append(vals[nonzeros]) row.append(nonzeros[0]) col.append(nonzeros[1] + i)