linnarsson-lab / loompy

Python implementation of the Loom file format - http://loompy.org
BSD 2-Clause "Simplified" License
137 stars 36 forks source link

h5py 3.1.0 breaks fancy indexing #147

Open camiel-m opened 3 years ago

camiel-m commented 3 years ago

After updating to h5py 3.1.0 fancy indexing in loompy seems to be broken. Downgrading to 2.10.0 solves the issue, alternatively a workaround is given in this thread where they suggest converting boolean arrays to indices. This might be solved in later versions of h5py, but maybe it would be good to require h5py < 3.1.0 as an installation requirement for the time being.

Traceback (most recent call last):
  File "/home/camiel/cytograph-dev/cytograph/plotting/TF_heatmap.py", line 29, in TF_heatmap
    hm.plot(ds, dsagg, out_file=out_file)
  File "/home/camiel/cytograph-dev/cytograph/plotting/heatmap.py", line 31, in plot
    data = np.log(ds[layer][self.genes, :] + 1)
  File "/home/camiel/anaconda3/envs/chromo/lib/python3.7/site-packages/loompy/loom_layer.py", line 88, in __getitem__
    return self.ds._file['/matrix'].__getitem__(slice)
  File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
  File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
  File "/home/camiel/anaconda3/envs/chromo/lib/python3.7/site-packages/h5py/_hl/dataset.py", line 777, in __getitem__
    selection = sel.select(self.shape, args, dataset=self)
  File "/home/camiel/anaconda3/envs/chromo/lib/python3.7/site-packages/h5py/_hl/selections.py", line 82, in select
    return selector.make_selection(args)
  File "h5py/_selector.pyx", line 272, in h5py._selector.Selector.make_selection
  File "h5py/_selector.pyx", line 183, in h5py._selector.Selector.apply_args
TypeError: Indexing arrays must have integer dtypes
winni2k commented 3 years ago

I observe this as well.