Skip to content

Commit 8f138e9

Browse files
authored
Tidy extend_haplotypes docstring (#3315)
And add doi
1 parent 3808fda commit 8f138e9

File tree

2 files changed

+18
-13
lines changed

2 files changed

+18
-13
lines changed

c/tskit/trees.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -933,17 +933,20 @@ path from `p` to `c`. For instance, if `p` is the parent of `n` and `n`
933933
is the parent of `c`, then the span of the edges from `p` to `n` and
934934
`n` to `c` are extended, and the span of the edge from `p` to `c` is
935935
reduced. However, any edges whose child node is a sample are not
936-
modified. The `node` of certain mutations may also be remapped; to do this
936+
modified. See Fritze et al. (2025):
937+
https://doi.org/10.1093/genetics/iyaf198 for more details.
938+
939+
The method works by iterating over the genome to look for edges that can
940+
be extended in this way; the maximum number of such iterations is
941+
controlled by ``max_iter``.
942+
943+
The `node` of certain mutations may also be remapped; to do this
937944
unambiguously we need to know mutation times. If mutations times are unknown,
938945
use `tsk_table_collection_compute_mutation_times` first.
939946
940947
The method will not affect any tables except the edge table, or the node
941948
column in the mutation table.
942949
943-
The method works by iterating over the genome to look for edges that can
944-
be extended in this way; the maximum number of such iterations is
945-
controlled by ``max_iter``.
946-
947950
@rst
948951
949952
**Options**: None currently defined.

python/tskit/trees.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7397,7 +7397,9 @@ def extend_haplotypes(self, max_iter=10):
73977397
`n` to `c` are extended, and the span of the edge from `p` to `c` is
73987398
reduced. Thus, the ancestral haplotype represented by `n` is extended
73997399
to a longer span of the genome. However, any edges whose child node is
7400-
a sample are not modified.
7400+
a sample are not modified. See
7401+
`Fritze et al. (2025) <https://doi.org/10.1093/genetics/iyaf198>`_
7402+
for more details.
74017403
74027404
Since some edges may be removed entirely, this process usually reduces
74037405
the number of edges in the tree sequence.
@@ -7420,15 +7422,15 @@ def extend_haplotypes(self, max_iter=10):
74207422
known mutation times. See :meth:`.impute_unknown_mutations_time` if
74217423
mutation times are not known.
74227424
7423-
The method will not affect the marginal trees (so, if the original tree
7424-
sequence was simplified, then following up with `simplify` will recover
7425-
the original tree sequence, possibly with edges in a different order).
7426-
It will also not affect the genotype matrix, or any of the tables other
7427-
than the edge table or the node column in the mutation table.
7425+
.. note::
7426+
The method will not affect the marginal trees (so, if the original tree
7427+
sequence was simplified, then following up with `simplify` will recover
7428+
the original tree sequence, possibly with edges in a different order).
7429+
It will also not affect the genotype matrix, or any of the tables other
7430+
than the edge table or the node column in the mutation table.
74287431
7429-
:param int max_iters: The maximum number of iterations over the tree
7432+
:param int max_iter: The maximum number of iterations over the tree
74307433
sequence. Defaults to 10.
7431-
74327434
:return: A new tree sequence with unary nodes extended.
74337435
:rtype: tskit.TreeSequence
74347436
"""

0 commit comments

Comments
 (0)