mkt.databases.protvar.ProtvarScoreQuery
- class mkt.databases.protvar.ProtvarScoreQuery(uniprot_id: str, pos: int, mut: str | None = None, url: str = 'https://www.ebi.ac.uk/ProtVar/api/score/<UNIPROT>/<POS>?mt=<MUT>', header: dict = <factory>)[source]
Bases:
RESTAPIClientClass to interact with the ProtVar score API.
A single query returns scores for every available database (Conservation, EVE, ESM1b, AlphaMissense, popEVE). The response is parsed into
ProtvarVariantobjects exposed viavariants:mutsupplied -> a single variant keyed by that residue.mutis None -> one variant per possible substitution (keyed by residue).
Residue identity for the variant-level databases is recovered from popEVE, the only database whose payload carries the mutant residue (
mt).- __init__(*args: Any, **kwargs: Any) None
Methods
__eq__(other)Return self==value.
__post_init__()Parse the flat score list into per-variant ProtvarVariant objects.
_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.
Create URL for Protvar score API query.
Return all raw score dicts retained from the query.
get_variant([mt])Return a single variant by mutant residue.
Query the ProtVar score API and parse the response into variants.
Attributes
__dataclass_fields____dataclass_params____match_args____pydantic_config__from_cacheWhether the most recent response was served from requests-cache.
Mutant residue (1 or 3 letter code); optional.
query_datetimeUTC datetime the underlying network query was made (cache creation time if served from cache).
URL for Protvar score API query.
Uniprot ID.
Position in the protein where mutation resides.
Header for the API request.
- get_scores() list[dict] | None[source]
Return all raw score dicts retained from the query.
- Returns:
All score dicts returned by the api, or None if the query failed.
- Return type:
list[dict] | None
- get_variant(mt: str | None = None) ProtvarVariant | None[source]
Return a single variant by mutant residue.
- Parameters:
mt (str | None, optional) – Mutant residue to retrieve. If None and the query targeted a single variant, that sole variant is returned; otherwise None.
- Returns:
The requested variant, or None if absent.
- Return type:
ProtvarVariant | None
- header: dict
Header for the API request.
- mut: str | None = None
Mutant residue (1 or 3 letter code); optional. If None, scores for every possible substitution at this position are returned.
- pos: int
Position in the protein where mutation resides.
- uniprot_id: str
Uniprot ID.
- url: str = 'https://www.ebi.ac.uk/ProtVar/api/score/<UNIPROT>/<POS>?mt=<MUT>'
URL for Protvar score API query.