From 589a6b1ddf0d63f3901b661b59f2fb7de883ad43 Mon Sep 17 00:00:00 2001 From: korikuzma Date: Tue, 26 Dec 2023 08:50:49 -0500 Subject: [PATCH] rm zero based --- cool_seq_tool/mappers/mane_transcript.py | 10 +++++----- cool_seq_tool/schemas.py | 1 - cool_seq_tool/utils.py | 2 -- tests/test_utils.py | 4 ---- 4 files changed, 5 insertions(+), 12 deletions(-) diff --git a/cool_seq_tool/mappers/mane_transcript.py b/cool_seq_tool/mappers/mane_transcript.py index ea7aad27..6a362062 100644 --- a/cool_seq_tool/mappers/mane_transcript.py +++ b/cool_seq_tool/mappers/mane_transcript.py @@ -174,7 +174,9 @@ async def _c_to_g(self, ac: str, pos: Tuple[int, int]) -> Optional[Dict]: if not self.transcript_mappings.ensembl_transcript_version_to_gene_symbol.get( ac ): - if not self.seqrepo_access.get_reference_sequence(ac, start=1, end=1)[0]: + if not self.seqrepo_access.get_reference_sequence(ac, start=1, end=1)[ + 0 + ]: logger.warning(f"Ensembl transcript not found: {ac}") return None @@ -508,9 +510,7 @@ def _validate_index( end_pos = pos[1] + coding_start_site if self.seqrepo_access.get_reference_sequence( ac, start=start_pos, end=end_pos, residue_mode=ResidueMode.INTER_RESIDUE - )[ - 0 - ]: + )[0]: return True else: return False @@ -808,7 +808,7 @@ async def get_mane_transcript( gene: Optional[str] = None, ref: Optional[str] = None, try_longest_compatible: bool = False, - residue_mode: Union[ResidueMode.RESIDUE, ResidueMode.INTER_RESIDUE] = ResidueMode.RESIDUE, + residue_mode: ResidueMode = ResidueMode.RESIDUE, ) -> Optional[Union[DataRepresentation, CdnaRepresentation]]: """Return mane transcript. diff --git a/cool_seq_tool/schemas.py b/cool_seq_tool/schemas.py index fae6162c..9a158fe3 100644 --- a/cool_seq_tool/schemas.py +++ b/cool_seq_tool/schemas.py @@ -56,7 +56,6 @@ class ResidueMode(str, Enum): INTER_RESIDUE | 0 | | 1 | | 2 | | 3 | """ - ZERO = "zero" RESIDUE = "residue" INTER_RESIDUE = "inter-residue" diff --git a/cool_seq_tool/utils.py b/cool_seq_tool/utils.py index 130e395c..009052b1 100644 --- a/cool_seq_tool/utils.py +++ b/cool_seq_tool/utils.py @@ -21,8 +21,6 @@ def get_inter_residue_pos( """ if residue_mode == ResidueMode.RESIDUE: start_pos -= 1 - elif residue_mode == ResidueMode.ZERO: - end_pos += 1 return start_pos, end_pos diff --git a/tests/test_utils.py b/tests/test_utils.py index fa4e3396..5db6250a 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -6,8 +6,6 @@ def test_get_inter_residue_pos(): """Test that get_inter_residue_pos function works correctly""" expected = (599, 600) - resp = get_inter_residue_pos(599, 599, ResidueMode.ZERO) - assert resp == expected resp = get_inter_residue_pos(600, 600, ResidueMode.RESIDUE) assert resp == expected @@ -16,8 +14,6 @@ def test_get_inter_residue_pos(): assert resp == expected expected = (746, 751) - resp = get_inter_residue_pos(746, 750, ResidueMode.ZERO) - assert resp == expected resp = get_inter_residue_pos(747, 751, ResidueMode.RESIDUE) assert resp == expected