[docs]@staticmethoddefencode_sequence(sequence:ReceptorSequence,params:EncoderParams):""" creates all overlapping gapped k-mers and IMGT position pairs from a sequence as features for use in KmerFrequencyEncoder. this gap length goes from min_gap to max_gap inclusive, and there is a k-mer of length k_left on the left side of the gap and a k-mer of length k_right on the right side of the gap. :param sequence: ReceptorSequence :param params: EncoderParams (within the "model", the following keys are used: "k_left", "k_right", "max_gap", "min_gap") :return: SequenceEncodingResult """k_left=params.model.get('k_left')k_right=params.model.get('k_right',k_left)max_gap=params.model.get('max_gap')min_gap=params.model.get('min_gap',0)sequence_type=params.model.get('sequence_type',EnvironmentSettings.sequence_type)length=len(getattr(sequence,params.get_seq_name_for_seq_object()))iflength<k_left+k_right+max_gap:warnings.warn('Sequence length is less than k_left + k_right + max_gap. Ignoring sequence')returnNonegapped_kmers=KmerHelper.create_IMGT_gapped_kmers_from_sequence(sequence,k_left=k_left,max_gap=max_gap,min_gap=min_gap,k_right=k_right,sequence_type=sequence_type,region_type=params.region_type)gapped_kmers=[Constants.FEATURE_DELIMITER.join([str(mer)formerinkmer])forkmeringapped_kmers]returngapped_kmers