Giter VIP home page Giter VIP logo

Comments (10)

flying-sheep avatar flying-sheep commented on August 17, 2024

connect returns a LoomConnection object. Support for the with syntax (=the __enter__/__exit__ methods) was added to LoomConnection in linnarsson-lab/loompy@aaafe0c. On top of the commit page, you see which tags (versions) contain this commit:

image

Looks like you have an ancient loompy version <1.1.0, is that correct?

from anndata.

mbuttner avatar mbuttner commented on August 17, 2024

Erm, apparently working with loompy 1.0.0. I guess that I may solve my issues by updating?

from anndata.

falexwolf avatar falexwolf commented on August 17, 2024

Yes!

from anndata.

flying-sheep avatar flying-sheep commented on August 17, 2024

Great!

from anndata.

mbuttner avatar mbuttner commented on August 17, 2024

Ok, updated to loompy 2.0.12:

adata = sc.read_loom(filename=path_to_velocyto_files + 'all_controls.loom')

Variable names are not unique. To make them unique, call `.var_names_make_unique`.
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-8-de63a2957df4> in <module>()
----> 1 adata = sc.read_loom(filename=path_to_velocyto_files + 'all_controls.loom')

~/anaconda3/lib/python3.6/site-packages/anndata/readwrite/read.py in read_loom(filename, sparse, cleanup, X_name, obs_names, var_names)
    172             obs=obs,  # not ideal: make the generator a dict...
    173             var=var,
--> 174             layers=layers)
    175     return adata
    176 

~/anaconda3/lib/python3.6/site-packages/anndata/base.py in __init__(self, X, obs, var, uns, obsm, varm, layers, raw, dtype, shape, filename, filemode, asview, oidx, vidx)
    681                 layers=layers,
    682                 dtype=dtype, shape=shape,
--> 683                 filename=filename, filemode=filemode)
    684 
    685     def _init_as_view(self, adata_ref: 'AnnData', oidx: Index, vidx: Index):

~/anaconda3/lib/python3.6/site-packages/anndata/base.py in _init_as_actual(self, X, obs, var, uns, obsm, varm, raw, layers, dtype, shape, filename, filemode)
    901         self._clean_up_old_format(uns)
    902 
--> 903         self._layers = AnnDataLayers(self, layers, dtype)
    904 
    905     def __sizeof__(self):

~/anaconda3/lib/python3.6/site-packages/anndata/layers.py in __init__(self, adata, layers, dtype, adata_ref, oidx, vidx)
     31                     raise ValueError('Shape does not fit.')
     32                 if layers[key].dtype != np.dtype(dtype):
---> 33                     self._layers[key] = layers[key].astype(dtype, copy=False)
     34                 else:
     35                     self._layers[key] = layers[key]

TypeError: astype() got an unexpected keyword argument 'copy'

from anndata.

flying-sheep avatar flying-sheep commented on August 17, 2024

Can you try the newest anndata from git?

pip install -U git+https://github.com/theislab/anndata.git

It should give you a better error message

from anndata.

mbuttner avatar mbuttner commented on August 17, 2024

OK, so I updated anndata to '0.6.10+2.ga323978' and re-run the read_loom command.

adata = sc.read_loom(filename=path_to_velocyto_files + 'all_controls.loom')

Variable names are not unique. To make them unique, call `.var_names_make_unique`.
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-4-de63a2957df4> in <module>()
----> 1 adata = sc.read_loom(filename=path_to_velocyto_files + 'all_controls.loom')

~/anaconda3/lib/python3.6/site-packages/anndata/readwrite/read.py in read_loom(filename, sparse, cleanup, X_name, obs_names, var_names)
    172             obs=obs,  # not ideal: make the generator a dict...
    173             var=var,
--> 174             layers=layers)
    175     return adata
    176 

~/anaconda3/lib/python3.6/site-packages/anndata/base.py in __init__(self, X, obs, var, uns, obsm, varm, layers, raw, dtype, shape, filename, filemode, asview, oidx, vidx)
    681                 layers=layers,
    682                 dtype=dtype, shape=shape,
--> 683                 filename=filename, filemode=filemode)
    684 
    685     def _init_as_view(self, adata_ref: 'AnnData', oidx: Index, vidx: Index):

~/anaconda3/lib/python3.6/site-packages/anndata/base.py in _init_as_actual(self, X, obs, var, uns, obsm, varm, raw, layers, dtype, shape, filename, filemode)
    901         self._clean_up_old_format(uns)
    902 
--> 903         self._layers = AnnDataLayers(self, layers, dtype)
    904 
    905     def __sizeof__(self):

~/anaconda3/lib/python3.6/site-packages/anndata/layers.py in __init__(self, adata, layers, dtype, adata_ref, oidx, vidx)
     35                 raise ValueError('Shape does not fit.')
     36             if layer.dtype != np.dtype(dtype):
---> 37                 self._layers[key] = layer.astype(dtype, copy=False)
     38             else:
     39                 self._layers[key] = layer

TypeError: astype() got an unexpected keyword argument 'copy'

from anndata.

flying-sheep avatar flying-sheep commented on August 17, 2024

OK. I test if layer is a np.ndarray (which has .astype with copy) or a scipy.sparse.spmatrix (which also has .astype with copy)

for the sparse matrices, this was added in scipy/scipy@d09dc32, which ended up in scipy 1.0, released almost a year ago. do you also have an old scipy version?

from anndata.

mbuttner avatar mbuttner commented on August 17, 2024

OK, my scipy version is 0.19.1.

from anndata.

yojetsharma avatar yojetsharma commented on August 17, 2024

Hi, I am facing a similar issue too.
When I processed my spliced and unspliced using Velocyto and loaded those loom files, it worked. But when
I converted my seurat to loom and I tried loading it into velocyto but received the following error:

>>> ls003 = scv.read_loom('/home/praghu/yojetsharma/new/loom_files/ls003/ls003.loom')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/praghu/yojetsharma/.conda/envs/yojet_velo/lib/python3.10/site-packages/anndata/compat/__init__.py", line 305, in inner_f
    return f(*args, **kwargs)
  File "/home/praghu/yojetsharma/.conda/envs/yojet_velo/lib/python3.10/site-packages/anndata/_io/read.py", line 251, in read_loom
    with connect(filename, "r", **kwargs) as lc:
  File "/home/praghu/yojetsharma/.conda/envs/yojet_velo/lib/python3.10/site-packages/loompy/loompy.py", line 1515, in connect
    return LoomConnection(filename, mode, validate=validate)
  File "/home/praghu/yojetsharma/.conda/envs/yojet_velo/lib/python3.10/site-packages/loompy/loompy.py", line 85, in __init__
    if not lv.validate(filename):
  File "/home/praghu/yojetsharma/.conda/envs/yojet_velo/lib/python3.10/site-packages/loompy/loom_validator.py", line 50, in validate
    self.version = get_loom_spec_version(f)
  File "/home/praghu/yojetsharma/.conda/envs/yojet_velo/lib/python3.10/site-packages/loompy/utils.py", line 19, in get_loom_spec_version
    if "attrs" in f and "LOOM_SPEC_VERSION" in f["/attrs"]:
  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/praghu/yojetsharma/.conda/envs/yojet_velo/lib/python3.10/site-packages/h5py/_hl/group.py", line 483, in __contains__
    return self._e(name) in self.id
  File "h5py/h5g.pyx", line 466, in h5py.h5g.GroupID.__contains__
  File "h5py/h5g.pyx", line 467, in h5py.h5g.GroupID.__contains__
  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 "h5py/h5g.pyx", line 540, in h5py.h5g._path_valid
  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 "h5py/h5l.pyx", line 212, in h5py.h5l.LinkProxy.exists
RuntimeError: Unable to get link info (addr overflow, addr = 12416, size = 176, eoa = 2048)

from anndata.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.