[docs]classTCRdistEncoder(DatasetEncoder):""" Encodes the given ReceptorDataset as a distance matrix between all receptors, where the distance is computed using TCRdist from the paper: Dash P, Fiore-Gartland AJ, Hertz T, et al. Quantifiable predictive features define epitope-specific T cell receptor repertoires. Nature. 2017; 547(7661):89-93. `doi:10.1038/nature22383 <https://www.nature.com/articles/nature22383>`_. For the implementation, `TCRdist3 <https://tcrdist3.readthedocs.io/en/latest/>`_ library was used (source code available `here <https://github.com/kmayerb/tcrdist3>`_). **Dataset type:** - ReceptorDatasets **Specification arguments:** - cores (int): number of processes to use for the computation **YAML specification:** .. indent with spaces .. code-block:: yaml definitions: encodings: my_tcr_dist_enc: TCRdist: cores: 4 """def__init__(self,cores:int,name:str=None):super().__init__(name=name)self.cores=coresself.distance_matrix=Noneself.context=None
[docs]@staticmethoddefbuild_object(dataset,**params):ifisinstance(dataset,ReceptorDataset):returnTCRdistEncoder(**params)else:raiseValueError("TCRdistEncoder is not defined for dataset types which are not ReceptorDataset.")