import: Columns are now rewritten in OBI_FLOAT if a value is > INT32_MAX
This commit is contained in:
@ -371,7 +371,7 @@ def run(config):
|
|||||||
# Fill value
|
# Fill value
|
||||||
dcols[tag][0][i] = value
|
dcols[tag][0][i] = value
|
||||||
|
|
||||||
except IndexError :
|
except (IndexError, OverflowError):
|
||||||
|
|
||||||
value_type = type(value)
|
value_type = type(value)
|
||||||
old_column = dcols[tag][0]
|
old_column = dcols[tag][0]
|
||||||
@ -419,7 +419,7 @@ def run(config):
|
|||||||
dcols[tag][0][i] = value
|
dcols[tag][0][i] = value
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print("\nCould not import sequence id:", entry.id, "(error raised:", e, ")")
|
print("\nCould not import sequence:", entry, "(error raised:", e, ")")
|
||||||
if 'skiperror' in config['obi'] and not config['obi']['skiperror']:
|
if 'skiperror' in config['obi'] and not config['obi']['skiperror']:
|
||||||
raise e
|
raise e
|
||||||
else:
|
else:
|
||||||
|
@ -54,6 +54,8 @@ cdef extern from "obitypes.h" nogil:
|
|||||||
extern uint8_t* OBIQual_int_NA
|
extern uint8_t* OBIQual_int_NA
|
||||||
extern void* OBITuple_NA
|
extern void* OBITuple_NA
|
||||||
|
|
||||||
|
extern obiint_t OBI_INT_MAX
|
||||||
|
|
||||||
const_char_p name_data_type(int data_type)
|
const_char_p name_data_type(int data_type)
|
||||||
|
|
||||||
ctypedef OBIType_t obitype_t
|
ctypedef OBIType_t obitype_t
|
||||||
|
@ -9,7 +9,8 @@ from obitools3.dms.capi.obitypes cimport is_a_DNA_seq, \
|
|||||||
OBI_QUAL, \
|
OBI_QUAL, \
|
||||||
OBI_SEQ, \
|
OBI_SEQ, \
|
||||||
OBI_STR, \
|
OBI_STR, \
|
||||||
index_t
|
index_t, \
|
||||||
|
OBI_INT_MAX
|
||||||
|
|
||||||
from obitools3.dms.capi.obierrno cimport OBI_LINE_IDX_ERROR, \
|
from obitools3.dms.capi.obierrno cimport OBI_LINE_IDX_ERROR, \
|
||||||
OBI_ELT_IDX_ERROR, \
|
OBI_ELT_IDX_ERROR, \
|
||||||
@ -258,7 +259,7 @@ cdef obitype_t update_obitype(obitype_t obitype, object new_value) :
|
|||||||
new_type = type(new_value)
|
new_type = type(new_value)
|
||||||
|
|
||||||
if obitype == OBI_INT :
|
if obitype == OBI_INT :
|
||||||
if new_type == float :
|
if new_type == float or new_value > OBI_INT_MAX :
|
||||||
return OBI_FLOAT
|
return OBI_FLOAT
|
||||||
# TODO BOOL vers INT/FLOAT
|
# TODO BOOL vers INT/FLOAT
|
||||||
elif new_type == str or new_type == bytes :
|
elif new_type == str or new_type == bytes :
|
||||||
|
@ -29,6 +29,8 @@
|
|||||||
#define OBIQual_int_NA (NULL) /**< NA value for the type OBI_QUAL if the quality is in integer format */
|
#define OBIQual_int_NA (NULL) /**< NA value for the type OBI_QUAL if the quality is in integer format */
|
||||||
#define OBITuple_NA (NULL) /**< NA value for tuples of any type */
|
#define OBITuple_NA (NULL) /**< NA value for tuples of any type */
|
||||||
|
|
||||||
|
#define OBI_INT_MAX (INT32_MAX) /**< Maximum value for the type OBI_INT */
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief enum for the boolean OBIType.
|
* @brief enum for the boolean OBIType.
|
||||||
|
Reference in New Issue
Block a user