1
/*****************************************
3
* Description: taxon1 API
12
#define struct_Org_ref orgref
20
/* API functions prototypes */
22
/*---------------------------------------------
25
* FALSE - Can't open taxonomy database
27
Boolean tax1_init(void);
29
/*---------------------------------------------
30
* Taxon1 server fini (frees memory)
35
/*---------------------------------------------
36
* Get organism by tax_id
37
* Returns: pointer to Taxon1Data if organism exists
38
* NULL - if tax_id wrong
40
* typedef struct struct_Taxon1_data {
42
* CharPtr div; genbank division ("MAM", "VIR", "PHG", ...)
43
* CharPtr embl_code; in common case first letters from genus-species pair
44
* Uint1 is_species_level; 1 if node on species level or below
45
* } Taxon1Data, PNTR Taxon1DataPtr;
48
* Caller gets his own copy of OrgRef structure.
51
Taxon1DataPtr tax1_getbyid(Int4 tax_id);
52
Taxon2DataPtr tax1m_getbyid(Int4 tax_id);
54
/*----------------------------------------------
55
* Get organism by OrgRef
56
* Returns: pointer to Taxon1Data if organism exists
57
* NULL - if no such organism in taxonomy database
60
* 1. This functions uses the following data from inp_orgRef to find organism
61
* in taxonomy database. It uses taxname first. If no organism was found (or multiple nodes found)
62
* then it tryes to find organism using common name. If nothing found, then it tryes to find
63
* organism using synonyms. tax1_lookup never uses tax_id to find organism.
64
* 2. If merge == 0 this function makes the new copy of OrgRef structure and puts into it data
65
* from taxonomy database.
66
* If merge != 0 this function updates inp_orgRef structure.
68
Taxon1DataPtr tax1_lookup(OrgRefPtr inp_orgRef, int merge);
69
Taxon2DataPtr tax1m_lookup(OrgRefPtr inp_orgRef, int merge);
71
/*-----------------------------------------------
72
* Get tax_id by OrgRef
73
* Returns: tax_id - if organism found
74
* 0 - no organism found
75
* -tax_id - if multiple nodes found (where tax_id is id of one of the nodes)
77
* This function uses the same information from inp_orgRef as a tax1_lookup
79
Int4 tax1_getTaxIdByOrgRef(OrgRefPtr inp_orgRef);
81
/*----------------------------------------------
82
* Get tax_id by organism name
83
* Returns: tax_id - if organism found
84
* 0 - no organism found
85
* -tax_id - if multiple nodes found (where tax_id is id of one of the nodes)
87
* orgname can be a regular expression.
89
Int4 tax1_getTaxIdByName(CharPtr orgname);
90
Int4 tax1_findTaxIdByName(CharPtr orgname); /* standalone version only */
93
/*----------------------------------------------
94
* Get ALL tax_id by organism name
95
* Returns: number of organism found
97
* 1. orgname can be a regular expression.
98
* 2. Ids consists of tax ids. Caller is responsible to free this memory
100
Int4 tax1_getAllTaxIdByName(CharPtr orgname, Int4 **Ids);
101
Int4 tax1_findAllTaxIdByName(CharPtr orgname, Int4 **Ids); /* standalone version only */
103
/*----------------------------------------------
104
* Get organism by tax_id
105
* Returns: pointer to OrgRef structure if organism found
106
* NULL - if no such organism in taxonomy database
108
* This function does not make a copy of OrgRef structure, so, caller can not use
109
* OrgRefFree function for returned pointer.
111
OrgRefPtr tax1_getOrgRef(Int4 tax_id, int* is_species, CharPtr div, CharPtr embl_cde);
112
OrgRefPtr tax1m_getOrgRef(Int4 tax_id, int* is_species, int* is_uncultured, CharPtr* blast_name);
114
/*---------------------------------------------
115
* Set mode for synonyms in OrgRef
116
* Returns: previous mode
118
* Default mode: do not include synonyms in OrgRef
120
Boolean tax1_setSynonyms(Boolean on_off);
122
/*---------------------------------------------
125
Int4 tax1_getParent(Int4 id_tax);
127
/*---------------------------------------------
128
* Get genus tax_id (id_tax should be below genus)
130
Int4 tax1_getGenus(Int4 id_tax);
132
/*---------------------------------------------
133
* Get taxids for all children.
134
* Returns: number of children
136
int tax1_getChildren(Int4 id_tax, Int4** children_ids);
138
/*---------------------------------------------
139
* Get genetic code name by genetic code id
141
CharPtr tax1_getGCName(Int2 gc_id);
143
/*---------------------------------------------
144
* Get the nearest common ancestor for two nodes
145
* Returns: id of this ancestor (id == 1 means that root node only is ancestor)
147
Int4 tax1_join(Int4 taxid1, Int4 taxid2);
149
/*---------------------------------------------
150
* Get all names for tax_id
151
* Returns: number of names
154
Int2 tax1_getAllNames(Int4 tax_id, CharPtr **names, Boolean unique);
156
/*---------------------------------------------
157
* Find organism name in the string (for PDB mostly)
158
* Returns: nimber of tax_ids found
160
* 1. orgname is substring of search_str which matches organism name (return parameter).
161
* 2. Ids consists of tax_ids. Caller is responsible to free this memory
163
Int4 tax1_getTaxId4Str(CharPtr search_str, CharPtr* orgname, Int4Ptr *Ids_out);
165
/*---------------------------------------------
166
* Find out is taxonomy lookup system alive or not
167
* Returns: TRUE - alive
171
Boolean tax1_isAlive(void);
173
/***************************************************
174
* Get tax_id for given gi
177
* 0 if no data or error
179
Int4 tax1_getTaxId4GI(Int4 gi);
181
/***************************************************
182
* Get pointer to "blast" name
183
* Returns: the pointer on first blast name at or above this node in the lineage
185
* This function does not make a copy of "blast" name, so, caller can not use
186
* MemFree function for returned pointer.
188
CharPtr tax1m_getBlastName(Int4 tax_id);