From 01af015cf029d92079baf1b584ec7956f250e42c Mon Sep 17 00:00:00 2001 From: Ben Jeffery Date: Mon, 31 Oct 2022 16:29:33 +0000 Subject: [PATCH] Add ancestral allele --- tsinfer/formats.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tsinfer/formats.py b/tsinfer/formats.py index 95c11a26..8d1081c1 100644 --- a/tsinfer/formats.py +++ b/tsinfer/formats.py @@ -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"]