admix.data.af_per_anc#

admix.data.af_per_anc(geno, lanc, n_anc=2, return_nhaplo=False) ndarray | Tuple[ndarray, ndarray][source]#

Calculate allele frequency per ancestry

If at one particular SNP locus, no SNP from one particular ancestry can be found the corresponding entries will be filled with np.NaN.

Parameters:
  • geno (np.ndarray) – genotype matrix

  • lanc (np.ndarray) – local ancestry matrix

  • n_anc (int) – number of ancestries

  • return_nhaplo (bool) – whether to return the number of haplotypes per ancestry

Returns:

np.ndarray – (n_snp, n_anc) length list of allele frequencies.