Skip to content

Commit

Permalink
get_genes return one gene if begin==end
Browse files Browse the repository at this point in the history
  • Loading branch information
jpjarnoux committed Jun 11, 2024
1 parent bf44030 commit b9a542c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ppanggolin/genome.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ def get_genes(self, begin: int = 0, end: int = None, outrange_ok: bool = False)
raise TypeError(f"Expected type int for 'begin' and 'end', "
f"but received types '{type(begin)}' and '{type(end)}'.")

if begin >= end:
if begin > end:
raise ValueError("The 'begin' position must be less than the 'end' position.")

if end > self._genes_position[-1].position:
Expand All @@ -603,7 +603,10 @@ def get_genes(self, begin: int = 0, end: int = None, outrange_ok: bool = False)
if end == self._genes_position[-1].position:
return self._genes_position[begin:]
else:
return self._genes_position[begin: end]
if begin == end:
return self._genes_position[begin]
else:
return self._genes_position[begin: end]

@property
def number_of_genes(self) -> int:
Expand Down

0 comments on commit b9a542c

Please sign in to comment.