Skip to content

Commit

Permalink
Add ancestral allele
Browse files Browse the repository at this point in the history
  • Loading branch information
benjeffery committed Oct 31, 2022
1 parent 9927560 commit 01af015
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tsinfer/formats.py
Original file line number Diff line number Diff line change
Expand Up @@ -2289,6 +2289,15 @@ def sites_position(self):
def sites_alleles(self):
return self.data["variant_allele"]

@property
def sites_ancestral_allele(self):
try:
return self.data["sites/ancestral_allele"]
except KeyError:
# Maintains backwards compatibility: in previous tsinfer versions the
# ancestral allele was always the zeroth element in the alleles list
return np.zeros(self.num_sites, dtype=np.int8)

@property
def sites_genotypes(self):
gt = self.data["call_genotype"]
Expand Down

0 comments on commit 01af015

Please sign in to comment.