#include #include #include #include float *matrix[110000]; int *matrixind[110000]; int size[110000]; char line[100000]; int dim=108931; int dim_scop=7392; float sigma=100; // sigma, controls size of local weights float alpha=0.95; // alpha parameter, controls amount of "clustering" int max_loops=20; // number of iterations of algorithm void load_matrix() // load the whole matrix { FILE *f; int index,amount,i,j,k,ind; char c; char buffer[20]; float eval;int flag=0; size[0]=0; f=fopen("rankprop_matrix.txt","r"); if (f==NULL) {printf("ERROR: File rankprop_matrix.txt not found!\n"); exit(0);} for(k=1;k %d \n",start); for(j=0;j %d %d\n",j,start); fscanf(fscop,"%d %d",&index,&amount); for(i=0;i1e-20) // otherwise we get nans for(i=0;i1e-20) // otherwise we get nans for(i=0;idim_scop) end=dim_scop; sprintf(fname,"rm rankprop_results_%d.txt",start); system(fname); // delete pre-existing file, we will concatenate each query on to this for(k=start+1;k<=end+1;k++) // all examples - make matrix!!!! { next_scop_matrix(); // load next query in scop file printf("%d %d %d \n",scop_index,scop_size,k); for(i=0;i<=dim+2;i++) // setup labels {y[i]=0.0; yorig[i]=0;} y[k]=1.0; // query point query_size=scop_size; row_ind=scop_rowind; row_eval=scop_row; // take query from scop file for(i=0;istart) sprintf(fname,"cat tmp.rankprop%d >> rankprop_results_%d.txt",start,start); else sprintf(fname,"cat tmp.rankprop%d > rankprop_results_%d.txt",start,start); printf("[%s]\n",fname); system(fname); } } int main(int argc, char *argv[]) { if (argc<3) { printf("Usage: rankprop \n\n"); printf(" Loads the file rankprop_matrix.txt, which gives the PSI-BLAST distance measure as input.\n"); printf(" Then, the RankProp algorithm is executed.\n The real-valued rank outputs for SCOP are saved in a file rankprop_results_.\n"); exit(0); } int start,end; start=atoi(argv[1]); // can start at different positions // for parallel implementation end=atoi(argv[2]); // can start at different positions // for parallel implementation printf("start on %dth query\n",start); printf("end on %dth query\n",end); load_scop_matrix(start); // load queries from a different file load_matrix(); normalize(); // do rbf, normalization ranking(start,end); // for each pt in scop, do ranking // output part of matrix to file }