Skip to content

tree sequence with edges has no edges on load #527

Closed

Description

@petrelharp

With the current HEAD, it seems that SLiM-produced tree sequences - which have edges - are not loaded with edges. For instance, running this SLiM script:

wget https://raw.githubusercontent.com/tskit-dev/pyslim/master/tests/examples/recipe_nonWF.slim
slim recipe_nonWF.slim
tskit info recipe_nonWF.trees

tells me there are no edges:

sequence_length:  100.0
trees:            1
samples:          28
individuals:      24
nodes:            58
edges:            0
sites:            33
mutations:        40
migrations:       0
populations:      2
provenances:      1

but there should be, and kastore confirms it:

kastore dump recipe_nonWF.trees edges/parent | wc -l
# 93

I bisected this, and found that this got introduced somewhere in these commits:

f53ff61344dbe15184a065daf43600623c286dea
d73d85a3c1d8c5c2bc4f4a0174dd5b85fb8834a9
fa35ef554aa43290f1d021ef6792c0ad85be8baf
0161fb30ffb4f4a65a8240da004a374a2fb743fe
4b285a5a70b71ff1fa63c9c12f3044ab0d3abafb
cbeb1297962400a1004b519da78ed4aa5785d163

I can't tell which of these commits, though, because trying to load the tree sequence at any of these commits results in this error:

$ tskit info recipe_nonWF.trees 
Traceback (most recent call last):
  File "/home/peter/.local/bin/tskit", line 11, in <module>
    load_entry_point('tskit==0.2.4.dev0', 'console_scripts', 'tskit')()
  File "/home/peter/.local/lib/python3.7/site-packages/tskit-0.2.4.dev0-py3.7-linux-x86_64.egg/tskit/cli.py", line 281, in tskit_main
    args.runner(args)
  File "/home/peter/.local/lib/python3.7/site-packages/tskit-0.2.4.dev0-py3.7-linux-x86_64.egg/tskit/cli.py", line 54, in run_info
    ts = load_tree_sequence(args.tree_sequence)
  File "/home/peter/.local/lib/python3.7/site-packages/tskit-0.2.4.dev0-py3.7-linux-x86_64.egg/tskit/cli.py", line 48, in load_tree_sequence
    return tskit.load(path)
  File "/home/peter/.local/lib/python3.7/site-packages/tskit-0.2.4.dev0-py3.7-linux-x86_64.egg/tskit/trees.py", line 1805, in load
    return TreeSequence.load(path)
  File "/home/peter/.local/lib/python3.7/site-packages/tskit-0.2.4.dev0-py3.7-linux-x86_64.egg/tskit/trees.py", line 2385, in load
    ts.load(str(path))
_tskit.LibraryError: Bad offset provided in input array

So, my guess is that f53ff61 introduced this "bad offset" bug, and cbeb129 fixed it but introduced a different bug.

I've inserted some fprintf()s into tsk_edge_table_load and read_table_cols, and verified that at this point there are in fact edges being read in. I haven't gone further down the path to figure out where things are going wrong, though.

I know this is HEAD, but it's still not good to be silently getting bad tree sequences.

Activity

  1. benjeffery commented on Apr 10, 2020

    @benjeffery
    Member

    @petrelharp thanks for finding this, I agree that it's not at all good. I'll look into it. With those PRs we are introducing the first optional columns to keep backwards compatibility so likely I have missed some detail.

    I had thought recently that we should put in some tests with older minor file format versions, this confirms that as it's not being picked up by the current test suite.

  2. self-assigned this
    on Apr 10, 2020
  3. added
    bug
    on Apr 10, 2020
  4. added this to the C API 0.99.3 milestone on Apr 10, 2020
  5. petrelharp commented on Apr 10, 2020

    @petrelharp
    ContributorAuthor

    we should put in some tests with older minor file format versions

    definately!

  6. added 4 commits that reference this issue on Apr 11, 2020
    26e9228
    f51ab0c
    72b126e
    a4a7220
  7. added a commit that references this issue on Apr 16, 2020
    5714959
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions