tskit icon indicating copy to clipboard operation
tskit copied to clipboard

get shared tree across an interval

Open petrelharp opened this issue 5 months ago • 5 comments

A common thing we'd like to do is to visualize shared structure in the trees across a region of the genome. It occurs to me that one way to do this is would be to be able to do like ts.at( ), perhaps

tree = ts.at(interval=(left, right))

which returns the tree constructed by all edges that span the entire interval [left, right).

Probably, this would be like "if the argument to ts.at( ) is a tuple of length two, return the interval".

I do like the ts.at() syntax, but we might alternatively implement this as

def tree(at=None, interval=None):
    if at is not None:
        return self.at(at)

and deprecate ts.at().

petrelharp avatar Jul 02 '25 15:07 petrelharp