mgaln.h

Go to the documentation of this file.
00001 #ifndef MGSALN_H
00002 #define MGSALN_H
00003 
00004 //file: mgsaln.h
00005 #include <stdio.h>
00006 #include "dynamicaln.h"
00007 
00008 class mgsaln {
00009  private:
00010         struct SEQALN_SEQUENCE *seq1,*seq2; /* 1st & 2nd sequences to be compared. */
00011         struct SEQALN_CONSTANTS  *scoring;  /* Scoring constants. */
00012         struct SEQALN_RESULTS  *results;    /* Computation results. */
00013         struct SEQALN_IO *io;
00014 
00015  public:
00016         mgsaln(char* seq2name, char* seq1str, char* seq2name, char* seq2str);
00017 
00018 
00019         int i,j;
00020         int seq1status;
00021         extern char *newmem();
00022 
00023         seq1 = (struct SEQALN_SEQUENCE *)newmem(1, sizeof(struct SEQALN_SEQUENCE));
00024         seq2 = (struct SEQALN_SEQUENCE *)newmem(1, sizeof(struct SEQALN_SEQUENCE));
00025         scoring = (struct SEQALN_CONSTANTS *)newmem(1, sizeof(struct SEQALN_CONSTANTS));
00026         results = (struct SEQALN_RESULTS *)newmem(1, sizeof(struct SEQALN_RESULTS));
00027         io = (struct SEQALN_IO *)newmem(1, sizeof(struct SEQALN_IO));
00028 
00029         io->STDIN = stdin;
00030         io->STDOUT = stdout;
00031         io->STDERR = stderr;
00032 
00033         if (argc<7)
00034           {
00035             (void)fprintf(io->STDOUT,"Shortcut:\n\n   %s file1 file2 ", argv[0]);
00036             (void)fprintf(io->STDOUT,"matrix offset ");
00037             (void)fprintf(io->STDOUT,"alpha beta ");
00038             (void)fprintf(io->STDOUT,"[flags]\n\n");
00039           }
00040         scoring->ptype = GLOBAL;
00041         scoring->stype = MATRIX;
00042         scoring->mtype = SIMILARITY;
00043         scoring->btype = FULL;
00044         scoring->memuse = SQUARE;
00045         parseargs(seq1,seq2,scoring,results,io,argc,argv); /* Parse program arguments */
00046         results_init(seq1,seq2,scoring,results,io); /* Initialize results data struct */
00047 
00048         /*
00049           We have all the parameter information.  Now proceed w/computation.
00050         */
00051         seq1status = seq1->len;
00052         while (seq1status > 0) {  /* Stop at 0-length seq, or EOF (seq1status==-1) */
00053           globalS(seq1,seq2,scoring,results,io);
00054           if (scoring->memuse == LINEAR) {
00055             if (scoring->rptscore) {
00056               rpt_align(seq1,seq2,scoring,results,io);
00057             }
00058           }
00059           else {
00060             for (i=0; i<=scoring->rptboth; i++) {
00061         trace(seq1,seq2,scoring,results,io);
00062         if (scoring->rpttrace) {
00063           print_trace(scoring,results,io);
00064         }
00065         if (scoring->rptscore || scoring->rptalign) {
00066           gen_align(seq1,seq2,scoring,results,io); /* Generate the alignment */
00067           rpt_align(seq1,seq2,scoring,results,io); /* Print the alignment */
00068         }
00069         if (scoring->rptboth) {
00070           scoring->traceupper = !scoring->traceupper;
00071           (void)fprintf(io->STDOUT,"\n");
00072         }
00073             }
00074           }
00075           seq1status = load_seq(seq1,scoring,io);
00076           if (seq1status > 0) {
00077             results_init(seq1,seq2,scoring,results,io);
00078           }
00079         }  /* End of while seq1status . . . */
00080         
00081         exit(0);
00082 }
00083 
00084 #endif

Generated on Wed Oct 14 21:49:13 2009 for Softwares from Orpara by  doxygen 1.5.6