astheeggeggs / lshmm

code to run Li and Stephens
MIT License
3 stars 3 forks source link

Better high-level interface #12

Closed jeromekelleher closed 2 months ago

jeromekelleher commented 2 years ago

What are the fundamental things we provide?

def forwards(reference_panel, query, *, recombination_rate=None, mutation_rate=None):
     ploidy = len(reference_panel.shape))
     if ploidy not in (2, 3):
         raise ValueError("no way man")
     if len(query.dims) != ploidy:
         raise ValueError("mismatch between 
    # etc
astheeggeggs commented 2 years ago

Partially resolved. There's a slight wrinkle in the choice of passing a scalar vs vector for mutation rate.

astheeggeggs commented 11 months ago

Scalar and vector mutation probabilities are now dealt with appropriately I think. @szhan does that seem right, based on what you've been doing and the edits you've made?

szhan commented 3 months ago

Ah, oops, sorry that I missed this ping. I'll see if I can address this as I refactor the haploid LS HMM code.

szhan commented 2 months ago

So, just to recap, these are the main API functions.

def forwards(
    reference_panel,
    query,
    prob_recombination,
    *,
    prob_mutation=None,
    alleles=None,
    scale_mutation_rate=None,
    normalise=None,
):
   pass

def backwards(
    reference_panel,
    query,
    normalisation_factor_from_forward,
    prob_recombination,
    *,
    prob_mutation=None,
    alleles=None,
    scale_mutation_rate=None,
):
   pass

def viterbi(
    reference_panel,
    query,
    prob_recombination,
    *,
    prob_mutation=None,
    alleles=None,
    scale_mutation_rate=None,
):
   pass

def path_loglik(
    reference_panel,
    query,
    path,
    prob_recombination,
    *,
    prob_mutation=None,
    alleles=None,
    scale_mutation_rate=None,
):
    pass
szhan commented 2 months ago

I've updated the above. I'm addressing this issue while fixing #37.

szhan commented 2 months ago

I think this is addressed by #37 ?