Given, adata and a key that points to a specific matrix stored in adata, return the data, formatted either as np.ndarray or torch.Tensor. If formatted as torch.Tensor, device may be specified based on available devices.
Key to access a matrix in adata. For example, if you wanted to access adata.obsm['X_pca'], you would pass: "X_pca".
groupby (Optional[str]) = None
Optionally, one may choose to group data according to a cell-specific annotation in adata.obs. This would invoke returning data as List
torch (bool) = False
Boolean indicator of whether data should be formatted as torch.Tensor. If False (default), data is formatted as np.ndarray.
device (torch.device) = autodevice.AutoDevice()
Should torch=True, the device ("cpu", "cuda:N", "mps:N") may be set. The default value, autodevice.AutoDevice() will indicate the use of GPU, if available.
as_dict (bool) =True
Only relevant when groupby is not None. Boolean indicator to return data in a Dict where the key for each value corresponds to the respective groupby value. If False, returns List.
Formatted data as np.ndarray or torch.Tensor. If torch=True the torch.Tensor is allocated to the device indicated by the device argument. If groupby is passed, returned as Dict[Union[str, int], np.ndarray] or Dict[Union[str, int]. torch.Tensor]. If groupby is passed and as_dict = False, returns List[np.ndarray] or List[tobrch.Tensor].