API Clients

class ideal_genom.api_client.GeneEnsemblRestClient

Bases: object

__init__(server='https://rest.ensembl.org', reqs_per_sec=15) None
_rate_limit() None

Rate-limiting to respect requests per second

get_gene_location(gene_symbol)

Fetch the start, end, strand, and chromosome for a given gene symbol using the Ensembl REST API.

Parameters:

gene_symbol (str): The symbol of the gene (e.g., “BRCA2”).

Returns:

dict: A dictionary containing start, end, strand, and chromosome information, or an error message.

perform_rest_action(method, endpoint, headers=None, params=None, data=None)

General method to perform REST actions with GET or POST

class ideal_genom.api_client.VEPEnsemblRestClient

Bases: object

ENSEMBL_API_URLS = ['https://rest.ensembl.org', 'https://useast.ensembl.org', 'https://asia.ensembl.org']
__init__(server: str | None = None, reqs_per_sec: int = 15) None
_rate_limit() None

Rate-limiting to respect requests per second

_switch_server() None

Switch to the next available Ensembl mirror if the current one fails.

perform_rest_action(method, endpoint, headers=None, params=None, data=None, retry_count: int = 0)

General method to perform REST actions with GET or POST

post_vep_request(ids)

Specific method to perform the VEP POST request with InAct parameter set to false.