Esempio n. 1
0
def _examine(V1, V2, variants, logprior=None, _calc_lh=None):
    E, Es = lh.calc_lh(
        *[
            common.convert_variant_dict_to_tuple(V)
            for V in (variants[V1], variants[V2])
        ], _calc_lh)
    Es -= np.max(Es, axis=1)[:, None]
    sep = np.nan * np.ones(len(variants[V1]['var_reads']))[:, None]
    persamp = np.hstack((
        variants[V1]['var_reads'][:, None],
        variants[V1]['total_reads'][:, None],
        variants[V1]['vaf'][:, None],
        variants[V1]['omega_v'][:, None],
        variants[V1]['vaf'][:, None] / variants[V1]['omega_v'][:, None],
        sep,
        variants[V2]['var_reads'][:, None],
        variants[V2]['total_reads'][:, None],
        variants[V2]['vaf'][:, None],
        variants[V2]['omega_v'][:, None],
        variants[V2]['vaf'][:, None] / variants[V2]['omega_v'][:, None],
        sep,
        Es,
    ))

    post = _calc_posterior(E, _complete_logprior(logprior))
    return (persamp, E, post)
Esempio n. 2
0
def _calc_lh_and_posterior(V1, V2, logprior):
    evidence, evidence_per_sample = lh.calc_lh(V1, V2)
    posterior = _calc_posterior(evidence, logprior)
    return (evidence, posterior)