Skip to content

Commit

Permalink
rm zero based
Browse files Browse the repository at this point in the history
  • Loading branch information
korikuzma committed Dec 26, 2023
1 parent aad58d3 commit 589a6b1
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 12 deletions.
10 changes: 5 additions & 5 deletions cool_seq_tool/mappers/mane_transcript.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
1 change: 0 additions & 1 deletion cool_seq_tool/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ class ResidueMode(str, Enum):
INTER_RESIDUE | 0 | | 1 | | 2 | | 3 |
"""

ZERO = "zero"
RESIDUE = "residue"
INTER_RESIDUE = "inter-residue"

Expand Down
2 changes: 0 additions & 2 deletions cool_seq_tool/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
4 changes: 0 additions & 4 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 589a6b1

Please sign in to comment.