Skip to content

Commit

Permalink
fixed error in tests and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
GertjanBisschop committed Mar 28, 2023
1 parent d847276 commit 2a492a6
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 12 deletions.
20 changes: 20 additions & 0 deletions docs/api.md
Expand Up @@ -87,6 +87,26 @@ for discussion and examples of individual features.
:members:
```

```{eval-rst}
.. autoclass:: msprime.NodeType
:members:
.. autoattribute:: RECOMBINANT
:annotation: = NodeType(1<<17)
.. autoattribute:: COMMON_ANCESTOR
:annotation: = NodeType(1<<18)
.. autoattribute:: MIGRANT
:annotation: = NodeType(1<<19)
.. autoattribute:: GENE_CONVERSION
:annotation: = NodeType(1<<21)
.. autoattribute:: PASS_THROUGH
:annotation: = NodeType(1<<22)
```

#### Models

```{eval-rst}
Expand Down
21 changes: 11 additions & 10 deletions msprime/ancestry.py
Expand Up @@ -549,11 +549,12 @@ def simulate(
arising from common ancestor and recombination events in the output
tree sequence. This will result in unary nodes (i.e., nodes in marginal
trees that have only one child). Defaults to False.
:param msprime.NodeType additional_nodes: Retain all ancestry for any nodes of
the specified type. This will result in unary nodes. Defaults to msprime.NodeType(0).
:param NodeType additional_nodes: Retain all ancestry for any nodes of
the specified type. This will result in unary nodes.
Defaults to :class: `.NodeType(0).`
:param bool coalescing_segments_only: If False, retain all ancestry for any
nodes that are coalescent nodes anywhere in the sequence. This will result
in unary nodes. Defaults to True.
nodes that are coalescent nodes anywhere in the sequence. This will result
in unary nodes. Defaults to True.
:param model: The simulation model to use.
This can either be a string (e.g., ``"smc_prime"``) or an instance of
a ancestry model class (e.g, ``msprime.DiscreteTimeWrightFisher()``.
Expand Down Expand Up @@ -1178,12 +1179,12 @@ def sim_ancestry(
tree sequence. This will result in unary nodes (i.e., nodes in marginal
trees that have only one child). Defaults to False.
See the :ref:`sec_ancestry_full_arg` section for examples.
:param msprime.NodeType additional_nodes: Retain all ancestry for any node
of the specified type. This will result in unary nodes.
Defaults to msprime.NodeType(0).
:param NodeType additional_nodes: Retain all ancestry for any node
of the specified type. This will result in unary nodes.
Defaults to class `msprime.NodeType(0)`.
:param bool coalescing_segments_only: If False, retain all ancestry for any
nodes that are coalescent nodes anywhere in the sequence. This will result in
unary nodes. Defaults to True.
nodes that are coalescent nodes anywhere in the sequence. This will result in
unary nodes. Defaults to True.
:param bool record_migrations: If True, record all migration events
that occur in the :ref:`tskit:sec_migration_table_definition` of
the output tree sequence. Defaults to False.
Expand Down Expand Up @@ -1325,7 +1326,7 @@ class ExitReason(enum.IntEnum):

class NodeType(enum.Flag):
"""
The different node types associated with all possible events.
Specify the type of node for which you want to track ancestry.
"""

RECOMBINANT = 1 << 17
Expand Down
3 changes: 2 additions & 1 deletion tests/test_mutations.py
Expand Up @@ -2395,7 +2395,7 @@ def test_record_unary(self):
20,
sequence_length=10,
random_seed=2,
record_unary=True,
coalescing_segments_only=False,
recombination_rate=1,
)
assert ts.num_trees > 1
Expand All @@ -2408,6 +2408,7 @@ def test_full_arg(self):
sequence_length=10,
random_seed=2,
record_full_arg=True,
coalescing_segments_only=False,
recombination_rate=1,
)
assert ts.num_trees > 1
Expand Down
3 changes: 2 additions & 1 deletion tests/test_simulate_from.py
Expand Up @@ -1295,7 +1295,7 @@ def test_record_unary(self):
random_seed=4,
recombination_rate=0.1,
population_size=1,
record_unary=True,
coalescing_segments_only=False,
)
assert rts.num_trees - ts.num_trees > 0
rts_simplified = rts.simplify()
Expand All @@ -1312,6 +1312,7 @@ def test_full_arg(self):
recombination_rate=1,
population_size=1,
record_full_arg=True,
coalescing_segments_only=False,
)
assert rts.num_trees - ts.num_trees > 0
flags = rts.tables.nodes.flags
Expand Down

0 comments on commit 2a492a6

Please sign in to comment.