Skip to content

Commit f1757db

Browse files
petrelharpjeromekelleher
authored andcommitted
additional clarification about union behavior with populations
1 parent 99a9b34 commit f1757db

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

python/tskit/trees.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7451,11 +7451,20 @@ def union(
74517451
4. Sites which were not present in ``self``, if the site contains a newly
74527452
added mutation.
74537453
7454-
By default, populations of newly added nodes are assumed to be new
7455-
populations, and added to the population table as well. This can be
7456-
thought of as a "node-wise" union: for instance, it can not be used
7457-
to add new edges between two nodes already in ``self`` or new mutations
7458-
above nodes already in ``self``.
7454+
This can be thought of as a "node-wise" union: for instance, it can not
7455+
be used to add new edges between two nodes already in ``self`` or new
7456+
mutations above nodes already in ``self``.
7457+
7458+
By default, with ``add_populations=True``, populations of all newly added
7459+
nodes are assumed to be new populations, and added to the end of the
7460+
population table as well. This is appropriate if all nodes to be added
7461+
are from distinct populations not already in ``self`` and ordering of
7462+
populations is not important. On the other hand, if
7463+
``add_populations=False`` then no new populations are added, so any
7464+
populations referred to in ``other`` must already exist in ``self``.
7465+
If some new nodes are in populations already in ``self`` but other new
7466+
nodes are in entirely new populations, then you must set up the
7467+
population table first, and then union with ``add_populations=False``.
74597468
74607469
If the resulting tree sequence is invalid (for instance, a node is
74617470
specified to have two distinct parents on the same interval),

0 commit comments

Comments
 (0)