Skip to content

Bug assertion in ts.allele_frequency_spectrum #2923

Open
@nspope

Description

@nspope

with: afs_error.trees.gz

import tskit
print(tskit.__version__) # '0.5.7.dev0'
ts = tskit.load("afs_error.trees")
ts.allele_frequency_spectrum() # works
ts.allele_frequency_spectrum(sample_sets=[[x for x in range(64)]]) # segfaults
# Bug detected in lib/tskit/trees.c at line 2721. If you are using tskit directly please open an issue on 
# GitHub, ideally with a reproducible example. (https://github.com/tskit-dev/tskit/issues) 
# Aborted (core dumped)

This example has one tree and one site. The segfault seems to be linked to the fact that there are multiple mutations at the site, but mutations.parent is tskit.NULL even when mutations are beneath another-- that is, if I dump tables and correct the mutations.parent column to reflect what mutation replaced what, then everything works.

This is output from SINGER, so I'll let them know that mutations.parent should be set during conversion to a tree sequence. But, it'd be nice to have the above example run through, or at least throw an informative error (note that ts.diversity works, although it returns a negative number for the "sample_sets" case above).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions