Comments (10)
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:
Looks like you have an ancient loompy version <1.1.0, is that correct?
from anndata.
Erm, apparently working with loompy 1.0.0
. I guess that I may solve my issues by updating?
from anndata.
Yes!
from anndata.
Great!
from anndata.
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.
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.
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.
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.
OK, my scipy version is 0.19.1
.
from anndata.
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)
- String indexes in var lead to UserWarning HOT 1
- Move tests out of the package
- Refactor `BaseCompressedSparseDataset` and subclasses to remove `backed_{csr,csc}_matrix`
- concat_on_disk should use int64 indptrs by default so that it can concatenate large files HOT 4
- TypeError: Can't implicitly convert non-string objects to strings HOT 4
- Error concatenating scRNA with visium dataset
- memory usage of concat HOT 3
- Using `Pint` for units HOT 9
- UMAP of gene subset of adata HOT 2
- Error using sc.pl.stacked_violin HOT 1
- NotImplementedError with concat_on_disk
- Issue when setting anndata.X to numpy array HOT 3
- Does anndata.raw can be automatically modified after define it?
- Make the call to `_check_uniqueness()` optional in `_init_as_actual()` (and `__init__()`) HOT 1
- `concat_on_disk` outer join
- `concat_on_disk` merge strategies are untested/not implemented
- Potentially flaky benchmark HOT 2
- Reading Anndata from only parts of h5ad file: Hack solution HOT 8
- 2D indexing (no “:”) in `sparse_dataset` is not lazy HOT 7
- Set of categories changes when slicing AnnData, but not when slicing DataFrame HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from anndata.