Compare commits

...

5 Commits

9 changed files with 50 additions and 16 deletions

View File

@ -371,8 +371,8 @@ 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]
old_nb_elements_per_line = old_column.nb_elements_per_line old_nb_elements_per_line = old_column.nb_elements_per_line
@ -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:

View File

@ -238,14 +238,14 @@ def run(config):
else: else:
sdvar= "%s" sdvar= "%s"
hcat = "\t".join([pcat % x for x in config['stats']['categories']]) + "\t" +\ hcat = "\t".join([pcat % x for x in config['stats']['categories']]) + \
"\t".join([minvar % x for x in config['stats']['minimum']]) + "\t" +\ "\t".join([minvar % x for x in config['stats']['minimum']]) + \
"\t".join([maxvar % x for x in config['stats']['maximum']]) + "\t" +\ "\t".join([maxvar % x for x in config['stats']['maximum']]) + \
"\t".join([meanvar % x for x in config['stats']['mean']]) + "\t" +\ "\t".join([meanvar % x for x in config['stats']['mean']]) + \
"\t".join([varvar % x for x in config['stats']['var']]) + "\t" +\ "\t".join([varvar % x for x in config['stats']['var']]) + \
"\t".join([sdvar % x for x in config['stats']['sd']]) + \ "\t".join([sdvar % x for x in config['stats']['sd']]) + \
"\t count" + \ "count\t" + \
"\t total" "total"
print(hcat) print(hcat)
sorted_stats = sorted(catcount.items(), key = lambda kv:(totcount[kv[0]]), reverse=True) sorted_stats = sorted(catcount.items(), key = lambda kv:(totcount[kv[0]]), reverse=True)
for i in range(len(sorted_stats)): for i in range(len(sorted_stats)):

View File

@ -53,6 +53,8 @@ cdef extern from "obitypes.h" nogil:
extern const_char_p OBIQual_char_NA extern const_char_p OBIQual_char_NA
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)

View File

@ -386,10 +386,13 @@ def open_uri(uri,
raise MalformedURIException('Malformed header argument in URI') raise MalformedURIException('Malformed header argument in URI')
if b"sep" in qualifiers: if b"sep" in qualifiers:
sep=tobytes(qualifiers[b"sep"][0][0]) sep = tobytes(qualifiers[b"sep"][0][0])
else: else:
try: try:
sep=tobytes(config["obi"]["sep"]) sep = config["obi"]["sep"]
if sep == '\\t': # dirty workaround for flake8(?) issue that reads '\t' as '\'+'t' when parsing the option value
sep = '\t'
sep = tobytes(sep)
except KeyError: except KeyError:
sep=None sep=None

View File

@ -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 :

View File

@ -1,5 +1,5 @@
major = 3 major = 3
minor = 0 minor = 0
serial= '1b5' serial= '1b6'
version ="%d.%d.%s" % (major,minor,serial) version ="%d.%d.%s" % (major,minor,serial)

View File

@ -2463,6 +2463,32 @@ int read_merged_dmp(const char* taxdump, OBIDMS_taxonomy_p tax, int32_t* delnode
return -1; return -1;
} }
// Write the rest of the taxa from the current taxa list
while (nT < (tax->taxa)->count)
{
// Add element from taxa list
// Enlarge structure if needed
if (n == buffer_size)
{
buffer_size = buffer_size * 2;
tax->merged_idx = (ecomergedidx_t*) realloc(tax->merged_idx, sizeof(ecomergedidx_t) + sizeof(ecomerged_t) * buffer_size);
if (tax->merged_idx == NULL)
{
obi_set_errno(OBI_MALLOC_ERROR);
obidebug(1, "\nError reallocating memory for a taxonomy structure");
closedir(tax_dir);
fclose(file);
return -1;
}
}
(tax->merged_idx)->merged[n].taxid = (tax->taxa)->taxon[nT].taxid;
(tax->merged_idx)->merged[n].idx = nT;
nT++;
n++;
}
// Store count // Store count
(tax->merged_idx)->count = n; (tax->merged_idx)->count = n;

View File

@ -75,7 +75,7 @@ typedef struct {
*/ */
int32_t max_taxid; /**< Maximum taxid existing in the taxon index. int32_t max_taxid; /**< Maximum taxid existing in the taxon index.
*/ */
int32_t buffer_size; /**< Number of taxa. // TODO kept this but not sure of its use int32_t buffer_size; /**< . // TODO kept this but not sure of its use
*/ */
ecotx_t taxon[]; /**< Taxon array. ecotx_t taxon[]; /**< Taxon array.
*/ */

View File

@ -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.