linnarsson-lab / loom-viewer

Tool for sharing, browsing and visualizing single-cell data stored in the Loom file format
BSD 2-Clause "Simplified" License
35 stars 6 forks source link

Bug in combine function #55

Closed gioelelm closed 7 years ago

gioelelm commented 8 years ago

If I do the following

to_combine = ['/Users/admin/Documents/IPyNotebook/BigProject/file1.loom',
              '/Users/admin/Documents/IPyNotebook/BigProject/file1.loom']
loompy.combine(to_combine, 'filecombined.loom')

I get:


---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-4-a3616af430ab> in <module>()
      1 to_combine = ['/Users/admin/Documents/IPyNotebook/BigProject/10X10_2.loom',
      2               '/Users/admin/Documents/IPyNotebook/BigProject/10X12_2.loom']
----> 3 loompy.combine(to_combine, 'filecombined.loom')
      4 with open('filecombined.meta','w') as fout:
      5     fout.write('\n'.join())

/Users/admin/anaconda/lib/python2.7/site-packages/loompy/loompy.pyc in combine(files, output_file)
    211                 ds = connect(output_file)
    212                 for f in files[1:]:
--> 213                         ds.add_loom(f)
    214 
    215 def connect(filename, infer=False):

/Users/admin/anaconda/lib/python2.7/site-packages/loompy/loompy.pyc in add_loom(self, other_file)
    514                                 raise ValueError, "Column attribute %s is missing in the other loom file" % ca
    515 
--> 516                 self.add_columns(other[:,:], other.col_attrs)
    517 
    518         def delete_attr(self, name, axis=0):

/Users/admin/anaconda/lib/python2.7/site-packages/loompy/loompy.pyc in add_columns(self, submatrix, col_attrs)
    480                                         raise ValueError, "INF and NaN not allowed in numeric attribute"
    481 
--> 482                         self.file['/col_attrs/' + key].resize(n_cols, axis = 0)
    483                         self.file['/col_attrs/' + key][self.shape[1]:] = vals
    484                         self.col_attrs[key] = self.file['/col_attrs/' + key]

/Users/admin/anaconda/lib/python2.7/site-packages/h5py/_hl/dataset.pyc in resize(self, size, axis)
    335         with phil:
    336             if self.chunks is None:
--> 337                 raise TypeError("Only chunked datasets can be resized")
    338 
    339             if axis is not None:

TypeError: Only chunked datasets can be resized
gioelelm commented 7 years ago

The presence of this bug is relevant at this point, we are getting a lot of data. We need a fix!

slinnarsson commented 7 years ago

Fixed and tested.