Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions c/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@

**Features**

- Add ``parents`` to the individual table to enable recording of pedigrees
(:user:`ivan-krukov`, :user:`benjeffery`, :issue:`852`, :pr:`1125`, :pr:`866`, :pr:`1153`, :pr:`1177`).

**Breaking changes**

- Method ``tsk_individual_table_add_row`` has an extra arguments ``parents`` and ``parents_length``.

**Bugfixes**

----------------------
Expand Down
2 changes: 1 addition & 1 deletion c/tskit/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ to the API or ABI are introduced, i.e., internal refactors of bugfixes.
#define TSK_FILE_FORMAT_NAME "tskit.trees"
#define TSK_FILE_FORMAT_NAME_LENGTH 11
#define TSK_FILE_FORMAT_VERSION_MAJOR 12
#define TSK_FILE_FORMAT_VERSION_MINOR 3
#define TSK_FILE_FORMAT_VERSION_MINOR 4

/**
@defgroup GENERAL_ERROR_GROUP General errors.
Expand Down
3 changes: 3 additions & 0 deletions python/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

**Features**

- Add ``parents`` column to the individual table to allow recording of pedigrees
(:user:`ivan-krukov`, :user:`benjeffery`, :issue:`852`, :pr:`1125`, :pr:`866`, :pr:`1153`, :pr:`1177`).

- Added ``Tree.generate_random_binary`` static method to create random
binary trees (:user:`hyanwong`, :user:`jeromekelleher`, :pr:`1037`).

Expand Down
6 changes: 6 additions & 0 deletions python/lwt_interface/CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
--------------------
[0.1.3] - 2021-02-01
--------------------

- Added optional ``parents`` to individual table.

--------------------
[0.1.2] - 2020-10-22
--------------------
Expand Down
17 changes: 15 additions & 2 deletions python/lwt_interface/dict_encoding_testlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def test_check_ts_full(tmp_path, full_ts):
class TestEncodingVersion:
def test_version(self):
lwt = lwt_module.LightweightTableCollection()
assert lwt.asdict()["encoding_version"] == (1, 2)
assert lwt.asdict()["encoding_version"] == (1, 3)


class TestRoundTrip:
Expand All @@ -141,7 +141,9 @@ def test_individuals(self):
ts = msprime.simulate(n, mutation_rate=1, random_seed=2)
tables = ts.dump_tables()
for j in range(n):
tables.individuals.add_row(flags=j, location=(j, j), metadata=b"x" * j)
tables.individuals.add_row(
flags=j, location=(j, j), parents=(j, j), metadata=b"x" * j
)
self.verify(tables)

def test_sequence_length(self):
Expand Down Expand Up @@ -473,10 +475,21 @@ def test_individuals(self, tables):
self.verify_offset_pair(
tables, len(tables.individuals), "individuals", "location"
)
self.verify_offset_pair(
tables, len(tables.individuals), "individuals", "parents"
)
self.verify_offset_pair(
tables, len(tables.individuals), "individuals", "metadata"
)
self.verify_metadata_schema(tables, "individuals")
# Verify optional parents column
d = tables.asdict()
d["individuals"]["parents"] = None
d["individuals"]["parents_offset"] = None
lwt = lwt_module.LightweightTableCollection()
lwt.fromdict(d)
out = lwt.asdict()
assert all(val == [] for val in out["individuals"]["parents"])

def test_nodes(self, tables):
self.verify_offset_pair(tables, len(tables.nodes), "nodes", "metadata")
Expand Down
2 changes: 1 addition & 1 deletion python/lwt_interface/tskit_lwt_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -1695,7 +1695,7 @@ dump_tables_dict(tsk_table_collection_t *tables)
}

/* Dict representation version */
val = Py_BuildValue("ll", 1, 2);
val = Py_BuildValue("ll", 1, 3);
if (val == NULL) {
goto out;
}
Expand Down
2 changes: 1 addition & 1 deletion python/tests/test_file_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@


CURRENT_FILE_MAJOR = 12
CURRENT_FILE_MINOR = 3
CURRENT_FILE_MINOR = 4

test_data_dir = os.path.join(os.path.dirname(__file__), "data")

Expand Down
2 changes: 1 addition & 1 deletion python/tskit/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -2233,7 +2233,7 @@ def asdict(self):
map of table names to the tables themselves was returned.
"""
ret = {
"encoding_version": (1, 2),
"encoding_version": (1, 3),
"sequence_length": self.sequence_length,
"metadata_schema": repr(self.metadata_schema),
"metadata": self.metadata_schema.encode_row(self.metadata),
Expand Down