minor tweaks to python

This commit is contained in:
Heng Li 2017-09-16 18:11:43 -04:00
parent 10bd4079d1
commit 322e5a16e5
3 changed files with 11 additions and 14 deletions

4
misc.c
View File

@ -90,7 +90,7 @@ double cputime()
#include <sys/resource.h>
#include <sys/time.h>
double cputime()
double cputime(void)
{
struct rusage r;
getrusage(RUSAGE_SELF, &r);
@ -98,7 +98,7 @@ double cputime()
}
#endif /* WIN32 || _WIN32 */
double realtime()
double realtime(void)
{
struct timeval tp;
struct timezone tzp;

View File

@ -79,13 +79,14 @@ cdef class ThreadBuffer:
cdef class Aligner:
cdef cminimap2.mm_idx_t *_idx
cdef public cminimap2.mm_idxopt_t idx_opt
cdef public cminimap2.mm_mapopt_t map_opt
cdef cminimap2.mm_idxopt_t idx_opt
cdef cminimap2.mm_mapopt_t map_opt
def __cinit__(self, fn_idx_in, preset=None, k=None, w=None, min_cnt=None, min_chain_score=None, min_dp_score=None, bw=None, best_n=None, n_threads=3, fn_idx_out=None):
cdef cminimap2.mm_idx_reader_t *r;
self._config(preset)
cminimap2.mm_set_opt(NULL, &self.idx_opt, &self.map_opt) # set the default options
if preset is not None:
cminimap2.mm_set_opt(preset, &self.idx_opt, &self.map_opt) # apply preset
self.map_opt.flag |= 4 # always perform alignment
self.idx_opt.batch_size = 0x7fffffffffffffffL # always build a uni-part index
if k is not None: self.idx_opt.k = k
if w is not None: self.idx_opt.w = w
@ -95,6 +96,7 @@ cdef class Aligner:
if bw is not None: self.map_opt.bw = bw
if best_n is not None: self.best_n = best_n
cdef cminimap2.mm_idx_reader_t *r;
if fn_idx_out is None:
r = cminimap2.mm_idx_reader_open(fn_idx_in, &self.idx_opt, NULL)
else:
@ -108,12 +110,6 @@ cdef class Aligner:
if self._idx is not NULL:
cminimap2.mm_idx_destroy(self._idx)
cdef _config(self, preset=None):
cminimap2.mm_set_opt(NULL, &self.idx_opt, &self.map_opt) # set the default options
if preset is not None:
cminimap2.mm_set_opt(preset, &self.idx_opt, &self.map_opt) # preset
self.map_opt.flag |= 4 # always perform alignment
def map(self, seq, buf=None):
cdef cminimap2.mm_reg1_t *regs
cdef cminimap2.mm_hitpy_t h

View File

@ -22,5 +22,6 @@ setup(
'ksw2_extd2_sse.c', 'ksw2_exts2_sse.c', 'ksw2_extz2_sse.c', 'ksw2_ll_sse.c', 'kthread.c', 'map.c',
'misc.c', 'sdust.c', 'sketch.c'],
extra_compile_args = ['-msse4'], # WARNING: ancient x86_64 CPUs don't have SSE4
include_dirs = ['.'])])
include_dirs = ['.'],
libraries = ['z', 'm', 'pthread'])])
)