Skip to content

Get the edge ids for every mutation in a TS #1307

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

You must be logged in to vote

Now that the mutations have an edge ID associated with them (see #2279) we should be able to do this with a simple loop. For example

def new_get_num_muts_for_edges(ts):
    mut_edges = np.zeros(ts.num_edges, dtype=int)
    for m in ts.mutations():
        mut_edges[m.edge] += 1
    return mut_edges

def new_get_muts_for_edges(ts):
    return np.array([m.edge for m in ts.mutations()])

Replies: 1 comment

Comment options

hyanwong
May 24, 2023
Collaborator Author

You must be logged in to vote
0 replies
Answer selected by hyanwong
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant