Skip to content

Commit

Permalink
Move assert to GeneticMap class
Browse files Browse the repository at this point in the history
  • Loading branch information
szhan committed Jan 14, 2024
1 parent 22e1cb7 commit 274e341
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions python/tests/beagle_numba.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@ class GeneticMap:
gen_pos: np.ndarray

def __post_init__(self):
assert len(self.base_pos) == len(self.gen_pos)
assert len(self.base_pos) == len(
self.gen_pos
), "Lists of physical positions and genetic map positions differ in length."
assert (
self.base_pos[1:] > self.base_pos[:-1]
), "Physical positions not in strict ascending order."


def convert_to_genetic_map_positions(pos, genetic_map=None):
Expand Down Expand Up @@ -66,8 +71,6 @@ def convert_to_genetic_map_positions(pos, genetic_map=None):
left_idx[i]
] # Genetic map position at right of marker i.
assert pos[i] >= a, f"Query position not >= left-bound position: {pos[i]}, {a}."
# TODO: Assert when instantiating GeneticMap.
assert b > a, f"Physical positions not in strict ascending order: {b}, {a}."
assert (
fb >= fa
), f"Genetic map positions not in monotonically ascending order: {fb}, {fa}."
Expand Down

0 comments on commit 274e341

Please sign in to comment.