mkt.databases.uniprot.UniProtJSON

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, RESTAPIClient

Class 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

Methods

__eq__(other)

Return self==value.

__init__(uniprot_id[, url, headers, _json, ...])

__post_init__()

_stamp_from_response(res)

Record query datetime + cache provenance from a requests-cache response.

_stamp_now()

Record current UTC datetime; cache provenance unknown.

check_response(res)

Check the response status code for errors.

extract_modified_residues()

Extract modified residues from JSON.

query_api()

Get JSON for UniProt ID.

Attributes

__dataclass_fields__

__dataclass_params__

__match_args__

_json

JSON response from the API.

dict_mod_res

Dictionary of modified residues.

from_cache

Whether the most recent response was served from requests-cache.

headers

Header for the API request.

query_datetime

UTC datetime the underlying network query was made (cache creation time if served from cache).

url

URL for the UniProt API.

uniprot_id

UniProt ID.

__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.

query_api() dict | None[source]

Get JSON for UniProt ID.

Returns:

JSON for UniProt ID; None if request fails

Return type:

dict | None

uniprot_id: str

UniProt ID.