Skip to content

Efficiently identifying nodes in a list of marginal trees (indexed from across the genome) #3232

Answered by hyanwong
moshejasper asked this question in Q&A
Discussion options

You must be logged in to vote

Re the edge_diffs approach, the general idea of using a node mask and adding / subtracting from that is probably right.

Have you tried using the fast Tree array accessors. That might also be a good option?

Simply:

used_nodes = np.zeros(ts.num_nodes)
for tree in ts.trees():
    if I_am_using_this_tree:
        used_nodes[tree.preorder()] = True

It could well be fast enough?

Replies: 1 comment 7 replies

Comment options

You must be logged in to vote
7 replies
@moshejasper
Comment options

@moshejasper
Comment options

@hyanwong
Comment options

@hyanwong
Comment options

Answer selected by moshejasper
@moshejasper
Comment options

@moshejasper
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants