freqsap.ebi =========== .. py:module:: freqsap.ebi .. autoapi-nested-parse:: Module for interacting with the EBI Proteins API. Classes ------- .. autoapisummary:: freqsap.ebi.EBI Functions --------- .. autoapisummary:: freqsap.ebi._get_dbsnp_id freqsap.ebi._check_response freqsap.ebi._get_variants Module Contents --------------- .. py:class:: EBI(timeout: int = 3) Bases: :py:obj:`freqsap.interfaces.ProteinVariantAPI` Class to access the EBI protein API. .. py:attribute:: _headers .. py:attribute:: _timeout :value: 3 .. py:method:: _request(url: str) -> requests.Response Private function to submit requests. :param url: Base URL to query. :type url: str :returns: Response returned by the server. :rtype: requests.Response .. py:method:: available() -> bool Check whether the service is available. :returns: True if service is available, False otherwise. :rtype: bool .. py:method:: get(accession: freqsap.accession.Accession) -> freqsap.protein.Protein Get the protein represented by the Accession. :param accession: Accession of the Protein. :type accession: Accession :returns: Protein specified by the accession. :rtype: Protein .. py:function:: _get_dbsnp_id(xrefs: list[dict]) -> str | None Parse dbSNP id from the xrefs entry. Private function. :param xrefs: List of xrefs specified in the protein. :type xrefs: list[dict] :returns: dbSNP id, if found, otherwise None. :rtype: str | None .. py:function:: _check_response(accession: freqsap.accession.Accession, response: requests.Response) -> None Check the response for the accession for errors. :param accession: Accession which was searched. :type accession: Accession :param response: Response obtained from the server. :type response: requests.Response :raises AccessionNotFound: Raises exception if the accession wasn't found. :raises Raises all other exceptions raised by the requests module.: .. py:function:: _get_variants(response: dict) -> Generator[freqsap.variation.Variation] Extract variations from EBI API response. :param response: JSON response from EBI API containing protein features. :type response: dict :Yields: *Variation* -- Each variation found with a valid dbSNP reference ID.