JWS-112 Bumping version of Mafft to version 7.310.
[jabaws.git] / binaries / src / mafft / core / suboptalign11.c
index 5c1a9fe..0fb84d2 100644 (file)
@@ -10,7 +10,7 @@ typedef struct _shuryoten
 {
        int i;
        int j;
-       float wm;
+       double wm;
        struct _shuryoten *next;
        struct _shuryoten *prev;
 } Shuryoten;
@@ -27,7 +27,7 @@ static int compshuryo( Shuryoten *s1_arg, Shuryoten *s2_arg )
        else                        return( 0 );
 }
 
-static void match_calc( float *match, char **s1, char **s2, int i1, int lgth2 )
+static void match_calc( double *match, char **s1, char **s2, int i1, int lgth2 )
 {
        int j;
 
@@ -35,10 +35,10 @@ static void match_calc( float *match, char **s1, char **s2, int i1, int lgth2 )
                match[j] = amino_dis[(int)(*s1)[i1]][(int)(*s2)[j]];
 }
 
-static float gentracking( int **used,
+static double gentracking( int **used,
                                                char **seq1, char **seq2, 
                         char **mseq1, char **mseq2, 
-                        float **cpmx1, float **cpmx2, 
+                        double **cpmx1, double **cpmx2, 
                         int **ijpi, int **ijpj, int *off1pt, int *off2pt, int endi, int endj )
 {
        int l, iin, jin, lgth1, lgth2, k, limk;
@@ -126,7 +126,7 @@ static float gentracking( int **used,
 }
 
 
-float suboptalign11( char **seq1, char **seq2, int alloclen, int *off1pt, int *off2pt, LocalHom *lhmpt )
+double suboptalign11( char **seq1, char **seq2, int alloclen, int *off1pt, int *off2pt, LocalHom *lhmpt )
 /* score no keisan no sai motokaraaru gap no atukai ni mondai ga aru */
 {
        int k;
@@ -135,51 +135,51 @@ float suboptalign11( char **seq1, char **seq2, int alloclen, int *off1pt, int *o
        int lasti, lastj;                      /* outgap == 0 -> lgth1, outgap == 1 -> lgth1+1 */
        int lgth1, lgth2;
        int resultlen;
-       float wm = 0.0;   // by D.Mathog, 
-       float g;
-       float *currentw, *previousw;
+       double wm = 0.0;   // by D.Mathog, 
+       double g;
+       double *currentw, *previousw;
 #if 1
-       float *wtmp;
+       double *wtmp;
        int *ijpipt;
        int *ijpjpt;
-       float *mjpt, *Mjpt, *prept, *curpt;
+       double *mjpt, *Mjpt, *prept, *curpt;
        int *mpjpt, *Mpjpt;
 #endif
-       static float mi, *m;
-       static float Mi, *largeM;
+       static double mi, *m;
+       static double Mi, *largeM;
        static int **ijpi;
        static int **ijpj;
        static int mpi, *mp;
        static int Mpi, *Mp;
-       static float *w1, *w2;
-//     static float *match;
-       static float *initverticalw;    /* kufuu sureba iranai */
-       static float *lastverticalw;    /* kufuu sureba iranai */
+       static double *w1, *w2;
+//     static double *match;
+       static double *initverticalw;    /* kufuu sureba iranai */
+       static double *lastverticalw;    /* kufuu sureba iranai */
        static char **mseq1;
        static char **mseq2;
-       static float **cpmx1;
-       static float **cpmx2;
+       static double **cpmx1;
+       static double **cpmx2;
        static int **intwork;
-       static float **floatwork;
+       static double **doublework;
        static int orlgth1 = 0, orlgth2 = 0;
-       float maxwm;
-       float tbk;
+       double maxwm;
+       double tbk;
        int tbki, tbkj;
        int endali, endalj;
-//     float localthr = 0.0;
-//     float localthr2 = 0.0;
-       float fpenalty = (float)penalty;
-       float fpenalty_OP = (float)penalty_OP;
-       float fpenalty_ex = (float)penalty_ex;
-//     float fpenalty_EX = (float)penalty_EX;
-       float foffset = (float)offset;
-       float localthr = -foffset;
-       float localthr2 = -foffset;
+//     double localthr = 0.0;
+//     double localthr2 = 0.0;
+       double fpenalty = (double)penalty;
+       double fpenalty_OP = (double)penalty_OP;
+       double fpenalty_ex = (double)penalty_ex;
+//     double fpenalty_EX = (double)penalty_EX;
+       double foffset = (double)offset;
+       double localthr = -foffset;
+       double localthr2 = -foffset;
        static Shuryoten *shuryo = NULL;
        int numshuryo;
-       float minshuryowm = 0.0; // by D.Mathog
+       double minshuryowm = 0.0; // by D.Mathog
        int minshuryopos = 0; // by D.Mathog
-       float resf;
+       double resf;
 
 
 //     fprintf( stderr, "@@@@@@@@@@@@@ penalty_OP = %f, penalty_EX = %f, pelanty = %f\n", fpenalty_OP, fpenalty_EX, fpenalty );
@@ -233,7 +233,7 @@ float suboptalign11( char **seq1, char **seq2, int alloclen, int *off1pt, int *o
                        FreeFloatMtx( cpmx2 );
 
        fprintf( stderr, "in suboptalign11 step 1.7\n" );
-                       FreeFloatMtx( floatwork );
+                       FreeFloatMtx( doublework );
                        FreeIntMtx( intwork );
                }
 
@@ -256,11 +256,11 @@ float suboptalign11( char **seq1, char **seq2, int alloclen, int *off1pt, int *o
                largeM = AllocateFloatVec( ll2+2 );
                Mp = AllocateIntVec( ll2+2 );
 
-               cpmx1 = AllocateFloatMtx( 26, ll1+2 );
-               cpmx2 = AllocateFloatMtx( 26, ll2+2 );
+               cpmx1 = AllocateFloatMtx( nalphabets, ll1+2 );
+               cpmx2 = AllocateFloatMtx( nalphabets, ll2+2 );
 
-               floatwork = AllocateFloatMtx( 26, MAX( ll1, ll2 )+2 ); 
-               intwork = AllocateIntMtx( 26, MAX( ll1, ll2 )+2 ); 
+               doublework = AllocateFloatMtx( nalphabets, MAX( ll1, ll2 )+2 ); 
+               intwork = AllocateIntMtx( nalphabets, MAX( ll1, ll2 )+2 ); 
 
                mseq1 = AllocateCharMtx( njob, ll1+ll2 );
                mseq2 = AllocateCharMtx( njob, ll1+ll2 );
@@ -643,7 +643,7 @@ fprintf( stderr, "\n" );
                fprintf( stderr, "k=%d, shuryo[k].i,j,wm=%d,%d,%f go\n", k, shuryo[k].i, shuryo[k].j, shuryo[k].wm );
                resf = gentracking( used, seq1, seq2, mseq1, mseq2, cpmx1, cpmx2, ijpi, ijpj, off1pt, off2pt, shuryo[k].i, shuryo[k].j );
                if( resf == -1.0 ) continue;
-               putlocalhom3( mseq1[0], mseq2[0], lhmpt, *off1pt, *off2pt, (int)shuryo[k].wm, strlen( mseq1[0] ) );
+               putlocalhom3( mseq1[0], mseq2[0], lhmpt, *off1pt, *off2pt, (int)shuryo[k].wm, strlen( mseq1[0] ), 'h' );
 #if 0
                fprintf( stderr, "\n" );
                fprintf( stderr, ">\n%s\n", mseq1[0] );