phydmslib.simulate module

Functions for performing simulations, mostly using pyvolve.

Written by Jesse Bloom and Sarah Hilton.

phydmslib.simulate.pyvolvePartitions(model, divselection=None)

Get list of pyvolve partitions for model.

Args:
model (phydmslib.models.Models object)

The model used for the simulations. Currently only certain Models are supported (e.g., YNGKP, ExpCM)

divselection (None or 2-tuple (divomega, divsites))

Set this option if you want to simulate a subset of sites as under diversifying selection (e.g., an omega different than that used by model. In this case, divomega is the omega for this subset of sites, and divsites is a list of the sites in 1, 2, … numbering.

Returns:
partitions (list of pyvolve.Partition objects)

Can be fed into pyvolve.Evolver to simulate evolution.

phydmslib.simulate.simulateAlignment(model, treeFile, alignmentPrefix, randomSeed=False)

Simulate an alignment given a model and tree (units = subs/site).

Simulations done using pyvolve.

Args:
model (phydmslib.models.Models object)

The model used for the simulations. Only models that can be passed to pyvolve.Partitions are supported.

treeFile (str)

Name of newick file used to simulate the sequences. The branch lengths should be in substitutions per site, which is the default units for all phydms outputs.

alignmentPrefix

Prefix for the files created by pyvolve.

The result of this function is a simulated FASTA alignment file with the name having the prefix giving by alignmentPrefix and the suffix ‘_simulatedalignment.fasta’.