Translates multiple identifiers in a single batch operation.
This function is more efficient than multiple calls to get_translation when
you need to translate many identifiers at once.
Args:
mart (str): The mart identifier (e.g., "ENSEMBL_MART_ENSEMBL")
dataset (str): The dataset identifier (e.g., "hsapiens_gene_ensembl")
from_attr (str): The source attribute name (e.g., "hgnc_symbol")
to_attr (str): The target attribute name (e.g., "ensembl_gene_id")
targets (list[str]): List of identifier values to translate (e.g., ["TP53", "BRCA1", "BRCA2"])
Returns:
dict: A dictionary containing:
- translations: Dictionary mapping input IDs to translated IDs
- not_found: List of IDs that could not be translated
- found_count: Number of successfully translated IDs
- not_found_count: Number of IDs that could not be translated
Example:
batch_translate("ENSEMBL_MART_ENSEMBL", "hsapiens_gene_ensembl", "hgnc_symbol", "ensembl_gene_id", ["TP53", "BRCA1", "BRCA2"])
>>> {"translations": {"TP53": "ENSG00000141510", "BRCA1": "ENSG00000012048"}, "not_found": ["BRCA2"], "found_count": 2, "not_found_count": 1}