crested.tl.data.MultiAnnDataWrapper#

class crested.tl.data.MultiAnnDataWrapper(data, genome=None, batch_size=256, random_reverse_complement=False, always_reverse_complement=True, max_stochastic_shift=0, in_memory=True, drop_remainder=False, train_splits=None, val_splits='val', test_splits='test', split_column='split', **kwargs)#

Wrapper around multiple AnnDatas and a genome, providing you with one-hot encoded sequences and multiple sets of associated scalar values to train a model with.

This assumes the AnnDatas contain the same inputs (regions or genes), and that they simply have different class values (same .var, different .obs). The first AnnData will be used to create the index, and all other AnnDatas must contain those indices as well. Required input for the tl.Crested class.

Parameters:
  • data (list[AnnData]) – List of your AnnData objects.

  • genome (Genome | None (default: None)) – The genome to extract sequences from, as a crested.Genome object. If None, will look up the registered Genome.

  • batch_size (int (default: 256)) – Batch size to use during training and evaluation.

  • random_reverse_complement (bool (default: False)) – If True, the sequences will be randomly reverse complemented during training. Incompatible with always_reverse_complement.

  • always_reverse_complement (bool (default: True)) – If True, the dataset will be expanded to include both the forward and reverse-complemented versions of every entry in the training set. Incompatible with random_reverse_complement.

  • max_stochastic_shift (int (default: 0)) – Maximum stochastic shift (n base pairs in either direction) to apply randomly to each sequence during training. Default is 0 (disabled).

  • drop_remainder (bool (default: False)) – If True, drop the last batch if it is not the full batch_size. Default is False.

  • train_splits (str | list | None (default: None)) – The values in your split labeling that correspond to the training set as string or list of strings, i.e ‘train’ or [‘fold0’, ‘fold1’, ‘fold2’] If None, uses the values that aren’t val_splits or test_splits.

  • val_splits (str | list (default: 'val')) – The values in your split labeling that correspond to the validation set as string or list of strings, i.e ‘val’ or [‘fold3’, ‘fold4’]

  • test_splits (str | list (default: 'test')) – The values in your split labeling that correspond to the test set as string or list of strings, i.e ‘test’ or [‘fold5’, ‘fold6’]

  • split_column (str (default: 'split')) – The column in adata.var that contains the values to split on (as provided to [train/val/test]_splits)

Attributes table#

n_datasets

Return the number of datasets in the MultiAnnDataWrapper.

Methods table#

get_config()

Return a dict of properties, to be logged during training.

Attributes#

MultiAnnDataWrapper.n_datasets#

Return the number of datasets in the MultiAnnDataWrapper.

Methods#

MultiAnnDataWrapper.get_config()#

Return a dict of properties, to be logged during training.

Primarily used in Crested.fit().

Return type:

dict