Skip to content

Commit

Permalink
refactor!: rename ExonCoord to _ExonCoord to indicate internal use (
Browse files Browse the repository at this point in the history
#357)

Part of #224
  • Loading branch information
korikuzma authored Aug 22, 2024
1 parent 639c1df commit 9967ccf
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 57 deletions.
18 changes: 9 additions & 9 deletions src/cool_seq_tool/mappers/exon_genomic_coords.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
_logger = logging.getLogger(__name__)


class ExonCoord(BaseModelForbidExtra):
class _ExonCoord(BaseModelForbidExtra):
"""Model for representing exon coordinate data"""

ord: StrictInt = Field(..., description="Exon number. 0-based.")
Expand Down Expand Up @@ -527,7 +527,7 @@ async def genomic_to_tx_segment(

async def _get_all_exon_coords(
self, tx_ac: str, genomic_ac: str | None = None
) -> list[ExonCoord]:
) -> list[_ExonCoord]:
"""Get all exon coordinate data for a transcript.
If ``genomic_ac`` is NOT provided, this method will use the GRCh38 accession
Expand Down Expand Up @@ -563,15 +563,15 @@ async def _get_all_exon_coords(
""" # noqa: S608

results = await self.uta_db.execute_query(query)
return [ExonCoord(**r) for r in results]
return [_ExonCoord(**r) for r in results]

async def _get_start_end_exon_coords(
self,
tx_ac: str,
exon_start: int | None = None,
exon_end: int | None = None,
genomic_ac: str | None = None,
) -> tuple[ExonCoord | None, ExonCoord | None, list[str]]:
) -> tuple[_ExonCoord | None, _ExonCoord | None, list[str]]:
"""Get exon coordinates for a transcript given exon start and exon end.
If ``genomic_ac`` is NOT provided, this method will use the GRCh38 accession
Expand Down Expand Up @@ -609,8 +609,8 @@ async def _get_start_end_exon_coords(
async def _get_alt_ac_start_and_end(
self,
tx_ac: str,
tx_exon_start: ExonCoord | None = None,
tx_exon_end: ExonCoord | None = None,
tx_exon_start: _ExonCoord | None = None,
tx_exon_end: _ExonCoord | None = None,
gene: str | None = None,
) -> tuple[tuple[tuple[int, int], tuple[int, int]] | None, str | None]:
"""Get aligned genomic coordinates for transcript exon start and end.
Expand Down Expand Up @@ -948,7 +948,7 @@ def _get_tx_segment(
genomic_ac: str,
strand: Strand,
offset: int,
genomic_ac_data: ExonCoord,
genomic_ac_data: _ExonCoord,
is_seg_start: bool = False,
) -> tuple[TxSegment | None, str | None]:
"""Get transcript segment data given ``genomic_ac`` and offset data
Expand Down Expand Up @@ -1153,7 +1153,7 @@ def _get_exon_offset(

@staticmethod
def _get_adjacent_exon(
tx_exons_genomic_coords: list[ExonCoord],
tx_exons_genomic_coords: list[_ExonCoord],
strand: Strand,
start: int | None = None,
end: int | None = None,
Expand Down Expand Up @@ -1191,7 +1191,7 @@ def _get_adjacent_exon(
return exon.ord if end else exon.ord + 1

@staticmethod
def _is_exonic_breakpoint(pos: int, tx_genomic_coords: list[ExonCoord]) -> bool:
def _is_exonic_breakpoint(pos: int, tx_genomic_coords: list[_ExonCoord]) -> bool:
"""Check if a breakpoint occurs on an exon
:param pos: Genomic breakpoint
Expand Down
54 changes: 27 additions & 27 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import pytest

from cool_seq_tool import CoolSeqTool
from cool_seq_tool.mappers.exon_genomic_coords import ExonCoord
from cool_seq_tool.mappers.exon_genomic_coords import _ExonCoord
from cool_seq_tool.schemas import ManeGeneData, Strand
from cool_seq_tool.sources.uta_database import GenomicAlnData, GenomicTxMetadata

Expand Down Expand Up @@ -52,79 +52,79 @@ def test_mane_transcript_mappings(test_cool_seq_tool):
def nm_152263_exons():
"""Create test fixture for NM_152263.3 exons."""
return [
ExonCoord(
_ExonCoord(
ord=0,
tx_start_i=0,
tx_end_i=234,
alt_start_i=154191901,
alt_end_i=154192135,
alt_strand=Strand.NEGATIVE,
),
ExonCoord(
_ExonCoord(
ord=1,
tx_start_i=234,
tx_end_i=360,
alt_start_i=154191185,
alt_end_i=154191311,
alt_strand=Strand.NEGATIVE,
),
ExonCoord(
_ExonCoord(
ord=2,
tx_start_i=360,
tx_end_i=494,
alt_start_i=154176114,
alt_end_i=154176248,
alt_strand=Strand.NEGATIVE,
),
ExonCoord(
_ExonCoord(
ord=3,
tx_start_i=494,
tx_end_i=612,
alt_start_i=154173083,
alt_end_i=154173201,
alt_strand=Strand.NEGATIVE,
),
ExonCoord(
_ExonCoord(
ord=4,
tx_start_i=612,
tx_end_i=683,
alt_start_i=154172907,
alt_end_i=154172978,
alt_strand=Strand.NEGATIVE,
),
ExonCoord(
_ExonCoord(
ord=5,
tx_start_i=683,
tx_end_i=759,
alt_start_i=154171412,
alt_end_i=154171488,
alt_strand=Strand.NEGATIVE,
),
ExonCoord(
_ExonCoord(
ord=6,
tx_start_i=759,
tx_end_i=822,
alt_start_i=154170648,
alt_end_i=154170711,
alt_strand=Strand.NEGATIVE,
),
ExonCoord(
_ExonCoord(
ord=7,
tx_start_i=822,
tx_end_i=892,
alt_start_i=154170399,
alt_end_i=154170469,
alt_strand=Strand.NEGATIVE,
),
ExonCoord(
_ExonCoord(
ord=8,
tx_start_i=892,
tx_end_i=971,
alt_start_i=154169304,
alt_end_i=154169383,
alt_strand=Strand.NEGATIVE,
),
ExonCoord(
_ExonCoord(
ord=9,
tx_start_i=971,
tx_end_i=7099,
Expand All @@ -139,79 +139,79 @@ def nm_152263_exons():
def nm_152263_exons_genomic_coords():
"""Create test fixture for NM_152263.4 exons and genomic coordinates."""
return [
ExonCoord(
_ExonCoord(
ord=0,
tx_start_i=0,
tx_end_i=199,
alt_start_i=154191901,
alt_end_i=154192100,
alt_strand=Strand.NEGATIVE,
),
ExonCoord(
_ExonCoord(
ord=1,
tx_start_i=199,
tx_end_i=325,
alt_start_i=154191185,
alt_end_i=154191311,
alt_strand=Strand.NEGATIVE,
),
ExonCoord(
_ExonCoord(
ord=2,
tx_start_i=325,
tx_end_i=459,
alt_start_i=154176114,
alt_end_i=154176248,
alt_strand=Strand.NEGATIVE,
),
ExonCoord(
_ExonCoord(
ord=3,
tx_start_i=459,
tx_end_i=577,
alt_start_i=154173083,
alt_end_i=154173201,
alt_strand=Strand.NEGATIVE,
),
ExonCoord(
_ExonCoord(
ord=4,
tx_start_i=577,
tx_end_i=648,
alt_start_i=154172907,
alt_end_i=154172978,
alt_strand=Strand.NEGATIVE,
),
ExonCoord(
_ExonCoord(
ord=5,
tx_start_i=648,
tx_end_i=724,
alt_start_i=154171412,
alt_end_i=154171488,
alt_strand=Strand.NEGATIVE,
),
ExonCoord(
_ExonCoord(
ord=6,
tx_start_i=724,
tx_end_i=787,
alt_start_i=154170648,
alt_end_i=154170711,
alt_strand=Strand.NEGATIVE,
),
ExonCoord(
_ExonCoord(
ord=7,
tx_start_i=787,
tx_end_i=857,
alt_start_i=154170399,
alt_end_i=154170469,
alt_strand=Strand.NEGATIVE,
),
ExonCoord(
_ExonCoord(
ord=8,
tx_start_i=857,
tx_end_i=936,
alt_start_i=154169304,
alt_end_i=154169383,
alt_strand=Strand.NEGATIVE,
),
ExonCoord(
_ExonCoord(
ord=9,
tx_start_i=936,
tx_end_i=7064,
Expand All @@ -226,47 +226,47 @@ def nm_152263_exons_genomic_coords():
def nm_001105539_exons_genomic_coords():
"""Create test fixture for NM_001105539.3 exons and genomic coordinates."""
return [
ExonCoord(
_ExonCoord(
ord=0,
tx_start_i=0,
tx_end_i=1557,
alt_start_i=80486225,
alt_end_i=80487782,
alt_strand=Strand.NEGATIVE,
),
ExonCoord(
_ExonCoord(
ord=1,
tx_start_i=1557,
tx_end_i=2446,
alt_start_i=80499493,
alt_end_i=80500382,
alt_strand=Strand.NEGATIVE,
),
ExonCoord(
_ExonCoord(
ord=2,
tx_start_i=2446,
tx_end_i=2545,
alt_start_i=80513909,
alt_end_i=80514008,
alt_strand=Strand.NEGATIVE,
),
ExonCoord(
_ExonCoord(
ord=3,
tx_start_i=2545,
tx_end_i=2722,
alt_start_i=80518402,
alt_end_i=80518579,
alt_strand=Strand.NEGATIVE,
),
ExonCoord(
_ExonCoord(
ord=4,
tx_start_i=2722,
tx_end_i=2895,
alt_start_i=80518781,
alt_end_i=80518954,
alt_strand=Strand.NEGATIVE,
),
ExonCoord(
_ExonCoord(
ord=5,
tx_start_i=2895,
tx_end_i=9938,
Expand Down
Loading

0 comments on commit 9967ccf

Please sign in to comment.