Skip to content

Commit

Permalink
Merge pull request #92 from szhan/fix_get_examples_haploid
Browse files Browse the repository at this point in the history
Fix get_examples_haploid
  • Loading branch information
astheeggeggs authored Jun 17, 2024
2 parents 605b22a + 3ebdefe commit 97cff8a
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions tests/lsbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ def get_ancestral_haplotypes(self, ts):

# Prepare example reference panels and queries.
def get_examples_haploid(self, ts, include_ancestors):
ref_panel = ts.genotype_matrix()
num_sites = ref_panel.shape[0]
query1 = ref_panel[:, 0].reshape(1, num_sites)
query2 = ref_panel[:, -1].reshape(1, num_sites)
if include_ancestors:
ref_panel = self.get_ancestral_haplotypes(ts)
else:
ref_panel = ref_panel[:, 1:]
ref_panel = ts.genotype_matrix()
num_sites = ref_panel.shape[0]
# Take some haplotypes as queries from the reference panel.
query1 = ref_panel[:, 0].reshape(1, num_sites)
query2 = ref_panel[:, 1].reshape(1, num_sites)
# Create queries with MISSING.
query_miss_last = query1.copy()
query_miss_last[0, -1] = core.MISSING
Expand All @@ -79,6 +79,8 @@ def get_examples_haploid(self, ts, include_ancestors):
query_miss_most = query1.copy()
query_miss_most[0, 1:] = core.MISSING
queries = [query1, query2, query_miss_last, query_miss_mid, query_miss_most]
# Exclude the arbitrarily chosen queries from the reference panel.
ref_panel = ref_panel[:, 2:]
return ref_panel, queries

def get_examples_diploid(self, ts, include_ancestors):
Expand Down

0 comments on commit 97cff8a

Please sign in to comment.