Skip to content

Commit e693543

Browse files
committed
Fix edge case where site is near sequence_length
1 parent 15dee64 commit e693543

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tsinfer/inference.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1903,7 +1903,11 @@ def add_sites(self, exclude_positions=None):
19031903
zeros = np.zeros(self.num_samples, dtype=np.int8)
19041904
self.ancestor_builder.add_site(tskit.UNKNOWN_TIME, zeros, terminal=True)
19051905
self.num_sites += 1
1906-
self.terminal_position = np.array([last_position + 1], dtype=np.float64)
1906+
1907+
terminal_position = last_position + 1
1908+
if terminal_position == self.variant_data.sequence_length:
1909+
terminal_position -= 0.5
1910+
self.terminal_position = np.array([terminal_position], dtype=np.float64)
19071911

19081912
logger.info("Finished adding sites")
19091913

0 commit comments

Comments
 (0)