tanaylab / metacells

Metacells - Single-cell RNA Sequencing Analysis
MIT License
86 stars 8 forks source link

downsample_cells asserts for "float32" type, prohibits "float64" #56

Closed ukleiner closed 1 year ago

ukleiner commented 1 year ago

Running mc.pl.exclude_genes fails if the X matrix is float64 instead of float32 because of a specific float32 check in mc.tl.downsample_cells (Line 97: assert ut.shaped_dtype(data) == "float32"). Does the matrix needs to be strictly float32? I got a float64 X matrix by saving a SingleCellExperiment object in R to H5AD using zellkonverter package.

Currently I'm converting my X matrix to float32 (adata.X = adata.X.astype("float32")) but I'd like to keep the float64 type

Thanks!

orenbenkiki commented 1 year ago

The "float32" data type is admittedly an unfortunate carryover from past versions.

Ideally, UMIs count should be integers (even better, unsigned integers). This is probably what we'll enforce when migrating to Daf.

For now, there's no value in moving towards float64 as there's no loss of precision here - the values must be integers anyway (that is, "0.0", "1.0", "2.0", ...).