Skip to content

Commit 41355dc

Browse files
hossam26644benjeffery
authored andcommitted
Remove legacy HDF5 formats
1 parent 35f52cb commit 41355dc

16 files changed

Lines changed: 20 additions & 948 deletions

File tree

c/tskit/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ tsk_strerror_internal(int err)
168168
break;
169169
case TSK_ERR_FILE_VERSION_TOO_OLD:
170170
ret = "tskit file version too old. Please upgrade using the "
171-
"'tskit upgrade' command. (TSK_ERR_FILE_VERSION_TOO_OLD)";
171+
"'tskit upgrade' command from tskit version<0.6.2. (TSK_ERR_FILE_VERSION_TOO_OLD)";
172172
break;
173173
case TSK_ERR_FILE_VERSION_TOO_NEW:
174174
ret = "tskit file version is too new for this instance. "

c/tskit/core.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ A file could not be read because it is in the wrong format
283283
/**
284284
The file is in tskit format, but the version is too old for the
285285
library to read. The file should be upgraded to the latest version
286-
using the ``tskit upgrade`` command line utility.
286+
using the ``tskit upgrade`` command line utility from tskit version<0.6.2.
287287
*/
288288
#define TSK_ERR_FILE_VERSION_TOO_OLD -101
289289
/**

docs/file-formats.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ stored as well as the top-level metadata.
4242
### Legacy Versions
4343

4444
Tree sequence files written by older versions of tskit are not readable by
45-
newer versions of tskit. For major releases of tskit, `tskit upgrade`
45+
newer versions of tskit. For tskit releases<0.6.2, `tskit upgrade`
4646
will convert older tree sequence files to the latest version.
4747

4848

python/CHANGELOG.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717
- Metadata.schema was returning a modified schema, this is fixed to return a copy of
1818
the original schema instead (:user:`benjeffery`, :issue:`3129`, :pr:`3130`)
1919

20+
**Breaking Changes**
21+
22+
- Legacy formats from msprime<0.6 (HDF5 formats) support is dropped. This includes the
23+
support for ``tskit upgrade`` (:user:`hossam26644`, :issue:`2812`, :pr:`3138`)
24+
2025
--------------------
2126
[0.6.1] - 2025-03-31
2227
--------------------
@@ -142,7 +147,7 @@
142147
pass a subset of nodes, so subtrees can be visually collapsed. Additionally, an option
143148
``pack_untracked_polytomies`` allows large polytomies involving untracked samples to
144149
be summarised as a dotted line (:user:`hyanwong`, :issue:`3011` :pr:`3010`, :pr:`3012`)
145-
150+
146151
- Added a ``title`` parameter to ``.draw_svg()`` methods (:user:`hyanwong`, :pr:`3015`)
147152

148153
- Add comma separation to all display numbers. (:user:`benjeffery`, :issue:`3017`, :pr:`3018`)

python/_tskitmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ handle_library_error(int err)
223223
const char *not_kas_format_msg
224224
= "File not in kastore format. Either the file is corrupt or it is not a "
225225
"tskit tree sequence file. It may be a legacy HDF file upgradable with "
226-
"`tskit upgrade` or a compressed tree sequence file that can be decompressed "
226+
"`tskit upgrade` from tskit version<0.6.2 or a compressed tree sequence file that can be decompressed "
227227
"with `tszip`.";
228228
const char *ibd_pairs_not_stored_msg
229229
= "Sample pairs are not stored by default "

python/requirements/CI-complete/requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
biopython==1.85
22
coverage==7.7.0
33
dendropy==5.0.1
4-
h5py==3.13.0
54
kastore==0.3.3
65
lshmm==0.0.8
76
msgpack==1.1.0
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
msprime==1.3.3
22
tszip==0.2.5
3-
h5py==3.13.0
43
zarr<3

python/requirements/development.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ codecov
66
coverage
77
dendropy
88
flake8
9-
h5py>=2.6.0
109
jsonschema>=3.0.0
1110
jupyter-book>=0.12.1
1211
kastore
@@ -22,7 +21,7 @@ numpy
2221
packaging
2322
portion
2423
pre-commit
25-
pyparsing
24+
pyparsing
2625
pysam
2726
pytest
2827
pytest-cov

python/requirements/development.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ dependencies:
1313
- dendropy
1414
- doxygen
1515
- flake8
16-
- h5py>=2.6.0
1716
- jsonschema>=3.0.0
1817
- jupyter-book>=0.12.1
1918
- kastore

python/tests/test_cli.py

Lines changed: 1 addition & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# MIT License
22
#
3-
# Copyright (c) 2018-2024 Tskit Developers
3+
# Copyright (c) 2018-2025 Tskit Developers
44
# Copyright (c) 2017 University of Oxford
55
#
66
# Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -30,7 +30,6 @@
3030
import unittest
3131
from unittest import mock
3232

33-
import h5py
3433
import msprime
3534
import pytest
3635

@@ -311,16 +310,6 @@ def test_vcf_allow_position_zero(self, flags, expected):
311310
assert args.tree_sequence == tree_sequence
312311
assert args.allow_position_zero == expected
313312

314-
def test_upgrade_default_values(self):
315-
parser = cli.get_tskit_parser()
316-
cmd = "upgrade"
317-
source = "in.trees"
318-
destination = "out.trees"
319-
args = parser.parse_args([cmd, source, destination])
320-
assert args.source == source
321-
assert args.destination == destination
322-
assert not args.remove_duplicate_positions
323-
324313
def test_info_default_values(self):
325314
parser = cli.get_tskit_parser()
326315
cmd = "info"
@@ -655,68 +644,3 @@ def test_migrations(self):
655644

656645
def test_provenances(self):
657646
self.verify("provenances")
658-
659-
660-
class TestUpgrade(TestCli):
661-
"""
662-
Tests the results of the upgrade operation to ensure they are
663-
correct.
664-
"""
665-
666-
def setUp(self):
667-
fd, self.legacy_file_name = tempfile.mkstemp(prefix="msp_cli", suffix=".trees")
668-
os.close(fd)
669-
fd, self.current_file_name = tempfile.mkstemp(prefix="msp_cli", suffix=".trees")
670-
os.close(fd)
671-
672-
def tearDown(self):
673-
os.unlink(self.legacy_file_name)
674-
os.unlink(self.current_file_name)
675-
676-
def test_conversion(self):
677-
ts1 = msprime.simulate(10)
678-
for version in [2, 3]:
679-
tskit.dump_legacy(ts1, self.legacy_file_name, version=version)
680-
stdout, stderr = capture_output(
681-
cli.tskit_main,
682-
["upgrade", self.legacy_file_name, self.current_file_name],
683-
)
684-
ts2 = tskit.load(self.current_file_name)
685-
assert stdout == ""
686-
assert stderr == ""
687-
# Quick checks to ensure we have the right tree sequence.
688-
# More thorough checks are done elsewhere.
689-
assert ts1.get_sample_size() == ts2.get_sample_size()
690-
assert ts1.num_edges == ts2.num_edges
691-
assert ts1.get_num_trees() == ts2.get_num_trees()
692-
693-
def test_duplicate_positions(self):
694-
ts = msprime.simulate(10, mutation_rate=10)
695-
for version in [2, 3]:
696-
tskit.dump_legacy(ts, self.legacy_file_name, version=version)
697-
root = h5py.File(self.legacy_file_name, "r+")
698-
root["mutations/position"][:] = 0
699-
root.close()
700-
stdout, stderr = capture_output(
701-
cli.tskit_main,
702-
["upgrade", "-d", self.legacy_file_name, self.current_file_name],
703-
)
704-
assert stdout == ""
705-
tsp = tskit.load(self.current_file_name)
706-
assert tsp.sample_size == ts.sample_size
707-
assert tsp.num_sites == 1
708-
709-
def test_duplicate_positions_error(self):
710-
ts = msprime.simulate(10, mutation_rate=10)
711-
for version in [2, 3]:
712-
tskit.dump_legacy(ts, self.legacy_file_name, version=version)
713-
root = h5py.File(self.legacy_file_name, "r+")
714-
root["mutations/position"][:] = 0
715-
root.close()
716-
with mock.patch("sys.exit", side_effect=TestException) as mocked_exit:
717-
with pytest.raises(TestException):
718-
capture_output(
719-
cli.tskit_main,
720-
["upgrade", self.legacy_file_name, self.current_file_name],
721-
)
722-
assert mocked_exit.call_count == 1

0 commit comments

Comments
 (0)