Skip to content

Commit

Permalink
🎨 Polish docstrings
Browse files Browse the repository at this point in the history
Signed-off-by: zethson <[email protected]>
  • Loading branch information
Zethson committed Nov 19, 2024
1 parent 6ee87c1 commit 7363a90
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions bionty/base/entities/_gene.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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"])
Expand Down Expand Up @@ -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'},
Expand Down

0 comments on commit 7363a90

Please sign in to comment.