sim

Below is an auto-generated summary of the xftsim.sim submodule API.

class xftsim.sim.DemoSimulation(routine='BGRM', n=2000, m=400)

Bases: Simulation

demo_routines = {'BGRM': 'Bivariate GCTA with balanced random mating demo\n', 'UGRM': 'Univariate GCTA with balanced random mating demo\n'}
class xftsim.sim.Simulation(founder_haplotypes, mating_regime, recombination_map, architecture, statistics=[], post_processors=[], generation=-1, control={}, reproduction_method=<class 'xftsim.reproduce.Meiosis'>, metadata={}, filter_sample=False, sample_filter=None)

Bases: object

A class for running an xft simulation.

mating_regime

Mating regime.

Type:

xft.mate.MatingRegime

recombination_map

Recombination map.

Type:

xft.reproduce.RecombinationMap

architecture

Phenogenetic architecture.

Type:

xft.arch.Architecture

statistics

Iterable of statistics to compute each generation, by default empty list.

Type:

Iterable, optional

post_processors

Iterable of post processors to apply each generation, by default empty list.

Type:

Iterable, optional

generation

Initial generation, by default -1, corresponding to an uninitialized simulation

Type:

int, optional

control

Control parameters for the simulation, by default an empty dictionary.

Type:

Dict, optional

reproduction_method

Reproduction method for the simulation, by default xft.reproduce.Meiosis.

Type:

xft.reproduce.ReproductionMethod, optional

control

Control parameters for the simulation

Type:

dict

haplotypes

Haplotypes for the current generation.

Type:

xr.DataArray

phenotypes

Phenotypes for the current generation.

Type:

xr.DataArray

mating

Mating information for the current generation.

Type:

xr.DataArray

parent_mating

Mating information for the previous generation.

Type:

xr.DataArray

parent_haplotypes

Haplotypes for the previous generation.

Type:

xr.DataArray

parent_phenotypes

Phenotypes for the previous generation.

Type:

xr.DataArray

results

Results for the current generation.

Type:

xr.DataArray

current_afs_empirical

Current empirical allele frequencies.

Type:

xr.DataArray

current_std_genotypes

Current standardized genotypes.

Type:

xr.DataArray

current_std_phenotypes

Current standardized phenotypes.

Type:

xr.DataArray

phenotype_store

Dictionary storing phenotypes for each generation.

Type:

Dict[int, xr.DataArray]

haplotype_store

Dictionary storing haplotypes for each generation.

Type:

Dict[int, xr.DataArray]

mating_store

Dictionary storing mating information for each generation.

Type:

Dict[int, xr.DataArray]

results_store

Dictionary storing results for each generation.

Type:

Dict[int, xr.DataArray]

pedigree

Pedigree information for the simulation (currently not implemented).

Type:

Any

metadata

Dictionary containing user specified metadata

Type:

Dict

run(n_generations: int):

Run the simulation for a specified number of generations.

run_generation():

Run a single generation of the simulation.

compute_phenotypes():

Compute phenotypes for the current generation.

mate():

Perform mating for the current generation.

reproduce():

Perform reproduction for the current generation.

estimate_statistics():

Estimate statistics for the current generation.

process():

Process the current generation using post-processors.

update_pedigree():

Update pedigree information for the current generation.

increment_generation():

Increment the current generation.

move_forward(n_generations: int):

Move the simulation forward by a specified number of generations.

apply_filter()

Apply sample filters to the current generation

compute_phenotypes()

Compute phenotypes for the current generation.

property control
property current_afs_empirical
property current_std_genotypes
property current_std_genotypes_filtered
property current_std_phenotypes
property current_std_phenotypes_filtered
property dependency_graph
property dependency_graph_edges
draw_dependency_graph(node_color='none', node_size=1200, font_size=5, margins=0.1, edge_color='#222222', arrowsize=6, number_edges=True, **kwargs)
estimate_statistics()

Estimate statistics for the current generation.

property generation
property haplotypes
property haplotypes_filtered
increment_generation()
mate()

Perform mating for the current generation.

property mating
move_forward(n_generations)
property parent_haplotypes
property parent_mating
property parent_phenotypes
property phenotypes
property phenotypes_filtered
pickle_results(path, metadata={}, results_store=True, architecture=True, mating_store=True, phenotype_store=True, mating_regime=False, haplotype_store=False)
process()

Apply post-processors to the current generation.

reproduce()

Perform reproduction for the current generation.

property results
run(n_generations)

Run the simulation for a specified number of generations.

Parameters:

n_generations (int) – Number of generations to run the simulation.

run_generation()

Run a single generation of the simulation.

update_pedigree()

Update pedigree information (NOT IMPLEMENTED).