[docs]classDeepRCEncoder(DatasetEncoder):""" DeepRCEncoder should be used in combination with the DeepRC ML method (:ref:`DeepRC`). This encoder writes the data in a RepertoireDataset to .tsv files. For each repertoire, one .tsv file is created containing the amino acid sequences and the counts. Additionally, one metadata .tsv file is created, which describes the subset of repertoires that is encoded by a given instance of the DeepRCEncoder. Note: sequences where count is None, the count value will be set to 1 **Dataset type:** - RepertoireDatasets **YAML specification:** .. indent with spaces .. code-block:: yaml definitions: encodings: my_deeprc_encoder: DeepRC """ID_COLUMN="ID"SEQUENCE_COLUMN="amino_acid"COUNTS_COLUMN="templates"SEP="\t"EXTENSION="tsv"METADATA_EXTENSION="csv"METADATA_SEP=","def__init__(self,context:dict=None,name:str=None):super().__init__(name=name)self.context=contextself.max_sequence_length=0
[docs]@staticmethoddefbuild_object(dataset,**params):ifisinstance(dataset,RepertoireDataset):prepared_params=DeepRCEncoder._prepare_parameters(**params)returnDeepRCEncoder(**prepared_params)else:raiseValueError("DeepRCEncoder is not defined for dataset types which are not RepertoireDataset.")