From a4388f1e8b73ce2f627360ce004da28255aaef7e Mon Sep 17 00:00:00 2001 From: ziejd2 Date: Tue, 2 Mar 2021 11:17:26 -0600 Subject: Delete sourcecodes/localscore directory --- sourcecodes/localscore/network_score.c | 1441 -------------------------------- 1 file changed, 1441 deletions(-) delete mode 100644 sourcecodes/localscore/network_score.c (limited to 'sourcecodes/localscore/network_score.c') diff --git a/sourcecodes/localscore/network_score.c b/sourcecodes/localscore/network_score.c deleted file mode 100644 index c50a520e..00000000 --- a/sourcecodes/localscore/network_score.c +++ /dev/null @@ -1,1441 +0,0 @@ -#include -#include -#include -#define MATHLIB_STANDALONE 1 -#include "matrix.h" -#include "postc0.c" -#include "modified_postc.c" // only line that has been changed in this code -//#define OUT_DIR "./Result/" //WHERE BENE READ DATA FOR STRUCTURE LEARNING //change it to #define OUT_DIR "/var/www/html/compbio/BNW/bene-0.9-4/example/resdir/" for server. Also change from sprintf(line+9,"%d",i); to sprintf(line+52,"%d",i); - -struct white{ -int n; -int *list; -}; - -struct ban{ -int n; -int *list; -}; - -struct ndata{ -int idx,type,score_i; -char **ddata; -char **label; //for descrete node -int lindex; -double *prob,*cdata,*post_alpha; -double score_zeroparent; -double *score; -struct white wlist; -struct ban blist; -}; - - -struct nd{ -int num,nd,*discrete,nc,*continuous,row; -double score; -struct ndata *node; -}; - -void get_next_seq(int *,int *,int); -void learn_node(struct nd *); -double learn_parent(struct nd *,int,int); - -double run_strtof (const char * input) //Convert string to double -{ - double output; - char * end; - output = strtod (input, & end); - if (end == input) { - return 0.0; - } - else { - return output; - } -} - - -char* itoa(int val, int base){ //convert number to string - - static char buf[32] = {0}; - - int i = 30; - - for(; val && i ; --i, val /= base) - - buf[i] = "0123456789abcdef"[val % base]; - - return &buf[i+1]; - -} - -double standarizedata(double val,double mean,double std) -{ - return (val-mean)/std; - -} - -double mean(double *a,int l) -{ -int i; -double m; -m=0; -for(i=0;i1) //discrete - // fprintf(outfile,"%d\t",j); - //else //continuous - // fprintf(outfile,"%d\t",k); - } - - banf=fopen (argv[2],"r"); //ban list file name - whitef=fopen (argv[3],"r"); //white list file name - - //read banlist -// fgets (line,2500,banf); //header - - -strcpy(nf,""); -strcpy(nt,""); - -while (fgets (line,2500,banf)!=NULL){ - - fscanf(banf,"%s",nf); //node from - fscanf(banf,"%s",nt); //node to - - for(i=0;inetwork.node[i].score_zeroparent) - min_score=network.node[i].score_zeroparent; - - //fprintf(outfile,"%d\t0\t%lf\n",i+1,network.node[i].score_zeroparent); //printing score for zero parent - } - else - { - network.node[i].score[0]=1.0; - //fprintf(outfile,"%d\t0\t0.0\n",i+1); - - } - network.node[i].score_i=1; - - - for(j=0;j> i) & 1; - - if(bit!=1) //check if the child itself is present in parent list - { - - bit_count=0; - //fprintf(outfile,"%d\t",i+1); - for(l=0;l> l) & 1; - if(bit==1) - { - //fprintf(outfile,"%d",l+1); - bit_count++; - - } - - } - - - if(network.node[i].type>1) //if discrete node checck if any continuous node is included in the parent list - { - flag=0; - ban_flag=0; - for(l=0;l> l) & 1; - - if(bit==1 && network.node[l].type==1) //check if continuous is parent of discrete - { - flag=1; - break; - } - if(bit==1) - { - for(k=0;kMAX_PARENT) - { - //fprintf(outfile,"\t0.0\n"); - - s_i=network.node[i].score_i; - network.node[i].score[s_i]=1.0; - network.node[i].score_i=s_i+1; - - - - } - else if(ban_flag==1) - { - //fprintf(outfile,"\t0.0\n"); - s_i=network.node[i].score_i; - network.node[i].score[s_i]=1.0; - network.node[i].score_i=s_i+1; - } - else // calculate score if white list check get satisfied - { - if(network.node[i].wlist.n==0) - { - score_val=learn_parent(&network,i,j); - - if(min_score>score_val) - min_score=score_val; - - - - //fprintf(outfile,"\t%lf\n",score_val); - s_i=network.node[i].score_i; - network.node[i].score[s_i]=score_val; - network.node[i].score_i=s_i+1; - } - else if(bit_count> l) & 1; - - if(bit==1) - { - for(k=0;k=network.node[i].wlist.n) - { //!=1 - white_flag_all=1; - break; - - } - - } - } - if(white_flag_all==1) - { - score_val=learn_parent(&network,i,j); - if(min_score>score_val) - min_score=score_val; - - //fprintf(outfile,"\t%lf\n",score_val); - s_i=network.node[i].score_i; - network.node[i].score[s_i]=score_val; - network.node[i].score_i=s_i+1; - } - else - { - //fprintf(outfile,"\t0.0\n"); - s_i=network.node[i].score_i; - network.node[i].score[s_i]=1.0; - network.node[i].score_i=s_i+1; - } - - } - } - - } - else //fill up data when continuous is parent of discrete - { - //fprintf(outfile,"\t0.0\n"); - s_i=network.node[i].score_i; - network.node[i].score[s_i]=1.0; - network.node[i].score_i=s_i+1; - - } - } - else //if continuous node then learn the network with the parent set - { - - ban_flag=0; - - - for(l=0;l> l) & 1; - if(bit==1) - { - - for(k=0;kMAX_PARENT) - { - //fprintf(outfile,"\t0.0\n"); - s_i=network.node[i].score_i; - network.node[i].score[s_i]=1.0; - network.node[i].score_i=s_i+1; - } - else if(ban_flag==1) - { - //fprintf(outfile,"\t0.0\n"); - s_i=network.node[i].score_i; - network.node[i].score[s_i]=1.0; - network.node[i].score_i=s_i+1; - } - else - { - if(network.node[i].wlist.n==0) - { - score_val=learn_parent(&network,i,j); - if(min_score>score_val) - min_score=score_val; - - //fprintf(outfile,"\t%lf\n",score_val); - s_i=network.node[i].score_i; - network.node[i].score[s_i]=score_val; - network.node[i].score_i=s_i+1; - } - else if(bit_count> l) & 1; - - if(bit==1) - { - for(k=0;k=network.node[i].wlist.n) - { //!=1 - white_flag_all=1; - break; - - } - - } - } - if(white_flag_all==1) - { - score_val=learn_parent(&network,i,j); - if(min_score>score_val) - min_score=score_val; - - //fprintf(outfile,"\t%lf\n",score_val); - s_i=network.node[i].score_i; - network.node[i].score[s_i]=score_val; - network.node[i].score_i=s_i+1; - } - else - { - // fprintf(outfile,"\t0.0\n"); - s_i=network.node[i].score_i; - network.node[i].score[s_i]=1.0; - network.node[i].score_i=s_i+1; - } - - } - } - - - } - - - } - } - } - - -//print scores to separate files - -min_score*=10; -inputFiles= (FILE **) malloc(network.num * sizeof(FILE*)); - -printf("%s\n",argv[5]); - -for(i=0;i1) - nk*=network.node[i].type; - } - - - - - for(i=0;i1) - { - - alpha=(double *)malloc(sizeof(double)*network.node[i].type); - k=1; - - for(j=0;j1) - k*=network.node[j].type; - - } - N=0.0; n=0.0; - for(j=0;j1) - nk*=network.node[i].type; - } - -//list of discrete snd continuous parents - cn=0; - ds=0; - alpha_parent=0; - alpha=2; - - k1=network.node[child].type; - k2=1; - - //printf("%d\n",child); - for(j=0;j> j) & 1; - - - if(bit==1 && j!=child) - { - - if(network.node[j].type>1) - { - discrete[ds]=j; - //printf("discrete parent=%d\n",j); - k1*=network.node[j].type; - k2*=network.node[j].type; - ds++; - } - else - { - continuous[cn]=j; - //printf("continuous parent=%d\n",j); - cn++; - } - } - else if(j!=child) - { - alpha*=network.node[j].type; - } - } - - if(network.nd<=2) - alpha=2; - - i=child; //i is the node with changes in its parrent nodes - - if(network.node[i].type>1 && cn==0) // no continuous node //prepare alpha and post alpha and then calculate local score - { - - k=k1; - postalpha=(double *)calloc(network.node[i].type,sizeof(double)); - - label=(char **)malloc(sizeof(char *)*(ds+1)); //label array - a=(int *)calloc((ds+1),sizeof(int)); - l_list=(int *)malloc(sizeof(int)*(ds+1)); - - for(j=0;j<=ds;j++) - label[j]=(char *)malloc(sizeof(char)*100); - - for(j=0;j=0;j--){ - a[j]+=1; - if(a[j]==l[j]) - a[j]=0; - else - break; - } - } -} - - -- cgit 1.4.1