// -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- // Copyright (C) 2007 Author: Fathi Elloumi. // This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or any later version. // This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. // You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- #include #include #include using namespace std; typedef struct { char pat[41]; // char pcon[41]; int len; int den; int sup; int tot; int revc; long double zssup; // long double zstot; long double mic; } element ; int bestscores(element tab[2000]) { FILE *infresult; char s1[20],s2[20],s3[20],s4[20],s5[20],s6[20],s7[20],s8[20],s9[20]; char epat[41],epcon[41]; int i,j,pos,erevc;; int elen,eden,esup,etot; long double eproba,epvalue; long double vmic; infresult= fopen("patt-cons-mic.txt","r") ; if (infresult==NULL) {printf("Error in reading file : patt-cons-mic.txt");return 0;}; if ( feof(infresult) ){printf("Error : input file patt-cons-mic.txt is empty");return 0;}; fscanf(infresult,"%s %s %s %s %s %s %s %s %s",s1,s2,s3,s4,s5,s6,s7,s8,s9); i=0; while ( !feof( infresult) ) { fscanf(infresult,"%s %s %i %i %i %i %Le %Le %Lf",epat,epcon,&elen,&eden,&esup,&etot,&eproba,&epvalue,&vmic); if ( feof(infresult) ) break; strcpy(tab[i].pat,epat); // strcpy(tab[i].pcon,epcon); tab[i].len =elen ;tab[i].den=eden ;tab[i].sup=esup ; tab[i].tot=etot ;tab[i].zssup=eproba ; // tab[i].zstot=epvalue ; tab[i].mic=vmic; //printf("mic %Le- ",vmic); i++; }; // while fclose(infresult); infresult= fopen("patt-rev-com.txt","r") ; if (infresult==NULL) {printf("Error in reading file : patt-rev-com.txt");return 0;}; if ( feof(infresult) ){printf("Error : input file patt-rev-com.txt is empty");return 0;}; fscanf(infresult,"%s %s %s %s %s %s %s %s",s1,s2,s3,s4,s5,s6,s7,s8); i=0; while ( !feof( infresult) ) { fscanf(infresult,"%s %i %i %i %i %Le %Le %i",epat,&elen,&eden,&esup,&etot,&eproba,&epvalue,&erevc); if ( feof(infresult) ) break; tab[i].revc=erevc; i++; }; // while fclose(infresult); //////////// return i; } int counting(element tab[2000],char *fich,int nbre) { FILE *infresult,*outstat; char ch[20]; int pv[2000]; int i,npat; double vtime; long double zsrand[2000]; for (i=0;i<2000;i++) pv[i]=0; infresult= fopen(fich,"r") ; if (infresult==NULL) {printf("Error in reading file : %s",fich);return 0;}; if ( feof(infresult) ){printf("Error : input file %s is empty",fich);return 0;}; for (i=0;i= tab[i].zssup) pv[i]++; }; // while fclose(infresult); outstat= fopen("final-results-with-pvalue.txt","w") ; fprintf(outstat,"#patt\tpattern\t#rev-com\tlength\tdensity\tsupport\ttotal\tzssup\tp-value\tmic\n"); for (i=0;i