tracts.demography.demographic_model
Functions
|
Classes
|
- class tracts.demography.demographic_model.DemographicModel(mig, max_remaining_tracts=1e-05, max_morgans=100)
Bases:
object- Z(L, pop)
The normalizing factor, to ensure that the tract density is 1.
- __init__(mig, max_remaining_tracts=1e-05, max_morgans=100)
A migratory model.
- Parameters:
mig – An array containing the migration proportions from a discrete number of populations over the last generations. Each row is a time, each column is a population. row zero corresponds to the current generation. The migration rate at the last generation
mig[-1,:]is the “founding generation” and should sum up to 1. Assumes that non-admixed individuals have been removed.max_remaining_tracts – The proportion of tracts that are allowed to be incomplete after cutoff Lambda (see Appendix 2 in Gravel (2012): doi: 10.1534/genetics.112.139808).
max_morgans – Used to impose a cutoff to the number of Markov transitions. If the simulated morgan lengths of tracts in an infinite genome is more than max_morgans, issue a warning and stop generating new transitions.
- expectperbin(Ls, pop, bins)
The expected number of tracts per bin for a diploid individual with distribution of chromosome lengths given by Ls. The bin should be a list with n+1 breakpoints for n bins. We will always add an extra value for the full chromosomes as an extra bin at the end. The last bin should not go beyond the end of the longest chromosome. For now, perform poor man’s integral by using the bin midpoint value times width.
- full(L, pop)
The expected fraction of full-chromosome tracts, p. 63 May 24, 2011.
- gen_variance(popnum)
Calculates (i) the expected genealogy variance in the model, (ii) the e(d) (equation 3 in MOLA (Models of Local Ancestry) paper) and (iii) the generations go from 0 to
self.ngen-1.
- inners(L, x, pop)
Calculates the length distribution of tract lengths not hitting a chromosome edge.
- loglik(bins, Ls, data, num_samples, cutoff=0)
Calculates the maximum-likelihood in a Poisson Random Field. Last bin of data is the number of whole-chromosome.
- loglik_biascorrect(bins, Ls, data, nsamp, cutoff=0, biascorrect=True)
Calculates the maximum-likelihood in a Poisson Random Field. Last bin of data is the number of whole-chromosome. Compares the model to the first bins, and simulates the addition (or removal) of the corresponding tracts.
- outers(L, x, pop)
Calculates the length distribution of tract lengths hitting a single chromosome edge.
- plot_model_data(Ls, bins, data, nsamp, pop, colordict)
- popNdist(pop)
Calculates the distribution of number of steps before exiting population.
- random_realization(Ls, bins, nind)
- switchdensity()
Calculates the density of ancestry switchpoints per morgan in our model.
- uniformizemat()
Uniformizes the transition matrix so that each state has the same total transition rate.
- tracts.demography.demographic_model.Erlang(i, x, T)