Pôle Rhône-Alpes de Bioinformatique Site Doua


C API for remote access

Download source code. Run make and use the resulting libraa.a library. Programming example

API functions in alphabetical order : codaa, raa_acnucclose, raa_acnucopen, raa_acnucopen_alt, raa_alllistranks, raa_bcount, raa_bit0, raa_bit1, raa_btest, raa_copylist, raa_countfilles, raa_decode_address, raa_extract_1_seq, raa_extract_interrupt, raa_fcode, raa_followshrt2, raa_getattributes, raa_getemptylist, raa_getlistrank, raa_getliststate, raa_get_taxon_info, raa_gfrag, raa_ghelp, raa_iknum, raa_isenum, raa_knowndbs, raa_loadtaxonomy, raa_modifylist, raa_next_annots, raa_nexteltinlist, raa_nexteltinlist_annots, raa_nextmatchkey, print_raa_long, raa_open_socket, raa_opendb, raa_opendb_pw, raa_prep_acnuc_query, raa_prep_extract, raa_proc_query, raa_read_annots, raa_readacc, raa_readaut, raa_readbib, raa_readext, raa_readkey, raa_readlng, raa_readloc, raa_readshrt, raa_readsmj, raa_readspec, raa_readsub, raa_read_first_rec, raa_releaselist, raa_residuecount, raa_savelist, raa_seq_to_annots, raa_seqrank_attributes, raa_setlistname, raa_setliststate, raa_showannots, raa_showannots_list, raa_translate_cds, raa_translate_init_codon, raa_zerolist, scan_raa_long

API functions by theme : #include "raa_acnuc.h"

Programming example

	#include "raa_acnuc.h"
	int main(int argc, char **argv)
	raa_db_access *raa;
	int err, list, count, num, length;
	char *seq, *name;

	err = raa_acnucopen_alt("", 5558, "embl", "myprog", &raa);
	if(err != 0) exit(1);
	raa_proc_query(raa, "j=nar and y=2000", NULL, "mylist", &list, &count, NULL, NULL);
	num = 0;
	while((num = raa_nexteltinlist(raa, num, list, &name, &length)) != 0) {
		seq = (char *)malloc((length + 1)*sizeof(char));
		raa_gfrag(raa, num, 1, length, seq);
		printf("Name:%s Sequence:%s\n", name, seq);

Link this toy program named prog.c with:

	setenv RAADIR name-of-dir-containing-libraa.a
	gcc -o prog prog.c -I$RAADIR -L$RAADIR -lraa -lz

Typedefs :

	raa_db_access: a structure containing all information related to a 
	connection with a remote acnuc database.
	typedef long long raa_long; /* scan_raa_long/print_raa_long converts from/to string decimal 
	form */
	typedef enum { raa_sub = 0, raa_loc, raa_key, raa_spec, raa_shrt, raa_lng, raa_ext, raa_smj,
	raa_aut, raa_bib, raa_txt, raa_acc } raa_file;
	typedef enum { raa_sub_of_bib = 0, raa_spec_of_loc, raa_bib_of_loc, raa_aut_of_bib, 
	     raa_bib_of_aut, raa_sub_of_acc, raa_key_of_sub, raa_acc_of_loc } raa_shortl2_kind;

Public fields of the raa_db_access structure :

typedef struct _raa_db_access {/* all information related to a connection with a remote acnuc 
	database */
	char *dbname; /* name of connected acnuc database */
	FILE *raa_sockfdr, *raa_sockfdw; /* variables for read/write from/to connection socket */
	int genbank, embl, swissprot, nbrf; /* one is true according to format of connected db */
	int nseq; /* total number of sequences (and subseqs) in db */
	int longa;
	int maxa;
	/* max widths of several db textual fields */
	/* number of elements in a SHORTL2 record (0 when the SHORTL2 index file is not used) */
	char *version_string; /* NULL, or a string containing version information */
        int maxlists; /* max # of possible lists */
	raa_node **sp_tree; /* NULL or the full taxonomy tree */
	int max_tid; /* largest correct taxon ID value */
	int *tid_to_rank; /* NULL or ncbi taxon ID to acnuc rank table */
	int SUBINLNG; /* true number of sequence numbers in a struct rlng record */
	struct rlng {
		int sub[SUBINLNG];
		int next;
		} *rlng_buffer;
	/* supports working with selected parts of sequence annotations */
	int tot_key_annots; /* number of elements of each of next three arrays */
	/* uppercase names of annotation records in connected database; key_annots[0] is "ALL" */
	char **key_annots; 
	char **key_annots_min; /* same in lowercase */
	/* each element is true if annotation record is wanted; want_key_annots[0]=TRUE means all 
	records wanted */
	unsigned char *want_key_annots; 
	} raa_db_access;