[docs]classChainRepertoireFilter(Filter):""" This filter has two options: it can remove repertoires from the dataset which have any chain other than the specified one (e.g., keep only TRB) or it can remove the sequences from the repertoire which do not have the desired chain. Since the filter may remove repertoires/sequences from the dataset (examples in machine learning setting), it cannot be used with :ref:`TrainMLModel` instruction. If you want to filter out repertoires including a given chain, see :ref:`DatasetExport` instruction with preprocessing. **Dataset types:** - RepertoireDataset **Specification arguments:** - keep_chains (list): Which chains should be kept, valid values are "TRA", "TRB", "IGH", "IGL", "IGK" - remove_only_sequences (bool): Whether to remove only sequences with different chain than "keep_chain" (true) in case of repertoire datasets; default is false **YAML specification:** .. indent with spaces .. code-block:: yaml preprocessing_sequences: my_preprocessing: - my_filter: ChainRepertoireFilter: keep_chains: [TRB] remove_only_sequences: true """def__init__(self,keep_chains:list,remove_only_sequences:bool=False,result_path:Path=None):super().__init__(result_path)ParameterValidator.assert_type_and_value(keep_chains,list,"ChainRepertoireFilter","keep_chains")self.keep_chains=[Chain.get_chain(keep_chain)forkeep_chaininkeep_chains]self.remove_only_sequences=remove_only_sequences