API¶
-
class
scriptgenerator.EventList(start_time, end_time=None) Holds a start and and end time, and a list of events that happens between those times.
-
class
scriptgenerator.MutationTypes(mutation_rate, selection_coeffs, proportions, dominance_coeffs=None) Holds information about mutations to put into the simulation.
-
class
scriptgenerator.PopulationConfiguration(initial_size, sample_size=None, growth_rate=0) Holds information about the populations in the simulation. The analogue of msprime.PopulationConfiguration objects.
Variables: - initial_size (int) – The number of haploids in the population at the start of the simulation.
- sample_size – Think – IS THIS NEEDED???
- growth_rate (float) – The initial growth rate. (GIVEN AS EXPONENT??)
-
class
scriptgenerator.RecentHistory(final_gen, chrom_length, reference_configs, adm_configs, prop, recombination=0, ref_labels=None, adm_label=None, reference_populations=None, admixed_population=None, mutations=None, outfile='recent-history.trees', model_type='WF', scriptfile='recent-history.slim') An object holding demographic history that can be converted into a SLiM script.
Variables: - final_gen (int) – The number of generations to simulate.
- chrom_length (int) – The number of bases in the simulated segment.
- reference_configs (slime.PopulationConfiguration) – Configurations of the ancestral populations.
- adm_configs (slime.PopulationConfiguration) – Configurations of the admixed population.
- prop (list, dtype=float) – The initial proportion of admixture from each reference population.
- recombination (float or recombination map (FORMAT?)) – Recombination rate or recombination map.
- ref_labels –
- adm_label –
- reference_populations –
- admixed_population –
- mutations –
- outfile – The filename to which to write the outputted tree sequence.
- model_type – To be removed.
- scriptfile – The filename to which to write the SLiM script.
-
add_continuous_process(new_range, event, early=True) Adds an event that occurs over an interval of generations. Breaks up existing events if necessary.
-
add_mass_migration(prop, time) Specifies a mass migration event from reference populations into admixed population at a specified time. This is like changing the migration rate, but the migration rate is changed to 0 afterwards. # Later: would be useful if it is changed back to original migration rate?
-
add_migration_rate(rates, time=(2, 'late')) Specifies rates of migration from references to admixed population.
-
add_new_single_time(time) Creates a new code block for the supplied single time.
-
add_population_parameters_change(paramChanges) Takes a list of msprime.PopulationParametersChange objects and ‘translates’ them into SLiM commands. https://msprime.readthedocs.io/en/stable/api.html#demographic-events There are two types of changes: exponential growth rate changes and instantaneous population size changes.
-
find_event_index(time=None, start=False, initialization=False) Finds the index of the script at which a new event should be inserted.
-
find_time_index(time) Finds the index of the script at which a new generation and time should be inserted.