evolver
Module¶
The module will evolve sequences along a phylogeny.
-
class
evolver.
Site
¶ Defines the Site class, which holds information for each evolved site.
-
class
evolver.
Evolver
(**kwargs)¶ Bases:
object
- This callable class evolves sequences along a phylogeny. By default, Evolver will evolve sequences and create several output files:
- simulated_alignment.fasta
- The resulting simulated alignment
- site_rates.txt
- File providing rate information about each simulated column. Gives the partition and rate cateogy for each site in final simulated alignment.
- Tab-delimited file with fields, Site_Index Partition_Index Rate_Category . All indexing is from 1.
- site_rates_info.txt
- File providing the true site-rate heterogeneity values (either the rate scaling factor or dN and dS) for each rate category.
- Tab-delimited file with fields, Partition_Index Model_Name Rate_Category Rate_Probability Rate_Factor
Note that file creation may be suppressed or files may be renamed using optional arguments given below.
- Required keyword arguments include,
- tree is the phylogeny (parsed with the
newick.read_tree
function) along which sequences are evolved - partitions (or partition) is a list of Partition instances to evolve.
- tree is the phylogeny (parsed with the
-
__call__
(**kwargs)¶ Simulate sequences, perform any necessary post-processing, and save sequences and/or other info to appropriate files.
- Optional keyword arguments:
- seqfile is a custom name for the output simulated alignment. Provide None or False to suppress file creation.
- seqfmt is the format for seqfile (either fasta, nexus, phylip, phylip-relaxed, stockholm, etc. Anything that Biopython can accept!!) Default is FASTA.
- ratefile is a custom name for the “site_rates.txt” file. Provide None or False to suppress file creation.
- infofile is a custom name for the “site_rates_info.txt” file. Provide None or False to suppress file creation.
- write_anc is a boolean argument (True or False) for whether ancestral sequences should be output along with the tip sequences. Default is False.
- Examples:
>>> # Set up Evolver instance, and use below in various ways evolve = Evolver(tree = my_tree, partitions = my_partition_list) >>> # Evolve according to default settings >>> evolve() >>> # Include ancestral sequences in output file >>> evolve(write_anc = True) >>> # Custom sequence file name and format, and suppress rate information >>> evolve(seqfile = "my_seqs.phy", seqfmt = "phylip", ratefile = None, infofile = None)
-
get_sequences
(anc=False)¶ Method to return the dictionary of simulated sequences. Default anc = False will return the leaf_sites dictionary. If anc == True, then will return the evolved_sites dictionary.