anndata icon indicating copy to clipboard operation
anndata copied to clipboard

Integration with Loompy

Open pranzatelli opened this issue 2 years ago • 1 comments

@edg1983 mentioned here that anndata fails to read in the loom files generated by loompy (necessary to link loompy and scvelo). I've fixed this locally by changing some code in io_/read.py's _fmt_loom_axis_attrs() from

        if v.ndim > 1 and v.shape[1] > 1:
            axis_mapping[k] = v
        else:
            axis_df[k] = v

to

        try:
            if v.ndim > 1 and v.shape[1] > 1:
                axis_mapping[k] = v
            else:
                axis_df[k] = v
        except:
            warn('Failed to import item '+k+' from loom file.')

However, I'm sure there's a more elegant (and professional) solution.

pranzatelli avatar Jul 12 '22 17:07 pranzatelli

Hi @pranzatelli, thanks for reporting this.

From the linked issue:

The problem is that the loom file produced by loompy using their reference file for hg38 has a row attribute Aliases which contains None object and thus crash the code.

AFAICT, this is a bug in loompy, since the spec says:

There MUST be a group /row_attrs There can OPTIONALLY be one or more datasets at /row_attrs/{name} whose first dimension has length N

I've opened an issue on loompy about this: https://github.com/linnarsson-lab/loompy/issues/175

ivirshup avatar Aug 30 '22 09:08 ivirshup

This issue has been automatically marked as stale because it has not had recent activity. Please add a comment if you want to keep the issue open. Thank you for your contributions!

github-actions[bot] avatar Nov 18 '22 11:11 github-actions[bot]