dnadna.examples.one_event

An example msprime-based simulator with demographic parameters for a model with one population change event.

Module Attributes

ONE_EVENT_CONFIG_SCHEMA

Schema for configuring the OneEventSimulator.

Classes

OneEventSimulator([config, validate])

An example msprime-based simulator with demographic parameters for a model with one population change event.

dnadna.examples.one_event.ONE_EVENT_CONFIG_SCHEMA = {'properties': {'data_source': {'default': {'format': 'dnadna'}}, 'dataset_name': {'default': 'one_event'}, 'generation_time': {'default': 25, 'type': 'integer'}, 'max': {'default': 4.698970004336019, 'type': 'number'}, 'mutation_rate': {'default': 1e-08, 'type': 'number'}, 'n_min': {'default': 3.6989700043360187, 'type': 'number'}, 'n_replicates': {'default': 3}, 'n_samples': {'default': 50}, 'n_scenarios': {'default': 100}, 'position_format': {'normalized': True}, 'recombination_rate': {'default': 1e-08, 'type': 'number'}, 'scenario_params_path': {'default': 'one_event_params.csv'}, 'tmax': {'default': 100000, 'type': 'integer'}, 'tmin': {'default': 2000, 'type': 'integer'}}}

Schema for configuring the OneEventSimulator. It is based on the the generic dnadna/schemas/simulation.yml schema but adds additional configuration options.

class dnadna.examples.one_event.OneEventSimulator(config={}, validate=True, **kwargs)[source]

Bases: dnadna.simulator.Simulator

An example msprime-based simulator with demographic parameters for a model with one population change event.

The following attributes are available via the Config object for this class:

n_scenarios

number of scenarios to simulate by random draw

Type

int

n_samples

number of segment drawn from the population

Type

int

n_replicates

number of replicates to generate from the same scenario (i.e. a set of demographic parameters)

Type

int

segment_length

length of each segment, in bp

Type

int

tmax

oldest time possible for the start of the event

Type

int

tmin

earliest time possible for the start of the event

Type

int

recombination_rate

per generation per bp recombination rate

Type

float

mutation_rate

per generation per bp mutation rate

Type

float

n_min

minimum size of a population

Type

int

n_max

maximum size of a population

Type

int

generation_time

length of a generation

Type

int

generate_scenario_params()[source]

Generate demographic parameters for a model with one event.

See the OneEventSimulator top-level documentation for the list of available attributes loaded from the config file.

simulate_scenario(scenario, verbose=False)[source]

Simulate scenarios containing only one event from a pandas DataFrame of simulation parameters.