/*need ba2 is ntax => ntax number of topologies => num_topology array of topologies => topology cutpoint => cutpoint array of names => taxon_name */ #include #include #include #include #include #define FIFTEEN_BITS_MAX 500000 int find_name(s1,s2) char *s1, *s2; { int i,j,found; for (i=0;i< strlen(s2)-strlen(s1);i++) { found=1; for (j=0;j50) { fprintf(stderr,"Sequence name too long.\n"); exit(-1); } name_found=0; for (i=0;i-4) { if (buffer2[i]==-2) rep_length=i+1; i++; } /* for (i=0;i=0)&&(buffer2[j]VERBOSE) fprintf(stderr,"%d groups required\n",(*ngroups));*/ free(buffer2); return groups; } int get_jack_groups(ntax,num_topologies,topology,cutpoint,taxon_name) int ntax, num_topologies, cutpoint; char **taxon_name, **topology; { int i,j,k,num_there=0; int counter=0,ngroups; int **groups; int **big_groups, *num_of_each; int same,counter2,counter3,in,l,cur_len; int **final_groups,d1,d2,first; char *group_names,*temp1; char *ba; groups=NULL; big_groups=NULL; num_of_each=NULL; final_groups=NULL; group_names=NULL; temp1=NULL; big_groups=(int **)malloc(sizeof(int *)); assert((int) big_groups); big_groups[0]=(int *)malloc((ntax+1)*sizeof(int)); assert((int) big_groups[0]); for (i=0;i0) { for (j=i+1;j0) { same=1; for (k=0;k=((cutpoint*num_topologies/100))) ++counter2; } if (counter2>0) { final_groups=(int **)malloc(counter2*sizeof(int *)); assert((int) final_groups); for (i=0;i=((cutpoint*num_topologies)/100)) counter2++; printf("There were %d suported (>=%d%% replicates) groups of %d possible and non-trivial\n",counter2,cutpoint,ntax-2); fprintf(stderr,"There were %d suported (>=%d%% replicates) groups of %d possible and non-trivial\n",counter2,cutpoint,ntax-2); if (counter2>0) { counter2=0; for (i=0;i=((cutpoint*num_topologies)/100)) { printf(" Group %d %d%% (",counter2,(num_of_each[i]*100)/num_topologies); fprintf(stderr," Group %d %d%% (",counter2,(num_of_each[i]*100)/num_topologies); counter3=0; for (j=0;j0) { for (i=ntax-1;i>1;i--) { for (j=0;j0) counter3=print_jack2(ba,1,taxon_name,ntax,final_groups,counter2); /*values->acgt=values->farris=values->inter_dig=values->dot=values->hen_gap=values->paup=values->paup_dot=0;*/ if (num_of_each) free(num_of_each); if (group_names) free(group_names); if (temp1) free(temp1); if (big_groups) { for (i=0;i",temp,strlen(temp));*/ topology[j]=(char *)malloc((1+strlen(temp))*sizeof(char)); assert((int) topology[j]); /*topology[j]=(char *)strcpy (topology[j],temp);*/ for (k=0;k