1 /* tax3api.h 2 * =========================================================================== 3 * 4 * PUBLIC DOMAIN NOTICE 5 * National Center for Biotechnology Information (NCBI) 6 * 7 * This software/database is a "United States Government Work" under the 8 * terms of the United States Copyright Act. It was written as part of 9 * the author's official duties as a United States Government employee and 10 * thus cannot be copyrighted. This software/database is freely available 11 * to the public for use. The National Library of Medicine and the U.S. 12 * Government do not place any restriction on its use or reproduction. 13 * We would, however, appreciate having the NCBI and the author cited in 14 * any work or product based on this material 15 * 16 * Although all reasonable efforts have been taken to ensure the accuracy 17 * and reliability of the software and data, the NLM and the U.S. 18 * Government do not and cannot warrant the performance or results that 19 * may be obtained by using this software or data. The NLM and the U.S. 20 * Government disclaim all warranties, express or implied, including 21 * warranties of performance, merchantability or fitness for any particular 22 * purpose. 23 * 24 * =========================================================================== 25 * 26 * File Name: tax3api.h 27 * 28 * Author: Jonathan Kans 29 * 30 * Version Creation Date: 7/8/04 31 * 32 * $Revision: 1.30 $ 33 * 34 * File Description: 35 * 36 * Modifications: 37 * -------------------------------------------------------------------------- 38 * Date Name Description of modification 39 * ------- ---------- ----------------------------------------------------- 40 * 41 * 42 * ========================================================================== 43 */ 44 45 46 #ifndef _TAX3API_ 47 #define _TAX3API_ 48 49 #include <ncbi.h> 50 #include <asn.h> 51 #include <objtax3.h> 52 #include <urlquery.h> 53 #include <objfeat.h> 54 55 #undef NLM_EXTERN 56 #ifdef NLM_IMPORT 57 #define NLM_EXTERN NLM_IMPORT 58 #else 59 #define NLM_EXTERN extern 60 #endif 61 62 63 #ifdef __cplusplus 64 extern "C" { 65 #endif 66 67 68 /* low-level connection functions */ 69 70 NLM_EXTERN CONN Tax3OpenConnection ( 71 void 72 ); 73 74 NLM_EXTERN Taxon3ReplyPtr Tax3WaitForReply ( 75 CONN conn 76 ); 77 78 /* 79 Tax3SynchronousQuery opens connection, sends an 80 ASN.1 request, and waits for a reply, cleaning 81 up the connection afterwards. 82 */ 83 84 NLM_EXTERN Taxon3ReplyPtr Tax3SynchronousQuery ( 85 Taxon3RequestPtr t3rq 86 ); 87 88 /* 89 Tax3AsynchronousQuery opens connection, send request, 90 and queues completion routine using urlquery queueing 91 mechanism. 92 93 Tax3CheckQueue should be called several times a second with 94 a timer. It calls QUERY_CheckQueue to poll connection, 95 which calls completion routine when result is available, 96 cleaning up connection afterwards. 97 98 Tax3ReadReply take conns and status parameters from completion 99 routine and reads Taxon3ReplyPtr. 100 */ 101 102 NLM_EXTERN Boolean Tax3AsynchronousQuery ( 103 Taxon3RequestPtr t3rq, 104 QUEUE* queue, 105 QueryResultProc resultproc, 106 VoidPtr userdata 107 ); 108 109 NLM_EXTERN Int4 Tax3CheckQueue ( 110 QUEUE* queue 111 ); 112 113 NLM_EXTERN Taxon3ReplyPtr Tax3ReadReply ( 114 CONN conn, 115 EIO_Status status 116 ); 117 118 119 /* request creation function */ 120 121 NLM_EXTERN Taxon3RequestPtr CreateTaxon3Request ( 122 Int4 taxid, 123 CharPtr name, 124 OrgRefPtr orp 125 ); 126 127 NLM_EXTERN Taxon3RequestPtr CreateMultiTaxon3Request (ValNodePtr org_list); 128 129 NLM_EXTERN Taxon3RequestPtr CreateJoinRequest (ValNodePtr taxon_list); 130 131 NLM_EXTERN OrgRefPtr Taxon3GetOrg (OrgRefPtr orp); 132 NLM_EXTERN ValNodePtr Taxon3GetOrgRefList (ValNodePtr org_list); 133 NLM_EXTERN void Tax3MergeSourceDescr (SeqEntryPtr sep, Pointer data, Int4 index, Int2 indent); 134 NLM_EXTERN Int4 Taxon3GetTaxIdByOrgRef (OrgRefPtr orp); 135 NLM_EXTERN OrgRefPtr Taxon3GetOrgRefByName (CharPtr orgname); 136 NLM_EXTERN Int4 Taxon3GetTaxIdByName (CharPtr orgname); 137 NLM_EXTERN void Taxon3ReplaceOrgInSeqEntry (SeqEntryPtr sep, Boolean keep_syn); 138 NLM_EXTERN void Taxon3ReplaceOrgInSeqEntryEx (SeqEntryPtr sep, Boolean keep_syn, Boolean replace_unpub); 139 140 NLM_EXTERN void Taxon3CheckOrgInSeqEntry (SeqEntryPtr sep, ValNodePtr PNTR not_found, ValNodePtr PNTR bad_match); 141 NLM_EXTERN void CheckTaxNamesAgainstTaxDatabase (ValNodePtr PNTR discrepancy_list, ValNodePtr sep_list); 142 143 typedef enum { 144 eReturnedOrgFlag_normal = 0x004, 145 eReturnedOrgFlag_misspelled = 0x008, 146 eReturnedOrgFlag_ambiguous = 0x010, 147 eReturnedOrgFlag_unpublished = 0x020, 148 eReturnedOrgFlag_common_name = 0x040, 149 eReturnedOrgFlag_error = 0x080, 150 } EReturnedOrgFlag; 151 152 typedef enum { 153 eSpecificHostFix_unrecognized = 0, 154 eSpecificHostFix_spelling, 155 eSpecificHostFix_capitalization, 156 eSpecificHostFix_truncation, 157 eSpecificHostFix_replacement, 158 eSpecificHostFix_ambiguous 159 } ESpecificHostFix; 160 161 NLM_EXTERN void 162 Taxon3ValidateSpecificHostsInSeqEntry 163 (SeqEntryPtr sep, 164 ValNodePtr PNTR misspelled_list, 165 ValNodePtr PNTR bad_caps_list, 166 ValNodePtr PNTR ambiguous_list, 167 ValNodePtr PNTR unrecognized_list); 168 169 typedef struct specifichostfix { 170 ValNodePtr feat_or_desc; 171 CharPtr bad_specific_host; 172 CharPtr old_taxname; 173 CharPtr new_taxname; 174 Uint1 fix_type; 175 } SpecificHostFixData, PNTR SpecificHostFixPtr; 176 177 extern ValNodePtr SpecificHostFixListFree (ValNodePtr vnp); 178 extern Boolean ApplyOneSpecificHostFix (SpecificHostFixPtr s); 179 /* returns ValNodePtr list of SpecificHostFixPtr */ 180 NLM_EXTERN ValNodePtr Taxon3GetSpecificHostFixesInSeqEntry (SeqEntryPtr sep, Boolean caps, Boolean paren); 181 182 NLM_EXTERN ValNodePtr GetOrganismTaxLookupFailuresInSeqEntry (SeqEntryPtr sep); 183 184 typedef struct taxfixitem { 185 Uint1 data_choice; 186 Pointer data; 187 OrgRefPtr orig_org; 188 OrgRefPtr response_org; 189 CharPtr taxname; 190 CharPtr suggested_fix; 191 CharPtr rank; 192 Boolean is_ambiguous; 193 Boolean is_species_specific; 194 Boolean remove_species_specific; 195 Boolean truncate_binomial; 196 } TaxFixItemData, PNTR TaxFixItemPtr; 197 198 NLM_EXTERN TaxFixItemPtr TaxFixItemNew (void); 199 NLM_EXTERN TaxFixItemPtr TaxFixItemFree (TaxFixItemPtr t); 200 NLM_EXTERN ValNodePtr LIBCALLBACK TaxFixItemListFree (ValNodePtr vnp); 201 NLM_EXTERN Boolean OkToTaxFix(CharPtr orgname); 202 NLM_EXTERN ValNodePtr Taxon3GetTaxFixList (ValNodePtr biop_list); 203 NLM_EXTERN void RemoveSpeciesSpecific (BioSourcePtr biop); 204 205 NLM_EXTERN OrgRefPtr GetCommonOrgRefForSeqEntry (SeqEntryPtr sep); 206 207 NLM_EXTERN SeqDescrPtr SeqDescrFromBioSample (CharPtr number); 208 209 /* Compare Functions */ 210 NLM_EXTERN int LIBCALL ObjectIdCompare (ObjectIdPtr a, ObjectIdPtr b); 211 NLM_EXTERN int LIBCALL DbtagCompare (DbtagPtr a, DbtagPtr b); 212 NLM_EXTERN int LIBCALL OrgModSetCompare (OrgModPtr mod1, OrgModPtr mod2); 213 NLM_EXTERN int LIBCALL OrgNameCompare (OrgNamePtr onp1, OrgNamePtr onp2); 214 NLM_EXTERN int LIBCALL OrgRefCompare (OrgRefPtr orp1, OrgRefPtr orp2); 215 216 #ifdef __cplusplus 217 } 218 #endif 219 220 #undef NLM_EXTERN 221 #ifdef NLM_EXPORT 222 #define NLM_EXTERN NLM_EXPORT 223 #else 224 #define NLM_EXTERN 225 #endif 226 227 #endif /* _TAX3API_ */ 228 229