File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed
Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -1026,12 +1026,20 @@ def node_info(node, label):
10261026 parent_left = hmm_match ["path" ][0 ]["parent" ]
10271027 parent_right = hmm_match ["path" ][1 ]["parent" ]
10281028
1029+ edges_right = self .ts .edges_right [self .ts .edges_child == u ]
1030+ interval_right = int (edges_right .min ())
1031+ if interval_right != interval [0 ][1 ]:
1032+ logger .warning (
1033+ f"RE: { u } interval right shifted from { interval [0 ][1 ]} "
1034+ f"to { interval_right } "
1035+ )
1036+
10291037 datum = {
10301038 "num_descendant_samples" : self .nodes_max_descendant_samples [u ],
10311039 "num_samples" : len (samples ),
10321040 "distinct_sample_pango" : len (set (causal_lineages .values ())),
10331041 "interval_left" : interval [0 ][0 ],
1034- "interval_right" : interval [ 0 ][ 1 ] ,
1042+ "interval_right" : interval_right ,
10351043 "num_mutations" : len (hmm_match ["mutations" ]),
10361044 "Viridian_amplicon_scheme" : self .nodes_metadata [v ].get (
10371045 "Viridian_amplicon_scheme" , "Unknown"
Original file line number Diff line number Diff line change @@ -223,6 +223,21 @@ def test_recombinants_summary_example_2(self, fx_recombinant_example_2):
223223 assert row ["diffs" ] == 6
224224 assert row ["max_run_length" ] == 2
225225
226+ def test_recombinants_summary_example_2_bp_shift (self , fx_recombinant_example_2 ):
227+ tables = fx_recombinant_example_2 .dump_tables ()
228+ sample = 55
229+ row = tables .nodes [sample ]
230+ md = row .metadata
231+ # Shift the bp one base right
232+ md ["sc2ts" ]["breakpoint_intervals" ] = [[114 , 29826 ]]
233+ tables .nodes [sample ] = row .replace (metadata = md )
234+ ts = tables .tree_sequence ()
235+ ti = info .TreeInfo (ts , show_progress = False )
236+ df1 = ti .recombinants_summary (characterise_copying = True , show_progress = False )
237+ ti = info .TreeInfo (fx_recombinant_example_2 , show_progress = False )
238+ df2 = ti .recombinants_summary (characterise_copying = True , show_progress = False )
239+ pd .testing .assert_frame_equal (df1 , df2 )
240+
226241
227242class TestSampleGroupInfo :
228243 def test_draw_svg (self , fx_ti_2020_02_13 ):
You can’t perform that action at this time.
0 commit comments