question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error loading loomxpy formatted files from Fly Cell Atlas

See original GitHub issue

I am trying to load .loom files from https://flycellatlas.org and am getting an odd error. For example:

fly_ann = sc.read_loom('s_fca_biohub_antenna_10x.loom')

gives me

s_fca_biohub_antenna_10x.loom does not appead to be a valid Loom file according to Loom spec version '3.0.0'

error, even though it can be opened in R just fine. Link to the file: https://cloud.flycellatlas.org/index.php/s/PcHBoL23CmxGNsb.

I have a fresh conda environment, scanpy 1.8.1, loompy 3.0.6.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:14 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
davidhbranncommented, Oct 8, 2021

That looks to be an error in loompy from loompy.LoomValidator(). The file has a bunch of row and column attributes that are not part of the loom spec and conventions, which you can find in their documentation here and which you can see in the traceback to ds = loompy.connect('s_fca_biohub_antenna_10x.loom'). You can load the file without validation manually, which worked on my end:

import pandas as pd
import anndata
import loompy

with loompy.connect("s_fca_biohub_antenna_10x.loom", validate=False) as ds:
    print(ds.shape)
    print(ds.ra.keys())
    print(ds.ca.keys())
    genes = ds.ra["Gene"]
    cells = ds.ca["CellID"]
    df = pd.DataFrame(ds[:, :], index=genes, columns=cells).T

adata = anndata.AnnData(df)
print(adata)

Or maybe you can pass the validation=False kwarg to sc.read_loom:

1reaction
dkobakcommented, Oct 11, 2021

Thanks a lot!

So setting validation=False kwarg to sc.read_loom does not work: it’s not a supported argument. Setting validate=False resulted in the following error:

ValueError: Cannot construct a Series from an ndarray with compound dtype.  Use DataFrame instead.

But your code snippet worked beautifully!

Do you think it’s something that should be dealt with in scanpy, or should I close this issue and report the problem to the loompy team instead? Or possibly to the Fly Atlas team who created incorrect loom files (I wonder how)?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error loading loomxpy formatted files from Fly Cell Atlas #627
I am trying to load .loom files from https://flycellatlas.org and am getting an odd error.
Read more >
SCope - FLY CELL ATLAS
Datasets can be uploaded in user sessions using the left sidebar. Files should be in the loom file format and will appear under...
Read more >
Tutorial 4 : How to work with Loom files created by ASAP
Tutorial 4 : How to work with Loom files created by ASAP. In this tutorial we will show you how to use the...
Read more >
SCENIC+: single-cell multiomic inference of enhancers and ...
We validated and benchmarked each of the SCENIC+ components on diverse data sets from different species, including human peripheral blood ...
Read more >
Other Tools - Brain Cell Data Center (BCDC)
Loom is an efficient file format for very large omics datasets, ... The Blue Brain Cell Atlas is a comprehensive online resource that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found