freqsap.ebi
Module for interacting with the EBI Proteins API.
Classes
Class to access the EBI protein API. |
Functions
|
Parse dbSNP id from the xrefs entry. Private function. |
|
Check the response for the accession for errors. |
|
Extract variations from EBI API response. |
Module Contents
- class freqsap.ebi.EBI(timeout: int = 3)[source]
Bases:
freqsap.interfaces.ProteinVariantAPIClass to access the EBI protein API.
- _request(url: str) requests.Response[source]
Private function to submit requests.
- Parameters:
url (str) – Base URL to query.
- Returns:
Response returned by the server.
- Return type:
requests.Response
- available() bool[source]
Check whether the service is available.
- Returns:
True if service is available, False otherwise.
- Return type:
- get(accession: freqsap.accession.Accession) freqsap.protein.Protein[source]
Get the protein represented by the Accession.
- freqsap.ebi._get_dbsnp_id(xrefs: list[dict]) str | None[source]
Parse dbSNP id from the xrefs entry. Private function.
- freqsap.ebi._check_response(accession: freqsap.accession.Accession, response: requests.Response) None[source]
Check the response for the accession for errors.
- Parameters:
accession (Accession) – Accession which was searched.
response (requests.Response) – Response obtained from the server.
- Raises:
AccessionNotFound – Raises exception if the accession wasn’t found.
Raises all other exceptions raised by the requests module. –
- freqsap.ebi._get_variants(response: dict) Generator[freqsap.variation.Variation][source]
Extract variations from EBI API response.
- Parameters:
response (dict) – JSON response from EBI API containing protein features.
- Yields:
Variation – Each variation found with a valid dbSNP reference ID.