[docs]@dataclassclassComparisonDataBatch:""" Arguments: matrix: array with dimension items x repertoires, where items are defined by comparison attributes specified in ComparisonData class and can include, for instance, receptor sequences or combinations of receptor sequences and V and J gene items: the item names extracted from the repertoires in the dataset on which the repertoires are evaluated (e.g. sequences or combinations of sequences and genes repertoire_index_mapping: a mapping between the repertoire identifier (a string) and a column number for faster access of columns (repertoire vectors w.r.t. given items) in the comparison data matrix where columns correspond to repertoires path (Path): path to directory where comp data is stored identifier (int): identifier of the batch """items:listrepertoire_index_mapping:Dict[str,int]path:Pathidentifier:intmatrix:np.ndarray=None
[docs]defload(self):file_path=self.path/f'{self.identifier}.pkl'iffile_path.is_file():withfile_path.open('rb')asfile:batch_vars=pickle.load(file)forvinbatch_vars:ifhasattr(self,v):setattr(self,v,batch_vars[v])else:logging.warning(f"ComparisonDataBatch: path {file_path} does not exist, returning the same object...")returnself