File tree Expand file tree Collapse file tree 1 file changed +2
-17
lines changed Expand file tree Collapse file tree 1 file changed +2
-17
lines changed Original file line number Diff line number Diff line change @@ -127,24 +127,9 @@ def get_mut_edges(ts):
127
127
"""
128
128
Get the number of mutations on each edge in the tree sequence.
129
129
"""
130
- edge_diff_iter = ts .edge_diffs ()
131
- right = 0
132
- edges_by_child = {} # contains {child_node:edge_id}
133
130
mut_edges = np .zeros (ts .num_edges , dtype = np .int64 )
134
- for site in ts .sites ():
135
- while right <= site .position :
136
- (left , right ), edges_out , edges_in = next (edge_diff_iter )
137
- for e in edges_out :
138
- del edges_by_child [e .child ]
139
- for e in edges_in :
140
- assert e .child not in edges_by_child
141
- edges_by_child [e .child ] = e .id
142
- for m in site .mutations :
143
- # In some cases, mutations occur above the root
144
- # These don't provide any information for the inside step
145
- if m .node in edges_by_child :
146
- edge_id = edges_by_child [m .node ]
147
- mut_edges [edge_id ] += 1
131
+ for m in ts .mutations ():
132
+ mut_edges [m .edge ] += 1
148
133
return mut_edges
149
134
150
135
@staticmethod
You can’t perform that action at this time.
0 commit comments