ontology distance script now accumulates annotations correctly.
This commit is contained in:
parent
11eb3306b9
commit
728c334e8a
|
@ -9,6 +9,7 @@
|
|||
void print_terms();
|
||||
void add_link(char*, char*);
|
||||
struct node* get_bp();
|
||||
struct node* get_term(char *);
|
||||
|
||||
/* initialisation */
|
||||
int godist_init() {
|
||||
|
@ -48,8 +49,26 @@ int godist_init() {
|
|||
fclose(tree_fd);
|
||||
printf(" %d edges\n", link_count);
|
||||
|
||||
accumulate_evidence(get_bp());
|
||||
for (i=0; i<term_array_size; i++) {
|
||||
clear_flags(get_bp());
|
||||
accumulate_evidence(term_array[i]);
|
||||
printf(".");
|
||||
}
|
||||
print_term(get_bp());
|
||||
|
||||
print_term(get_term("GO:0040007"));
|
||||
print_term(get_term("GO:0007275"));
|
||||
print_term(get_term("GO:0007582"));
|
||||
print_term(get_term("GO:0043473"));
|
||||
print_term(get_term("GO:0000004"));
|
||||
print_term(get_term("GO:0051704"));
|
||||
print_term(get_term("GO:0000003"));
|
||||
print_term(get_term("GO:0016032"));
|
||||
print_term(get_term("GO:0009987"));
|
||||
print_term(get_term("GO:0050896"));
|
||||
print_term(get_term("GO:0050789"));
|
||||
|
||||
/* find_multi_parented();*/
|
||||
}
|
||||
|
||||
void godist_exit() {
|
||||
|
@ -95,11 +114,7 @@ int godist_read_term(FILE *fd) {
|
|||
e.key = n->term;
|
||||
e.data = (void*)n;
|
||||
res = hsearch(e, ENTER);
|
||||
/* if (res);
|
||||
printf("hash-insert: %s", ((struct node*)res->data)->term);
|
||||
else
|
||||
printf("hash-insert: error");
|
||||
*/
|
||||
|
||||
term_array[term_array_size++] = n;
|
||||
}
|
||||
|
||||
|
@ -111,11 +126,6 @@ float go_distance(char *term1, char *term2) {
|
|||
return 0.0;
|
||||
}
|
||||
|
||||
void add_node(char *term, int parentc, struct node **parents) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
void clear_flags(struct node *n) {
|
||||
int i;
|
||||
for (i=0; i<n->childrenc; i++)
|
||||
|
@ -152,20 +162,20 @@ void add_link(char *parent_id, char *child_id) {
|
|||
}
|
||||
parent->children[parent->childrenc] = child;
|
||||
parent->childrenc++;
|
||||
/* printf("adding %x as child of %x\n", child, parent);*/
|
||||
child->parents[child->parentc] = parent;
|
||||
child->parentc++;
|
||||
}
|
||||
|
||||
struct node *get_bp() {
|
||||
return get_term("GO:0008150");
|
||||
}
|
||||
|
||||
struct node *get_term(char *term) {
|
||||
ENTRY e, *ep;
|
||||
e.key = "GO:0008150";
|
||||
e.key = term;
|
||||
ep = hsearch(e, FIND);
|
||||
|
||||
if (ep) {
|
||||
/* printf("BP is %x and %s\n", (int) ep->data, ep->key);
|
||||
printf("%d\n", ((struct node*)ep->data)->childrenc );
|
||||
printf("%s\n", ((struct node*)ep->data)->term);*/
|
||||
return ep->data;
|
||||
}
|
||||
return NULL;
|
||||
|
@ -175,6 +185,7 @@ void accumulate_evidence(struct node *n) {
|
|||
int i, j;
|
||||
if (n->visited)
|
||||
return;
|
||||
n->visited = 1;
|
||||
|
||||
for (i=0; i<12; i++)
|
||||
n->acc_evidence[i] = n->evidence[i];
|
||||
|
@ -186,7 +197,6 @@ void accumulate_evidence(struct node *n) {
|
|||
n->acc_evidence[j] += n->children[i]->acc_evidence[j];
|
||||
}
|
||||
}
|
||||
/* printf(".");*/
|
||||
}
|
||||
|
||||
void print_terms() {
|
||||
|
@ -211,3 +221,15 @@ void print_term(struct node *n) {
|
|||
printf("\n");
|
||||
}
|
||||
|
||||
void find_multi_parented() {
|
||||
int i;
|
||||
for (i=0; i<term_array_size; i++) {
|
||||
if (term_array[i]->parentc > 1)
|
||||
printf("%s -- %d\n", term_array[i]->term, term_array[i]->parentc);
|
||||
}
|
||||
}
|
||||
|
||||
float calc_ic(unsigned int evidence) {
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,19 @@
|
|||
#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" */
|
||||
|
|
Reference in New Issue