102 lines
2.2 KiB
C
102 lines
2.2 KiB
C
![]() |
/********************************************************************
|
||
|
* OBIDMS taxonomy headeer file *
|
||
|
********************************************************************/
|
||
|
|
||
|
/**
|
||
|
* @file obidms_taxonomy.h
|
||
|
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||
|
* @date March 2nd 2016
|
||
|
* @brief Header file for the functions handling the reading of binary taxonomy files.
|
||
|
*/
|
||
|
|
||
|
|
||
|
#include <stdlib.h>
|
||
|
#include <stdio.h>
|
||
|
#include <stdbool.h>
|
||
|
|
||
|
#include "obidms.h"
|
||
|
|
||
|
|
||
|
typedef struct {
|
||
|
int32_t taxid;
|
||
|
int32_t rank;
|
||
|
int32_t parent;
|
||
|
int32_t name_length;
|
||
|
char name[1];
|
||
|
} ecotxformat_t;
|
||
|
|
||
|
|
||
|
typedef struct ecotxnode {
|
||
|
int32_t taxid;
|
||
|
int32_t rank;
|
||
|
int32_t farest;
|
||
|
struct ecotxnode* parent;
|
||
|
char* name;
|
||
|
} ecotx_t;
|
||
|
|
||
|
|
||
|
typedef struct {
|
||
|
int32_t count;
|
||
|
int32_t max_taxid;
|
||
|
int32_t buffer_size;
|
||
|
ecotx_t taxon[1];
|
||
|
} ecotxidx_t;
|
||
|
|
||
|
|
||
|
typedef struct {
|
||
|
int32_t count;
|
||
|
char* label[1];
|
||
|
} ecorankidx_t;
|
||
|
|
||
|
|
||
|
typedef struct {
|
||
|
int32_t is_scientific_name;
|
||
|
int32_t name_length;
|
||
|
int32_t class_length;
|
||
|
int32_t taxid;
|
||
|
char names[1];
|
||
|
} econameformat_t;
|
||
|
|
||
|
|
||
|
typedef struct {
|
||
|
char* name;
|
||
|
char* class_name;
|
||
|
int32_t is_scientific_name;
|
||
|
struct ecotxnode* taxon;
|
||
|
} econame_t;
|
||
|
|
||
|
|
||
|
typedef struct {
|
||
|
int32_t count;
|
||
|
econame_t names[1];
|
||
|
} econameidx_t;
|
||
|
|
||
|
|
||
|
typedef struct OBIDMS_taxonomy_t {
|
||
|
ecorankidx_t* ranks;
|
||
|
econameidx_t* names;
|
||
|
ecotxidx_t* taxa;
|
||
|
} OBIDMS_taxonomy_t, *OBIDMS_taxonomy_p;
|
||
|
|
||
|
|
||
|
OBIDMS_taxonomy_p obi_read_taxonomy(OBIDMS_p dms, const char* taxonomy_name, bool read_alternative_names);
|
||
|
|
||
|
int obi_close_taxonomy(OBIDMS_taxonomy_p taxonomy);
|
||
|
|
||
|
ecotx_t* obi_taxo_get_parent_at_rank(ecotx_t* taxon, int32_t rankidx);
|
||
|
|
||
|
ecotx_t* obi_taxo_get_taxon_with_taxid(OBIDMS_taxonomy_p taxonomy, int32_t taxid);
|
||
|
|
||
|
bool obi_taxo_is_taxon_under_taxid(ecotx_t* taxon, int32_t other_taxid);
|
||
|
|
||
|
ecotx_t* obi_taxo_get_species(ecotx_t* taxon, OBIDMS_taxonomy_p taxonomy);
|
||
|
|
||
|
ecotx_t* obi_taxo_get_genus(ecotx_t* taxon, OBIDMS_taxonomy_p taxonomy);
|
||
|
|
||
|
ecotx_t* obi_taxo_get_family(ecotx_t* taxon, OBIDMS_taxonomy_p taxonomy);
|
||
|
|
||
|
ecotx_t* obi_taxo_get_kingdom(ecotx_t* taxon, OBIDMS_taxonomy_p taxonomy);
|
||
|
|
||
|
ecotx_t* obi_taxo_get_superkingdom(ecotx_t* taxon, OBIDMS_taxonomy_p taxonomy);
|
||
|
|