mirror of
https://github.com/lh3/minimap2.git
synced 2026-09-15 21:17:54 +08:00
minor
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user