From: Multiple genome comparison based on overlap regions of pairwise local alignments
Algorithm 1 (LinearMOI) |
---|
Input: sorted list of all intervals interval[1..n]; number of collections k |
Variables: largest end point seen so far in each collection endPoint[1..k]; c[0..l] |
1: endPoint[1..k] ← 0 |
2: prevEnd ← 0 |
3: min ← 0 |
4: c[0] ← k; c[1..l] ← 0 |
5: for all ∈ interval[1..n] do |
6: if end >endPoint[j] then |
7: c[endPoint[j]] ← c[endPoint[j]] - 1 |
8: c[end] ← c[end] + 1 |
9: endPoint[j] ← end |
10: end if |
11: if all intervals with recent start position processed then |
12: while c[min] = 0 do |
13: min ← min + 1 |
14: end while |
15: if prevEnd < min and min ≥ start then |
16: output MOI(start, min) |
17: prevEnd ← min |
18: end if |
19: end if |
20: end for |