// -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- // 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 "utilities2.h"; //// function MAIN ///////////////////////////////////////////////////// int main(int vnbre, char *arg[]) //int main() { int nombre=0; int i,vtaille; elt * tab; FILE * outrec, *outrep,*inproba; double pa,pc,pg,pt; time_t start; try { if (vnbre > 2) {printf("\nError: Invalid number of parameters\n"); printf("\nSYNTAX: Bestpatterns [number_of_patterns] defaults=20\n"); return 0; } else if (vnbre==2) { vtaille = atoi(arg[1]); if (vtaille < 10 || vtaille > 2000) { printf("\nError: Min=10 and Max=2000\n"); return 0; }; } else vtaille=40; tab= new elt[vtaille]; inproba = fopen("fproba.txt","r") ; if (inproba==NULL) {printf("Error in reading used probabilities");return 0;}; if ( feof(inproba) ){printf("Error : proba file is empty");return 0;}; fscanf(inproba,"%lf %lf %lf %lf",&pa,&pc,&pg,&pt); //printf("%lf %lf %lf %lf",pa,pc,pg,pt); fclose(inproba); outrec= fopen("bestzstot.txt","w"); outrep= fopen("runreport.txt","a"); //////////////// time(&start); printf("\n*** Selecting the best %i patterns for the z-zcore of the total number of occurences on %s:...\n",vtaille,ctime(&start)); fprintf(outrep,"\n*** Selecting the best %i patterns for the z-zcore of the total number of occurences on %s:...\n",vtaille,ctime(&start)); // printf ("\nStatus:"); printf ("\nFrom family A: %i",besttot(tab,nombre,vtaille,"resA.txt")); printf ("\nFrom family C: %i",besttot(tab,nombre,vtaille,"resC.txt")); printf ("\nFrom family G: %i",besttot(tab,nombre,vtaille,"resG.txt")); printf ("\nFrom family T: %i",besttot(tab,nombre,vtaille,"resT.txt")); fprintf(outrec,"Pattern\t") ; // fprintf(outrec,"Max\t") ; fprintf(outrec,"Length\t") ; fprintf(outrec,"Density\t") ; fprintf(outrec,"Support\t") ; fprintf(outrec,"Total\t") ; fprintf(outrec,"Zs-supp\t") ; fprintf(outrec,"Zs-tot\t") ; fprintf(outrec,"Sequences_and_Positions\n") ; for (i=0;i see file: bestzstot.txt\n"); fprintf(outrep,"\n--> see file: bestzstot.txt\n"); printf("\n*** Sites extraction with their positions.......\n"); fprintf(outrep,"\n*** Sites extraction with their positions.......\n"); // pospatt("bestzstot.txt","sites-positions-tot.txt","sites-for-logo-tot.txt"); printf("\n--> see files: sites-positions-tot.txt & sites-for-logo-tot.txt\n"); fprintf(outrep,"\n--> see files: sites-positions-tot.txt & sites-for-logo-tot.txt\n"); printf("\n*** Profiles,Consensus and mean information content.......\n"); fprintf(outrep,"\n*** Profiles,Consensus and mean information content.......\n"); // prostat(pa,pc,pg,pt,"sites-for-logo-tot.txt","patt-profiles-tot.txt","patt-cons-mic-tot.txt"); printf("\n--> see files: patt-profiles-tot.txt & patt-cons-mic-tot.txt\n"); fprintf(outrep,"\n--> see files: patt-profiles-tot.txt & patt-cons-mic-tot.txt\n"); printf("\n*** Information about pattern similarity and reverse complements.......\n"); fprintf(outrep,"\n*** Information about pattern similarity and reverse complements.......\n" ); simrev("bestzstot.txt","patt-similarity-tot.txt","patt-rev-com-tot.txt"); printf("\n--> see files: patt-similarity-tot.txt & patt-rev-com-tot.txt\n"); fprintf(outrep,"\n--> see files: patt-similarity-tot.txt & patt-rev-com-tot.txt\n"); printf("\nDone ! \n"); fprintf(outrep,"\nDone ! \n"); fclose(outrep); /////////////// } catch (exception &e) { printf("exception: %s\n",e.what()) ; } return 0; }