~ubuntu-branches/ubuntu/lucid/ncbi-tools6/lucid

« back to all changes in this revision

Viewing changes to network/taxon1/common/taxinc.h

  • Committer: Bazaar Package Importer
  • Author(s): Aaron M. Ucko
  • Date: 2002-04-04 22:13:09 UTC
  • Revision ID: james.westby@ubuntu.com-20020404221309-vfze028rfnlrldct
Tags: upstream-6.1.20011220a
ImportĀ upstreamĀ versionĀ 6.1.20011220a

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*****************************************
 
2
 * File: taxinc.h
 
3
 * Description: taxon1 API
 
4
 */
 
5
 
 
6
#ifndef TAXINC_H_DONE
 
7
#define TAXINC_H_DONE
 
8
 
 
9
#include <ncbi.h>
 
10
#include <objfeat.h>
 
11
 
 
12
#define struct_Org_ref orgref
 
13
 
 
14
#include <objtax1.h>
 
15
 
 
16
#ifdef __cplusplus
 
17
extern "C" { /* } */
 
18
#endif
 
19
 
 
20
/* API functions prototypes */
 
21
 
 
22
/*---------------------------------------------
 
23
 * Taxon1 server init
 
24
 * Returns: TRUE - OK
 
25
 *          FALSE - Can't open taxonomy database
 
26
 */
 
27
Boolean tax1_init(void);
 
28
 
 
29
/*---------------------------------------------
 
30
 * Taxon1 server fini (frees memory)
 
31
 */
 
32
 
 
33
void tax1_fini(void);
 
34
 
 
35
/*---------------------------------------------
 
36
 * Get organism by tax_id
 
37
 * Returns: pointer to Taxon1Data if organism exists
 
38
 *          NULL - if tax_id wrong
 
39
 *
 
40
 * typedef struct struct_Taxon1_data {
 
41
 *   OrgRefPtr   org;
 
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;
 
46
 * 
 
47
 * NOTE:
 
48
 * Caller gets his own copy of OrgRef structure.
 
49
 */
 
50
 
 
51
Taxon1DataPtr tax1_getbyid(Int4 tax_id);
 
52
Taxon2DataPtr tax1m_getbyid(Int4 tax_id);
 
53
 
 
54
/*----------------------------------------------
 
55
 * Get organism by OrgRef
 
56
 * Returns: pointer to Taxon1Data if organism exists
 
57
 *          NULL - if no such organism in taxonomy database
 
58
 *
 
59
 * NOTE:
 
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.
 
67
 */
 
68
Taxon1DataPtr tax1_lookup(OrgRefPtr inp_orgRef, int merge);
 
69
Taxon2DataPtr tax1m_lookup(OrgRefPtr inp_orgRef, int merge);
 
70
 
 
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)
 
76
 * NOTE:
 
77
 * This function uses the same information from inp_orgRef as a tax1_lookup
 
78
 */ 
 
79
Int4 tax1_getTaxIdByOrgRef(OrgRefPtr inp_orgRef);
 
80
 
 
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)
 
86
 * NOTE:
 
87
 * orgname can be a regular expression.
 
88
 */
 
89
Int4 tax1_getTaxIdByName(CharPtr orgname);
 
90
Int4 tax1_findTaxIdByName(CharPtr orgname); /* standalone version only */
 
91
 
 
92
 
 
93
/*----------------------------------------------
 
94
 * Get ALL tax_id by organism name
 
95
 * Returns: number of organism found
 
96
 * NOTE:
 
97
 * 1. orgname can be a regular expression.
 
98
 * 2. Ids consists of tax ids. Caller is responsible to free this memory
 
99
 */
 
100
Int4 tax1_getAllTaxIdByName(CharPtr orgname, Int4 **Ids);
 
101
Int4 tax1_findAllTaxIdByName(CharPtr orgname, Int4 **Ids); /* standalone version only */
 
102
 
 
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
 
107
 * NOTE:
 
108
 * This function does not make a copy of OrgRef structure, so, caller can not use
 
109
 * OrgRefFree function for returned pointer.
 
110
 */
 
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);
 
113
 
 
114
/*---------------------------------------------
 
115
 * Set mode for synonyms in OrgRef
 
116
 * Returns: previous mode
 
117
 * NOTE:
 
118
 * Default mode: do not include synonyms in OrgRef
 
119
 */
 
120
Boolean tax1_setSynonyms(Boolean on_off);
 
121
 
 
122
/*---------------------------------------------
 
123
 * Get parent tax_id
 
124
 */
 
125
Int4 tax1_getParent(Int4 id_tax);
 
126
 
 
127
/*---------------------------------------------
 
128
 * Get genus tax_id (id_tax should be below genus)
 
129
 */
 
130
Int4 tax1_getGenus(Int4 id_tax);
 
131
 
 
132
/*---------------------------------------------
 
133
 * Get taxids for all children.
 
134
 * Returns: number of children
 
135
 */
 
136
int tax1_getChildren(Int4 id_tax, Int4** children_ids);
 
137
 
 
138
/*---------------------------------------------
 
139
 * Get genetic code name by genetic code id
 
140
 */
 
141
CharPtr tax1_getGCName(Int2 gc_id);
 
142
 
 
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)
 
146
 */
 
147
Int4 tax1_join(Int4 taxid1, Int4 taxid2);
 
148
 
 
149
/*---------------------------------------------
 
150
 * Get all names for tax_id
 
151
 * Returns: number of names
 
152
 */
 
153
 
 
154
Int2 tax1_getAllNames(Int4 tax_id, CharPtr **names, Boolean unique);
 
155
 
 
156
/*---------------------------------------------
 
157
 * Find organism name in the string (for PDB mostly)
 
158
 * Returns: nimber of tax_ids found
 
159
 * NOTE:
 
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
 
162
 */
 
163
Int4 tax1_getTaxId4Str(CharPtr search_str, CharPtr* orgname, Int4Ptr *Ids_out);
 
164
 
 
165
/*---------------------------------------------
 
166
 * Find out is taxonomy lookup system alive or not
 
167
 * Returns: TRUE - alive
 
168
 *          FALSE - dead
 
169
 */
 
170
 
 
171
Boolean tax1_isAlive(void);
 
172
 
 
173
/***************************************************
 
174
 * Get tax_id for given gi
 
175
 * returns:
 
176
 *       tax_id if found
 
177
 *       0      if no data or error
 
178
 */
 
179
Int4 tax1_getTaxId4GI(Int4 gi);
 
180
 
 
181
/***************************************************
 
182
 * Get pointer to "blast" name
 
183
 * Returns: the pointer on first blast name at or above this node in the lineage
 
184
 * NOTE:
 
185
 * This function does not make a copy of "blast" name, so, caller can not use
 
186
 * MemFree function for returned pointer.
 
187
 */
 
188
CharPtr tax1m_getBlastName(Int4 tax_id);
 
189
 
 
190
 
 
191
#ifdef __cplusplus
 
192
/* { */ }
 
193
#endif
 
194
 
 
195
#endif