Module fwdpy11.conditional_models
#
Defining models with specific outcomes.
The API of this module may be subjet to change. Hence, the documentation is minimal.
- exception fwdpy11.conditional_models.AddMutationFailure#
- class fwdpy11.conditional_models.AlleleCount(count)#
Specify a number of copies of a mutation.
- Parameters:
count (int) – Initial number of copies of a mutation. This value must be > 0.
- count#
- class fwdpy11.conditional_models.AlleleCountRange(minimum, maximum)#
Specify a range for a number of copies of a mutation.
- Parameters:
- maximum#
- minimum#
- class fwdpy11.conditional_models.AncientSamplePolicy(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)#
When to record “preserved” or “ancient” samples:
- COMPLETION = 2#
Only record the generation when the terminiation condition is first met.
- DURATION = 1#
During the entire sojourn of the mutation from when it is first added to when the terminiation condition is first met.
- NEVER = 0#
Never.
- class fwdpy11.conditional_models.ConditionalModelOutput(*, pop, params, mutation_index, fixation_index, num_descendant_nodes)#
- fixation_index#
The index of the new mutation in pop.fixations
- mutation_index#
The index of the new mutation in pop.mutations
- num_descendant_nodes#
The number of alive nodes initially containing the new mutation
- params#
The evolved model parameters
- pop#
The population with the added mutation
- class fwdpy11.conditional_models.EvolveOptions(simplification_interval=100, suppress_table_indexing=True, record_gvalue_matrix=False, preserve_first_generation=False)#
Options to pass on too
fwdpy11.evolvets()
.- asdict()#
Return dict representation
- classmethod fromdict(d)#
Build an instance from a dictionary
- preserve_first_generation#
- record_gvalue_matrix#
- simplification_interval#
- suppress_table_indexing#
- class fwdpy11.conditional_models.FocalDemeFixation(deme)#
A terminiation condition checking for fixation in a specific deme.
- deme#
- class fwdpy11.conditional_models.FrequencyRange(minimum, maximum)#
Specify a range for the initial frequency of a mutation
- Parameters:
- maximum#
- minimum#
- class fwdpy11.conditional_models.GlobalFixation#
A terminiation condition monitoring for global fixation of the mutation.
- class fwdpy11.conditional_models.NewMutationParameters(*, deme=None, frequency, position, data)#
Details of a new mutation to add to a population.
Class instances are created via keyword arguments that become attribute names:
- Parameters:
deme (Optional[int]) – The id of the deme in which to add the mutation
frequency (Union[AlleleCount, AlleleCountRange, FrequencyRange]) – The frequency of the new mutation.
position (PositionRange) – Where to put the new mutation
data (
fwdpy11.NewMutationData
) – The specifics of the new mutation
- data#
- deme#
- frequency#
- position#
- exception fwdpy11.conditional_models.OutOfAttempts#
- class fwdpy11.conditional_models.PositionRange(*, left, right)#
Specify a half-open interval within which to place a mutation.
- Parameters:
- left#
- right#
- class fwdpy11.conditional_models.SimulationStatus(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)#
- Continue = 1#
- Restart = 0#
- Success = 2#
- fwdpy11.conditional_models.track_added_mutation(rng, pop, params, mutation_parameters, *, when=None, until=None, max_attempts=None, sampling_policy=None, stopping_condition=None, evolvets_options=None, return_when_stopping_condition_met=False)#
Track the fate of a specific mutation added to the population.
- Parameters:
rng (
fwdpy11.GSLrng
) – A random number generatorpop (
fwdpy11.DiploidPopulation
) – The input populationparams (
fwdpy11.ModelParams
) – Input simulation parametersmutation_parameters (
NewMutationParameters
) – Details of the new mutationwhen (int) – Time to add the new mutation
until (int) – Time stop monitoring the new mutation
max_attempts (int) – Maximum number of attempts to satisfy stopping_condition
sampling_policy (
AncientSamplePolicy
) – Enumeration specifying the recording of ancient samples.stopping_condition (Optional[Callable[ [fwdpy11.DiploidPopulation, int, Tuple[float, float, int]], SimulationStatus,]) – An optional callable that specifies a TODO
evolvets_options (
EvolveOptions
) – Options tofwdpy11.evolvets()
return_when_stopping_condition_met – If True, return to calling environment once stopping_condition is satisfied. If False, simulate to the end of the model.
- fwdpy11.conditional_models.selective_sweep(rng, pop, params, mutation_parameters, stopping_condition, **kwargs)#
This function is a wrapper around
fwdpy11.conditional_models.track_added_mutation()
.This function requires a stopping_condition. If when is not given as a keyword argument, it is assumed to be 0. The keyword argument until is not allowed.