Skip to content

Commit

Permalink
Expose precision
Browse files Browse the repository at this point in the history
  • Loading branch information
szhan committed Dec 18, 2023
1 parent e7fd7ed commit 3c6a546
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions python/tests/beagle_numba.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ def run_beagle(ref_h, query_h, pos, miscall_rate=1e-4, ne=1e6, genetic_map=None)
return (imputed_alleles, max_allele_prob)


def run_tsimpute(ref_ts, query_h, pos, mu, rho, genetic_map=None):
def run_tsimpute(ref_ts, query_h, pos, mu, rho, precision=22, genetic_map=None):
"""
Run the BEAGLE 4.1 algorithm except that the forward and backward probability
matrices are computed from a tree sequence.
Expand All @@ -381,6 +381,7 @@ def run_tsimpute(ref_ts, query_h, pos, mu, rho, genetic_map=None):
:param numpy.ndarray pos: Site positions of all the markers.
:param numpy.ndarray mu: Mutation rate.
:param numpy.ndarray rho: Recombination rate.
:param int precision: Precision when running LS HMM (default = 22).
:param msprime.RateMap genetic_map: Genetic map.
:return: Imputed alleles and their associated probabilities.
:rtype: tuple(numpy.ndarray, numpy.ndarray)
Expand Down Expand Up @@ -410,7 +411,11 @@ def run_tsimpute(ref_ts, query_h, pos, mu, rho, genetic_map=None):
fm = _tskit.CompressedMatrix(ref_ts_genotyped._ll_tree_sequence)
bm = _tskit.CompressedMatrix(ref_ts_genotyped._ll_tree_sequence)
ls_hmm = _tskit.LsHmm(
ref_ts_genotyped._ll_tree_sequence, mu, rho, acgt_alleles=True
ref_ts_genotyped._ll_tree_sequence,
mu,
rho,
acgt_alleles=True,
precision=precision,
)
ls_hmm.forward_matrix(query_h_genotyped.T, fm)
ls_hmm.backward_matrix(query_h_genotyped.T, fm.normalisation_factor, bm)
Expand Down

0 comments on commit 3c6a546

Please sign in to comment.