2007-03-23 14:25:07 +01:00
|
|
|
#ifndef GODIST_H
|
|
|
|
#define GODIST_H
|
|
|
|
|
|
|
|
#include <search.h>
|
|
|
|
|
|
|
|
#define MAX_NODES 15000
|
|
|
|
#define MAX_PARENTS 100
|
|
|
|
#define MAX_CHILDREN 100
|
|
|
|
|
2007-03-27 01:15:14 +02:00
|
|
|
enum EVIDENCE { MP = 1,
|
|
|
|
IGI = 1 << 1,
|
|
|
|
IPI = 1 << 2,
|
|
|
|
ISS = 1 << 3,
|
|
|
|
IDA = 1 << 4,
|
|
|
|
IEP = 1 << 5,
|
|
|
|
IEA = 1 << 6,
|
|
|
|
TAS = 1 << 7,
|
|
|
|
NAS = 1 << 8,
|
|
|
|
ND = 1 << 9,
|
|
|
|
RCA = 1 << 10,
|
|
|
|
IC = 1 << 11 };
|
|
|
|
|
2007-03-23 14:25:07 +01:00
|
|
|
struct node;
|
|
|
|
struct node {
|
|
|
|
/* GO term id. E.g: "GO:0005180" */
|
|
|
|
char term[11];
|
|
|
|
/* Information content */
|
|
|
|
float ic;
|
|
|
|
/* Depth in tree */
|
|
|
|
int depth;
|
|
|
|
/* Evidence codes */
|
|
|
|
int evidence[12];
|
|
|
|
/* Accumulated evidence codes */
|
|
|
|
int acc_evidence[12];
|
|
|
|
|
2007-05-15 20:16:07 +02:00
|
|
|
/* Working memory */
|
|
|
|
int temp_acc[12];
|
|
|
|
|
2007-03-23 14:25:07 +01:00
|
|
|
/* Parent count and parents */
|
|
|
|
int parentc;
|
|
|
|
struct node *parents[MAX_PARENTS];
|
|
|
|
|
|
|
|
/* Child count and children */
|
|
|
|
int childrenc;
|
|
|
|
struct node *children[MAX_CHILDREN];
|
2007-03-26 19:18:26 +02:00
|
|
|
|
|
|
|
/* Flag to ensure that a node is only visited once in DAG operations */
|
|
|
|
char visited;
|
2007-03-23 14:25:07 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
struct node* term_array[MAX_NODES];
|
|
|
|
long term_array_size;
|
|
|
|
int link_count;
|
2007-04-03 15:08:48 +02:00
|
|
|
int total_ann;
|
|
|
|
int evidence; /* bitvector with one bit per evidence code */
|
2007-03-23 14:25:07 +01:00
|
|
|
|
|
|
|
/* Ontology initialisation functions. */
|
|
|
|
int godist_init();
|
|
|
|
int godist_read_assoc(FILE *fd);
|
|
|
|
int godist_read_term(FILE *fd);
|
|
|
|
void accumulate_evidence(struct node*);
|
|
|
|
|
|
|
|
/* Distance metric functions */
|
|
|
|
float resnik_distance(char *term1, char *term2);
|
|
|
|
float fussimeg_distance(char *term1, char *term2);
|
2007-04-03 15:08:48 +02:00
|
|
|
void calc_ic(struct node *n, unsigned int evidence);
|
|
|
|
|
|
|
|
void clear_flags(struct node *n);
|
|
|
|
void print_term(struct node *n);
|
2007-03-23 14:25:07 +01:00
|
|
|
|
2007-05-15 20:16:07 +02:00
|
|
|
void add_ancestors(int *ancc, struct node *anc[], struct node *n);
|
|
|
|
|
|
|
|
void calculate_ics(unsigned int);
|
|
|
|
void acc_ev(struct node*);
|
|
|
|
|
2007-03-23 14:25:07 +01:00
|
|
|
#endif
|
|
|
|
|