INNER CODE UNIT · Python
p_err
wheaton5/souporcell · consensus.py:132
p_err = average_allele_expression[locus][1]/(average_allele_expression[locus][1] + average_allele_expression[locus][2]);
p_err = fmax(.01,fmin(.99,p_err));
hom_ref = binomial_lpmf(cluster_allele_counts[locus][cluster][1] | depth, p_hom_ref);
hom_alt = binomial_lpmf(cluster_allele_counts[locus][cluster][2] | depth, p_hom_alt);
het = binomial_lpmf(cluster_allele_counts[locus][cluster][1] | depth, p_het_ref);
err[locus] += neg_log_3 + depth*logp_base_correct + binomial_lpmf(cluster_allele_counts[locus][cluster][1] | depth, p_err);
genotypes[locus][cluster][1] = hom_ref + neg_log_3;
genotypes[locus][cluster][2] = hom_alt + neg_log_3;
if (ploidy == 2) {
genotypes[locus][cluster][3] = het + neg_log_3;
}
truth[locus] += log_sum_exp(genotypes[locus][cluster]);
}
truth[locus] += tp_prior;
err[locus] += fp_prior;
}
}
"""