betatree.py
: This file contains the betatree
class, which is responsible for simulating beta coalescent trees. It implements methods for tree initialization, coalescence events, and tree structure manipulation.
sfs.py
and sfs_py3.py
: These files define the SFS
class, which extends the functionality of betatree
to calculate the Site Frequency Spectrum. The SFS
class generates multiple trees, accumulates allele frequency information, and computes the SFS. It also provides methods for binning the SFS and saving/loading SFS data.
scipy.special
is used for special mathematical functions like the gamma function.Bio.Phylo
module is used for working with phylogenetic trees.sample_size
: The number of individuals in the sample.alpha
: The alpha parameter of the beta coalescent model (default is 2, which corresponds to the Kingman coalescent).betatree
or SFS
objects to simulate different evolutionary scenarios.
The SFS
class also allows for configuration of the SFS calculation and binning process through method parameters:
ntrees
: The number of trees to generate for SFS calculation.mode
: The binning mode for the SFS (linear, log, or logit).bins
: The number of bins or custom bin edges for SFS binning.