-
Notifications
You must be signed in to change notification settings - Fork 20
/
test_ncls.py
40 lines (25 loc) · 1.12 KB
/
test_ncls.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from ncls import NCLS
import numpy as np
starts = np.array([5, 9_223_372_036_854_775_805], dtype=np.long)
ends = np.array([6, 9_223_372_036_854_775_807], dtype=np.long)
ids = np.array([2147483647, 3], dtype=np.long)
def test_ncls():
# ids = starts
print(starts, ends, ids)
ncls = NCLS(starts, ends, ids)
print(ncls)
print(ncls.intervals())
assert list(ncls.find_overlap(0, 2)) == []
print("aaa", list(ncls.find_overlap(9_223_372_036_854_775_805, 9_223_372_036_854_775_806)))
assert list(ncls.find_overlap(0, 9_223_372_036_854_775_806)) == [(5, 6, 2147483647), (9223372036854775805, 9223372036854775807, 3)]
r, l = ncls.all_overlaps_both(starts, ends, ids)
assert list(r) == [2147483647, 3]
assert list(l) == [2147483647, 3]
def test_all_containments_both():
starts = np.array([1291845632, 3002335232], dtype=int)
ends = np.array([1292894207, 3002597375], dtype=int)
ids = np.array([0, 1], dtype=int)
ncls = NCLS(starts, ends, ids)
subs, covers = ncls.all_containments_both(starts, ends, ids)
print(ncls.intervals())
assert list(subs) == [0, 1] == list(covers)