Cache1D_mod
Initially developed by Bernard Kim and published as fitdadi. Kim, Huber, Lohmueller (2017) Genetics. Modified version of the script found at: https://doi.org/10.1534/genetics.116.197145. Based on scripts from: https://groups.google.com/forum/#!topic/dadi-user/4xspqlITcvc.
Cache1D(params, ns, demo_sel_func, pts, gamma_bounds=(0.0001, 2000), gamma_pts=500, additional_gammas=[], cpus=None, gpus=0, verbose=False)
Initialize the Cache1D object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
tuple
|
Optimized demographic parameters. |
required |
ns
|
tuple
|
Sample size(s) for cached spectra. |
required |
demo_sel_func
|
function
|
dadi demographic function with selection. Gamma must be the last argument. |
required |
pts
|
tuple
|
Integration/extrapolation grid points settings for demo_sel_func. |
required |
gamma_bounds
|
tuple
|
Range of gammas to cache spectra for. Defaults to (1e-4, 2000). |
(0.0001, 2000)
|
gamma_pts
|
int
|
Number of gamma grid points over which to integrate. Defaults to 500. |
500
|
additional_gammas
|
list
|
Additional positive values of gamma to cache for. Defaults to []. |
[]
|
cpus
|
int
|
Number of CPU jobs to launch for multiprocessing. Defaults to None. |
None
|
gpus
|
int
|
Number of GPU jobs to launch for multiprocessing. Defaults to 0. |
0
|
verbose
|
bool
|
If True, print messages to track progress of cache generation. Defaults to False. |
False
|
Source code in dadi/DFE/Cache1D_mod.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | |
integrate(params, ns, sel_dist, theta, pts=None, exterior_int=True)
Integrate spectra over a univariate probability distribution for negative gammas.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
tuple
|
Parameters for sel_dist. |
required |
ns
|
tuple
|
Ignored. Will be retrieved from original caching. |
required |
sel_dist
|
function
|
Univariate probability distribution, taking in arguments (xx, params). |
required |
theta
|
float
|
Population-scaled mutation rate. |
required |
pts
|
tuple
|
Ignored. Defaults to None, will use pts from original caching. |
None
|
exterior_int
|
bool
|
If False, do not integrate outside sampled domain. Defaults to True. |
True
|
Returns:
| Name | Type | Description |
|---|---|---|
fs |
Spectrum
|
Integrated spectrum. |
Source code in dadi/DFE/Cache1D_mod.py
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 | |
integrate_point_pos(params, ns, sel_dist, theta, demo_sel_func=None, Npos=1, pts=None, exterior_int=True)
Integrate spectra over a univariate probability distribution for negative gammas, plus one or more point masses of positive selection.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
params
|
tuple
|
Parameters. The last Npos*2 are assumed to be the proportion of positive selection and the gamma for each point mass, in the order (ppos1, gammapos1, ppos2, gammapos2, ...). The remaining parameters are for the continuous point mass. |
required |
ns
|
tuple
|
Ignored. Will be retrieved from original caching. |
required |
sel_dist
|
function
|
Univariate probability distribution, taking in arguments (xx, params). |
required |
theta
|
float
|
Population-scaled mutation rate. |
required |
demo_sel_func
|
function
|
DaDi demographic function with selection. Defaults to None. |
None
|
Npos
|
int
|
Number of positive point masses to model. Defaults to 1. |
1
|
pts
|
tuple
|
Ignored. Defaults to None and will use pts from original caching. |
None
|
exterior_int
|
bool
|
If False, do not integrate outside sampled domain. Defaults to True. |
True
|
Returns:
| Name | Type | Description |
|---|---|---|
fs |
Spectrum
|
Integrated spectrum. |
Source code in dadi/DFE/Cache1D_mod.py
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | |