mkt.databases.klifs.KLIFSPocket
- class mkt.databases.klifs.KLIFSPocket(uniprotSeq: str, klifsSeq: str, idx_kd: tuple[int | None, int | None], offset_bool: bool = True, list_klifs_region: list[str | None] = <factory>, list_klifs_substr_actual: list[str | None] = <factory>, list_klifs_substr_match: list[str | None] = <factory>, list_substring_idxs: list[list[int | None] | None] = <factory>, list_align: list[str | None] | None = None, KLIFS2UniProtIdx: dict[str, int | None] = <factory>, KLIFS2UniProtSeq: dict[str, str | None] = <factory>)[source]
Bases:
objectDataclass to hold KLIFS pocket alignment information per kinase.
- Variables:
uniprotSeq (str) – UniProt canonical sequence
klifsSeq (str) – KLIFS pocket sequence
idx_kd (tuple[int | None, int | None]) – Index of kinase domain in UniProt sequence (start, end)
offset_bool (bool) – If True, offset indices by 1 to match 1-based indexing; default True
list_klifs_region (list[str]) – List of start and end regions of KLIFS pocket separated by “:”; end region will be the same as start region if no concatenation necessary to find a single exact match
list_klifs_substr_actual (list[str | None]) – List of substring of KLIFS pocket that maps to the start region of the KLIFS pocket
list_klifs_substr_match (list[str | None]) – List of the actual substring used to match to the KLIFS pocket for the region(s) provided; will be the same as list_klifs_substr_actual if no concatenation necessary to find a single exact match
list_substring_idxs (list[list[int] | None]) – List of indices in UniProt sequence where KLIFS substring match starts; offset by length of preceding KLIFS region with gaps removed
list_align (list[str | None] | None) – List of final alignments to UniProt sequence
- __init__(uniprotSeq: str, klifsSeq: str, idx_kd: tuple[int | None, int | None], offset_bool: bool = True, list_klifs_region: list[str | None] = <factory>, list_klifs_substr_actual: list[str | None] = <factory>, list_klifs_substr_match: list[str | None] = <factory>, list_substring_idxs: list[list[int | None] | None] = <factory>, list_align: list[str | None] | None = None, KLIFS2UniProtIdx: dict[str, int | None] = <factory>, KLIFS2UniProtSeq: dict[str, str | None] = <factory>) None
Methods
__eq__(other)Return self==value.
__init__(uniprotSeq, klifsSeq, idx_kd[, ...])__post_init__()align_klifs_pocket_to_uniprot_seq(idx_start, ...)Align KLIFS region to UniProt canonical Uniprot sequence.
find_intra_gaps(dict_in[, bool_bl])Find intra-pocket gaps in KLIFS pocket region.
find_start_or_end_idx_recursively(idx_in[, ...])Find the start or end indices in UniProt canonical sequence of flanking KLIFS regions recursively.
generate_alignment_list(bool_offset)Generate and validate alignment list.
Return fully aligned KLIFS pocket.
Get inter-region sequences.
Get intra-region sequences.
Align KLIFS region to UniProt canonical Uniprot sequence.
recursive_idx_search(idx, in_dict, decreasing)Recursively search for index in dictionary.
remove_gaps_from_klifs(klifs_string)Remove gaps from KLIFS pocket sequence.
Return indices of alignment match.
Returns the index where substring begins in superstring (does not require -1 offset).
return_intra_gap_substr(bl_bool)Return intra-region gap substring.
return_partial_alignments(idx[, align_fn])Return partial alignments for b.l region.
select_correct_alignment(alignments[, bool_bl])Select correct alignment for b.l region.
Attributes
__dataclass_fields____dataclass_params____match_args__- KLIFS2UniProtIdx: dict[str, int | None]
- KLIFS2UniProtSeq: dict[str, str | None]
- __init__(uniprotSeq: str, klifsSeq: str, idx_kd: tuple[int | None, int | None], offset_bool: bool = True, list_klifs_region: list[str | None] = <factory>, list_klifs_substr_actual: list[str | None] = <factory>, list_klifs_substr_match: list[str | None] = <factory>, list_substring_idxs: list[list[int | None] | None] = <factory>, list_align: list[str | None] | None = None, KLIFS2UniProtIdx: dict[str, int | None] = <factory>, KLIFS2UniProtSeq: dict[str, str | None] = <factory>) None
- align_klifs_pocket_to_uniprot_seq(idx_start: int, idx_end: int) tuple[str, list[int] | None][source]
Align KLIFS region to UniProt canonical Uniprot sequence.
- Parameters:
idx_start (int) – Start index of KLIFS region
idx_end (int) – End index of KLIFS region
- Returns:
substring_klifs (str) – Substring of KLIFS pocket that maps to indices for the region(s) provided
list_idx (list[int] | None) – List of indices in UniProt sequence where KLIFS region starts
- find_intra_gaps(dict_in: dict[str, int], bool_bl: bool = True) tuple[int, str] | None[source]
Find intra-pocket gaps in KLIFS pocket region.
- Parameters:
dict_in (dict[str, int]) – Dictionary of KLIFS regions and their corresponding indices
bool_bl (bool) – If True, find intra-region gaps for b.l region; if False, find intra-region gaps for linker region
- Returns:
Tuple of intra-region gaps
- Return type:
tuple[str, str] | None
- find_start_or_end_idx_recursively(idx_in: int, bool_start: bool = True) int[source]
Find the start or end indices in UniProt canonical sequence of flanking KLIFS regions recursively.
- Parameters:
idx_in (int) – Index of KLIFS region (e.g., I is 0, g.l is 1, etc.)
bool_start (bool) – If True, find start index (default); if False, find end index
- generate_alignment_list(bool_offset: bool) list[str | None][source]
Generate and validate alignment list.
- Parameters:
bool_offset (bool) – If True, offset indices by 1 to match 1-based indexing
- Returns:
List of alignments
- Return type:
list[str | None]
- idx_kd: tuple[int | None, int | None]
- klifsSeq: str
- list_align: list[str | None] | None = None
- list_klifs_region: list[str | None]
- list_klifs_substr_actual: list[str | None]
- list_klifs_substr_match: list[str | None]
- list_substring_idxs: list[list[int | None] | None]
- offset_bool: bool = True
- recursive_idx_search(idx: int, in_dict: dict[str, int], decreasing: bool)[source]
Recursively search for index in dictionary.
- Parameters:
idx (int) – Index to start search
in_dict (dict[str, int]) – Dictionary to search
decreasing (bool) – If True, search in decreasing order; if False, search in increasing order
- Returns:
idx – Index in dictionary
- Return type:
int
- static remove_gaps_from_klifs(klifs_string: str) str[source]
Remove gaps from KLIFS pocket sequence.
- Parameters:
klifs_pocket (str) – KLIFS pocket sequence; can be entire sequence or substring
- Returns:
klifs_pocket_narm – KLIFS pocket sequence without gaps (i.e., “-” removed)
- Return type:
str
- static return_idx_of_alignment_match(align: PairwiseAlignments) list[int][source]
Return indices of alignment match.
- Parameters:
align (Align.PairwiseAlignments) – Pairwise alignments
- Returns:
List of indices for alignment match
- Return type:
list[int]
- static return_idx_of_substring_in_superstring(superstring: str, substring: str) list[int] | None[source]
Returns the index where substring begins in superstring (does not require -1 offset).
- Parameters:
superstring (str) – String in which to find substring index
substring (str) – String in which to find superstring index
- Returns:
list_out – Index where substring begins in superstring; None if substring not in superstring
- Return type:
list[int] | None
- return_intra_gap_substr(bl_bool) str | None[source]
Return intra-region gap substring.
- Parameters:
bl_bool (bool) – If True, find intra-region gaps for b.l region; if False, find intra-region gaps for linker region
- Returns:
Intra-region gap substring
- Return type:
str | None
- return_partial_alignments(idx: int, align_fn: PairwiseAligner | None = None) tuple[int, int, PairwiseAlignments | list[int | None] | None][source]
Return partial alignments for b.l region.
- Parameters:
idx (int) – Index of region (e.g., I is 0, g.l is 1, etc.)
align_fn (Align.PairwiseAligner | None) – Alignment function; if none provided will use exact match
- Returns:
Start, end, and alignments (either indices or alignments or None) for region
- Return type:
tuple[int, int, Align.PairwiseAlignments | list[int | None] | None]
- select_correct_alignment(alignments: PairwiseAlignments, bool_bl: bool = True) list[int][source]
Select correct alignment for b.l region.
- Parameters:
alignments (Align.PairwiseAlignments) – Pairwise alignments
bool_bl (bool) – If True, select correct alignment for b.l region; if False, select correct alignment for linker region
- Returns:
List of indices for correct alignment
- Return type:
list[int]
- uniprotSeq: str