JWS-112 Bumping version of Mafft to version 7.310.
[jabaws.git] / binaries / src / mafft / core / blosum.c
index 62652e5..45a7d9b 100644 (file)
@@ -2,7 +2,8 @@
 #define DEFAULTGEP_B   -00 
 #define DEFAULTOFS_B  -123   /* +10 -- -50  teido ka ? */
 
-void BLOSUMmtx( int n, double **matrix, double *freq, char *amino, char *amino_grp )
+
+void BLOSUMmtx( int n, double **matrix, double *freq, unsigned char *amino, char *amino_grp )
 {
        /*
        char locaminod[26] = "GASTPLIMVDNEQFYWKRHCXXX.-U";
@@ -157,6 +158,52 @@ void BLOSUMmtx( int n, double **matrix, double *freq, char *amino, char *amino_g
      -4,     -4,     -4,     -6,     -5,     -3,     -5,     -6,      3,     -3,     -2,     -4,     -3,      4,     -6,     -3,     -3,      3,     11,
      -1,     -4,     -5,     -6,     -2,     -4,     -4,     -6,     -5,      4,      1,     -4,      1,     -2,     -4,     -3,      0,     -5,     -3,      7,
        };
+       double tmpmtx90[] = 
+       {
+ 5,
+-2,  6,
+-2, -1,  7,
+-3, -3,  1,  7,
+-1, -5, -4, -5,  9,
+-1,  1,  0, -1, -4,  7,
+-1, -1, -1,  1, -6,  2,  6,
+ 0, -3, -1, -2, -4, -3, -3,  6,
+-2,  0,  0, -2, -5,  1, -1, -3,  8,
+-2, -4, -4, -5, -2, -4, -4, -5, -4,  5,
+-2, -3, -4, -5, -2, -3, -4, -5, -4,  1,  5,
+-1,  2,  0, -1, -4,  1,  0, -2, -1, -4, -3,  6,
+-2, -2, -3, -4, -2,  0, -3, -4, -3,  1,  2, -2,  7,
+-3, -4, -4, -5, -3, -4, -5, -5, -2, -1,  0, -4, -1,  7,
+-1, -3, -3, -3, -4, -2, -2, -3, -3, -4, -4, -2, -3, -4,  8,
+ 1, -1,  0, -1, -2, -1, -1, -1, -2, -3, -3, -1, -2, -3, -2,  5,
+ 0, -2,  0, -2, -2, -1, -1, -3, -2, -1, -2, -1, -1, -3, -2,  1,  6,
+-4, -4, -5, -6, -4, -3, -5, -4, -3, -4, -3, -5, -2,  0, -5, -4, -4, 11,
+-3, -3, -3, -4, -4, -3, -4, -5,  1, -2, -2, -3, -2,  3, -4, -3, -2,  2,  8,
+-1, -3, -4, -5, -2, -3, -3, -5, -4,  3,  0, -3,  0, -2, -3, -2, -1, -3, -3,  5,
+       };
+       double tmpmtx100[] = 
+       {
+ 8,
+-3,10,
+-4,-2,11,
+-5,-5, 1,10,
+-2,-8,-5,-8,14,
+-2, 0,-1,-2,-7,11,
+-3,-2,-2, 2,-9, 2,10,
+-1,-6,-2,-4,-7,-5,-6, 9,
+-4,-1, 0,-3,-8, 1,-2,-6,13,
+-4,-7,-7,-8,-3,-6,-7,-9,-7, 8,
+-4,-6,-7,-8,-5,-5,-7,-8,-6, 2, 8,
+-2, 3,-1,-3,-8, 2, 0,-5,-3,-6,-6,10,
+-3,-4,-5,-8,-4,-2,-5,-7,-5, 1, 3,-4,12,
+-5,-6,-7,-8,-4,-6,-8,-8,-4,-2, 0,-6,-1,11,
+-2,-5,-5,-5,-8,-4,-4,-6,-5,-7,-7,-3,-5,-7,12,
+ 1,-3, 0,-2,-3,-2,-2,-2,-3,-5,-6,-2,-4,-5,-3, 9,
+-1,-3,-1,-4,-3,-3,-3,-5,-4,-3,-4,-3,-2,-5,-4, 2, 9,
+-6,-7,-8,-10,-7,-5,-8,-7,-5,-6,-5,-8,-4, 0,-8,-7,-7,17,
+-5,-5,-5,-7,-6,-4,-7,-8, 1,-4,-4,-5,-5, 4,-7,-5,-5, 2,12,
+-2,-6,-7,-8,-3,-5,-5,-8,-7, 4, 0,-5, 0,-3,-6,-4,-1,-5,-5, 8,
+       };
        double tmpmtx0[] = 
        {
      2.4,
@@ -190,6 +237,8 @@ void BLOSUMmtx( int n, double **matrix, double *freq, char *amino, char *amino_g
        else if( n == 50 ) tmpmtx = tmpmtx50;
        else if( n == 62 ) tmpmtx = tmpmtx62;
        else if( n == 80 ) tmpmtx = tmpmtx80;
+       else if( n == 90 ) tmpmtx = tmpmtx90;
+       else if( n == 100 ) tmpmtx = tmpmtx100;
        else if( n == 0 ) tmpmtx = tmpmtx0;
        else if( n == -1 ) tmpmtx = loadaamtx();
        else
@@ -264,3 +313,44 @@ void BLOSUMmtx( int n, double **matrix, double *freq, char *amino, char *amino_g
     for( i=0; i<26; i++ ) amino[i] = locaminod[i];
     for( i=0; i<26; i++ ) amino_grp[(int)amino[i]] = locgrpd[i];
 }
+
+void extendedmtx( double **matrix, double *freq, unsigned char *amino, char *amino_grp )
+{
+       int i;
+       int j;
+
+       for( i=0; i<nalphabets; i++ ) 
+       {
+//             fprintf( stderr, "i=%d, i=%c\n", i, i );
+               amino[i] = (unsigned char)i;
+       }
+       for( i=0; i<nalphabets; i++ ) amino_grp[(int)amino[i]] = i % 6;
+       for( i=0; i<nalphabets; i++ ) freq[i] = 1.0/nalphabets;
+
+       for( i=0; i<nalphabets; i++ )
+       {
+               for( j=0; j<=i; j++ )
+               {
+                       matrix[i][j] = matrix[j][i] = (double)-1.0;
+               }
+       }
+       for( i=0; i<nalphabets; i++ )
+               matrix[i][i] = matrix[i][i] = (double)1.0;
+#if 0 // user-defined matrix no toki fukkatsu saseru.
+       if( tmpmtx[400] != -1.0 ) 
+       {
+               for( i=0; i<20; i++ ) freq[i] = tmpmtx[400+i];
+               av = 0.0;
+               for( i=0; i<20; i++ ) av += freq[i];
+               for( i=0; i<20; i++ ) freq[i] /= av;
+       }
+       else
+               for( i=0; i<20; i++ ) freq[i] = freqd[i];
+#endif
+#if 0
+       for( i=0; i<nalphabets; i++ )
+       {
+               fprintf( stderr, "%d: %c, %d, %f\n", i, amino[i], amino_grp[amino[i]], freq[i] );
+       }
+#endif
+}