spVIPES.dataloaders._ann_dataloader.AnnDataLoader

spVIPES.dataloaders._ann_dataloader.AnnDataLoader#

class spVIPES.dataloaders._ann_dataloader.AnnDataLoader#

Bases: DataLoader

DataLoader for loading tensors from AnnData objects.

Parameters:
  • adata_manager (AnnDataManager) – AnnDataManager object with a registered AnnData object.

  • shuffle (bool (default: False)) – Whether the data should be shuffled

  • use_labels (bool (default: False)) – Whether to use labels for weighted sampling

  • indices (Union[Sequence[int], Sequence[bool], None] (default: None)) – The indices of the observations in the adata to load

  • batch_size (int (default: 128)) – minibatch size to load each iteration

  • sampler (Optional[Sampler] (default: None)) – Defines the strategy to draw samples from the dataset. Can be any Iterable with __len__ implemented. If specified, shuffle must not be specified. By default, we use a custom sampler that is designed to get a minibatch of data with one call to __getitem__.

  • data_and_attributes (Union[list[str], dict[str, dtype], None] (default: None)) – Dictionary with keys representing keys in data registry (adata_manager.data_registry) and value equal to desired numpy loading type (later made into torch tensor) or list of such keys. A list can be used to subset to certain keys in the event that more tensors than needed have been registered. If None, defaults to all registered data.

  • iter_ndarray (bool (default: False)) – Whether to iterate over numpy arrays instead of torch tensors

  • data_loader_kwargs – Keyword arguments for DataLoader

__init__(adata_manager, shuffle=False, use_labels=False, indices=None, batch_size=128, sampler=None, data_and_attributes=None, drop_last=False, iter_ndarray=False, **data_loader_kwargs)#
static __new__(cls, *args, **kwargs)#
Return type:

Any