Cython API: better handling of default quality offset value
This commit is contained in:
@ -26,6 +26,7 @@ SEQUENCE_COLUMN = b"SEQ"
|
||||
|
||||
SPECIAL_COLUMNS = [NUC_SEQUENCE_COLUMN, SEQUENCE_COLUMN, ID_COLUMN, DEFINITION_COLUMN, QUALITY_COLUMN]
|
||||
|
||||
QUALITY_ASCII_BASE = 33
|
||||
|
||||
|
||||
cdef class Seq(dict) :
|
||||
@ -127,7 +128,7 @@ cdef class Seq(dict) :
|
||||
|
||||
cdef class Nuc_Seq(Seq) :
|
||||
|
||||
def __init__(self, object id, object seq, object definition=None, object quality=None, int offset=-1, object tags=None) :
|
||||
def __init__(self, object id, object seq, object definition=None, object quality=None, int offset=QUALITY_ASCII_BASE, object tags=None) :
|
||||
cdef object k
|
||||
cdef bytes k_b
|
||||
cdef int q
|
||||
@ -183,7 +184,7 @@ cdef class Nuc_Seq(Seq) :
|
||||
else:
|
||||
return None
|
||||
|
||||
cpdef set_quality(self, object new_quality, int offset=-1):
|
||||
cpdef set_quality(self, object new_quality, int offset=QUALITY_ASCII_BASE):
|
||||
cdef list quality_int
|
||||
if type(new_quality) == list:
|
||||
quality_int = new_quality
|
||||
@ -290,7 +291,7 @@ cdef class Nuc_Seq_Stored(Seq_Stored) :
|
||||
# if column_name_b in SPECIAL_COLUMNS:
|
||||
# self[column_name_b] = tags[column_name]
|
||||
|
||||
cpdef set(self, object id, object seq, object definition=None, object quality=None, int offset=-1, object tags=None):
|
||||
cpdef set(self, object id, object seq, object definition=None, object quality=None, int offset=QUALITY_ASCII_BASE, object tags=None):
|
||||
cdef object k
|
||||
cdef bytes k_b
|
||||
cdef int q
|
||||
@ -336,7 +337,7 @@ cdef class Nuc_Seq_Stored(Seq_Stored) :
|
||||
Column.new_column(self._view, QUALITY_COLUMN, OBI_QUAL)
|
||||
self._view.get_column(QUALITY_COLUMN).set_line(self.index, new_qual)
|
||||
|
||||
cpdef set_quality_char(self, object new_qual, int offset=-1):
|
||||
cpdef set_quality_char(self, object new_qual, int offset=QUALITY_ASCII_BASE):
|
||||
if QUALITY_COLUMN not in self:
|
||||
Column.new_column(self._view, QUALITY_COLUMN, OBI_QUAL)
|
||||
self._view.get_column(QUALITY_COLUMN).set_str_line(self.index, tobytes(new_qual), offset=offset)
|
||||
|
Reference in New Issue
Block a user