[med-svn] [Git][med-team/python-ncls][upstream] New upstream version 0.0.56+ds
Nilesh Patra
gitlab at salsa.debian.org
Tue Oct 13 07:31:51 BST 2020
Nilesh Patra pushed to branch upstream at Debian Med / python-ncls
Commits:
bc53e262 by Nilesh Patra at 2020-10-13T11:57:45+05:30
New upstream version 0.0.56+ds
- - - - -
8 changed files:
- CHANGELOG
- ncls/src/cncls.pxd
- ncls/src/intervaldb.c
- ncls/src/intervaldb.h
- ncls/src/ncls.pyx
- ncls/version.py
- setup.py
- tests/test_ncls.py
Changes:
=====================================
CHANGELOG
=====================================
@@ -1,4 +1,10 @@
-# 0.0.53 (unreleased)
+# 0.0.55-56 (12.10.20)
+- fix build on 32-bit architectures (thanks to nileshpatra)
+
+# 0.0.54 (14.09.20)
+- fix #38 (thanks fireice-uk)
+
+# 0.0.53 (?)
- add datastructure FNCLS which uses floating point starts and ends
# 0.0.52 (20.02.20)
=====================================
ncls/src/cncls.pxd
=====================================
@@ -52,8 +52,8 @@ cdef extern from "ncls/src/intervaldb.h":
int start
int len
- int find_overlap_start(int64_t start, int64_t end, IntervalMap im[], int n)
- int find_suboverlap_start(int64_t start, int64_t end, int isub, IntervalMap im[], SublistHeader subheader[])
+ int64_t find_overlap_start(int64_t start, int64_t end, IntervalMap im[], int n)
+ int64_t find_suboverlap_start(int64_t start, int64_t end, int isub, IntervalMap im[], SublistHeader subheader[])
int imstart_qsort_cmp(void *void_a,void *void_b)
IntervalMap *read_intervals(int n,FILE *ifile)
SublistHeader *build_nested_list(IntervalMap im[],int n,int *p_n,int *p_nlists)
=====================================
ncls/src/intervaldb.c
=====================================
@@ -370,10 +370,10 @@ int find_index_start(int start,int end,IntervalIndex im[],int n)
-inline int find_suboverlap_start(int start,int end,int isub,IntervalMap im[],
+inline int64_t find_suboverlap_start(int64_t start, int64_t end, int isub, IntervalMap im[],
SublistHeader subheader[])
{
- int i;
+ int64_t i;
if (isub>=0) {
i=find_overlap_start(start,end,im+subheader[isub].start,subheader[isub].len);
=====================================
ncls/src/intervaldb.h
=====================================
@@ -77,8 +77,8 @@ typedef struct {
extern int *alloc_array(int n);
-extern int64_t find_overlap_start(int64_t start,int64_t end,IntervalMap im[],int n);
-extern int find_suboverlap_start(int start,int end,int isub,IntervalMap im[],SublistHeader subheader[]);
+extern int64_t find_overlap_start(int64_t start, int64_t end, IntervalMap im[],int n);
+extern int64_t find_suboverlap_start(int64_t start, int64_t end,int isub, IntervalMap im[], SublistHeader subheader[]);
extern int imstart_qsort_cmp(const void *void_a,const void *void_b);
extern int target_qsort_cmp(const void *void_a,const void *void_b);
extern IntervalMap *read_intervals(int n,FILE *ifile);
=====================================
ncls/src/ncls.pyx
=====================================
@@ -150,7 +150,7 @@ cdef class NCLS64:
@cython.boundscheck(False)
@cython.wraparound(False)
@cython.initializedcheck(False)
- cpdef last_overlap_both(self, const int64_t [::1] starts, const int64_t [::1] ends, const long [::1] indexes):
+ cpdef last_overlap_both(self, const int64_t [::1] starts, const int64_t [::1] ends, const int64_t [::1] indexes):
cdef int i = 0
cdef int nhit = 0
@@ -159,10 +159,10 @@ cdef class NCLS64:
cdef int nfound = 0
cdef int max_end = -1
- output_arr = np.zeros(length, dtype=long)
- output_arr_other = np.zeros(length, dtype=long)
- cdef long [::1] output
- cdef long [::1] output_other
+ output_arr = np.zeros(length, dtype=np.int64)
+ output_arr_other = np.zeros(length, dtype=np.int64)
+ cdef int64_t [::1] output
+ cdef int64_t [::1] output_other
output = output_arr
output_other = output_arr_other
@@ -588,8 +588,8 @@ cdef class NCLS64:
cdef int loop_counter = 0
cdef int nfound = 0
- output_arr = np.zeros(length, dtype=np.long)
- output_arr_other = np.zeros(length, dtype=np.long)
+ output_arr = np.zeros(length, dtype=np.int64)
+ output_arr_other = np.zeros(length, dtype=np.int64)
cdef int64_t [::1] output
cdef int64_t [::1] output_other
@@ -630,8 +630,8 @@ cdef class NCLS64:
cdef int nfound = 0
cdef int64_t start, end
- output_arr = np.zeros(length, dtype=np.long)
- output_arr_other = np.zeros(length, dtype=np.long)
+ output_arr = np.zeros(length, dtype=np.int64)
+ output_arr_other = np.zeros(length, dtype=np.int64)
cdef int64_t [::1] output
cdef int64_t [::1] output_other
@@ -725,10 +725,10 @@ cdef class NCLSIterator:
cdef cn.IntervalIterator *it_alloc
cdef cn.IntervalMap im_buf[1024]
cdef int nhit, ihit
- cdef int64_t start, end
+ cdef int64_t start, end
cdef NCLS64 db
- def __cinit__(self, long start, long end, NCLS64 db not None):
+ def __cinit__(self, int64_t start, int64_t end, NCLS64 db not None):
self.it = cn.interval_iterator_alloc()
self.it_alloc = self.it
self.start = start
=====================================
ncls/version.py
=====================================
@@ -1 +1 @@
-__version__ = "0.0.53"
+__version__ = "0.0.56"
=====================================
setup.py
=====================================
@@ -1,5 +1,5 @@
-from distutils.core import setup
from setuptools import find_packages, Extension, Command
+from distutils.core import setup
# try:
@@ -94,4 +94,3 @@ setup(
package_data={'': ['*.pyx', '*.pxd', '*.h', '*.c']},
include_dirs=["."],
)
-
=====================================
tests/test_ncls.py
=====================================
@@ -1,40 +1,81 @@
+import struct
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)
+import struct
+# 64 bit architecture?
+if struct.calcsize("P") * 8 == 64:
-ids = np.array([2147483647, 3], dtype=np.long)
+ starts = np.array([5, 9_223_372_036_854_775_805], dtype=np.int64)
-def test_ncls():
- # ids = starts
+ ends = np.array([6, 9_223_372_036_854_775_807], dtype=np.int64)
- print(starts, ends, ids)
+ ids = np.array([2147483647, 3], dtype=np.int64)
- ncls = NCLS(starts, ends, ids)
- print(ncls)
- print(ncls.intervals())
+ def test_ncls():
+ # ids = starts
- 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)]
+ print(starts, ends, ids)
- r, l = ncls.all_overlaps_both(starts, ends, ids)
- assert list(r) == [2147483647, 3]
- assert list(l) == [2147483647, 3]
+ ncls = NCLS(starts, ends, ids)
+ print(ncls)
+ print(ncls.intervals())
-def test_all_containments_both():
+ 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)]
- starts = np.array([1291845632, 3002335232], dtype=int)
- ends = np.array([1292894207, 3002597375], dtype=int)
- ids = np.array([0, 1], dtype=int)
+ r, l = ncls.all_overlaps_both(starts, ends, ids)
+ assert list(r) == [2147483647, 3]
+ assert list(l) == [2147483647, 3]
- ncls = NCLS(starts, ends, ids)
- subs, covers = ncls.all_containments_both(starts, ends, ids)
+ def test_all_containments_both():
- print(ncls.intervals())
+ starts = np.array([1291845632, 3002335232], dtype=np.int64)
+ ends = np.array([1292894207, 3002597375], dtype=np.int64)
+ ids = np.array([0, 1], dtype=np.int64)
- assert list(subs) == [0, 1] == list(covers)
+ ncls = NCLS(starts, ends, ids)
+ subs, covers = ncls.all_containments_both(starts, ends, ids)
+
+ print(ncls.intervals())
+
+ assert list(subs) == [0, 1] == list(covers)
+
+else:
+
+ starts = np.array([5, 2_147_483_645], dtype=np.int64)
+ ends = np.array([6, 2_147_483_646], dtype=np.int64)
+ ids = np.array([0, 3], dtype=np.int64)
+
+ 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)) == []
+ assert list(ncls.find_overlap(0, 2_147_483_647)) == [(5, 6, 0), (2_147_483_645, 2_147_483_646, 3)]
+
+ r, l = ncls.all_overlaps_both(starts, ends, ids)
+ assert list(r) == [0, 3]
+ assert list(l) == [0, 3]
+
+ def test_all_containments_both():
+
+ starts = np.array([5, 10], dtype=np.int64)
+ ends = np.array([6, 50], dtype=np.int64)
+ ids = np.array([0, 1], dtype=np.int64)
+
+ ncls = NCLS(starts, ends, ids)
+ subs, covers = ncls.all_containments_both(starts, ends, ids)
+
+ print(ncls.intervals())
+
+ assert list(subs) == [0, 1] == list(covers)
View it on GitLab: https://salsa.debian.org/med-team/python-ncls/-/commit/bc53e2626eb2f1fa60f2e94db42b5603dc5ed21f
--
View it on GitLab: https://salsa.debian.org/med-team/python-ncls/-/commit/bc53e2626eb2f1fa60f2e94db42b5603dc5ed21f
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20201013/19d3499e/attachment-0001.html>
More information about the debian-med-commit
mailing list