From fe495d685c8c2b601efef58cc4aacd1334167e73 Mon Sep 17 00:00:00 2001 From: Yan Wong Date: Thu, 8 Jul 2021 17:45:54 +0100 Subject: [PATCH] Correct docs to point out that individuals are sorted --- docs/data-model.rst | 4 ++-- python/tskit/tables.py | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/data-model.rst b/docs/data-model.rst index 20ec2a121e..c90047dd6a 100644 --- a/docs/data-model.rst +++ b/docs/data-model.rst @@ -570,8 +570,8 @@ respect to any other tables. Individuals can have a reference to their parent individuals, if present these references must be valid or null (-1). Individuals must be sorted such that parents are before children. -Sorting a set of tables using :meth:`TableCollection.sort` has -no effect on the individuals. +Sorting a set of tables using :meth:`TableCollection.sort` will ensure that +this requirement is fulfilled. .. _sec_node_requirements: diff --git a/python/tskit/tables.py b/python/tskit/tables.py index 7e69ffa141..4d951ac54b 100644 --- a/python/tskit/tables.py +++ b/python/tskit/tables.py @@ -2924,7 +2924,7 @@ def sort(self, edge_start=0): are not affected. This parameter is provided to allow for efficient sorting when the user knows that the edges up to a given index are already sorted. - The individual, node, population and provenance tables are not affected + The node, population and provenance tables are not affected by this method. Edges are sorted as follows: @@ -2940,6 +2940,9 @@ def sort(self, edge_start=0): given parent ID are adjacent, but we do not require that they be listed in sorted order. + Individuals are sorted so that parents come before children, and the + parent column remapped as required. + Sites are sorted by position, and sites with the same position retain their relative ordering.