cointf¶
Fast, exact likelihoods for the Housworth–Stahl model of crossover interference.
cointf is a Python package with an R interface. It evaluates the likelihood of observed
crossover positions under a two-pathway model:
crossovers that obey interference (a gamma-type renewal process governed by \(\nu\)) and crossovers
that escape it (a Poisson process carrying a fraction \(p\) of all crossovers). It is built for
repeated evaluation inside optimisers and samplers, and for parameters that vary between meioses.
Contents¶
Page |
What it covers |
|---|---|
The generative model, the forward recursion for single meioses, and the \(O(n^3)\) recursion for phase-unknown (quartet) data |
|
Data format, pooled and per-meiosis parameters, kernels, quartets and simulation |
|
How the series are truncated, the Chebyshev kernel, how correctness is tested, and benchmarks |
|
Installing the R package, how it finds Python, data conversion, an R maximum-likelihood fit |
|
Estimating \(\nu\) and \(p\) from a dataset, with standard errors and a likelihood surface |
|
Every public class and function, with parameters, return values and examples |
|
Every function in the R package, generated from its help pages |
Installation¶
cointf is installed from a clone of the GitHub repository, not from PyPI or CRAN.
git clone https://github.com/aabiddanda/cointf.git && cd cointf
pip install . # Python
R CMD INSTALL r # R (needs the reticulate package); see "Using cointf from R"
At a glance¶
from cointf import Meioses, loglik_fast, simulate_meioses
data = simulate_meioses(L=1.5, nu=4.0, p=0.05, n=200, seed=7) # positions in Morgans
mz = Meioses(data, 1.5) # prepare once
loglik_fast(mz, None, nu=4.0, p=0.05) # evaluate many times
Function |
Purpose |
|---|---|
|
Exact log-likelihood of single meioses (vectorised) |
|
Log-likelihood of phase-unknown data: crossovers of two meioses pooled |
|
Faster approximate kernel for either likelihood (errors ~1e-14 to 3e-12 in the log kernel terms) |
|
Slow reference implementations used for validation |
|
Simulation from the same model |
The R functions have the same names and arguments (meioses() and chebyshev_kernel() stand in
for Meioses and ChebyshevKernel); see Using cointf from R.
Conventions¶
Positions and lengths are in Morgans (1 M = 100 cM), not base pairs.
A “meiosis” is one chromosome in one gamete. The expected number of crossovers per meiosis is \(L\), for every \((\nu, p)\).
\(\nu = 1\) means no interference; \(\nu > 1\) means positive interference. \(p = 0\) is the pure interference model and \(p = 1\) a Poisson process.