Skip to content

Commit

Permalink
feat!: rename ExonGenomicCoordsMapper methods (#338)
Browse files Browse the repository at this point in the history
Addresses part of #224
* `transcript_to_genomic_coordinates` renamed to `tx_segment_to_genomic`
* `genomic_to_transcript_exon_coordinates` renamed to `genomic_to_tx_segment`
  • Loading branch information
korikuzma committed Aug 21, 2024
1 parent 0662692 commit cc6cf81
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 86 deletions.
16 changes: 7 additions & 9 deletions src/cool_seq_tool/mappers/exon_genomic_coords.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ def __init__(
>>> import asyncio
>>> result = asyncio.run(
... egc.transcript_to_genomic_coordinates(
... "NM_002529.3", exon_start=2, exon_end=17
... )
... egc.tx_segment_to_genomic("NM_002529.3", exon_start=2, exon_end=17)
... )
>>> result.genomic_data.start, result.genomic_data.end
(156864428, 156881456)
Expand Down Expand Up @@ -89,7 +87,7 @@ def _return_warnings(
resp.warnings.append(msg)
return resp

async def transcript_to_genomic_coordinates(
async def tx_segment_to_genomic(
self,
transcript: str,
gene: str | None = None,
Expand All @@ -98,15 +96,15 @@ async def transcript_to_genomic_coordinates(
exon_end: int | None = None,
exon_end_offset: int = 0,
) -> GenomicDataResponse:
"""Get genomic data given transcript data.
"""Get genomic data given transcript segment data.
By default, transcript data is aligned to the GRCh38 assembly.
>>> import asyncio
>>> from cool_seq_tool import CoolSeqTool
>>> egc = CoolSeqTool().ex_g_coords_mapper
>>> tpm3 = asyncio.run(
... egc.transcript_to_genomic_coordinates(
... egc.tx_segment_to_genomic(
... "NM_152263.3",
... gene="TPM3",
... exon_start=1,
Expand Down Expand Up @@ -233,7 +231,7 @@ async def transcript_to_genomic_coordinates(

return resp

async def genomic_to_transcript_exon_coordinates(
async def genomic_to_tx_segment(
self,
chromosome: str | None = None,
alt_ac: str | None = None,
Expand All @@ -246,7 +244,7 @@ async def genomic_to_transcript_exon_coordinates(
coordinate_type: Literal[CoordinateType.INTER_RESIDUE]
| Literal[CoordinateType.RESIDUE] = CoordinateType.RESIDUE,
) -> GenomicDataResponse:
"""Get transcript data for genomic data, lifted over to GRCh38.
"""Get transcript segment data for genomic data, lifted over to GRCh38.
MANE Transcript data will be returned if and only if ``transcript`` is not
supplied. ``gene`` must be given in order to retrieve MANE Transcript data.
Expand All @@ -256,7 +254,7 @@ async def genomic_to_transcript_exon_coordinates(
>>> from cool_seq_tool.schemas import Strand
>>> egc = CoolSeqTool().ex_g_coords_mapper
>>> result = asyncio.run(
... egc.genomic_to_transcript_exon_coordinates(
... egc.genomic_to_tx_segment(
... alt_ac="NC_000001.11",
... start=154192136,
... end=154170400,
Expand Down
Loading

0 comments on commit cc6cf81

Please sign in to comment.