Skip to content

Commit

Permalink
Merge pull request #91 from szhan/move_assertations_up
Browse files Browse the repository at this point in the history
Switch order of checks
  • Loading branch information
szhan authored Jun 7, 2023
2 parents b4b34f5 + 7dd66bc commit 6db01a9
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,16 +199,16 @@ def make_compatible_samples(
if not isinstance(ts, tskit.TreeSequence):
raise TypeError(f"ts must be a TreeSequence object.")

# Check all sites in ts are biallelic.
for v in ts.variants():
if len(set(v.alleles) - {None}) != 2:
raise ValueError(f"All sites in ts must be biallelic.")

# Check all sites in sd are mono- or biallelic.
for v in sd.variants():
if len(set(v.alleles) - {None}) > 2:
raise ValueError(f"All sites in sd must be mono- or biallelic.")

# Check all sites in ts are biallelic.
for v in ts.variants():
if len(set(v.alleles) - {None}) != 2:
raise ValueError(f"All sites in ts must be biallelic.")

sd_site_pos = sd.sites_position[:]
ts_site_pos = ts.sites_position
all_site_pos = sorted(set(sd_site_pos).union(set(ts_site_pos)))
Expand Down

0 comments on commit 6db01a9

Please sign in to comment.