mkt.databases.app.sequences
Sequence-alignment logic backing the Streamlit app.
Provides SequenceAlignment, which computes and formats kinase sequence
alignments for display in the Streamlit app.
Classes
|
Class to generate sequence alignments for kinase sequences. |
- class mkt.databases.app.sequences.SequenceAlignment(str_kinase: str, dict_color: dict[str, str], bool_mismatch: bool = True, bool_klifs: bool = True, bool_reverse: bool = True, obj_kinase: KinaseInfo | None = None)[source]
Bases:
objectClass to generate sequence alignments for kinase sequences.
- static _map_single_alignment(idx_start: int, idx_end: int, str_uniprot: str, seq_obj: str | None = None)[source]
Map the indices of the alignment to the original sequence.
- Parameters:
idx_start (int) – Start index of the alignment.
idx_end (int) – End index of the alignment.
str_uniprot (str) – Full canonical UniProt sequence.
seq_obj (str | None) – Seq obj provided by user or database. If None, use UniProt sequence. This is the case for Pfam, which only provides start and end indices.
- Returns:
Output string with the alignment mapped to the original sequence.
- Return type:
str
- _parse_start_end_values(start_or_end: Any, str_seq: str) int | None[source]
Parse the start and end keys for the alignment.
- Parameters:
start_or_end (Any) – The start or end key to parse.
str_seq (str) – The sequence to parse - only used if start_or_end callable.
- Returns:
The parsed start or end index, or None if not found.
- Return type:
int | None
- bool_klifs: bool = True
If True, shade KLIFS pocket residues using KLIFS pocket colors, by default True.
- bool_mismatch: bool = True
If True, show mismatches with UniProt seq in crimson, by default True.
- bool_reverse: bool = True
Whether or not to reverse order of inputs
- dict_color: dict[str, str]
Color dictionary for sequence viewer.
- generate_alignments() dict[str, str | list[str]][source]
Iterate through the KinaseInfo object and generate a list of sequences and a list of colors.
- Returns:
A dictionary with keys DICT_ALIGNMENT containing the sequences and a list of colors per residue.
- Return type:
dict[str, str | list[str]]
- obj_kinase: KinaseInfo | None = None
KinaseInfo object from which to extract sequences (loaded from str_kinase if not provided).
- str_kinase: str
Gene name of the kinase for which to generate the sequence alignment.