Projects/laydi
Projects
/
laydi
Archived
7
0
Fork 0
This repository has been archived on 2024-07-04. You can view files and clone it, but cannot push or open issues or pull requests.
laydi/scripts/geneontology/go-distance/godist.h

70 lines
1.5 KiB
C

#ifndef GODIST_H
#define GODIST_H
#include <search.h>
#define MAX_NODES 15000
#define MAX_PARENTS 100
#define MAX_CHILDREN 100
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 };
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];
/* Parent count and parents */
int parentc;
struct node *parents[MAX_PARENTS];
/* Child count and children */
int childrenc;
struct node *children[MAX_CHILDREN];
/* Flag to ensure that a node is only visited once in DAG operations */
char visited;
};
struct node* term_array[MAX_NODES];
long term_array_size;
int link_count;
int total_ann;
int evidence; /* bitvector with one bit per evidence code */
/* 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);
void calc_ic(struct node *n, unsigned int evidence);
void clear_flags(struct node *n);
void print_term(struct node *n);
#endif