Fixed the handling of sample names that are numbers (forcing conversion)
This commit is contained in:
@ -7,7 +7,8 @@ __OBIDMS_COLUMN_CLASS__ = {}
|
||||
from ..capi.obitypes cimport name_data_type, \
|
||||
obitype_t, \
|
||||
obiversion_t, \
|
||||
OBI_QUAL
|
||||
OBI_QUAL, \
|
||||
OBI_STR
|
||||
|
||||
from ..capi.obidms cimport obi_import_column
|
||||
|
||||
@ -128,6 +129,10 @@ cdef class Column(OBIWrapper) :
|
||||
else:
|
||||
elements_names_p = NULL
|
||||
|
||||
if column_name_b == b"SAMPLE" or column_name_b == b"sample":
|
||||
# force str type
|
||||
data_type = OBI_STR
|
||||
|
||||
if data_type == OBI_QUAL:
|
||||
if associated_column_name_b == b"":
|
||||
if column_name == QUALITY_COLUMN:
|
||||
|
@ -74,6 +74,9 @@ cdef class Column_str(Column_idx):
|
||||
if value is None :
|
||||
value_b = <char*>OBIStr_NA
|
||||
else :
|
||||
if self.name == b'sample' or self.name == b'SAMPLE':
|
||||
if type(value) == int:
|
||||
value = str(value) # force sample ids to be str
|
||||
value_bytes = tobytes(value)
|
||||
value_b = <char*>value_bytes
|
||||
|
||||
@ -137,6 +140,9 @@ cdef class Column_multi_elts_str(Column_multi_elts_idx):
|
||||
if value is None :
|
||||
value_b = <char*>OBIStr_NA
|
||||
else :
|
||||
if self.name == b'sample' or self.name == b'SAMPLE':
|
||||
if type(value) == int:
|
||||
value = str(value) # force sample ids to be str
|
||||
value_bytes = tobytes(value)
|
||||
value_b = <char*>value_bytes
|
||||
|
||||
@ -206,6 +212,9 @@ cdef class Column_tuples_str(Column_idx):
|
||||
i = 0
|
||||
for elt in value :
|
||||
if elt is not None and elt != '':
|
||||
if self.name == b'sample' or self.name == b'SAMPLE':
|
||||
if type(elt) == int:
|
||||
elt = str(elt) # force sample ids to be str
|
||||
elt_b = tobytes(elt)
|
||||
strcpy(array+i, <char*>elt_b)
|
||||
i = i + len(elt_b) + 1
|
||||
|
Reference in New Issue
Block a user