hey! I'm trying to write a Seurat object to anndata but it fails in the write part
adata <- Convert(sc, to = "anndata")
works no problem
adata <- Convert(sc, to = "anndata",filename = "~/Lung_facs_seurat.h5ad")
Error in py_call_impl(callable, dots$args, dots$keywords) : ValueError: name already used as a name or title
Thanks! We're aware that the anndata convert is throwing errors in some cases, and are working to fix before the formal v3 release. Apologies for the delay in the mean time
I am trying to save seurat object into h5ad so that I can visualize it using cellxgene. Is there any progress regarding this issue?
hi @hejing3283, lately I've been able to convert between Seurat and h5ad with a few tricks. I'd suggest for you to compute everything in Seurat such that your Seurat object as all the slots filled. Once you do that try using the Convert function. If it doesn't work message me and I'll be able to help -- and good choice on cellxgene, it is a great tool! :)
Hi @aopisco , thanks for the suggestion! are you using Seurat V3 or V2?
@hejing3283 I'm using V2 - didn't try V3 yet
I am using V3. I found many conversion function didn't work in V3. so stay
with V2.
On Wed, May 8, 2019 at 12:18 PM aopisco notifications@github.com wrote:
@hejing3283 https://github.com/hejing3283 I'm using V2 - didn't try V3
yet—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/satijalab/seurat/issues/1006#issuecomment-490552569,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAUAIIMJDBIKDF6OLDQBU5DPUL4NHANCNFSM4GJXRHUQ
.
--
Cheers!
E-mail:
jing.[email protected]
Hi all,
We currently do not support direct Seurat → AnnData conversion. We do have a work around by allowing users to write out to a loom file with as.loom, then reading the loom file in Python with Scanpy/AnnData
Thanks!
On Fri, May 17, 2019 at 11:23 AM Paul Hoffman notifications@github.com
wrote:
Hi all,
We currently do not support direct Seurat ↔ AnnData conversion. We do have
a work around by allowing users to write out to a loom file with as.loom,
then reading the loom file in Python with Scanpy/AnnData—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/satijalab/seurat/issues/1006?email_source=notifications&email_token=AAUAIIJQ6WDVTTUYCNSSQ5DPV3EWHA5CNFSM4GJXRHU2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODVVB4IA#issuecomment-493493792,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAUAIIM7YFRU2XLCEREEFN3PV3EWHANCNFSM4GJXRHUQ
.
--
Cheers!
Jing
Hi Paul,
Is there a plan to support direct Seurat -> AnnData conversion soon? i.e. https://rdrr.io/github/satijalab/seurat/man/h5ad.html
I'm trying to convert for use with cellxgene without using Python.
Thanks,
Alex
Hi Alex,
I was able to do it by Seurat=>loom==>h5ad
H5ad is what cellxgene needed. This is working for the most updated version of Seurat v3.
Best,
Jing
On Jun 25, 2019, at 11:18, Alex Tamburino notifications@github.com wrote:
Hi Paul,
Is there a plan to support direct Seurat -> AnnData conversion soon? i.e. https://rdrr.io/github/satijalab/seurat/man/h5ad.html
I'm trying to convert for use with cellxgene without using Python.
Thanks,
Alex—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
Hi Jing,
Thanks for the info. Can you please elaborate?
Alex
Hi.
Here is what I did.
$ R
require(Seurat)
devtools::install_github(repo = 'hhoeflin/hdf5r') # Update hdf5r for
stability improvements
devtools::install_github(repo = 'mojaveazure/loomR', ref = 'develop’)
require(loomR)
sessionInfo()
[1] Seurat_3.0.1 loomR_0.2.1.9000 hdf5r_1.2.0
load(’SEURAT_OBJ.Rdata’)
Seurat.obj.ad = as.loom(seurat.obj, filename=’SEURAT_OBJ.loom’)
q()
$ conda activate YOUR_ENV
$ pip install -U loompy
$ pip install scanpy==1.4.3
$ python
import scanpy as sc
import loompy
print(loompy.__version__) ## 2.0.17
adata = sc.read_loom('SEURAT_OBJ.loom')
adata.write('SEURAT_OBJ.h5ad')
exit()
$ cellxgene prepare --layout umap SEURAT_OBJ.h5ad --output
SEURAT_OBJ_umap.h5ad ## if layout not computed
$ cellxgene launch --layout tsne SEURAT_OBJ_umap.h5ad --open
On Tue, Jun 25, 2019 at 1:15 PM Alex Tamburino notifications@github.com
wrote:
Hi Jing,
Thanks for the info. Can you please elaborate?
Alex
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/satijalab/seurat/issues/1006?email_source=notifications&email_token=AAUAIIJOJQ7POQARMSSCV4DP4JHC7A5CNFSM4GJXRHU2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYQ6O5Q#issuecomment-505538422,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAUAIIOT37KXZXV37RCB5SDP4JHC7ANCNFSM4GJXRHUQ
.
--
Cheers!
Jing
Thanks Jing!
On Thu, Jun 27, 2019 at 10:34 AM Jing He notifications@github.com wrote:
Hi.
Here is what I did.
$ R
require(Seurat)
devtools::install_github(repo = 'hhoeflin/hdf5r') # Update hdf5r for
stability improvementsdevtools::install_github(repo = 'mojaveazure/loomR', ref = 'develop’)
require(loomR)
sessionInfo()[1] Seurat_3.0.1 loomR_0.2.1.9000 hdf5r_1.2.0
load(’SEURAT_OBJ.Rdata’)
Seurat.obj.ad = as.loom(seurat.obj, filename=’SEURAT_OBJ.loom’)
q()
python
$ conda activate YOUR_ENV
$ pip install -U loompy
$ pip install scanpy==1.4.3
$ python
import scanpy as sc
import loompy
print(loompy.__version__) ## 2.0.17
adata = sc.read_loom('SEURAT_OBJ.loom')
adata.write('SEURAT_OBJ.h5ad')
exit()
$ cellxgene prepare --layout umap SEURAT_OBJ.h5ad --output
SEURAT_OBJ_umap.h5ad ## if layout not computed$ cellxgene launch --layout tsne SEURAT_OBJ_umap.h5ad --open
On Tue, Jun 25, 2019 at 1:15 PM Alex Tamburino notifications@github.com
wrote:Hi Jing,
Thanks for the info. Can you please elaborate?
Alex
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<
https://github.com/satijalab/seurat/issues/1006?email_source=notifications&email_token=AAUAIIJOJQ7POQARMSSCV4DP4JHC7A5CNFSM4GJXRHU2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYQ6O5Q#issuecomment-505538422
,
or mute the thread
<
https://github.com/notifications/unsubscribe-auth/AAUAIIOT37KXZXV37RCB5SDP4JHC7ANCNFSM4GJXRHUQ.
--
Cheers!
Jing—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/satijalab/seurat/issues/1006?email_source=notifications&email_token=AGDVLKWJ3RLRDXN7W6RQV7TP4TFW7A5CNFSM4GJXRHU2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYXKBTI#issuecomment-506372301,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AGDVLKVQ7P2XRDCY77RVHQ3P4TFW7ANCNFSM4GJXRHUQ
.
Np.
Best,
Jing
On Jun 27, 2019, at 12:26, Alex Tamburino notifications@github.com wrote:
Thanks Jing!
On Thu, Jun 27, 2019 at 10:34 AM Jing He notifications@github.com wrote:
Hi.
Here is what I did.
$ R
require(Seurat)
devtools::install_github(repo = 'hhoeflin/hdf5r') # Update hdf5r for
stability improvementsdevtools::install_github(repo = 'mojaveazure/loomR', ref = 'develop’)
require(loomR)
sessionInfo()[1] Seurat_3.0.1 loomR_0.2.1.9000 hdf5r_1.2.0
load(’SEURAT_OBJ.Rdata’)
Seurat.obj.ad = as.loom(seurat.obj, filename=’SEURAT_OBJ.loom’)
q()
python
$ conda activate YOUR_ENV
$ pip install -U loompy
$ pip install scanpy==1.4.3
$ python
import scanpy as sc
import loompy
print(loompy.__version__) ## 2.0.17
adata = sc.read_loom('SEURAT_OBJ.loom')
adata.write('SEURAT_OBJ.h5ad')
exit()
$ cellxgene prepare --layout umap SEURAT_OBJ.h5ad --output
SEURAT_OBJ_umap.h5ad ## if layout not computed$ cellxgene launch --layout tsne SEURAT_OBJ_umap.h5ad --open
On Tue, Jun 25, 2019 at 1:15 PM Alex Tamburino notifications@github.com
wrote:Hi Jing,
Thanks for the info. Can you please elaborate?
Alex
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<
https://github.com/satijalab/seurat/issues/1006?email_source=notifications&email_token=AAUAIIJOJQ7POQARMSSCV4DP4JHC7A5CNFSM4GJXRHU2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYQ6O5Q#issuecomment-505538422
,
or mute the thread
<
https://github.com/notifications/unsubscribe-auth/AAUAIIOT37KXZXV37RCB5SDP4JHC7ANCNFSM4GJXRHUQ.
--
Cheers!
Jing—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/satijalab/seurat/issues/1006?email_source=notifications&email_token=AGDVLKWJ3RLRDXN7W6RQV7TP4TFW7A5CNFSM4GJXRHU2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYXKBTI#issuecomment-506372301,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AGDVLKVQ7P2XRDCY77RVHQ3P4TFW7ANCNFSM4GJXRHUQ
.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
Hi Jing,
ValueError Traceback (most recent call last)
1 #pwd
----> 2 adata = sc.read_loom('GM_OS.merge.loom')
3 #adata.write('SEURAT_OBJ.h5ad')
D:Anaconda3libsite-packagesanndatareadwriteread.py in read_loom(filename, sparse, cleanup, X_name, obs_names, var_names, dtype, **kwargs)
158
159 if X_name not in lc.layers.keys(): X_name = ''
--> 160 X = lc.layers[X_name].sparse().T.tocsr() if sparse else lc.layers[X_name][()].T
161
162 layers = OrderedDict()
D:Anaconda3libsite-packagesloompyloom_layer.py in sparse(self, rows, cols)
109 col: List[np.ndarray] = []
110 i = 0
--> 111 for (ix, selection, view) in self.ds.scan(items=cols, axis=1, layers=[self.name]):
112 if rows is not None:
113 vals = view.layers[self.name][rows, :]
D:Anaconda3libsite-packagesloompyloompy.py in scan(self, items, axis, layers, key, batch_size)
597 for key, layer in vals.items():
598 lm[key] = loompy.MemoryLoomLayer(key, layer)
--> 599 view = loompy.LoomView(lm, self.ra[ordering], self.ca[ix + selection], self.row_graphs[ordering], self.col_graphs[ix + selection], filename=self.filename, file_attrs=self.attrs)
600 yield (ix, ix + selection, view)
601 ix += cols_per_chunk
D:Anaconda3libsite-packagesloompygraph_manager.py in __getitem__(self, thing)
96 if type(thing) is slice or type(thing) is np.ndarray or type(thing) is int:
97 gm = GraphManager(None, axis=self.axis)
---> 98 for key, g in self.items():
99 # Slice the graph matrix properly without making it dense
100 (a, b, w) = (g.row, g.col, g.data)
D:Anaconda3libsite-packagesloompygraph_manager.py in items(self)
55 def items(self) -> Iterable[Tuple[str, sparse.coo_matrix]]:
56 for key in self.keys():
---> 57 yield (key, self[key])
58
59 def __len__(self) -> int:
D:Anaconda3libsite-packagesloompygraph_manager.py in __getitem__(self, thing)
116 raise AttributeError(f"'{type(self)}' object has no attribute {thing}")
117 else:
--> 118 return self.__getattr__(thing)
119
120 def __getattr__(self, name: str) -> sparse.coo_matrix:
D:Anaconda3libsite-packagesloompygraph_manager.py in __getattr__(self, name)
127 c = self.ds._file[a][name]["b"]
128 w = self.ds._file[a][name]["w"]
--> 129 g = sparse.coo_matrix((w, (r, c)), shape=(self.ds.shape[self.axis], self.ds.shape[self.axis]))
130 self.__dict__["storage"][name] = g
131 return g
D:Anaconda3libsite-packagesscipysparsecoo.py in __init__(self, arg1, shape, dtype, copy)
196 self.data = self.data.astype(dtype, copy=False)
197
--> 198 self._check()
199
200 def reshape(self, args, *kwargs):
D:Anaconda3libsite-packagesscipysparsecoo.py in _check(self)
285 raise ValueError('row index exceeds matrix dimensions')
286 if self.col.max() >= self.shape[1]:
--> 287 raise ValueError('column index exceeds matrix dimensions')
288 if self.row.min() < 0:
289 raise ValueError('negative row index found')
ValueError: column index exceeds matrix dimensions
Do you have any idea?
Thank you very much!
Kai
Hi,
I'm also trying to convert my Seurat object to h5ad for use with cellxgene.
I'm following @hejing3283 's workflow
neocortex.loom <- as.loom(Neocortex, file="neocortex.loom")
Error in loomR::create(filename = filename, data = GetAssayData(object = x, :
unused arguments (feature.attrs = as.list(x = meta.feature), transpose = TRUE,
calc.count = FALSE, max.size = max.size, verbose = verbose)
$ R
devtools::install_github(repo = 'mojaveazure/loomR') (*)
require(loomR)
sessionInfo()
[1] Seurat_3.0.1 loomR_0.2.0
load(’Neocortex.Rdata’)
(*) Unfortunately, we cannot install the hdf5r package on our cluster - it is too outdated. So I can only install loomR 0.2.0 (not the 'develop' version, as that one calls hdf5r). However, I don't think this is the reason for the error.
Most helpful comment
Hi.
Here is what I did.
$ R
[1] Seurat_3.0.1 loomR_0.2.1.9000 hdf5r_1.2.0
python
$ conda activate YOUR_ENV
$ pip install -U loompy
$ pip install scanpy==1.4.3
$ python
$ cellxgene prepare --layout umap SEURAT_OBJ.h5ad --output
SEURAT_OBJ_umap.h5ad ## if layout not computed
$ cellxgene launch --layout tsne SEURAT_OBJ_umap.h5ad --open
On Tue, Jun 25, 2019 at 1:15 PM Alex Tamburino notifications@github.com
wrote:
--
Cheers!
Jing