Skip to content

Export.py for sparse pandas data frames[results] #278

@cbravo93

Description

@cbravo93

In export.py these lines cause an error when using a sparse data frame:

# Calculate the number of genes per cell.
binary_mtx = ex_mtx.copy()
binary_mtx[binary_mtx != 0] = 1.0
ngenes = binary_mtx.sum(axis=1).astype(int)

Something like this (not-tested) could be used for sparse pandas:

ngenes = ex_mtx.values().count_nonzero().astype(int)

The question is, is a dense matrix required at any point for creating the loom file? Otherwise changing these would be more efficient for very large data sets.

Cheers!

C

Metadata

Metadata

Assignees

No one assigned

    Labels

    resultsQuestion about pySCENIC results

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions