From 9d40b61f8336ec69235d1adf5869baaaf2b9bd1e Mon Sep 17 00:00:00 2001
From: PopSim-bot filename (Union[str, os.PathLike, FileLike]) – The path to the file to be loaded, or a file-like object
+ filename (Union[str, os.PathLike, FileLike]) – The path to the file to be loaded, or a file-like object
with a format (str) – The format of the input file. Either “yaml” or “json”. format (str) – The format of the input file. Either “yaml” or “json”. filename (Union[str, os.PathLike, FileLike]) – The path to the file to be loaded, or a file-like object
+ filename (Union[str, os.PathLike, FileLike]) – The path to the file to be loaded, or a file-like object
with a format (str) – The format of the input file. Either “yaml” or “json”. format (str) – The format of the input file. Either “yaml” or “json”.Loading and saving Demes graphs
-
read()
method.Loading and saving Demes graphs
-
read()
method.Loading and saving Demes graphsReturn type:
-
Loading and saving Demes graphs
Loading and saving Demes graphs
Loading and saving Demes graphsReturn type:
-
Loading and saving Demes graphsSpecification.
filename (Union[str, os.PathLike, FileLike]) – The path to the file to be loaded, or a file-like object +
filename (Union[str, os.PathLike, FileLike]) – The path to the file to be loaded, or a file-like object
with a read()
method.
graph (demes.Graph) – The graph to dump.
filename (Union[str, os.PathLike, FileLike]) – Path to the output file, or a file-like object with a +
filename (Union[str, os.PathLike, FileLike]) – Path to the output file, or a file-like object with a
write()
method.
format (str) – The format of the output file. Either “yaml” or “json”.
simplified (bool) – If True, the output file follows the Human Data Model, +
format (str) – The format of the output file. Either “yaml” or “json”.
simplified (bool) – If True, the output file follows the Human Data Model, which has many fields omitted and is thus more compact. If False, the output file is fully-resolved and follows the Machine Data Model.
graph (demes.Graph) – The graph to dump.
format (str) – The format of the output file. Either “yaml” or “json”.
simplified (bool) – If True, returns a string following the Human Data Model, +
format (str) – The format of the output file. Either “yaml” or “json”.
simplified (bool) – If True, returns a string following the Human Data Model, which has many fields omitted and is thus more compact. If False, returns a string that is fully-resolved following the Machine Data Model.
The YAML or JSON string.
graphs – An iterable of graphs to dump.
filename (Union[str, os.PathLike, FileLike]) – Path to the output file, or a file-like object with a +
filename (Union[str, os.PathLike, FileLike]) – Path to the output file, or a file-like object with a
write()
method.
simplified (bool) – If True, the output file follows the Human Data Model, +
simplified (bool) – If True, the output file follows the Human Data Model, which has many fields omitted and is thus more compact. If False, the output file is fully-resolved and follows the Machine Data Model.
Graph
object using the resolve()
method.
data (dict) –
The data dictionary of the demographic model’s current state. +
data (dict) –
The data dictionary of the demographic model’s current state. The objects nested within this dictionary should follow Demes’ data model, as described in the Human Data Model schema.
description (str) – A human readable description of the demography.
time_units (str) – The units of time used for the demography. This is +
description (str) – A human readable description of the demography.
time_units (str) – The units of time used for the demography. This is
commonly years
or generations
, but can be any string.
generation_time (float) – The generation time of demes, in units given +
generation_time (float) – The generation time of demes, in units given
by the time_units
parameter.
doi (list[str]) – If the graph describes a published demography, the DOI(s) +
doi (list[str]) – If the graph describes a published demography, the DOI(s) should be be given here as a list.
defaults (dict) – A dictionary of default values, following the +
defaults (dict) – A dictionary of default values, following the Human Data Model schema for defaults.
metadata (dict) – A dictionary of arbitrary additional data.
metadata (dict) – A dictionary of arbitrary additional data.
name (str) – A string identifier for the deme.
description (str) – A description of the deme.
ancestors (list[str]) – List of deme names for the deme’s ancestors.
proportions (list[float]) – The proportions of ancestry from each ancestor. +
name (str) – A string identifier for the deme.
description (str) – A description of the deme.
ancestors (list[str]) – List of deme names for the deme’s ancestors.
proportions (list[float]) – The proportions of ancestry from each ancestor.
This list has the same length as ancestors
, and must sum to 1.
start_time (float) – The deme’s start time.
epochs (list[dict]) – List of epoch dictionaries. Each dictionary +
start_time (float) – The deme’s start time.
epochs (list[dict]) – List of epoch dictionaries. Each dictionary follows the Human Data Model schema for an epoch object.
defaults (dict) – A dictionary of default deme values, following the +
defaults (dict) – A dictionary of default deme values, following the Human Data Model schema for deme defaults.
demes (list[str]) – List of deme names. If specified, migration is symmetric +
demes (list[str]) – List of deme names. If specified, migration is symmetric between all pairs of demes in this list.
source (str) – The name of the source deme. If specified, migration is asymmetric +
source (str) – The name of the source deme. If specified, migration is asymmetric from this deme.
dest (str) – The name of the destination deme. If specified, migration is +
dest (str) – The name of the destination deme. If specified, migration is asymmetric into this deme.
rate (float) – The rate of migration per generation.
start_time (float) – The time at which the migration rate is enabled.
end_time (float) – The time at which the migration rate is disabled.
rate (float) – The rate of migration per generation.
start_time (float) – The time at which the migration rate is enabled.
end_time (float) – The time at which the migration rate is disabled.
sources (list(str)) – A list of names of the source deme(s).
dest (str) – The name of the destination deme.
proportion (list(float)) – At the instant after migration, this is the expected proportion(s) +
sources (list(str)) – A list of names of the source deme(s).
dest (str) – The name of the destination deme.
proportion (list(float)) – At the instant after migration, this is the expected proportion(s) of individuals in the destination deme made up of individuals from the source deme(s).
time (float) – The time at which migrations occur.
time (float) – The time at which migrations occur.
description (str) – A human readable description of the demography.
time_units (str) – The units of time used for the demography. This is +
description (str) – A human readable description of the demography.
time_units (str) – The units of time used for the demography. This is
commonly years
or generations
, but can be any string.
This field is intended to be useful for documenting a demography,
but the actual value provided here should not be relied upon.
generation_time (float) – The generation time of demes, in units given +
generation_time (float) – The generation time of demes, in units given
by the time_units
parameter. Concretely, dividing all times
by generation_time
will convert the graph to have time
units in generations.
See also: in_generations()
.
doi (list[str]) – A list of publications that describe the demographic model.
metadata (dict) – A dictionary of arbitrary additional data.
migrations (list[AsymmetricMigration]) – The continuous asymmetric migrations for the demographic model.
pulses (list[Pulse]) – The instantaneous pulse migrations for the demographic model.
doi (list[str]) – A list of publications that describe the demographic model.
metadata (dict) – A dictionary of arbitrary additional data.
migrations (list[AsymmetricMigration]) – The continuous asymmetric migrations for the demographic model.
pulses (list[Pulse]) – The instantaneous pulse migrations for the demographic model.
deme_name (str) – The name of the deme.
+deme_name (str) – The name of the deme.
True
if the deme is in the graph, False
otherwise.
deme_name (str) – The name of the deme.
+deme_name (str) – The name of the deme.
A data dictionary following the Machine Data Model.
A data dictionary following the Human Data Model.
other (Graph
) – The graph to compare against.
rel_tol (float) – The relative tolerance permitted for numerical
-comparisons. See documentation for math.isclose()
.
abs_tol (float) – The absolute tolerance permitted for numerical
-comparisons. See documentation for math.isclose()
.
rel_tol (float) – The relative tolerance permitted for numerical
+comparisons. See documentation for math.isclose()
.
abs_tol (float) – The absolute tolerance permitted for numerical
+comparisons. See documentation for math.isclose()
.
Merge
, and Admix
objects.
data (dict) – A data dictionary following either the +
data (dict) – A data dictionary following either the Human Data Model or the Machine Data Model.
Returns true if the graph and other
implement essentially
the same demographic model. Numerical values are compared using the
-math.isclose()
function, from which this method takes its name.
+math.isclose()
function, from which this method takes its name.
Furthermore, the following implementation details are ignored during
the comparison:
@@ -747,17 +747,17 @@Working with Demes graphsParameters:
- -
other (
Graph
) – The graph to compare against.- -
rel_tol (float) – The relative tolerance permitted for numerical -comparisons. See documentation for
math.isclose()
.- +
abs_tol (float) – The absolute tolerance permitted for numerical -comparisons. See documentation for
math.isclose()
.- +
rel_tol (float) – The relative tolerance permitted for numerical +comparisons. See documentation for
math.isclose()
.abs_tol (float) – The absolute tolerance permitted for numerical +comparisons. See documentation for
math.isclose()
.- Returns:
True if the two graphs implement the same model, False otherwise.
- Return type:
-- +
@@ -807,7 +807,7 @@Working with Demes graphsend_times are a list of end times for each matrix.
tuple[list[list[list[float]]], list[float]]
+A NetworkX compatible dict-of-lists graph of the demes’ predecessors.
names (dict) – A dictionary with deme names and new names.
+names (dict) – A dictionary with deme names and new names.
A demographic model with renamed demes.
@@ -872,7 +872,7 @@A NetworkX compatible dict-of-lists graph of the demes’ successors.
name (str) – A concise string that identifies the deme.
description (str) – A description of the deme.
start_time (float) – The time at which the deme begins to exist.
ancestors (list[str]) – List of deme names for the deme’s ancestors.
proportions (list[float]) – The proportions of ancestry from each ancestor, +
name (str) – A concise string that identifies the deme.
description (str) – A description of the deme.
start_time (float) – The time at which the deme begins to exist.
ancestors (list[str]) – List of deme names for the deme’s ancestors.
proportions (list[float]) – The proportions of ancestry from each ancestor, ordered to correspond with the same order as the ancestors list. If there are one or more ancestors, the proportions sum to 1.
epochs (list[Epoch]) – A list of epochs that span the time interval over which the +
epochs (list[Epoch]) – A list of epochs that span the time interval over which the deme exists. Epoch time intervals are non-overlapping, completely cover the deme’s existence time interval, and are listed in time-descending order (from the past @@ -914,10 +914,10 @@
other (Deme
) – The deme to compare against.
rel_tol (float) – The relative tolerance permitted for numerical
-comparisons. See documentation for math.isclose()
abs_tol (float) – The absolute tolerance permitted for numerical
-comparisons. See documentation for math.isclose()
.
rel_tol (float) – The relative tolerance permitted for numerical
+comparisons. See documentation for math.isclose()
abs_tol (float) – The absolute tolerance permitted for numerical
+comparisons. See documentation for math.isclose()
.
other (Deme
) – The deme to compare against.
rel_tol (float) – The relative tolerance permitted for numerical
-comparisons. See documentation for math.isclose()
abs_tol (float) – The absolute tolerance permitted for numerical
-comparisons. See documentation for math.isclose()
.
rel_tol (float) – The relative tolerance permitted for numerical
+comparisons. See documentation for math.isclose()
abs_tol (float) – The absolute tolerance permitted for numerical
+comparisons. See documentation for math.isclose()
.
True if the two demes are equivalent, False otherwise.
time (float) – The time at which the size should be calculated.
+time (float) – The time at which the size should be calculated.
The deme size.
start_time (float) – The start time of the epoch. +
start_time (float) – The start time of the epoch. This value is greater than zero and may be infinity.
end_time (float) – The end time of the epoch. +
end_time (float) – The end time of the epoch. This value is greater than or equal to zero and finite.
start_size (float) – Population size at start_time
.
end_size (float) – Population size at end_time
.
+
start_size (float) – Population size at start_time
.
end_size (float) – Population size at end_time
.
If start_size != end_size
, the population size changes
between the start and end times according to the
size_function
.
size_function (str) –
The size change function. This is either +
size_function (str) –
The size change function. This is either
constant
, exponential
or linear
, though it is possible
that additional values will be added in the future.
@@ -1041,8 +1041,8 @@Working with Demes graphsfloat) – The selfing rate for this epoch.
cloning_rate (float) – The cloning rate for this epoch.
selfing_rate (float) – The selfing rate for this epoch.
cloning_rate (float) – The cloning rate for this epoch.
other (Epoch
) – The epoch to compare against.
rel_tol (float) – The relative tolerance permitted for numerical
-comparisons. See documentation for math.isclose()
abs_tol (float) – The absolute tolerance permitted for numerical
-comparisons. See documentation for math.isclose()
.
rel_tol (float) – The relative tolerance permitted for numerical
+comparisons. See documentation for math.isclose()
abs_tol (float) – The absolute tolerance permitted for numerical
+comparisons. See documentation for math.isclose()
.
other (Epoch
) – The epoch to compare against.
rel_tol (float) – The relative tolerance permitted for numerical
-comparisons. See documentation for math.isclose()
abs_tol (float) – The absolute tolerance permitted for numerical
-comparisons. See documentation for math.isclose()
.
rel_tol (float) – The relative tolerance permitted for numerical
+comparisons. See documentation for math.isclose()
abs_tol (float) – The absolute tolerance permitted for numerical
+comparisons. See documentation for math.isclose()
.
True if the two epochs are equivalent, False otherwise.
source (str) – The source deme for asymmetric migration.
dest (str) – The destination deme for asymmetric migration.
start_time (float) – The time at which the migration rate is activated.
end_time (float) – The time at which the migration rate is deactivated.
rate (float) – The rate of migration per generation.
source (str) – The source deme for asymmetric migration.
dest (str) – The destination deme for asymmetric migration.
start_time (float) – The time at which the migration rate is activated.
end_time (float) – The time at which the migration rate is deactivated.
rate (float) – The rate of migration per generation.
other (AsymmetricMigration) – The migration to compare against.
rel_tol (float) – The relative tolerance permitted for numerical
-comparisons. See documentation for math.isclose()
abs_tol (float) – The absolute tolerance permitted for numerical
-comparisons. See documentation for math.isclose()
.
rel_tol (float) – The relative tolerance permitted for numerical
+comparisons. See documentation for math.isclose()
abs_tol (float) – The absolute tolerance permitted for numerical
+comparisons. See documentation for math.isclose()
.
other (AsymmetricMigration) – The migration to compare against.
rel_tol (float) – The relative tolerance permitted for numerical
-comparisons. See documentation for math.isclose()
abs_tol (float) – The absolute tolerance permitted for numerical
-comparisons. See documentation for math.isclose()
.
rel_tol (float) – The relative tolerance permitted for numerical
+comparisons. See documentation for math.isclose()
abs_tol (float) – The absolute tolerance permitted for numerical
+comparisons. See documentation for math.isclose()
.
True if the two epochs are equivalent, False otherwise.
dest (str) – The destination deme.
time (float) – The time of migration.
proportions (list(float)) – Immediately following migration, the proportion(s) +
dest (str) – The destination deme.
time (float) – The time of migration.
proportions (list(float)) – Immediately following migration, the proportion(s) of individuals in the destination deme made up of migrant individuals or having parents from the source deme(s).
other (Pulse
) – The pulse to compare against.
rel_tol (float) – The relative tolerance permitted for numerical
-comparisons. See documentation for math.isclose()
abs_tol (float) – The absolute tolerance permitted for numerical
-comparisons. See documentation for math.isclose()
.
rel_tol (float) – The relative tolerance permitted for numerical
+comparisons. See documentation for math.isclose()
abs_tol (float) – The absolute tolerance permitted for numerical
+comparisons. See documentation for math.isclose()
.
other (Pulse
) – The pulse to compare against.
rel_tol (float) – The relative tolerance permitted for numerical
-comparisons. See documentation for math.isclose()
abs_tol (float) – The absolute tolerance permitted for numerical
-comparisons. See documentation for math.isclose()
.
rel_tol (float) – The relative tolerance permitted for numerical
+comparisons. See documentation for math.isclose()
abs_tol (float) – The absolute tolerance permitted for numerical
+comparisons. See documentation for math.isclose()
.
True if the two pulses are equivalent, False otherwise.
other (Split
) – The split to compare against.
rel_tol (float) – The relative tolerance permitted for numerical
-comparisons. See documentation for math.isclose()
abs_tol (float) – The absolute tolerance permitted for numerical
-comparisons. See documentation for math.isclose()
.
rel_tol (float) – The relative tolerance permitted for numerical
+comparisons. See documentation for math.isclose()
abs_tol (float) – The absolute tolerance permitted for numerical
+comparisons. See documentation for math.isclose()
.
other (Split
) – The split to compare against.
rel_tol (float) – The relative tolerance permitted for numerical
-comparisons. See documentation for math.isclose()
abs_tol (float) – The absolute tolerance permitted for numerical
-comparisons. See documentation for math.isclose()
.
rel_tol (float) – The relative tolerance permitted for numerical
+comparisons. See documentation for math.isclose()
abs_tol (float) – The absolute tolerance permitted for numerical
+comparisons. See documentation for math.isclose()
.
True if the two splits are equivalent, False otherwise.
other (Branch
) – The branch to compare against.
rel_tol (float) – The relative tolerance permitted for numerical
-comparisons. See documentation for math.isclose()
abs_tol (float) – The absolute tolerance permitted for numerical
-comparisons. See documentation for math.isclose()
.
rel_tol (float) – The relative tolerance permitted for numerical
+comparisons. See documentation for math.isclose()
abs_tol (float) – The absolute tolerance permitted for numerical
+comparisons. See documentation for math.isclose()
.
other (Branch
) – The branch to compare against.
rel_tol (float) – The relative tolerance permitted for numerical
-comparisons. See documentation for math.isclose()
abs_tol (float) – The absolute tolerance permitted for numerical
-comparisons. See documentation for math.isclose()
.
rel_tol (float) – The relative tolerance permitted for numerical
+comparisons. See documentation for math.isclose()
abs_tol (float) – The absolute tolerance permitted for numerical
+comparisons. See documentation for math.isclose()
.
True if the two branches are equivalent, False otherwise.
other (Merge
) – The merge to compare against.
rel_tol (float) – The relative tolerance permitted for numerical
-comparisons. See documentation for math.isclose()
abs_tol (float) – The absolute tolerance permitted for numerical
-comparisons. See documentation for math.isclose()
.
rel_tol (float) – The relative tolerance permitted for numerical
+comparisons. See documentation for math.isclose()
abs_tol (float) – The absolute tolerance permitted for numerical
+comparisons. See documentation for math.isclose()
.
other (Merge
) – The merge to compare against.
rel_tol (float) – The relative tolerance permitted for numerical
-comparisons. See documentation for math.isclose()
abs_tol (float) – The absolute tolerance permitted for numerical
-comparisons. See documentation for math.isclose()
.
rel_tol (float) – The relative tolerance permitted for numerical
+comparisons. See documentation for math.isclose()
abs_tol (float) – The absolute tolerance permitted for numerical
+comparisons. See documentation for math.isclose()
.
True if the two merges are equivalent, False otherwise.
other (Admix
) – The admixture to compare against.
rel_tol (float) – The relative tolerance permitted for numerical
-comparisons. See documentation for math.isclose()
abs_tol (float) – The absolute tolerance permitted for numerical
-comparisons. See documentation for math.isclose()
.
rel_tol (float) – The relative tolerance permitted for numerical
+comparisons. See documentation for math.isclose()
abs_tol (float) – The absolute tolerance permitted for numerical
+comparisons. See documentation for math.isclose()
.
other (Admix
) – The admixture to compare against.
rel_tol (float) – The relative tolerance permitted for numerical
-comparisons. See documentation for math.isclose()
abs_tol (float) – The absolute tolerance permitted for numerical
-comparisons. See documentation for math.isclose()
.
rel_tol (float) – The relative tolerance permitted for numerical
+comparisons. See documentation for math.isclose()
abs_tol (float) – The absolute tolerance permitted for numerical
+comparisons. See documentation for math.isclose()
.
True if the two admixtures are equivalent, False otherwise.
command (str) – The ms command line.
N0 (float) – The reference population size (\(N_0\)) used to translate +
command (str) – The ms command line.
N0 (float) – The reference population size (\(N_0\)) used to translate
from coalescent units. For a command
that specifies a
\(\theta\) value with the -t theta
option,
this can be calculated as \(N_0 = \theta / (4 \mu L)\),
where \(\mu\) is the per-generation mutation rate and
\(L\) is the length of the sequence being simulated.
deme_names (list[str]) – A list of names to use for the demes. +
deme_names (list[str]) – A list of names to use for the demes. If not specified, demes will be named deme1, deme2, etc.
N0 (float) – The reference population size used to translate into coalescent units. +
N0 (float) – The reference population size used to translate into coalescent units.
See from_ms()
for details.
samples (list(int)) – A list of haploid sample numbers, one for each deme, in the same +
samples (list(int)) – A list of haploid sample numbers, one for each deme, in the same
order as the order of demes in the graph.
The parameter is ignored for demographic models with only one deme.
The given sampling scheme will be used with the -I
argument.
@@ -1576,7 +1576,7 @@
The ms command line.
<Axes: ylabel='time ago (generations)'>
This YAML file can be loaded into Python with the load()
function,
to obtain a Graph
instance (modify the filename as appropriate).
<Axes: ylabel='time ago (generations)'>