Skip to content

Commit a55e416

Browse files
committed
a compilable version
1 parent c68891d commit a55e416

File tree

8 files changed

+28
-12
lines changed

8 files changed

+28
-12
lines changed

README.md

+12
Original file line numberDiff line numberDiff line change
@@ -1 +1,13 @@
11
# DCJUC
2+
3+
# compile
4+
before compile, gsl must be installed
5+
how to compile:
6+
```
7+
make
8+
```
9+
how to run (options are in the main.c code):
10+
```
11+
cd main
12+
./DCJUC
13+
```

dist/dist.o

-45.5 KB
Binary file not shown.

generator/sim.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -537,9 +537,10 @@ vis_fork_adj(pa a, int pos_n){
537537

538538
void
539539
init_adj(pa a, int size1, int size2){
540+
int i;
540541
a->list = (int**)malloc(sizeof(int*)*size1);
541542
for(i=0; i<size1; i++)
542543
a->list[i] = (int*)malloc(sizeof(int)*size2);
543-
a->idx_list = (int*)malloc(sizeof(int)*siz1);
544+
a->idx_list = (int*)malloc(sizeof(int)*size1);
544545
a->list_size = size1;
545546
}

include/graph.h

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ struct gr
3636
int *zero;
3737
int cycle;
3838
int distance[3];
39+
int score;
3940
};
4041
typedef struct gr tg;
4142
typedef struct gr *pg;

include/tree.h

+2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ struct tree{
3737
int lower_bound;
3838
tte *edges;
3939
po orders;
40+
int num_genome;
41+
int edge_num;
4042
};
4143
typedef struct tree tt;
4244
typedef struct tree *pt;

lib/dist.a

-46.1 KB
Binary file not shown.

phylogeny/model.c

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include "model.h"
22
#include "tree.h"
33
#include "newick.h"
4+
#include "sim.h"
45

56
void
67
graph_to_orders(pg g, pt tree);
@@ -66,7 +67,7 @@ run_initialization(char *file, char *nwfile){
6667
root = n_tree->edges[i][j];
6768
init_graph_by_two_orders(tree->orders, g,
6869
to[0], to[1]);
69-
init_directive_node(g, tree, root);
70+
init_directive_node(g, n_tree, tree, root);
7071
graph_to_orders(g, tree);
7172
}
7273
//three neighbors are initiated
@@ -108,7 +109,6 @@ run_refinement(pt tree){
108109
}
109110
while(improved == TRUE){
110111
for(i=o->num_input_genome; i<o->num_genome; i++){
111-
int old_score =
112112
pg g = (pg)malloc(sizeof(tg));
113113
init_graph_by_three_orders(tree->orders, g,
114114
n_tree->edges[i][0], n_tree->edges[i][1],
@@ -251,7 +251,7 @@ init_directive_node(pg g, pt tree,
251251
//pop queue
252252
int current = queue[--q_idx];
253253
if(nw->v_type[current] == V_TYPE_INIT)
254-
init_adj_directive_node(o, a, current);
254+
init_adj_directive_node(o, adj, current);
255255
else{ // add into queue
256256
for(i=0; i<3; i++)
257257
queue[q_idx++] = nw->edges[current][i];
@@ -262,7 +262,7 @@ init_directive_node(pg g, pt tree,
262262
}
263263

264264
void
265-
adj_to_graph_csr(pg g, pa adj, int pos){
265+
adj_to_graph_csr(pg g, pa a, int pos){
266266
int i, j, k;
267267
//compute v_idx first
268268
int sum = 0;
@@ -295,13 +295,13 @@ void
295295
init_adj_directive_node(po o, pa a, int o_pos){
296296
int i, j, k;
297297
for(i=0; i<o->v_size; i++){
298-
int start = i==0?0:o->v_idx[pos][i-1];
299-
int end = o->v_idx[pos][i];
298+
int start = i==0?0:o->v_idx[o_pos][i-1];
299+
int end = o->v_idx[o_pos][i];
300300
for(j=start; j<end; j++){
301-
int to = o->e_idx[pos][j];
301+
int to = o->e_idx[o_pos][j];
302302
int from = i;
303-
if(search(a->list[from], idx_list[from], to) == FALSE)
304-
a->list[from][idx_list[from]++] = to;
303+
//if(search(a->list[from], a->list[from], to) == FALSE)
304+
// a->list[from][a->list[from]++] = to;
305305
}
306306
}
307307
}
@@ -313,4 +313,4 @@ search(int *dic, int size, int word){
313313
if(dic[i] == word)
314314
return TRUE;
315315
return FALSE;
316-
}
316+
}

phylogeny/nj.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ run_upper_bound(po o){
8787
num_remain++;
8888
}
8989
if(num_remain==0)
90-
return;
90+
return -1;
9191
oo->num_genome = o->num_genome;
9292
oo->num_med_genome = o->num_med_genome;
9393
oo->num_input_genome = o->num_input_genome;

0 commit comments

Comments
 (0)