Skip to content

include windows in genetic_relatedness_vector #2996

Closed

Description

@petrelharp

Currently it's hard-coded "no windows".

I was a bit worried about how to efficiently deal with clearing out state between windows, but there's a nice way. Naively, we could start at each sample and traverse up the tree to the root to compute the state for that sample. That'd be O(N log N). However, if we clear the state of each node we pass through on the way, that lets us know "we've already been here and everywhere above this"; so we just have to traverse up until we find a node with x == position. This means we hit each edge once; so it's O(N).

Activity

  1. petrelharp commented on Sep 24, 2024

    @petrelharp
    ContributorAuthor

    Oh, wait - that doesn't work. The issue is that we store things so that the desired value is the sum all the way up the tree; we don't have a notion of "stuff further up the tree doesn't contribute". This was the price we had to pay for not keeping track of siblings and children - we'd need sibs and children to push things back down the tree.

    So - I'll do this in the O(N log N) way; I think to do better we need a way to traverse back down the tree.

  2. jeromekelleher commented on Sep 24, 2024

    @jeromekelleher
    Member

    Meh, log N is small so let's not worry about it. Could easily be cancelled out by a simpler algorithm.

  3. added 3 commits that reference this issue on Sep 25, 2024
    39174d2
    93db1d4
    75ba0c3
  4. added a commit that references this issue on Sep 25, 2024
    e724f33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions