Package dadi

For examples of dadi's usage, see the examples directory in the source distribution.

Documentation of all methods can be found in doc/api/index.html of the source distribution.

Sub-modules

dadi.DFE

Fitting Distributions of Fitness Effects to population genomic data, both single-population and joint.

dadi.Demes
dadi.Demographics1D

Single population demographic models.

dadi.Demographics2D

Two population demographic models.

dadi.Demographics3D

Three population demographic models.

dadi.Godambe

Parameter uncertainties and likelihood ratio tests using Godambe information.

dadi.Inference

Comparison and optimization of model spectra to data.

dadi.Integration

Functions for integrating population frequency spectra.

dadi.LowPass
dadi.Misc

Miscellaneous utility functions. Including ms simulation.

dadi.NLopt_mod
dadi.Numerics

Numerically useful functions, including extrapolation and default grid.

dadi.PhiManip

Manipulating population frequency spectra phi. e.g. population splittings and admixture

dadi.Plotting

Routines for Plotting comparisons between model and data …

dadi.Polyploidy

Modeling polyploid populations.

dadi.PortikModels
dadi.Spectrum_mod

Contains Spectrum object, which represents frequency spectra.

dadi.Triallele

Modeling triallelic data.

dadi.TwoLocus

Fitting models to data summarized by pairs of loci, incorporating both allele frequencies and linkage disequilibrium

dadi.integration_c
dadi.tridiag_cython

Functions

def RAM_to_pts(RAM, P)
Expand source code
def RAM_to_pts(RAM, P):
    """
    Approximate maximum grid points given the number of populations and available RAM

    pts: Grid points setting
    P: Number of populations
    """
    return int((RAM*1024**3/(8*4))**(1./P))

Approximate maximum grid points given the number of populations and available RAM

pts: Grid points setting P: Number of populations

def citation()
Expand source code
def citation():
    """
    Print citation information for dadi codebase.
    """
    print("""
If you find dadi useful in your research, please cite:
RN Gutenkunst, RD Hernandez, SH Williamson, CD Bustamante "Inferring the joint demographic history of multiple populations from multidimensional SNP data" PLoS Genetics 5:e1000695 (2009)

If you find the Godambe Information Matrix methods useful, please cite:
AJ Coffman, P Hsieh, S Gravel, RN Gutenkunst "Computationally efficient composite likelihood statistics for demographic inference" Molecular Biology and Evolution 33:591 (2016)

If you find the DFE inference methods useful, please cite:
BY Kim, CD Huber, KE Lohmueller "Inference of the Distribution of Selection Coefficients for New Nonsynonymous Mutations Using Large Samples" Genetics 206:345 (2017)

If you find the triallelic methods useful, please cite:
AP Ragsdale, AJ Coffman, P Hsieh, TJ Struck, RN Gutenkunst "Triallelic population genomics for inferring correlated fitness effects of same site nonsynonymous mutations" Genetics 203:513 (2016)

If you find the two-locus methods useful, please cite:
AP Ragsdale, RN Gutenkunst "Inferring demographic history using two-locus statistics" Genetics 206:1037 (2017)

If you use a Portik model from PortikModels, please cite:
Portik, DM, Leaché, AD, Rivera, D, et al. Evaluating mechanisms of diversification in a Guineo-Congolian tropical forest frog using demographic model selection. Mol Ecol. 2017; 26: 5245–5263. https://doi.org/10.1111/mec.14266 
""")

Print citation information for dadi codebase.

def cuda_enabled(toggle=None)
Expand source code
def cuda_enabled(toggle=None):
    """
    Enable or disable cuda execution
    """
    if toggle is None:
        return Integration.cuda_enabled
    elif toggle == True:
        try:
            from . import cuda
            Integration.cuda_enabled = True
            return True
        except:
            print("Failed to import dadi.cuda")
            return False
    elif toggle == False:
        Integration.cuda_enabled = False
        return False
    else:
        raise ValueError("toggle must be True, False, or None")

Enable or disable cuda execution

def pts_to_RAM(pts, P)
Expand source code
def pts_to_RAM(pts, P):
    """
    Approximate RAM usage for a given grid points and number of populations 

    pts: Grid points setting
    P: Number of populations
    """
    return 8*4*pts**P / 1024**3

Approximate RAM usage for a given grid points and number of populations

pts: Grid points setting P: Number of populations