This commit is contained in:
Heng Li 2017-09-16 09:30:00 -04:00
parent c07f9f9a49
commit 7e34bea7ab
3 changed files with 10 additions and 5 deletions

View File

@ -56,7 +56,7 @@ ksw2_dispatch.o:ksw2_dispatch.c ksw2.h
$(CC) -c $(CFLAGS) $(CPPFLAGS) -DKSW_CPU_DISPATCH $(INCLUDES) $< -o $@
clean:
rm -fr gmon.out *.o a.out $(PROG) $(PROG_EXTRA) *~ *.a *.dSYM session*
rm -fr gmon.out *.o a.out $(PROG) $(PROG_EXTRA) *~ *.a *.dSYM build dist minimap2.so minimap2.c
depend:
(LC_ALL=C; export LC_ALL; makedepend -Y -- $(CFLAGS) $(CPPFLAGS) -- *.c)

View File

@ -74,6 +74,9 @@ cdef extern from "minimap.h":
void mm_tbuf_destroy(mm_tbuf_t *b)
mm_reg1_t *mm_map(const mm_idx_t *mi, int l_seq, const char *seq, int *n_regs, mm_tbuf_t *b, const mm_mapopt_t *opt, const char *name)
#
# Helper header (because it is hard to expose mm_reg1_t with Cython
#
cdef extern from "cminimap2.h":
ctypedef struct mm_hitpy_t:
const char *ctg

View File

@ -31,11 +31,11 @@ cdef class Alignment:
@property
def is_rev(self):
return self._is_rev
return (self._is_rev != 0)
@property
def is_primary(self):
return self._is_primary
return (self._is_primary != 0)
@property
def q_st(self):
@ -68,7 +68,7 @@ cdef class Aligner:
cdef public cminimap2.mm_mapopt_t map_opt
def __cinit__(self, fn, preset=None):
self.config(preset)
self._config(preset)
cdef cminimap2.mm_idx_reader_t *r;
r = cminimap2.mm_idx_reader_open(fn, &self.idx_opt, NULL)
self._idx = cminimap2.mm_idx_reader_read(r, 3) # NB: ONLY read the first part
@ -79,7 +79,7 @@ cdef class Aligner:
if self._idx is not NULL:
cminimap2.mm_idx_destroy(self._idx)
def config(self, preset=None):
def _config(self, preset=None):
cminimap2.mm_set_opt(NULL, &self.idx_opt, &self.map_opt)
if preset is not None:
cminimap2.mm_set_opt(preset, &self.idx_opt, &self.map_opt)
@ -90,6 +90,8 @@ cdef class Aligner:
cdef ThreadBuffer b
cdef int n_regs
if self._idx is NULL:
return None
if buf is None: b = ThreadBuffer()
else: b = buf
regs = cminimap2.mm_map(self._idx, len(seq), seq, &n_regs, b._b, &self.map_opt, NULL)