Skip to content

Sum duplicate rows in muon.atac.tl.count_fragments_features #125

@benjamin-james

Description

@benjamin-james

Is your feature request related to a problem? Please describe.
When I am converting range counts to smaller integers (i8 to i1, for example), sums from count_fragments_features can overflow, even though all numbers are below the maximum value supported. Apparently many duplicate row, column pairs can be inserted in count_fragments_features which can lead to this error.

Describe the solution you'd like

mx = mx.tocsr().transpose()
mx.sum_duplicates()
return AnnData(X=mx, obs=adata.obs, var=features)

Describe alternatives you've considered
Simply calling sum_duplicates() after count_fragments_features is what I currently do.

Additional context
I generally use count_fragments_features to count peak sets from a fragments file, so finding correct values so that they can be clipped per-peak is important.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions