From 7363a90bc5bc7c9b6a2b9ba2169914b052688640 Mon Sep 17 00:00:00 2001 From: zethson Date: Tue, 19 Nov 2024 11:32:42 +0100 Subject: [PATCH] :art: Polish docstrings Signed-off-by: zethson --- bionty/base/entities/_gene.py | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/bionty/base/entities/_gene.py b/bionty/base/entities/_gene.py index 24809aa..c388792 100644 --- a/bionty/base/entities/_gene.py +++ b/bionty/base/entities/_gene.py @@ -17,6 +17,15 @@ class MappingResult(NamedTuple): + """Result of mapping legacy Ensembl gene IDs to current IDs. + + Attributes: + mapped: Dictionary of successfully mapped old ensembl IDs to new ensembl IDs + ambiguous: Dictionary of ambiguously mapped old ensembl IDs to new ensembl IDs - when + a legacy ID maps to multiple current IDs + unmapped: List of old ensembl IDs that couldn't be found in the current version + """ + mapped: dict[str, str] ambiguous: dict[str, list[str]] unmapped: list[str] @@ -62,12 +71,6 @@ def map_legacy_ids(self, values: Iterable) -> MappingResult: Args: values: Legacy ensemble gene IDs of any version - Returns: - :class:`~bionty.base.entities._gene.MappingResult` containing: - - mapped: Dictionary of successfully mapped old ensembl IDs to new ensembl IDs - - ambiguous: Dictionary of ambigiously mapped old ensembl IDs to new ensembl IDs - - unmapped: List of unmapped ensembl IDs - Examples: >>> gene = bt.base.Gene() >>> gene.map_legacy_genes(["ENSG00000260150", "ENSG00000260587"]) @@ -301,12 +304,6 @@ def map_legacy_ids(self, values: Iterable, df: pd.DataFrame) -> MappingResult: values: Single gene ID string or iterable of gene ID strings to map df: DataFrame containing current Ensembl gene IDs in 'ensembl_gene_id' column - Returns: - :class:`~bionty.base.entities._gene.MappingResult` containing: - mapped: Dictionary of unique legacy ID to current ID mappings - ambiguous: Dictionary of legacy IDs to lists of possible current IDs - unmapped: List of legacy IDs that couldn't be mapped - Example: >>> map_legacy_ids(['ENSG00000139618'], df) MappingResult(mapped={'ENSG00000139618': 'ENSG00000012048'},