Skip to content

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.

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

Source code in dadi/__init__.py
61
62
63
64
65
66
67
68
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))

citation()

Print citation information for dadi codebase.

Source code in dadi/__init__.py
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
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 
""")

cuda_enabled(toggle=None)

Enable or disable cuda execution

Source code in dadi/__init__.py
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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")

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

Source code in dadi/__init__.py
52
53
54
55
56
57
58
59
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