Setting up genomic intervals#
- class fwdpy11.Region(beg, end, weight, coupled=True, label=0)#
A genomic region, defined by half-open interval [beg, end)
This class has the following attributes, whose names are also kwargs for intitialization. The attribute names also determine the order of positional arguments:
- Parameters:
beg (float) – the beginning of the region
end (float) – the end of the region
weight (float) – the weight to assign
coupled (bool) – if True, the weight is converted to (end-beg)*weight
label (
numpy.uint16
) – Not relevant to recombining regions. Otherwise, this value will be used to fillfwdpy11.Mutation.label
.
When coupled is True, the “weight” may be interpreted as a “per base pair” (or per unit, generally speaking) term.
Changed in version 0.3.0: Refactored from a pure Python class to a C++/pybind11 class
Changed in version 0.8.0: Refactored to use attrs and inherit from low-level C++ class
- class fwdpy11.Sregion#
Representation of a “region” in a simulation with a dominance term.
This class is an ABC.
Changed in version 0.13.a2: Added “scaling” attribute.
Changed in version 0.3.0: Refactored from a pure Python class to a C++/pybind11 class
Changed in version 0.8.0: C++ version of class API minimized in favor of attrs.
Changed in version 0.13.0: Remove “dominance” property.
This class is an ABC derived from
fwdpy11.Region
- class fwdpy11.ConstantS(beg, end, weight, s, h=1.0, coupled=True, label=0, scaling=1.0)#
Mutations with fixed effect sizes
This class has the following attributes, whose names are also kwargs for intitialization. The attribute names also determine the order of positional arguments:
- Parameters:
beg (float) – the beginning of the region
end (float) – the end of the region
weight (float) – the weight to assign
s (float) – the selection coefficient
h (Union[float, fwdpy11.MutationDominance]) – the dominance
coupled (bool) – if True, the weight is converted to (end-beg)*weight
label (
numpy.uint16
) – Fillfwdpy11.Mutation.label
with this value.scaling (float) – The scaling of the DFE
When coupled is True, the “weight” may be interpreted as a “per base pair” (or per unit, generally speaking) term.
Changed in version 0.8.0: Refactored to use attrs and inherit from low-level C++ class
- class fwdpy11.UniformS(beg, end, weight, lo, hi, h=1.0, coupled=True, label=0, scaling=1.0)#
Uniform distrubution of effect sizes
This class has the following attributes, whose names are also kwargs for intitialization. The attribute names also determine the order of positional arguments:
- Parameters:
beg (float) – the beginning of the region
end (float) – the end of the region
weight (float) – the weight to assign
lo (float) – lower bound on s
hi (float) – upper bound on s
h (Union[float, fwdpy11.MutationDominance]) – the dominance
coupled (bool) – if True, the weight is converted to (end-beg)*weight
label (
numpy.uint16
) – Fillfwdpy11.Mutation.label
with this value.scaling (float) – The scaling of the DFE
When coupled is True, the “weight” may be interpreted as a “per base pair” (or per unit, generally speaking) term.
Changed in version 0.8.0: Refactored to use attrs and inherit from low-level C++ class
- class fwdpy11.ExpS(beg, end, weight, mean, h=1.0, coupled=True, label=0, scaling=1.0)#
Exponential distribution of effect sizes
This class has the following attributes, whose names are also kwargs for intitialization. The attribute names also determine the order of positional arguments:
- Parameters:
beg (float) – the beginning of the region
end (float) – the end of the region
weight (float) – the weight to assign
mean – the mean selection coefficient
h (Union[float, fwdpy11.MutationDominance]) – the dominance
coupled (bool) – if True, the weight is converted to (end-beg)*weight
label (
numpy.uint16
) – Fillfwdpy11.Mutation.label
with this value.scaling (float) – The scaling of the DFE
When coupled is True, the “weight” may be interpreted as a “per base pair” (or per unit, generally speaking) term.
Changed in version 0.8.0: Refactored to use attrs and inherit from low-level C++ class
- class fwdpy11.GammaS(beg, end, weight, mean, shape_parameter, h=1.0, coupled=True, label=0, scaling=1.0)#
Gamma distribution of effect sizes
This class has the following attributes, whose names are also kwargs for intitialization. The attribute names also determine the order of positional arguments:
- Parameters:
beg (float) – the beginning of the region
end (float) – the end of the region
weight (float) – the weight to assign
mean (float) – the mean selection coefficient
shape_parameter (float) – the shape parameter of the distribution
h (Union[float, fwdpy11.MutationDominance]) – the dominance
coupled (bool) – if True, the weight is converted to (end-beg)*weight
label (
numpy.uint16
) – Fillfwdpy11.Mutation.label
with this value.scaling (float) – The scaling of the DFE
When coupled is True, the “weight” may be interpreted as a “per base pair” (or per unit, generally speaking) term.
Changed in version 0.8.0: Refactored to use attrs and inherit from low-level C++ class
- class fwdpy11.GaussianS(beg, end, weight, sd, h=1.0, coupled=True, label=0, scaling=1.0)#
Gaussian distribution of effect sizes
This class has the following attributes, whose names are also kwargs for intitialization. The attribute names also determine the order of positional arguments:
- Parameters:
beg (float) – the beginning of the region
end (float) – the end of the region
weight (float) – the weight to assign
sd (float) – standard deviation of effect sizes
h (Union[float, fwdpy11.MutationDominance]) – the dominance
coupled (bool) – if True, the weight is converted to (end-beg)*weight
label (
numpy.uint16
) – Fillfwdpy11.Mutation.label
with this value.scaling (float) – The scaling of the DFE
When coupled is True, the “weight” may be interpreted as a “per base pair” (or per unit, generally speaking) term.
Changed in version 0.8.0: Refactored to use attrs and inherit from low-level C++ class
- class fwdpy11.MultivariateGaussianEffects(beg, end, weight, cov_matrix, fixed_effect=0.0, h=1.0, coupled=True, label=0)#
Pleiotropic effects via a multivariate Gaussian distribution.
This class can be used to generate mutations with both vectors of effect sizes as well as a separate fixed effect.
This class has the following attributes, whose names are also kwargs for intitialization. The attribute names also determine the order of positional arguments:
- Parameters:
beg (float) – Beginning of the region
end (float) – End of the region
weight (float) – Weight on the region
cov_matrix (
numpy.ndarray
) – Variance-covariance matrixfixed_effect (float) – Fixed effect size. Defaults to 0.0.
h (Union[float, fwdpy11.MutationDominance]) – Dominance. Defaults to 1.0
coupled (bool) – Specify if weight is function of end-beg or not. Defaults to True
label (
numpy.uint16
) – Fillfwdpy11.Mutation.label
with this value.
The input matrix must be square and semi-positive definite. If either of these conditions are not met, ValueError will be raised. ValueError will also be raised if the input matrix contains any non-finite values.
Note
The dominance parameter (h) applies to both the fixed effect and those drawn from a multivariate normal.
New in version 0.3.0.
Changed in version 0.8.0: Refactored to use attrs and inherit from low-level C++ class
- class fwdpy11.LogNormalS(beg, end, weight, zeta, sigma, h=1.0, coupled=True, label=0, scaling=1.0)#
Log-normal distribution of effect sizes.
This class has the following attributes, whose names are also kwargs for intitialization. The attribute names also determine the order of positional arguments:
- Parameters:
beg (float) – the beginning of the region
end (float) – the end of the region
weight (float) – the weight to assign
zeta (float) – the zeta parameter
sigma (float) – the sigma parameter
h (Union[float, fwdpy11.MutationDominance]) – the dominance
coupled (bool) – if True, the weight is converted to(end-beg)*weight
label (
numpy.uint16
) – Fillfwdpy11.Mutation.label
with this value.scaling (float) – The scaling of the DFE
When coupled is True, the “weight” may be interpreted as a “per base pair” (or per unit, generally speaking) term.
New in version 0.7.0.
Changed in version 0.8.0: Refactored to use attrs and inherit from low-level C++ class
- classmethod mv(beg, end, weight, h=1.0, coupled=True, label=0, scaling=1.0)#
Factory method to create an instance compatible with
fwdpy11.mvDES
. See Different effect sizes of mutations in different demes for details.- Parameters:
beg (float) – the beginning of the region
end (float) – the end of the region
weight (float) – the weight to assign
h (Union[float, fwdpy11.MutationDominance]) – the dominance
coupled (bool) – if True, the weight is converted to(end-beg)*weight
label (
numpy.uint16
) – Fillfwdpy11.Mutation.label
with this value.scaling (float) – The scaling of the DFE
- class fwdpy11.DiscreteDESD(beg, end, weight, joint_dist, coupled=True, label=0, scaling=1.0)#
Discretized distribution of effect sizes and dominance.
This class allows you to specify a discrete joint distrubtion of effect size and dominance.
The distribution is specified by a list of tuples. Each tuple contains (effect size, dominance, weight). The weights must all be >= 0 and all values must fe finite.
This class has the following attributes, whose names are also kwargs for intitialization. The attribute names also determine the order of positional arguments:
- Parameters:
beg (float) – Beginning of the region
end (float) – End of the region
weight (float) – Weight on the region
joint_dist (list) – The joint distribution + weights
coupled (bool) – Specify if weight is function of end-beg or not. Defaults to True
label (
numpy.uint16
) – Fillfwdpy11.Mutation.label
with this value.scaling (float) – The scaling of the DFE
New in version 0.10.0.
- class fwdpy11.mvDES(des, means, matrix=None)#
General multivariate distribution of effect sizes.
This class has the following attributes, whose names are also kwargs for intitialization. The attribute names also determine the order of positional arguments:
- Parameters:
means (
numpy.ndarray
) – means marginal gaussian Distributionsmatrix (
numpy.ndarray
) – Variance/covariance matrix
New in version 0.7.0.
Changed in version 0.8.0: Refactored to use attrs and inherit from low-level C++ class
- class fwdpy11.PoissonInterval(beg, end, mean, *, discrete=False)#
Generate poisson number of crossover breakpoints.
This class has the following attributes, whose names are also kwargs for intitialization. The attribute names also determine the order of positional arguments:
- Parameters:
New in version 0.3.0.
Changed in version 0.5.0: Refactored back-end to be based on fwdpp types
Changed in version 0.7.1: Add __repr__
Changed in version 0.8.0: Refactored to use attrs and inherit from low-level C++ class
Changed in version 0.12.0: Added discrete option to initializer.
- class fwdpy11.PoissonPoint(position, mean, *, discrete=False)#
Generate a recombination breakpoint at a fixed position if the number of crossover events is odd.
This class has the following attributes, whose names are also kwargs for intitialization. The attribute names also determine the order of positional arguments:
- Parameters:
New in version 0.3.0.
Changed in version 0.5.0: Refactored back-end to be based on fwdpp types
Changed in version 0.7.1: Add __repr__
Changed in version 0.8.0: Refactored to use attrs and inherit from low-level C++ class
Changed in version 0.12.0: Added discrete option to initializer.
- class fwdpy11.BinomialPoint(position, probability, *, discrete=False)#
Generate a crossover breakpoint at a fixed position with a fixed probability. This class represents genetic distance as centiMorgans/100.
This class has the following attributes, whose names are also kwargs for intitialization. The attribute names also determine the order of positional arguments:
- Parameters:
New in version 0.3.0.
Changed in version 0.5.0: Refactored back-end to be based on fwdpp types
Changed in version 0.7.1: Add __repr__
Changed in version 0.8.0: Refactored to use attrs and inherit from low-level C++ class
Changed in version 0.12.0: Added discrete option to initializer.
- class fwdpy11.FixedCrossovers(beg, end, num_xovers, *, discrete=False)#
Generate a fixed number of crossover breakpoints.
This class has the following attributes, whose names are also kwargs for intitialization. The attribute names also determine the order of positional arguments:
- Parameters:
New in version 0.3.0.
Changed in version 0.5.0: Refactored back-end to be based on fwdpp types
Changed in version 0.7.1: Add __repr__
Changed in version 0.8.0: Refactored to use attrs and inherit from low-level C++ class
Changed in version 0.12.0: Added discrete option to initializer.
- class fwdpy11.BinomialInterval(beg, end, probability, *, discrete=False)#
Generate exactly one crossover with a given probability
This class has the following attributes, whose names are also kwargs for intitialization. The attribute names also determine the order of positional arguments:
- Parameters:
New in version 0.5.2.
Changed in version 0.7.1: Add __repr__
Changed in version 0.8.0: Refactored to use attrs and inherit from low-level C++ class
Changed in version 0.12.0: Added discrete option to initializer.
- class fwdpy11.BinomialIntervalMap(probability, regions, *, discrete=False)#
Generate exactly one crossover with a given probability and a non-uniform map to generate positions.
This class has the following attributes, whose names are also kwargs for intitialization. The attribute names also determine the order of positional arguments:
- Parameters:
probability (float) – The probability of a breakpoint
regions (list[fwdpy11.Region]) – the map describing intervals and weights
discrete (bool) – If False, positions are continuous and uniform from [beg, end). If True, positions take integer values uniformly from [beg, end).
Unlike
fwdpy11.BinomialInterval
, this class allows a non-uniform map to generate breakpoint positions. Theregions
parameter is used to generate a lookup table allowing efficient generation of positions.New in version 0.20.0.
- class fwdpy11.MutationDominance#
ABC for classes determining the dominance of new mutations.
New in version 0.13.0.
See here for details.
- class fwdpy11.FixedDominance(h)#
Fixed heterozygous effects.
- Parameters:
h (float) – The heterozygous effect of a mutation, or “dominance”.
New in version 0.13.0.
See here for details.
- class fwdpy11.UniformDominance(lo, hi)#
Uniform distribution of heterozygous effects.
New in version 0.13.0.
See here for details.
- class fwdpy11.ExponentialDominance(m)#
Exponential distribution of heterozygous effects.
- Parameters:
m (float) – The mean of the distribution.
New in version 0.13.0.
See here for details.
- class fwdpy11.LargeEffectExponentiallyRecessive(k, scaling=1.0)#
Large effect mutations are more recessive according to the function \(y \times e^{-k|s|}\), where \(s\) is the effect size and \(y\) is a “scaling” parameter.
- Parameters:
k (float) – The “tuning” parameter.
New in version 0.13.0.
See here for details.