cellarium-ai / cellarium-ml

Distributed single-cell data analysis.
BSD 3-Clause "New" or "Revised" License
22 stars 3 forks source link

Allow `AnnDataField` to have more than one key #256

Closed sjfleming closed 1 month ago

sjfleming commented 1 month ago

Small change that allows key of AnnDataField to be a list of strings.

An accompanying change that allows categories_to_codes to handle a DataFrame (the result of accessing adata.obs with a list of keys) as well as a Series.

This enables the scvi model to be written much more efficiently. We have a use case where we can have several adata.obs keys designated as "categorical covariates", and we would like to load them all into a single tensor that gets passed to the forward call of the model. These changes enable that.