mkt.databases.uniprot
UniProt clients for FASTA sequences and JSON records.
Provides UniProtFASTA and UniProtJSON clients (with RefSeq
cross-reference support) and query_uniprotbulk_api() for bulk UniProt retrieval.
Module Attributes
UniProt evidence codes mapped to descriptions. |
|
Dictionary for empty phospho sites, evidence, and description. |
Functions
|
Query UniProt bulk download API for list of RefSeq Protein identifiers and return DataFrame. |
Classes
|
Class to interact with the UniProt API. |
|
Class to interact UniProt API for FASTA download. |
|
Class to interact UniProt API for JSON download. |
|
Class to interact with UniProt API bulk download for list of RefSeqProtein identifiers via GET. |
- mkt.databases.uniprot.DICT_PHOSPHO_EMPTY = {'phospho_description': None, 'phospho_evidence': None, 'phospho_sites': None}
Dictionary for empty phospho sites, evidence, and description.
- Type:
dict[str, None]
- mkt.databases.uniprot.DICT_UNIPROT_EVIDENCE = {'ECO:0000250': 'Computational, ISS', 'ECO:0000255': 'Computational, ISM', 'ECO:0000269': 'Manual, experimental', 'ECO:0000305': 'Inferred by curator', 'ECO:0007744': 'Manual, combo'}
UniProt evidence codes mapped to descriptions.
- Type:
dict[str, str]
- class mkt.databases.uniprot.UniProt(uniprot_id: str, url: str = 'https://rest.uniprot.org/uniprotkb')[source]
Bases:
objectClass to interact with the UniProt API.
- __init__(uniprot_id: str, url: str = 'https://rest.uniprot.org/uniprotkb') None
- uniprot_id: str
UniProt ID.
- url: str = 'https://rest.uniprot.org/uniprotkb'
URL for the UniProt API.
- class mkt.databases.uniprot.UniProtFASTA(uniprot_id: str, url: str = 'https://rest.uniprot.org/uniprotkb', url_fasta: str | None = None, _header: str | None = None, _sequence: str | None = None)[source]
Bases:
UniProt,RESTAPIClientClass to interact UniProt API for FASTA download.
- __init__(uniprot_id: str, url: str = 'https://rest.uniprot.org/uniprotkb', url_fasta: str | None = None, _header: str | None = None, _sequence: str | None = None) None
- static _convert_fasta2seq(str_fasta) tuple[str, str][source]
Convert FASTA sequence to string sequence (i.e., remove header line breaks).
- Parameters:
str_fasta (str) – FASTA string (including header and line breaks)
- Returns:
header, seq – FASTA header and sequence strings (excluding line breaks)
- Return type:
tuple[str, str]
- query_api(bool_seq: bool = True) str | None[source]
Get FASTA sequence for UniProt ID.
- Parameters:
bool_seq (bool) – If True, return sequence string only (i.e., no header or line breaks); otherwise return full FASTA string
- Returns:
FASTA sequences for UniProt ID; None if request fails
- Return type:
str | None
- url_fasta: str | None = None
URL for the UniProt FASTA API including UniProt ID.
- class mkt.databases.uniprot.UniProtJSON(uniprot_id: str, url: str = 'https://rest.uniprot.org/uniprotkb', headers: str = "{'Accept': 'application/json'}", _json: dict | None = None, dict_mod_res: dict | None = None)[source]
Bases:
UniProt,RESTAPIClientClass to interact UniProt API for JSON download.
- __init__(uniprot_id: str, url: str = 'https://rest.uniprot.org/uniprotkb', headers: str = "{'Accept': 'application/json'}", _json: dict | None = None, dict_mod_res: dict | None = None) None
- dict_mod_res: dict | None = None
Dictionary of modified residues.
- extract_modified_residues()[source]
Extract modified residues from JSON.
- Returns:
List of modified residues
- Return type:
list[str]
- headers: str = "{'Accept': 'application/json'}"
Header for the API request.
- class mkt.databases.uniprot.UniProtRefSeqProteinGET(identifier: str, term_in: str | None, term_out: str | None, url_base: str, headers: str | None = None, polling_interval: int = 5, jobId: str | None = None)[source]
Bases:
UniProtGETClass to interact with UniProt API bulk download for list of RefSeqProtein identifiers via GET.
- __init__(identifier: str, term_in: str | None, term_out: str | None, url_base: str, headers: str | None = None, polling_interval: int = 5, jobId: str | None = None) None
- mkt.databases.uniprot.query_uniprotbulk_api(input_ids: str, term_in: str = 'RefSeq_Protein', term_out: str = 'UniProtKB', database: str = 'UniProtBULK') DataFrame[source]
Query UniProt bulk download API for list of RefSeq Protein identifiers and return DataFrame.
Parameters:
- inputs_idsstr
Comma-separated string of RefSeq Protein identifiers to query UniProt API for.
- term_instr
Term to query UniProt API for. Default is “RefSeq_Protein”.
- term_outstr
Term to retrieve from UniProt API. Default is “UniProtKB”.
- databasestr
Database to query UniProt API for. Default is “UniProtBULK”.
Returns:
- pd.DataFrame
DataFrame with UniProt mapping results.