crested.tl.data.AnnDataWrapper#
- class crested.tl.data.AnnDataWrapper(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 your AnnData and genome, providing you with one-hot encoded sequences and associated scalar values to train a model with.
The
Crestedclass expects this orAnnDataModule.- Parameters:
data (
AnnData) – Your AnnData object.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’tval_splitsortest_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)kwargs – Arguments passed to
BaseGenomicDataWrapper.
Attributes table#
Methods table#
Return a dict of properties, to be logged during training. |