| 1 |
#ifndef RAA_ACNUC_H |
| 2 |
#define RAA_ACNUC_H |
| 3 |
|
| 4 |
#include <stdio.h> |
| 5 |
#include <stdlib.h> |
| 6 |
#include <string.h> |
| 7 |
#include <ctype.h> |
| 8 |
#if defined(_WIN32) |
| 9 |
#define SOCKBUFS 8192 |
| 10 |
#endif |
| 11 |
#ifdef __alpha |
| 12 |
typedef long raa_long; |
| 13 |
#define RAA_LONG_FORMAT "%lu" |
| 14 |
#else |
| 15 |
typedef long long raa_long; |
| 16 |
#define RAA_LONG_FORMAT "%llu" |
| 17 |
#endif |
| 18 |
|
| 19 |
#ifndef TRUE |
| 20 |
#define FALSE 0 |
| 21 |
#define TRUE (!FALSE) |
| 22 |
#endif |
| 23 |
#ifndef ERREUR |
| 24 |
#define ERREUR 1 |
| 25 |
#endif |
| 26 |
|
| 27 |
struct rlng { |
| 28 |
int next; |
| 29 |
int sub[1]; |
| 30 |
}; |
| 31 |
|
| 32 |
#define RAA_GFRAG_BSIZE 10000 |
| 33 |
struct gfrag_aux { |
| 34 |
char buffer[RAA_GFRAG_BSIZE + 1]; |
| 35 |
int lbuf, nseq_buf, first_buf, l_nseq_buf; |
| 36 |
}; |
| 37 |
|
| 38 |
struct readsub_aux { |
| 39 |
char *name; |
| 40 |
int lname, previous, length, type, toext, lkey, locus, frame, gencode, div; |
| 41 |
raa_long addr; |
| 42 |
}; |
| 43 |
|
| 44 |
#define ANNOTCOUNT 40 |
| 45 |
struct annot_aux { |
| 46 |
char *annotline[ANNOTCOUNT + 1]; |
| 47 |
int annotcurrent, annotcount, annotdiv; |
| 48 |
raa_long annotaddr, annotaddrfirst, annotaddrlast; |
| 49 |
char annotsbuffer[ 300 ]; |
| 50 |
}; |
| 51 |
|
| 52 |
struct readsp_kw_aux { |
| 53 |
char name[150], libel[200]; |
| 54 |
int lsub, desc, syno, host, previous; |
| 55 |
}; |
| 56 |
|
| 57 |
#define BLOCK_ELTS_IN_LIST 500 |
| 58 |
struct nextelt_aux { |
| 59 |
int current_rank, previous, total; |
| 60 |
int tabnum[BLOCK_ELTS_IN_LIST]; |
| 61 |
char *tabname[BLOCK_ELTS_IN_LIST]; |
| 62 |
int tablength[BLOCK_ELTS_IN_LIST]; |
| 63 |
raa_long taboffset[BLOCK_ELTS_IN_LIST]; |
| 64 |
int tabdiv[BLOCK_ELTS_IN_LIST]; |
| 65 |
}; |
| 66 |
|
| 67 |
#define S_BUF_SHRT 5000 |
| 68 |
struct readshrt_aux { |
| 69 |
unsigned shrt_buffer[S_BUF_SHRT][3]; |
| 70 |
int shrt_max, shrt_begin, total; |
| 71 |
}; |
| 72 |
|
| 73 |
typedef struct shrt2_list { |
| 74 |
int length; |
| 75 |
int size; |
| 76 |
unsigned point; |
| 77 |
unsigned next; |
| 78 |
unsigned vals[1]; |
| 79 |
} shrt2_list; |
| 80 |
|
| 81 |
struct readsmj_aux { |
| 82 |
int lastrec; |
| 83 |
char **names, **libels; |
| 84 |
unsigned *plongs; |
| 85 |
}; |
| 86 |
|
| 87 |
typedef struct raa_node { |
| 88 |
char *name; |
| 89 |
char *libel; |
| 90 |
char *libel_upcase; |
| 91 |
int rank; |
| 92 |
int tid; |
| 93 |
int count; |
| 94 |
struct raa_node *parent; |
| 95 |
struct raa_pair *list_desc; |
| 96 |
struct raa_node *syno; |
| 97 |
} raa_node; |
| 98 |
struct raa_pair { |
| 99 |
raa_node *value; |
| 100 |
struct raa_pair *next; |
| 101 |
}; |
| 102 |
|
| 103 |
#define WIDTH_MAX 150 |
| 104 |
|
| 105 |
typedef enum { raa_sub_of_bib = 0, raa_spec_of_loc, raa_bib_of_loc, raa_aut_of_bib, raa_bib_of_aut, |
| 106 |
raa_sub_of_acc, raa_key_of_sub, raa_acc_of_loc } raa_shortl2_kind; |
| 107 |
|
| 108 |
typedef struct _raa_db_access { |
| 109 |
char *dbname; |
| 110 |
FILE *raa_sockfdr, *raa_sockfdw; |
| 111 |
int genbank, embl, swissprot, nbrf; |
| 112 |
int nseq, longa, maxa; |
| 113 |
int L_MNEMO, WIDTH_SP, WIDTH_KW, WIDTH_SMJ, WIDTH_AUT, WIDTH_BIB, ACC_LENGTH, SUBINLNG, lrtxt, VALINSHRT2; |
| 114 |
char *version_string; |
| 115 |
int maxlists; |
| 116 |
raa_node **sp_tree; |
| 117 |
int max_tid; |
| 118 |
int *tid_to_rank; |
| 119 |
struct rlng *rlng_buffer; |
| 120 |
struct gfrag_aux gfrag_data; |
| 121 |
struct readsub_aux readsub_data; |
| 122 |
int first_recs[20]; |
| 123 |
struct annot_aux annot_data; |
| 124 |
struct readsp_kw_aux readspec_data, readkey_data; |
| 125 |
struct nextelt_aux nextelt_data; |
| 126 |
struct readshrt_aux readshrt_data; |
| 127 |
struct shrt2_list *readshrt2_data[raa_acc_of_loc+1]; |
| 128 |
struct readsmj_aux readsmj_data; |
| 129 |
void *matchkey_data; |
| 130 |
|
| 131 |
int tot_key_annots; |
| 132 |
char **key_annots, **key_annots_min; |
| 133 |
unsigned char *want_key_annots; |
| 134 |
#ifdef _WIN32 |
| 135 |
char sock_input[SOCKBUFS]; |
| 136 |
char *sock_input_pos, *sock_input_end; |
| 137 |
char sock_output[SOCKBUFS]; |
| 138 |
unsigned sock_output_lbuf; |
| 139 |
#endif |
| 140 |
char buffer[5000]; |
| 141 |
char remote_file[300]; |
| 142 |
char *full_line; |
| 143 |
int max_full_line; |
| 144 |
int was_here; |
| 145 |
char *namestr; |
| 146 |
char residuecount[30]; |
| 147 |
char *help; |
| 148 |
int lhelp; |
| 149 |
int tmp_total; |
| 150 |
int tmp_current; |
| 151 |
int *tmp_prelist; |
| 152 |
char *translate_buffer; |
| 153 |
int num_5_partial; |
| 154 |
char mnemo[WIDTH_MAX]; |
| 155 |
char species[WIDTH_MAX]; |
| 156 |
char access[WIDTH_MAX]; |
| 157 |
char author[WIDTH_MAX]; |
| 158 |
char biblio[WIDTH_MAX]; |
| 159 |
char descript[WIDTH_MAX]; |
| 160 |
char date[12]; |
| 161 |
} raa_db_access; |
| 162 |
|
| 163 |
|
| 164 |
typedef enum { raa_sub = 0, raa_loc, raa_key, raa_spec, raa_shrt, raa_lng, raa_ext, raa_smj, |
| 165 |
raa_aut, raa_bib, raa_txt, raa_acc } raa_file; |
| 166 |
typedef void (*raa_char_void_function)(raa_db_access *, char *); |
| 167 |
|
| 168 |
|
| 169 |
extern raa_char_void_function raa_error_mess_proc; |
| 170 |
|
| 171 |
|
| 172 |
extern int raa_acnucopen (const char *clientid, raa_db_access **psock) ; |
| 173 |
extern int raa_decode_address(char *url, char **p_ip_name, int *socket, char **p_remote_db); |
| 174 |
extern int raa_acnucopen_alt (const char *serveurName, int port, const char *db_name, const char *clientid, raa_db_access **psock); |
| 175 |
extern int raa_open_socket(const char *serveurName, int port, const char *clientid, raa_db_access **psock); |
| 176 |
extern int raa_opendb(raa_db_access *raa_current_db, const char *db_name); |
| 177 |
int raa_opendb_pw(raa_db_access *raa_current_db, const char *db_name, void *ptr, char *(*getpasswordf)(void *) ); |
| 178 |
extern int raa_gfrag(raa_db_access *raa_current_db, int nsub, int first, int lfrag, char *dseq) ; |
| 179 |
extern void raa_acnucclose(raa_db_access *raa_current_db) ; |
| 180 |
extern int raa_prep_acnuc_query(raa_db_access *raa_current_db) ; |
| 181 |
extern int raa_proc_query(raa_db_access *raa_current_db, char *query, char **message, char *nomliste, int *numlist, |
| 182 |
int *count, int *locus, int *type) ; |
| 183 |
int raa_nexteltinlist(raa_db_access *raa_current_db, int first, int lrank, char **pname, int *plength) ; |
| 184 |
int raa_nexteltinlist_annots(raa_db_access *raa_current_db, int first, int lrank, char **pname, int *plength, |
| 185 |
raa_long *paddr, int *pdiv); |
| 186 |
raa_long scan_raa_long(char *txt); |
| 187 |
int raa_seq_to_annots(raa_db_access *raa_current_db, int numseq, raa_long *faddr, int *div); |
| 188 |
char *print_raa_long(raa_long val, char *buffer); |
| 189 |
char *raa_read_annots(raa_db_access *raa_current_db, raa_long faddr, int div); |
| 190 |
char *raa_next_annots(raa_db_access *raa_current_db, raa_long *faddr); |
| 191 |
char *raa_translate_cds(raa_db_access *raa_current_db, int seqnum); |
| 192 |
char raa_translate_init_codon(raa_db_access *raa_current_db, int numseq); |
| 193 |
int raa_iknum(raa_db_access *raa_current_db, char *name, raa_file cas); |
| 194 |
int raa_isenum(raa_db_access *raa_current_db, char *name); |
| 195 |
int raa_bcount(raa_db_access *raa_current_db, int lrank); |
| 196 |
void raa_bit1(raa_db_access *raa_current_db, int lrank, int num); |
| 197 |
void raa_bit0(raa_db_access *raa_current_db, int lrank, int num); |
| 198 |
int raa_btest(raa_db_access *raa_current_db, int lrank, int num); |
| 199 |
void raa_copylist(raa_db_access *raa_current_db, int from, int to); |
| 200 |
void raa_zerolist(raa_db_access *raa_current_db, int rank); |
| 201 |
void raa_setliststate(raa_db_access *raa_current_db, int lrank, int locus, int type); |
| 202 |
char *raa_getliststate(raa_db_access *raa_current_db, int lrank, int *locus, int *type, int *count); |
| 203 |
char *raa_residuecount(raa_db_access *raa_current_db, int lrank); |
| 204 |
int raa_getemptylist(raa_db_access *raa_current_db, char *name); |
| 205 |
int raa_setlistname(raa_db_access *raa_current_db, int lrank, char *name); |
| 206 |
int raa_getlistrank(raa_db_access *raa_current_db, char *name); |
| 207 |
int raa_releaselist(raa_db_access *raa_current_db, int lrank); |
| 208 |
int raa_countfilles(raa_db_access *raa_current_db, int lrank); |
| 209 |
int raa_alllistranks(raa_db_access *raa_current_db, int **pranks); |
| 210 |
int raa_fcode(raa_db_access *raa_current_db, raa_file cas, char *name); |
| 211 |
int raa_read_first_rec(raa_db_access *raa_current_db, raa_file cas); |
| 212 |
char *raa_readsub(raa_db_access *raa_current_db, int num, int *plength, int *ptype, int *pext, int *plkey, int *plocus, |
| 213 |
int *pframe, int *pgencode); |
| 214 |
char *raa_readsub_pannots(raa_db_access *raa_current_db, int num, int *plength, int *ptype, int *pext, int *plkey, int *plocus, |
| 215 |
int *pframe, int *pgencode, raa_long *paddr, int *pdiv); |
| 216 |
char *raa_readloc(raa_db_access *raa_current_db, int num, int *sub, int *pnuc, int *spec, int *host, int *plref, |
| 217 |
int *molec, int *placc, int *org); |
| 218 |
char *raa_readspec(raa_db_access *raa_current_db, int num, char **plibel, int *plsub, int *desc, int *syno, int *plhost); |
| 219 |
char *raa_readkey(raa_db_access *raa_current_db, int num, char **plibel, int *plsub, int *desc, int *syno); |
| 220 |
char *raa_readsmj(raa_db_access *raa_current_db, int num, char **plibel, int *plong); |
| 221 |
char *raa_readacc(raa_db_access *raa_current_db, int num, int *plsub); |
| 222 |
char *raa_readaut(raa_db_access *raa_current_db, int num, int *plsub); |
| 223 |
char *raa_readbib(raa_db_access *raa_current_db, int num, int *plsub, int *plaut, int *pj, int *py); |
| 224 |
int raa_readext(raa_db_access *raa_current_db, int num, int *mere, int *deb, int *fin); |
| 225 |
int raa_readlng(raa_db_access *raa_current_db, int num); |
| 226 |
unsigned raa_readshrt(raa_db_access *raa_current_db, unsigned point, int *val); |
| 227 |
unsigned raa_followshrt2(raa_db_access *raa_current_db, int *p_point, int *p_rank, raa_shortl2_kind kind); |
| 228 |
char *raa_ghelp(raa_db_access *raa_current_db, char *fname, char *topic); |
| 229 |
int raa_nextmatchkey(raa_db_access *raa_current_db, int num, char *pattern, char **matching); |
| 230 |
int raa_savelist(raa_db_access *raa_current_db, int lrank, FILE *out, int use_acc, char *prefix); |
| 231 |
int raa_modifylist(raa_db_access *raa_current_db, int lrank, char *type , char *operation , |
| 232 |
int *pnewlrank, int (*check_interrupt)(void) , int *p_processed); |
| 233 |
int raa_knowndbs(raa_db_access *raa_current_db, char ***pnames, char ***pdescriptions); |
| 234 |
char *raa_short_descr(raa_db_access *raa_current_db, int seqnum, char *text, int maxlen, raa_long pinf, int div, char *name); |
| 235 |
void *raa_prep_extract(raa_db_access *raa_current_db, char *format, FILE *outstream, char *choix, |
| 236 |
char *feature_name, char *bornes, char *min_bornes, char **message, int lrank); |
| 237 |
int raa_extract_1_seq(void *opaque); |
| 238 |
int raa_extract_interrupt(raa_db_access *raa_current_db, void *opaque); |
| 239 |
void *raa_prep_coordinates(raa_db_access *raa_current_db, int lrank, int seqnum, |
| 240 |
char *operation, |
| 241 |
char *feature_name, char *bounds, char *min_bounds); |
| 242 |
int *raa_1_coordinate_set(void *); |
| 243 |
int raa_loadtaxonomy(raa_db_access *raa_current_db, char *rootname, |
| 244 |
int (*progress_function)(int, void *), void *progress_arg, |
| 245 |
int (*need_interrupt_f)(void *), void *interrupt_arg); |
| 246 |
char *raa_get_taxon_info(raa_db_access *raa_current_db, char *name, int rank, int tid, int *p_rank, |
| 247 |
int *p_tid, int *p_parent, struct raa_pair **p_desc_list); |
| 248 |
char *raa_getattributes(raa_db_access *raa_current_db, const char *id, |
| 249 |
int *prank, int *plength, int *pframe, int *pgc, char **pacc, char **pdesc, char **pspecies, char **pseq); |
| 250 |
char *raa_seqrank_attributes(raa_db_access *raa_current_db, int rank, |
| 251 |
int *plength, int *pframe, int *pgc, char **pacc, char **pdesc, char **pspecies, char **pseq); |
| 252 |
|
| 253 |
int sock_fputs(raa_db_access *raa_current_db, const char *line); |
| 254 |
int sock_flush(raa_db_access *raa_current_db); |
| 255 |
char *read_sock(raa_db_access *raa_current_db); |
| 256 |
|
| 257 |
|
| 258 |
int trim_key(char *name); |
| 259 |
void majuscules(char *name); |
| 260 |
int atoi_u(const char *p); |
| 261 |
void compact(char *chaine); |
| 262 |
int strcmptrail(char *s1, int l1, char *s2, int l2); |
| 263 |
|
| 264 |
|
| 265 |
#endif |