mkt.databases.klifs
KLIFS API client for kinase names, pocket residues, and KLIFS region annotations.
Provides KLIFS Swagger clients (KinaseNames, KinaseInfo) and
KLIFSPocket for retrieving and structuring KLIFS pocket and region data.
Module Attributes
Mapping KLIFS pocket region to start and end indices, boolean denoting if subsequent regions are contiguous, and colors. |
|
List of string of all KLIFS pocket regions in format region:idx. |
|
List of inter-region region gaps that exist given analysis. |
|
List of intra-region region gaps that exist given analysis. |
|
List of keys for kinase information; use to populate if 404 error. |
Classes
|
Class to interact with the KLIFS API. |
|
Dataclass to hold KLIFS pocket alignment information per kinase. |
|
Class to get information about a kinase from KLIFS. |
|
Class to get kinase names from KLIFS. |
- mkt.databases.klifs.DICT_POCKET_KLIFS_REGIONS = {'GK': {'color': 'orange', 'contiguous': True, 'end': 45, 'start': 45}, 'I': {'color': 'khaki', 'contiguous': True, 'end': 3, 'start': 1}, 'II': {'color': 'khaki', 'contiguous': True, 'end': 13, 'start': 10}, 'III': {'color': 'khaki', 'contiguous': False, 'end': 19, 'start': 14}, 'IV': {'color': 'khaki', 'contiguous': False, 'end': 41, 'start': 38}, 'V': {'color': 'khaki', 'contiguous': True, 'end': 44, 'start': 42}, 'VI': {'color': 'khaki', 'contiguous': True, 'end': 67, 'start': 65}, 'VII': {'color': 'khaki', 'contiguous': False, 'end': 78, 'start': 76}, 'VIII': {'color': 'khaki', 'contiguous': True, 'end': 79, 'start': 79}, 'a.l': {'color': 'cornflowerblue', 'contiguous': False, 'end': 85, 'start': 84}, 'b.l': {'color': 'green', 'contiguous': True, 'end': 37, 'start': 31}, 'c.l': {'color': 'darkorange', 'contiguous': True, 'end': 75, 'start': 68}, 'g.l': {'color': 'green', 'contiguous': True, 'end': 9, 'start': 4}, 'hinge': {'color': 'magenta', 'contiguous': True, 'end': 48, 'start': 46}, 'linker': {'color': 'cyan', 'contiguous': True, 'end': 52, 'start': 49}, 'xDFG': {'color': 'cornflowerblue', 'contiguous': True, 'end': 83, 'start': 80}, 'αC': {'color': 'red', 'contiguous': True, 'end': 30, 'start': 20}, 'αD': {'color': 'red', 'contiguous': False, 'end': 59, 'start': 53}, 'αE': {'color': 'red', 'contiguous': True, 'end': 64, 'start': 60}}
Mapping KLIFS pocket region to start and end indices, boolean denoting if subsequent regions are contiguous, and colors.
- Type:
dict[str, dict[str, int | bool | str]]
- class mkt.databases.klifs.KLIFS[source]
Bases:
SwaggerAPIClientClass to interact with the KLIFS API.
- 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
- 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
- class mkt.databases.klifs.KinaseInfo(search_term: str | None = None, search_field: str | None = None, species: str = 'Human')[source]
Bases:
KLIFSClass to get information about a kinase from KLIFS.
- __init__(search_term: str | None = None, search_field: str | None = None, species: str = 'Human') None[source]
Initialize KinaseInfo Class object.
Upon initialization, KLIFS API is queried and kinase information for specificied kinase is retrieved.
- Parameters:
search_term (str) – Search term used to query KLIFS API; if None will return all kinases
search_field (str | None) – Search field (optional; default: None); only used to post-hoc annotate column with search term in case of missing data
species (str) – Species of the kinase; default “Human” but can also be “Mouse”
- Variables:
search_term (str) – Search term used to query KLIFS API
search_field (str | None) – Search field (optional; default: None); only used to post-hoc annotate column with search term in case of missing data
species (str) – Species of the kinase
status_code (int | None) – Status code of the query; None if query fails
_kinase_info (list[dict[str, str | int | None]] | None) – List of KLIFS API object for search term
- class mkt.databases.klifs.KinaseNames(species: str | None = 'Human')[source]
Bases:
KLIFSClass to get kinase names from KLIFS.
- __init__(species: str | None = 'Human') None[source]
Initialize KinaseNames Class object.
Upon initialization, KLIFS API is queried and kinase names are retrieved.
- Parameters:
species (str) – Species of the kinase; default “Human” but can also be “Mouse”
_kinase_names (dict[str, dict[str, str | int]] | None) – Llist of dictionaries of all kinase names info from KLIFS
- Variables:
_kinase_names (list[str]) – List of kinase names
- mkt.databases.klifs.LIST_INTER_REGIONS = ['II:III', 'III:αC', 'IV:V', 'hinge:linker', 'αD:αE', 'αE:VI', 'VII:VIII']
List of inter-region region gaps that exist given analysis.
- Type:
list[str]
- mkt.databases.klifs.LIST_INTRA_REGIONS = ['b.l_intra', 'linker_intra']
List of intra-region region gaps that exist given analysis.
- Type:
list[str]
- mkt.databases.klifs.LIST_KINASEINFO_KEYS = ['family', 'full_name', 'gene_name', 'group', 'iuphar', 'kinase_ID', 'name', 'pocket', 'species', 'subfamily', 'uniprot']
List of keys for kinase information; use to populate if 404 error.
- Type:
list[str]
- mkt.databases.klifs.LIST_KLIFS_REGION = ['I:1', 'I:2', 'I:3', 'g.l:4', 'g.l:5', 'g.l:6', 'g.l:7', 'g.l:8', 'g.l:9', 'II:10', 'II:11', 'II:12', 'II:13', 'III:14', 'III:15', 'III:16', 'III:17', 'III:18', 'III:19', 'αC:20', 'αC:21', 'αC:22', 'αC:23', 'αC:24', 'αC:25', 'αC:26', 'αC:27', 'αC:28', 'αC:29', 'αC:30', 'b.l:31', 'b.l:32', 'b.l:33', 'b.l:34', 'b.l:35', 'b.l:36', 'b.l:37', 'IV:38', 'IV:39', 'IV:40', 'IV:41', 'V:42', 'V:43', 'V:44', 'GK:45', 'hinge:46', 'hinge:47', 'hinge:48', 'linker:49', 'linker:50', 'linker:51', 'linker:52', 'αD:53', 'αD:54', 'αD:55', 'αD:56', 'αD:57', 'αD:58', 'αD:59', 'αE:60', 'αE:61', 'αE:62', 'αE:63', 'αE:64', 'VI:65', 'VI:66', 'VI:67', 'c.l:68', 'c.l:69', 'c.l:70', 'c.l:71', 'c.l:72', 'c.l:73', 'c.l:74', 'c.l:75', 'VII:76', 'VII:77', 'VII:78', 'VIII:79', 'xDFG:80', 'xDFG:81', 'xDFG:82', 'xDFG:83', 'a.l:84', 'a.l:85']
List of string of all KLIFS pocket regions in format region:idx.
- Type:
list[str]