[med-svn] [Git][med-team/mafft][upstream] New upstream version 7.486

Nilesh Patra (@nilesh) gitlab at salsa.debian.org
Fri Jul 23 21:41:17 BST 2021



Nilesh Patra pushed to branch upstream at Debian Med / mafft


Commits:
084720ae by Nilesh Patra at 2021-07-24T02:02:38+05:30
New upstream version 7.486
- - - - -


14 changed files:

- MPI/pairlocalalign_mpi.c
- core/MSalignmm.c
- core/Salignmm.c
- core/disttbfast.c
- core/functions.h
- core/mafft.tmpl
- core/mltaln.h
- core/mtxutl.c
- core/pairlocalalign.c
- core/pairlocalalignmain.c
- − core/serial.c
- core/tbfast.c
- core/univscript.tmpl
- readme


Changes:

=====================================
MPI/pairlocalalign_mpi.c
=====================================
@@ -72,6 +72,7 @@ typedef struct _thread_arg
 	Lastresx **lastresx;
 	int alloclen;
 	int *targetmap;
+	double **expdist;
 	pthread_mutex_t *mutex_counter;
 	pthread_mutex_t *mutex_stdout;
 } thread_arg_t;
@@ -1973,6 +1974,7 @@ static void *athread( void *arg ) // alg='R', alg='r' -> tsukawarenai.
 	Lastresx **lastresx = targ->lastresx;
 	int alloclen = targ->alloclen;
 	int *targetmap = targ->targetmap;
+	double **expdist = targ->expdist;
 
 //	fprintf( stderr, "thread %d start!\n", thread_no );
 
@@ -2138,7 +2140,10 @@ static void *athread( void *arg ) // alg='R', alg='r' -> tsukawarenai.
 #if 1
 								if( specificityconsideration > 0.0 )
 								{
-									dist = score2dist( pscore, selfscore[i], selfscore[j] );
+									if( expdist )
+										dist = expdist[i][j];	
+									else
+										dist = score2dist( pscore, selfscore[i], selfscore[j] );
 									if( ( scoreoffset = dist2offset( dist ) ) < 0.0 )
 									{
 										makedynamicmtx( dynamicmtx, n_dis_consweight_multi, 0.5 * dist ); // upgma ni awaseru.
@@ -2193,8 +2198,11 @@ static void *athread( void *arg ) // alg='R', alg='r' -> tsukawarenai.
 #if 1
 							if( specificityconsideration > 0.0 )
 							{
-								dist = score2dist( pscore, selfscore[i], selfscore[j] );
-//								dist = score2dist( L__align11_noalign( n_dis_consweight_multi, distseq1, distseq2 ), selfscore[i], selfscore[j] ); // 2014/Feb/20
+								if( expdist )
+									dist = expdist[i][j];	
+								else
+									dist = score2dist( pscore, selfscore[i], selfscore[j] );
+//									dist = score2dist( L__align11_noalign( n_dis_consweight_multi, distseq1, distseq2 ), selfscore[i], selfscore[j] ); // 2014/Feb/20
 								if( dist2offset( dist ) < 0.0 )
 								{
 									makedynamicmtx( dynamicmtx, n_dis_consweight_multi, 0.5 * dist ); // upgma ni awaseru.
@@ -2231,7 +2239,10 @@ static void *athread( void *arg ) // alg='R', alg='r' -> tsukawarenai.
 #if 1
 						if( specificityconsideration > 0.0 )
 						{
-							dist = score2dist( pscore, selfscore[i], selfscore[j] );
+							if( expdist )
+								dist = expdist[i][j];	
+							else
+								dist = score2dist( pscore, selfscore[i], selfscore[j] );
 							if( dist2offset( dist ) < 0.0 )
 							{
 								makedynamicmtx( dynamicmtx, n_dis_consweight_multi, 0.5 * dist ); // upgma ni awaseru.
@@ -2374,7 +2385,7 @@ static void *athread( void *arg ) // alg='R', alg='r' -> tsukawarenai.
 }
 #endif
 
-static void pairalign( char **name, int *nlen, char **seq, char **aseq, char **dseq, int *thereisxineachseq, char **mseq1, char **mseq2, int alloclen, Lastresx **lastresx, double **distancemtx, LocalHom **localhomtable, int ngui )
+static void pairalign( char **name, int *nlen, char **seq, char **aseq, char **dseq, int *thereisxineachseq, char **mseq1, char **mseq2, int alloclen, Lastresx **lastresx, double **distancemtx, LocalHom **localhomtable, double **expdist, int ngui )
 {
 	int i, j, ilim, jst, jj;
 	int off1, off2, dum1, dum2, thereisx;
@@ -2616,6 +2627,7 @@ static void pairalign( char **name, int *nlen, char **seq, char **aseq, char **d
 			targ[i].bpp = bpp; 
 			targ[i].lastresx = lastresx;
 			targ[i].alloclen = alloclen;
+			targ[i].expdist = expdist;
 			targ[i].targetmap = targetmap;
 			targ[i].mutex_counter = &mutex_counter;
 			targ[i].mutex_stdout = &mutex_stdout;
@@ -2724,8 +2736,11 @@ static void pairalign( char **name, int *nlen, char **seq, char **aseq, char **d
 #if 1
 									if( specificityconsideration > 0.0 )
 									{
-										dist = score2dist( pscore, selfscore[i], selfscore[j] );
-//										dist = score2dist( L__align11_noalign( n_dis_consweight_multi, distseq1, distseq2 ), selfscore[i], selfscore[j] ); // 2014/Feb/20
+										if( expdist )
+											dist = expdist[i][j];
+										else
+											dist = score2dist( pscore, selfscore[i], selfscore[j] );
+//											dist = score2dist( L__align11_noalign( n_dis_consweight_multi, distseq1, distseq2 ), selfscore[i], selfscore[j] ); // 2014/Feb/20
 										if( dist2offset( dist ) < 0.0 )
 										{
 											makedynamicmtx( dynamicmtx, n_dis_consweight_multi, 0.5 * dist ); // upgma ni awaseru.
@@ -2762,7 +2777,10 @@ static void pairalign( char **name, int *nlen, char **seq, char **aseq, char **d
 								if( specificityconsideration > 0.0 )
 								{
 //									fprintf( stderr, "dist = %f\n", score2dist( pscore, selfscore[i], selfscore[j] ) );
-									dist = score2dist( pscore, selfscore[i], selfscore[j] );
+									if( expdist )
+										dist = expdist[i][j];
+									else
+										dist = score2dist( pscore, selfscore[i], selfscore[j] );
 									if( dist2offset( dist ) < 0.0 )
 									{
 										makedynamicmtx( dynamicmtx, n_dis_consweight_multi, 0.5 * dist ); // upgma ni awaseru.
@@ -2806,7 +2824,10 @@ static void pairalign( char **name, int *nlen, char **seq, char **aseq, char **d
 #if 1
 										if( specificityconsideration > 0.0 )
 										{
-											dist = score2dist( pscore, selfscore[i], selfscore[j] );
+											if( expdist )
+												dist = expdist[i][j];
+											else
+												dist = score2dist( pscore, selfscore[i], selfscore[j] );
 											if( ( scoreoffset = dist2offset( dist ) ) < 0.0 )
 											{
 												makedynamicmtx( dynamicmtx, n_dis_consweight_multi, 0.5 * dist ); // upgma ni awaseru.
@@ -3059,7 +3080,7 @@ static void pairalign( char **name, int *nlen, char **seq, char **aseq, char **d
 }
 
 
-int pairlocalalign( int ngui, int lgui, char **namegui, char **seqgui, double **distancemtx, LocalHom **localhomtable, int argc, char **argv )
+int pairlocalalign( int ngui, int lgui, char **namegui, char **seqgui, double **distancemtx, LocalHom **localhomtable, int argc, char **argv, double **expdist )
 {
 	int  *nlen, *thereisxineachseq;
 	char **name, **seq;
@@ -3214,7 +3235,7 @@ int pairlocalalign( int ngui, int lgui, char **namegui, char **seqgui, double **
 		thereisxineachseq[i] = removex( dseq[i], bseq[i] );
 	}
 
-	pairalign( name, nlen, bseq, aseq, dseq, thereisxineachseq, mseq1, mseq2, alloclen, lastresx, distancemtx, localhomtable, ngui );
+	pairalign( name, nlen, bseq, aseq, dseq, thereisxineachseq, mseq1, mseq2, alloclen, lastresx, distancemtx, localhomtable, expdist, ngui );
 
 	fprintf( trap_g, "done.\n" );
 #if DEBUG


=====================================
core/MSalignmm.c
=====================================
@@ -2091,9 +2091,10 @@ static void freearrays(
 	free( mgt2 );
 }
 
-double MSalignmm( double **n_dynamicmtx, char **seq1, char **seq2, double *eff1, double *eff2, int icyc, int jcyc, int alloclen, char *sgap1, char *sgap2, char *egap1, char *egap2, int *chudanpt, int chudanref, int *chudanres, int headgp, int tailgp, double **cpmxchild0, double **cpmxchild1, double ***cpmxresult, double orieff1, double orieff2 )
+double MSalignmm( double **n_dynamicmtx, char **seq1, char **seq2, double *eff1, double *eff2, int icyc, int jcyc, int alloclen, char *sgap1, char *sgap2, char *egap1, char *egap2, int *chudanpt, int chudanref, int *chudanres, int headgp, int tailgp, double ***cpmxchild0, double ***cpmxchild1, double ***cpmxresult, double orieff1, double orieff2 )
 /* score no keisan no sai motokaraaru gap no atukai ni mondai ga aru */
 {
+
 //	int k;
 	int i, j;
 	int ll1, ll2;
@@ -2192,14 +2193,14 @@ double MSalignmm( double **n_dynamicmtx, char **seq1, char **seq2, double *eff1,
 		}
 
 
-		if( cpmxchild0 )
+		if( cpmxchild0 && *cpmxchild0 )
 		{
 //			reporterr( "\nUse cpmxhist for child 0!\n" );
-			cpmx1pt = cpmxchild0;
+			cpmx1pt = *cpmxchild0;
 #if ATO
-			gapfreq1pt = cpmxchild0[nalphabets];
-			ogcp1opt = cpmxchild0[nalphabets+1];
-			fgcp1opt = cpmxchild0[nalphabets+2];
+			gapfreq1pt = (*cpmxchild0)[nalphabets];
+			ogcp1opt = (*cpmxchild0)[nalphabets+1];
+			fgcp1opt = (*cpmxchild0)[nalphabets+2];
 #endif
 		}
 		else
@@ -2219,14 +2220,14 @@ double MSalignmm( double **n_dynamicmtx, char **seq1, char **seq2, double *eff1,
 #endif
 		}
 	
-		if( cpmxchild1 )
+		if( cpmxchild1 && *cpmxchild1 )
 		{
 //			reporterr( "\nUse cpmxhist for child 1!\n" );
-			cpmx2pt = cpmxchild1;
+			cpmx2pt = *cpmxchild1;
 #if ATO
-			gapfreq2pt = cpmxchild1[nalphabets];
-			ogcp2opt = cpmxchild1[nalphabets+1];
-			fgcp2opt = cpmxchild1[nalphabets+2];
+			gapfreq2pt = (*cpmxchild1)[nalphabets];
+			ogcp2opt = (*cpmxchild1)[nalphabets+1];
+			fgcp2opt = (*cpmxchild1)[nalphabets+2];
 #endif
 		}
 		else
@@ -2478,15 +2479,17 @@ double MSalignmm( double **n_dynamicmtx, char **seq1, char **seq2, double *eff1,
 #endif
 
 // matomete free
-	if( cpmx1pt != cpmx1 ) 
+	if( cpmx1pt != cpmx1 && cpmxchild0 && *cpmxchild0 ) 
 	{
 //		reporterr( "freeing cpmxchild0\n" );
-		FreeDoubleMtx( cpmxchild0 );
+		FreeDoubleMtx( *cpmxchild0 );
+		*cpmxchild0 = NULL;
 	}
-	if( cpmx2pt != cpmx2 ) 
+	if( cpmx2pt != cpmx2 && cpmxchild1 && *cpmxchild1 ) 
 	{
 //		reporterr( "freeing cpmxchild1\n" );
-		FreeDoubleMtx( cpmxchild1 );
+		FreeDoubleMtx( *cpmxchild1 );
+		*cpmxchild1 = NULL;
 	}
 
 


=====================================
core/Salignmm.c
=====================================
@@ -605,7 +605,7 @@ static void Atracking_localhom( double *impwmpt, double *lasthorizontalw, double
 	}
 }
 
-static void createcpmxresult( double **cpmxresult, int limk, double eff1, double eff2, double **cpmx1, double **cpmx2, char *gaptable1, char *gaptable2, int usehist1, int usehist2 ) // allocate, free ryouhou suru.
+static void createcpmxresult( double **cpmxresult, int limk, double eff1, double eff2, double ***cpmx1, double ***cpmx2, char *gaptable1, char *gaptable2, int usehist1, int usehist2 ) // allocate, free ryouhou suru.
 {
 	int i, j, p;
 	int alen = strlen( gaptable1 );
@@ -623,7 +623,7 @@ static void createcpmxresult( double **cpmxresult, int limk, double eff1, double
 				;
 				//if( amino_n['-'] == i ) cpmxresult[amino_n['-']][j] = eff1; // tsukawanai
 			else
-				cpmxresult[i][j] += cpmx1[i][p++] * eff1;
+				cpmxresult[i][j] += (*cpmx1)[i][p++] * eff1;
 		}
 
 		for( j=0,p=0; j<alen; j++ ) 
@@ -632,16 +632,32 @@ static void createcpmxresult( double **cpmxresult, int limk, double eff1, double
 				;
 				//if( amino_n['-'] == i ) cpmxresult[amino_n['-']][j] = eff2; // tsukawanai
 			else
-				cpmxresult[i][j] += cpmx2[i][p++] * eff2;
+				cpmxresult[i][j] += (*cpmx2)[i][p++] * eff2;
 		}
 
-		if( usehist1 ) free( cpmx1[i] );
-//		cpmx1[i] = NULL;
-		if( usehist2 ) free( cpmx2[i] );
-//		cpmx2[i] = NULL;
+		if( usehist1 ) 
+		{
+			free( (*cpmx1)[i] );
+			(*cpmx1)[i] = NULL;
+		}
+		if( usehist2 ) 
+		{
+			free( (*cpmx2)[i] );
+			(*cpmx2)[i] = NULL;
+		}
 	}
-	if( usehist1 ) free( cpmx1 );
-	if( usehist2 ) free( cpmx2 );
+#if 1
+	if( usehist1 ) 
+	{
+		free( *cpmx1 );
+		*cpmx1 = NULL;
+	}
+	if( usehist2 )
+	{
+		free( *cpmx2 );
+		*cpmx2 = NULL;
+	}
+#endif
 #endif
 }
 
@@ -1067,7 +1083,7 @@ static double Atracking( double *lasthorizontalw, double *lastverticalw,
 	return( wm );
 }
 
-double A__align( double **n_dynamicmtx, int penalty_l, int penalty_ex_l, char **seq1, char **seq2, double *eff1, double *eff2, int icyc, int jcyc, int alloclen, int constraint, double *impmatch, char *sgap1, char *sgap2, char *egap1, char *egap2, int *chudanpt, int chudanref, int *chudanres, int headgp, int tailgp, int firstmem, int calledbyfulltreebase, double **cpmxchild0, double **cpmxchild1, double ***cpmxresult, double orieff1, double orieff2 )
+double A__align( double **n_dynamicmtx, int penalty_l, int penalty_ex_l, char **seq1, char **seq2, double *eff1, double *eff2, int icyc, int jcyc, int alloclen, int constraint, double *impmatch, char *sgap1, char *sgap2, char *egap1, char *egap2, int *chudanpt, int chudanref, int *chudanres, int headgp, int tailgp, int firstmem, int calledbyfulltreebase, double ***cpmxchild0, double ***cpmxchild1, double ***cpmxresult, double orieff1, double orieff2 )
 /* score no keisan no sai motokaraaru gap no atukai ni mondai ga aru */
 {
 
@@ -1112,9 +1128,9 @@ double A__align( double **n_dynamicmtx, int penalty_l, int penalty_ex_l, char **
 	static TLS double *fgcp2, *fgcp2o;
 	double *ogcp1opt, *ogcp2opt, *fgcp1opt, *fgcp2opt;
 	static TLS double **cpmx1;
-	double **cpmx1pt;
+	double ***cpmx1pt = NULL;
 	static TLS double **cpmx2;
-	double **cpmx2pt;
+	double ***cpmx2pt = NULL;
 	static TLS int **intwork;
 	static TLS double **doublework;
 	static TLS int orlgth1 = 0, orlgth2 = 0;
@@ -1461,19 +1477,19 @@ double A__align( double **n_dynamicmtx, int penalty_l, int penalty_ex_l, char **
 		}
 
 
-		if( cpmxchild0 )
+		if( cpmxchild0 && *cpmxchild0 )
 		{
 //			reporterr( "\nUse cpmxhist for child 0!\n" );
-			cpmx1pt = cpmxchild0;
-			gapfreq1pt = cpmxchild0[nalphabets];
-			ogcp1opt = cpmxchild0[nalphabets+1];
-			fgcp1opt = cpmxchild0[nalphabets+2];
+			cpmx1pt = (cpmxchild0);
+			gapfreq1pt = (*cpmxchild0)[nalphabets];
+			ogcp1opt = (*cpmxchild0)[nalphabets+1];
+			fgcp1opt = (*cpmxchild0)[nalphabets+2];
 		}
 		else
 		{
 //			reporterr( "\nDo not use cpmxhist for child 0!\n" );
-			cpmx1pt = cpmx1;
-			cpmx_calc_new( seq1, cpmx1pt, eff1, lgth1, icyc );
+			cpmx1pt = &cpmx1;
+			cpmx_calc_new( seq1, *cpmx1pt, eff1, lgth1, icyc );
 
 			gapfreq1pt = gapfreq1;
 			gapcountf( gapfreq1pt, seq1, icyc, eff1, lgth1 );
@@ -1485,19 +1501,19 @@ double A__align( double **n_dynamicmtx, int penalty_l, int penalty_ex_l, char **
 			st_FinalGapCount( fgcp1opt, icyc, seq1, eff1, lgth1 );
 		}
 	
-		if( cpmxchild1 )
+		if( cpmxchild1 && *cpmxchild1 )
 		{
 //			reporterr( "\nUse cpmxhist for child 1!\n" );
-			cpmx2pt = cpmxchild1;
-			gapfreq2pt = cpmxchild1[nalphabets];
-			ogcp2opt = cpmxchild1[nalphabets+1];
-			fgcp2opt = cpmxchild1[nalphabets+2];
+			cpmx2pt = (cpmxchild1);
+			gapfreq2pt = (*cpmxchild1)[nalphabets];
+			ogcp2opt = (*cpmxchild1)[nalphabets+1];
+			fgcp2opt = (*cpmxchild1)[nalphabets+2];
 		}
 		else
 		{
 //			reporterr( "\nDo not use cpmxhist for child 1!\n" );
-			cpmx2pt = cpmx2;
-			cpmx_calc_new( seq2, cpmx2pt, eff2, lgth2, jcyc );
+			cpmx2pt = &cpmx2;
+			cpmx_calc_new( seq2, *cpmx2pt, eff2, lgth2, jcyc );
 
 			gapfreq2pt = gapfreq2;
 			gapcountf( gapfreq2pt, seq2, jcyc, eff2, lgth2 );
@@ -1518,8 +1534,8 @@ double A__align( double **n_dynamicmtx, int penalty_l, int penalty_ex_l, char **
 	}
 	else
 	{
-		cpmx1pt = cpmx1;
-		cpmx2pt = cpmx2;
+		cpmx1pt = &cpmx1;
+		cpmx2pt = &cpmx2;
 		gapfreq1pt = gapfreq1;
 		gapfreq2pt = gapfreq2;
 		ogcp1opt = ogcp1o;
@@ -1530,14 +1546,14 @@ double A__align( double **n_dynamicmtx, int penalty_l, int penalty_ex_l, char **
 		if( reuseprofiles )
 		{
 //			reporterr( "reuse" );
-			cpmx_calc_add( seq1, cpmx1pt, eff1, lgth1, icyc );
+			cpmx_calc_add( seq1, *cpmx1pt, eff1, lgth1, icyc );
 		}
 		else
 		{
 //			reporterr( "new profile" );
-			cpmx_calc_new( seq1, cpmx1pt, eff1, lgth1, icyc );
+			cpmx_calc_new( seq1, *cpmx1pt, eff1, lgth1, icyc );
 		}
-		cpmx_calc_new( seq2, cpmx2pt, eff2, lgth2, jcyc );
+		cpmx_calc_new( seq2, *cpmx2pt, eff2, lgth2, jcyc );
 
 		if( sgap1 )
 		{
@@ -1614,7 +1630,7 @@ double A__align( double **n_dynamicmtx, int penalty_l, int penalty_ex_l, char **
 	{
 		reporterr( "%3d ", i );
 		for( j=0; j<nalphabets; j++ ) 
-			reporterr( "%4.2f ", cpmx1pt[j][i] );
+			reporterr( "%4.2f ", (*cpmx1pt)[j][i] );
 		reporterr( "\n" );
 	}
 #endif
@@ -1628,7 +1644,7 @@ double A__align( double **n_dynamicmtx, int penalty_l, int penalty_ex_l, char **
 	{
 		reporterr( "%3d ", i );
 		for( j=0; j<nalphabets; j++ ) 
-			reporterr( "%4.2f ", cpmx2pt[j][i] );
+			reporterr( "%4.2f ", (*cpmx2pt)[j][i] );
 		reporterr( "\n" );
 	}
 	reporterr( "\ngapfreq1 = " );
@@ -1681,11 +1697,11 @@ double A__align( double **n_dynamicmtx, int penalty_l, int penalty_ex_l, char **
 	currentw = w1;
 	previousw = w2;
 
-	match_calc( n_dynamicmtx, initverticalw, cpmx2pt, cpmx1pt, 0, lgth1, doublework, intwork, 1 );
+	match_calc( n_dynamicmtx, initverticalw, *cpmx2pt, *cpmx1pt, 0, lgth1, doublework, intwork, 1 );
 	if( constraint )
 		imp_match_out_vead_tate( initverticalw, 0, lgth1 ); // 060306
 
-	match_calc( n_dynamicmtx, currentw, cpmx1pt, cpmx2pt, 0, lgth2, doublework, intwork, 1 );
+	match_calc( n_dynamicmtx, currentw, *cpmx1pt, *cpmx2pt, 0, lgth2, doublework, intwork, 1 );
 	if( constraint )
 		imp_match_out_vead( currentw, 0, lgth2 ); // 060306
 #if 0 // -> tbfast.c // impossible
@@ -1810,7 +1826,7 @@ for( i=0; i<lgth2; i++ )
 
 		previousw[0] = initverticalw[i-1];
 
-		match_calc( n_dynamicmtx, currentw, cpmx1pt, cpmx2pt, i, lgth2, doublework, intwork, 0 );
+		match_calc( n_dynamicmtx, currentw, *cpmx1pt, *cpmx2pt, i, lgth2, doublework, intwork, 0 );
 #if XXXXXXX
 fprintf( stderr, "\n" );
 fprintf( stderr, "i=%d\n", i );
@@ -2092,18 +2108,18 @@ fprintf( stderr, "\n" );
 #endif
 	
 			*cpmxresult = AllocateDoubleMtx( nalphabets+3, 0 ); // gapcount, opg, fng no bun
-			createcpmxresult( *cpmxresult, limk, totaleff1, totaleff2, cpmx1pt, cpmx2pt, gt1, gt2, (cpmx1!=cpmx1pt), (cpmx2!=cpmx2pt) ); // naka de free
+			createcpmxresult( *cpmxresult, limk, totaleff1, totaleff2, cpmx1pt, cpmx2pt, gt1, gt2, (cpmx1!=*cpmx1pt), (cpmx2!=*cpmx2pt) ); // naka de free
 			creategapfreqresult( *cpmxresult+nalphabets, limk, totaleff1, totaleff2, gapfreq1pt, gapfreq2pt, gt1, gt2 ); // naka deha free shinai
 			// gapfreq1, gapfreq2 ha mada tsukau
 			createogresult( *cpmxresult+nalphabets+1, limk, totaleff1, totaleff2, ogcp1opt, ogcp2opt, gapfreq1pt, gapfreq2pt, gt1, gt2 ); // naka deha free shinai
-			if( cpmx1!=cpmx1pt ) free( ogcp1opt );
-			if( cpmx2!=cpmx2pt ) free( ogcp2opt );
+			if( cpmx1!=*cpmx1pt ) free( ogcp1opt );
+			if( cpmx2!=*cpmx2pt ) free( ogcp2opt );
 			createfgresult( *cpmxresult+nalphabets+2, limk, totaleff1, totaleff2, fgcp1opt, fgcp2opt, gapfreq1pt, gapfreq2pt, gt1, gt2 ); // naka deha free shinai
-			if( cpmx1!=cpmx1pt ) free( fgcp1opt );
-			if( cpmx2!=cpmx2pt ) free( fgcp2opt );
+			if( cpmx1!=*cpmx1pt ) free( fgcp1opt );
+			if( cpmx2!=*cpmx2pt ) free( fgcp2opt );
 
-			if( cpmx1!=cpmx1pt ) free( gapfreq1pt );
-			if( cpmx2!=cpmx2pt ) free( gapfreq2pt );
+			if( cpmx1!=*cpmx1pt ) free( gapfreq1pt );
+			if( cpmx2!=*cpmx2pt ) free( gapfreq2pt );
 #if 0
 			reporterr( "\n" );
 			for( j=0; j<nalphabets; j++ ) 
@@ -2124,16 +2140,24 @@ fprintf( stderr, "\n" );
 
 	free( gt1bk );
 	free( gt2bk );
-#if 0
-	if( cpmx1pt != cpmx1 ) 
+#if 0 // 2021/Jun/24
+	if( *cpmx1pt != cpmx1 ) 
 	{
-//		reporterr( "freeing cpmxchild0\n" );
-		FreeDoubleMtx( cpmxchild0 );
+		if( cpmxchild0 && *cpmxchild0 )
+		{
+			reporterr( "freeing *cpmxchild0\n" );
+			FreeDoubleMtx( *cpmxchild0 );
+			*cpmxchild0 = NULL;
+		}
 	}
-	if( cpmx2pt != cpmx2 ) 
+	if( *cpmx2pt != cpmx2 ) 
 	{
-//		reporterr( "freeing cpmxchild1\n" );
-		FreeDoubleMtx( cpmxchild1 );
+		if( cpmxchild1 && *cpmxchild1 )
+		{
+			reporterr( "freeing *cpmxchild1\n" );
+			FreeDoubleMtx( *cpmxchild1 );
+			*cpmxchild1 = NULL;
+		}
 	}
 #endif
 


=====================================
core/disttbfast.c
=====================================
@@ -1927,7 +1927,7 @@ static void *treebasethread( void *arg )
 	int ssi, ssm, bunbo;
 	int tm, ti;
 	int **localmem = NULL;
-	double **cpmxchild0, **cpmxchild1;
+	double ***cpmxchild0, ***cpmxchild1;
 	double orieff1, orieff2;
 	ExtAnch *pairanch = NULL;
 #if SKIP
@@ -2078,8 +2078,8 @@ static void *treebasethread( void *arg )
 
 
 //		reporterr( "l=%d, dep[l].child0=%d, dep[l].child1=%d\n", l, dep[l].child0, dep[l].child1 );
-		if( dep[l].child0 == -1 ) cpmxchild0 = NULL; else cpmxchild0 = cpmxhist[dep[l].child0];
-		if( dep[l].child1 == -1 ) cpmxchild1 = NULL; else cpmxchild1 = cpmxhist[dep[l].child1];
+		if( dep[l].child0 == -1 ) cpmxchild0 = NULL; else cpmxchild0 = cpmxhist+dep[l].child0;
+		if( dep[l].child1 == -1 ) cpmxchild1 = NULL; else cpmxchild1 = cpmxhist+dep[l].child1;
 //		reporterr( "cpmxchild0=%p, cpmxchild1=%p\n", cpmxchild0, cpmxchild1 );
 
 
@@ -2259,7 +2259,7 @@ static void *treebasethread( void *arg )
 					break;
 				case( 'M' ):
 					if( l < 500 || l % 100 == 0 ) reporterr(       "m" );
-					if( l < 500 || l % 100 == 0 ) if( cpmxchild1 || cpmxchild0 ) reporterr(       " h" );
+					if( l < 500 || l % 100 == 0 ) if( ( cpmxchild1 && *cpmxchild1 ) || ( cpmxchild0 && *cpmxchild0 ) ) reporterr(       " h" );
 //					reporterr(       "%d-%d", clus1, clus2 );
 					pscore = MSalignmm( dynamicmtx, mseq1, mseq2, effarr1, effarr2, clus1, clus2, *alloclen, NULL, NULL, NULL, NULL, NULL, 0, NULL, outgap, outgap, cpmxchild0, cpmxchild1, cpmxhist+l, orieff1, orieff2 );
 					break;
@@ -2284,7 +2284,7 @@ static void *treebasethread( void *arg )
 					else
 					{
 //						reporterr(       "%d-%d", clus1, clus2 );
-						if( l < 500 || l % 100 == 0 ) if( cpmxchild1 || cpmxchild0 ) reporterr(       " h" );
+						if( l < 500 || l % 100 == 0 ) if( ( cpmxchild1 && *cpmxchild1 ) || ( cpmxchild0 && *cpmxchild0 ) ) reporterr(       " h" );
 						pscore = A__align( dynamicmtx, penalty, penalty_ex, mseq1, mseq2, effarr1, effarr2, clus1, clus2, *alloclen, 0, &dumdb, NULL, NULL, NULL, NULL, NULL, 0, NULL, outgap, outgap, -1, -1, cpmxchild0, cpmxchild1, cpmxhist+l, orieff1, orieff2 );
 					}
 					break;
@@ -2420,7 +2420,7 @@ static int dooneiteration( int *nlen, char **aseq, int nadd, char *mergeoralign,
 	int *alreadyaligned = NULL;
 	double **dynamicmtx = NULL;
 	int **localmem = NULL;
-	double **cpmxchild0, **cpmxchild1;
+	double ***cpmxchild0, ***cpmxchild1;
 	double orieff1, orieff2;
 	double oscore, nscore;
 	ExtAnch *pairanch;
@@ -2606,7 +2606,7 @@ static int dooneiteration( int *nlen, char **aseq, int nadd, char *mergeoralign,
 					break;
 				case( 'M' ):
 					if( l < 500 || l % 100 == 0 ) reporterr(       "m" );
-					if( l < 500 || l % 100 == 0 ) if( cpmxchild1 || cpmxchild0 ) reporterr(       " h" );
+					if( l < 500 || l % 100 == 0 ) if( ( cpmxchild1 && *cpmxchild1 ) || ( cpmxchild0 && *cpmxchild0 ) ) reporterr(       " h" );
 //					reporterr(       "%d-%d", clus1, clus2 );
 					pscore = MSalignmm( dynamicmtx, mseq1, mseq2, effarr1, effarr2, clus1, clus2, *alloclen, NULL, NULL, NULL, NULL, NULL, 0, NULL, outgap, outgap, cpmxchild0, cpmxchild1, cpmxhist+l, orieff1, orieff2 );
 					break;
@@ -2630,7 +2630,7 @@ static int dooneiteration( int *nlen, char **aseq, int nadd, char *mergeoralign,
 					}
 					else
 					{
-						if( l < 500 || l % 100 == 0 ) if( cpmxchild1 || cpmxchild0 ) reporterr(       " h" );
+						if( l < 500 || l % 100 == 0 ) if( ( cpmxchild1 && *cpmxchild1 ) || ( cpmxchild0 && *cpmxchild0 ) ) reporterr(       " h" );
 //						reporterr(       "\n\n %d - %d (%d x %d) : \n", topol[l][0][0], topol[l][1][0], clus1, clus2 );
 						pscore = A__align( dynamicmtx, penalty, penalty_ex, mseq1, mseq2, effarr1, effarr2, clus1, clus2, *alloclen, 0, &dumdb, NULL, NULL, NULL, NULL, NULL, 0, NULL, outgap, outgap, localmem[0][0], 1, cpmxchild0, cpmxchild1, cpmxhist+l, orieff1, orieff2 );
 					}
@@ -2748,7 +2748,7 @@ static int treebase( int *nlen, char **aseq, int nadd, char *mergeoralign, char
 	int tm, ti;
 	int gapmaplen;
 	int **localmem = NULL;
-	double **cpmxchild0, **cpmxchild1;
+	double ***cpmxchild0, ***cpmxchild1;
 	double orieff1, orieff2;
 	ExtAnch *pairanch;
 #if SKIP
@@ -2808,8 +2808,8 @@ static int treebase( int *nlen, char **aseq, int nadd, char *mergeoralign, char
 //		reporterr( " at the beginning of the loop, clus1,clus2=%d,%d\n", clus1, clus2 );
 
 //		reporterr( "l=%d, dep[l].child0=%d, dep[l].child1=%d\n", l, dep[l].child0, dep[l].child1 );
-		if( dep[l].child0 == -1 ) cpmxchild0 = NULL; else cpmxchild0 = cpmxhist[dep[l].child0];
-		if( dep[l].child1 == -1 ) cpmxchild1 = NULL; else cpmxchild1 = cpmxhist[dep[l].child1];
+		if( dep[l].child0 == -1 ) cpmxchild0 = NULL; else cpmxchild0 = cpmxhist+dep[l].child0;
+		if( dep[l].child1 == -1 ) cpmxchild1 = NULL; else cpmxchild1 = cpmxhist+dep[l].child1;
 //		reporterr( "cpmxchild0=%p, cpmxchild1=%p\n", cpmxchild0, cpmxchild1 );
 
 #if 0
@@ -3075,7 +3075,7 @@ static int treebase( int *nlen, char **aseq, int nadd, char *mergeoralign, char
 					break;
 				case( 'M' ):
 					if( l < 500 || l % 100 == 0 ) reporterr(       "m" );
-					if( l < 500 || l % 100 == 0 ) if( cpmxchild1 || cpmxchild0 ) reporterr(       " h" );
+					if( l < 500 || l % 100 == 0 ) if( ( cpmxchild1 && *cpmxchild1 ) || ( cpmxchild0 && *cpmxchild0 ) ) reporterr(       " h" );
 //					reporterr(       "%d-%d", clus1, clus2 );
 					pscore = MSalignmm( dynamicmtx, mseq1, mseq2, effarr1, effarr2, clus1, clus2, *alloclen, NULL, NULL, NULL, NULL, NULL, 0, NULL, outgap, outgap, cpmxchild0, cpmxchild1, cpmxhist+l, orieff1, orieff2 );
 					break;
@@ -3099,7 +3099,7 @@ static int treebase( int *nlen, char **aseq, int nadd, char *mergeoralign, char
 					}
 					else
 					{
-						if( l < 500 || l % 100 == 0 ) if( cpmxchild1 || cpmxchild0 ) reporterr(       " h" );
+						if( l < 500 || l % 100 == 0 ) if( ( cpmxchild1 && *cpmxchild1 ) || ( cpmxchild0 && *cpmxchild0 ) ) reporterr(       " h" );
 //						reporterr(       "\n\n %d - %d (%d x %d) : \n", topol[l][0][0], topol[l][1][0], clus1, clus2 );
 						pscore = A__align( dynamicmtx, penalty, penalty_ex, mseq1, mseq2, effarr1, effarr2, clus1, clus2, *alloclen, 0, &dumdb, NULL, NULL, NULL, NULL, NULL, 0, NULL, outgap, outgap, localmem[0][0], 1, cpmxchild0, cpmxchild1, cpmxhist+l, orieff1, orieff2 );
 					}
@@ -4766,12 +4766,27 @@ int disttbfast( int ngui, int lgui, char **namegui, char **seqgui, int argc, cha
 //		free( topol[njob-1] ); topol[njob-1]=NULL;
 //		free( topol ); topol=NULL;
 		FreeIntCub( topol ); topol = NULL;
+#if 1 // 2021/Jun/24
+		if( cpmxhist ) // nakutemo yoi
+		{
+			for( i=0; i<njob-1; i++ )
+			{
+				if( cpmxhist[i] ) 
+				{
+//					reporterr( "freeing cpmxhist[%d]\n", i );
+					FreeDoubleMtx( cpmxhist[i] ); cpmxhist[i] = NULL;
+				}
+			}
+			free( cpmxhist ); cpmxhist = NULL;
+		}
+#else
 		if( cpmxhist[njob-2] ) 
 		{
 //			reporterr( "freeing cpmxhist[njob-2]\n" );
 			FreeDoubleMtx( cpmxhist[njob-2] ); cpmxhist[njob-2] = NULL;
 		}
 		free( cpmxhist ); cpmxhist = NULL;
+#endif
 
 		free( memhist ); memhist = NULL;
 //		reporterr( "after freeing topol, " );


=====================================
core/functions.h
=====================================
@@ -141,13 +141,13 @@ extern void blockAlign2( int *cut1, int *cut2, Segment **seg1, Segment **seg2, d
 extern void blockAlign3( int *cut1, int *cut2, Segment **seg1, Segment **seg2, double **ocrossscore, int *ncut );
 extern double imp_match_out_scD( int i1, int j1 );
 extern void imp_match_init_strictD( double *imp, int clus1, int clus2, int lgth1, int lgth2, char **seq1, char **seq2, double *eff1, double *eff2, double *eff1kozo, double*eff2kozo, LocalHom ***localhom, char *swaplist, int forscore, int *memlist1, int *memlist2, int *uselh, int *seedinlh1, int *seedinlh2, int nodeid, int nfiles );
-extern double MSalignmm( double **n_dynamicmtx, char **seq1, char **seq2, double *eff1, double *eff2, int icyc, int jcyc, int alloclen, char *, char *, char *, char *, int *, int, int *, int headgp, int tailgp, double **cpmxchild0, double **cpmxchild1, double ***cpmxresult, double orieff1, double orieff2 );
+extern double MSalignmm( double **n_dynamicmtx, char **seq1, char **seq2, double *eff1, double *eff2, int icyc, int jcyc, int alloclen, char *, char *, char *, char *, int *, int, int *, int headgp, int tailgp, double ***cpmxchild0, double ***cpmxchild1, double ***cpmxresult, double orieff1, double orieff2 );
 extern double MSalignmm_variousdist( double **pairoffset, double ***matrices, double **dummtx, char **seq1, char **seq2, double *eff1, double *eff2, double **eff1s, double **eff2s, int icyc, int jcyc, int alloclen, char *, char *, char *, char *, int *, int, int *, int headgp, int tailgp );
 extern double Lalignmm_hmout( char **seq1, char **seq2, double *eff1, double *eff2, int icyc, int jcyc, int alloclen, char *, char *, char *, char *, double **map );
 extern double Lalign2m2m_hmout( char **seq1, char **seq2, char **seq1r, char **seq2r, char *dir1, char *dir2, double *eff1, double *eff2, int icyc, int jcyc, int alloclen, char *, char *, char *, char *, double **map );
 extern double MSalign11( char **seq1, char **seq2, int alloclen );
 //extern double rnalocal( char **seq1, char **seq2, double *eff1, double *eff2, int icyc, int jcyc, int alloclen, RNApair **pair );
-extern double A__align( double **scoringmtx, int penalty, int penalty_ex, char **seq1, char **seq2, double *eff1, double *eff2, int icyc, int jcyc, int alloclen, int constraint, double *impmatch, char *gs1, char *gs2, char *ge1, char *ge2, int *, int, int *, int headgp, int tailgp, int firstmem, int calledby, double **cpmxchild0, double **cpmxchild1, double ***cpmxresult, double orieff1, double orieff2 );
+extern double A__align( double **scoringmtx, int penalty, int penalty_ex, char **seq1, char **seq2, double *eff1, double *eff2, int icyc, int jcyc, int alloclen, int constraint, double *impmatch, char *gs1, char *gs2, char *ge1, char *ge2, int *, int, int *, int headgp, int tailgp, int firstmem, int calledby, double ***cpmxchild0, double ***cpmxchild1, double ***cpmxresult, double orieff1, double orieff2 );
 extern double A__align_variousdist( int **which, double ***scoringmatrices, double **dummtx, int penalty, int penalty_ex, char **seq1, char **seq2, double *eff1, double *eff2, double **eff1s, double **eff2s, int icyc, int jcyc, int alloclen, int constraint, double *impmatch, char *gs1, char *gs2, char *ge1, char *ge2, int *, int, int *, int headgp, int tailgp );
 extern double A__align_gapmap( char **seq1, char **seq2, double *eff1, double *eff2, int icyc, int jcyc, int alloclen, int constraint, double *impmatch, int *gapmap1, int *gapmap2 );
 extern double translate_and_Calign( char **mseq1, char **mseq2, double *effarr1, double *effarr2, int clus1, int clus2, int alloclen );
@@ -408,7 +408,7 @@ extern double distcompact( int len1, int len2, int *table1, int *point2, int ss1
 extern double distcompact_msa( char *seq1, char *seq2, int *skiptable1, int *skiptable2, int ss1, int ss2 );
 extern void fillimp( double **impmtx, double *imp, int clus1, int clus2, int lgth1, int lgth2, char **seq1, char **seq2, double *eff1, double *eff2, double *eff1_kozo, double *eff2_kozo, LocalHom ***localhom, char *swaplist, int forscore, int *orinum1, int *orinum2 );
 extern void fillimp_file( double **impmtx, double *imp, int clus1, int clus2, int lgth1, int lgth2, char **seq1, char **seq2, double *eff1, double *eff2, double *eff1_kozo, double *eff2_kozo, LocalHom ***localhom, char *swaplist, int forscore, int *orinum1, int *orinum2, int *uselh, int *seedinlh1, int *seedinlh2, int nodeid, int nfiles );
-extern int pairlocalalign( int ngui, int lgui, char **namegui, char **seqgui, double **distancemtx, LocalHom **localhomtable, int argc, char **argv );
+extern int pairlocalalign( int ngui, int lgui, char **namegui, char **seqgui, double **distancemtx, LocalHom **localhomtable, int argc, char **argv, double **expdist );
 extern char creverse( char f );
 #ifndef mingw
 extern void setstacksize( rlim_t );


=====================================
core/mafft.tmpl
=====================================
@@ -1,7 +1,7 @@
 #! /bin/bash 
 er=0;
 myself=`dirname "$0"`/`basename "$0"`; export myself
-version="v7.481 (2021/May/26)"; export version
+version="v7.486 (2021/Jul/19)"; export version
 LANG=C; export LANG
 os=`uname`
 progname=`basename "$0"`
@@ -294,6 +294,7 @@ enrich=0        # ato de kezuru
 enrichseq=0     # ato de kezuru
 enrichstr=0     # ato de kezuru
 seektarget=""   # ato de kezuru
+dashserver="https://sysimm.org/dash/REST1.0/"
 newdash=0
 newdash_originalsequenceonly=0
 exclude_ho=0
@@ -952,6 +953,9 @@ if [ $# -gt 0 ]; then
 			newdash=1
 			distance="global" # can be override
 			iterate=3         # can be override
+		elif [ "$1" = "--dashserver" ]; then
+			shift
+			dashserver="$1"
 		elif [ "$1" = "--originalseqonly" ]; then
 			newdash_originalsequenceonly=1
 		elif [ "$1" = "--excludehomologs" ]; then # works with --dash only
@@ -2369,7 +2373,7 @@ $ownlist"
 			fi
 			
 			echo "Calling DASH (https://sysimm.org/dash/)" 1>>"$progressfile"
-			"$prefix/dash_client" -i dashin -sequences dashsequences -hat3 hat3.seed 1>>"$progressfile"
+			"$prefix/dash_client" -url "$dashserver" -i dashin -sequences dashsequences -hat3 hat3.seed 1>>"$progressfile"
 			dashres="$?"
 			if [ $dashres -ne "0" ]; then
 				echo "Error in DASH" 1>>"$progressfile"


=====================================
core/mltaln.h
=====================================
@@ -36,7 +36,7 @@
 
 
 
-#define VERSION "7.481"
+#define VERSION "7.486"
 #define SHOWVERSION reporterr( "%s (%s) Version " VERSION "\nalg=%c, model=%s, amax=%3.1f\n%d thread(s)\n\n", progName( argv[0] ), (dorp=='d')?"nuc":((nblosum==-2)?"text":"aa"), alg, modelname, specificityconsideration, nthread )
 
 #define FFT_THRESHOLD  80


=====================================
core/mtxutl.c
=====================================
@@ -520,7 +520,10 @@ void FreeDoubleMtx( double **mtx )
 {
 	int i;
 	for( i=0; mtx[i]; i++ )
+	{
 		FreeDoubleVec( mtx[i] );
+		mtx[i] = NULL;
+	}
 	free( mtx );
 }
 


=====================================
core/pairlocalalign.c
=====================================
@@ -71,6 +71,7 @@ typedef struct _thread_arg
 	Lastresx **lastresx;
 	int alloclen;
 	int *targetmap;
+	double **expdist;
 	pthread_mutex_t *mutex_counter;
 	pthread_mutex_t *mutex_stdout;
 } thread_arg_t;
@@ -1972,6 +1973,7 @@ static void *athread( void *arg ) // alg='R', alg='r' -> tsukawarenai.
 	Lastresx **lastresx = targ->lastresx;
 	int alloclen = targ->alloclen;
 	int *targetmap = targ->targetmap;
+	double **expdist = targ->expdist;
 
 //	fprintf( stderr, "thread %d start!\n", thread_no );
 
@@ -2137,7 +2139,10 @@ static void *athread( void *arg ) // alg='R', alg='r' -> tsukawarenai.
 #if 1
 								if( specificityconsideration > 0.0 )
 								{
-									dist = score2dist( pscore, selfscore[i], selfscore[j] );
+									if( expdist ) 
+										dist = expdist[i][j];
+									else
+										dist = score2dist( pscore, selfscore[i], selfscore[j] );
 									if( ( scoreoffset = dist2offset( dist ) ) < 0.0 )
 									{
 										makedynamicmtx( dynamicmtx, n_dis_consweight_multi, 0.5 * dist ); // upgma ni awaseru.
@@ -2192,8 +2197,11 @@ static void *athread( void *arg ) // alg='R', alg='r' -> tsukawarenai.
 #if 1
 							if( specificityconsideration > 0.0 )
 							{
-								dist = score2dist( pscore, selfscore[i], selfscore[j] );
-//								dist = score2dist( L__align11_noalign( n_dis_consweight_multi, distseq1, distseq2 ), selfscore[i], selfscore[j] ); // 2014/Feb/20
+								if( expdist ) 
+									dist = expdist[i][j];
+								else
+									dist = score2dist( pscore, selfscore[i], selfscore[j] );
+//									dist = score2dist( L__align11_noalign( n_dis_consweight_multi, distseq1, distseq2 ), selfscore[i], selfscore[j] ); // 2014/Feb/20
 								if( dist2offset( dist ) < 0.0 )
 								{
 									makedynamicmtx( dynamicmtx, n_dis_consweight_multi, 0.5 * dist ); // upgma ni awaseru.
@@ -2204,6 +2212,7 @@ static void *athread( void *arg ) // alg='R', alg='r' -> tsukawarenai.
 								}
 //								pscore = (double)naivepairscore11( *mseq1, *mseq2, 0.0 );
 							}
+//
 #endif
 						}
 						else
@@ -2230,7 +2239,10 @@ static void *athread( void *arg ) // alg='R', alg='r' -> tsukawarenai.
 #if 1
 						if( specificityconsideration > 0.0 )
 						{
-							dist = score2dist( pscore, selfscore[i], selfscore[j] );
+							if( expdist ) 
+								dist = expdist[i][j];
+							else
+								dist = score2dist( pscore, selfscore[i], selfscore[j] );
 							if( dist2offset( dist ) < 0.0 )
 							{
 								makedynamicmtx( dynamicmtx, n_dis_consweight_multi, 0.5 * dist ); // upgma ni awaseru.
@@ -2373,7 +2385,7 @@ static void *athread( void *arg ) // alg='R', alg='r' -> tsukawarenai.
 }
 #endif
 
-static void pairalign( char **name, int *nlen, char **seq, char **aseq, char **dseq, int *thereisxineachseq, char **mseq1, char **mseq2, int alloclen, Lastresx **lastresx, double **distancemtx, LocalHom **localhomtable, int ngui )
+static void pairalign( char **name, int *nlen, char **seq, char **aseq, char **dseq, int *thereisxineachseq, char **mseq1, char **mseq2, int alloclen, Lastresx **lastresx, double **distancemtx, LocalHom **localhomtable, double **expdist, int ngui )
 {
 	int i, j, ilim, jst, jj;
 	int off1, off2, dum1, dum2, thereisx;
@@ -2616,6 +2628,7 @@ static void pairalign( char **name, int *nlen, char **seq, char **aseq, char **d
 			targ[i].bpp = bpp; 
 			targ[i].lastresx = lastresx;
 			targ[i].alloclen = alloclen;
+			targ[i].expdist = expdist;
 			targ[i].targetmap = targetmap;
 			targ[i].mutex_counter = &mutex_counter;
 			targ[i].mutex_stdout = &mutex_stdout;
@@ -2724,8 +2737,12 @@ static void pairalign( char **name, int *nlen, char **seq, char **aseq, char **d
 #if 1
 									if( specificityconsideration > 0.0 )
 									{
-										dist = score2dist( pscore, selfscore[i], selfscore[j] );
+										if( expdist ) 
+											dist = expdist[i][j];
+										else
+											dist = score2dist( pscore, selfscore[i], selfscore[j] );
 //										dist = score2dist( L__align11_noalign( n_dis_consweight_multi, distseq1, distseq2 ), selfscore[i], selfscore[j] ); // 2014/Feb/20
+//										reporterr( "dist(%d,%d)=%f\n", i, j, dist );
 										if( dist2offset( dist ) < 0.0 )
 										{
 											makedynamicmtx( dynamicmtx, n_dis_consweight_multi, 0.5 * dist ); // upgma ni awaseru.
@@ -2762,7 +2779,10 @@ static void pairalign( char **name, int *nlen, char **seq, char **aseq, char **d
 								if( specificityconsideration > 0.0 )
 								{
 //									fprintf( stderr, "dist = %f\n", score2dist( pscore, selfscore[i], selfscore[j] ) );
-									dist = score2dist( pscore, selfscore[i], selfscore[j] );
+									if( expdist ) 
+										dist = expdist[i][j];
+									else
+										dist = score2dist( pscore, selfscore[i], selfscore[j] );
 									if( dist2offset( dist ) < 0.0 )
 									{
 										makedynamicmtx( dynamicmtx, n_dis_consweight_multi, 0.5 * dist ); // upgma ni awaseru.
@@ -2806,7 +2826,10 @@ static void pairalign( char **name, int *nlen, char **seq, char **aseq, char **d
 #if 1
 										if( specificityconsideration > 0.0 )
 										{
-											dist = score2dist( pscore, selfscore[i], selfscore[j] );
+											if( expdist ) 
+												dist = expdist[i][j];
+											else
+												dist = score2dist( pscore, selfscore[i], selfscore[j] );
 											if( ( scoreoffset = dist2offset( dist ) ) < 0.0 )
 											{
 												makedynamicmtx( dynamicmtx, n_dis_consweight_multi, 0.5 * dist ); // upgma ni awaseru.
@@ -3065,7 +3088,7 @@ static void pairalign( char **name, int *nlen, char **seq, char **aseq, char **d
 }
 
 
-int pairlocalalign( int ngui, int lgui, char **namegui, char **seqgui, double **distancemtx, LocalHom **localhomtable, int argc, char **argv )
+int pairlocalalign( int ngui, int lgui, char **namegui, char **seqgui, double **distancemtx, LocalHom **localhomtable, int argc, char **argv, double **expdist )
 {
 	int  *nlen, *thereisxineachseq;
 	char **name, **seq;
@@ -3211,8 +3234,7 @@ int pairlocalalign( int ngui, int lgui, char **namegui, char **seqgui, double **
 
 //	writePre( njob, name, nlen, seq, 0 );
 
-
-
+	//reporterr( "expdist=%p\n", expdist );
 
 	if( dorp == 'p' && scoremtx == 1 && nblosum > 0 ) // protein, not text.  hitsuyou?
 	{
@@ -3232,7 +3254,7 @@ int pairlocalalign( int ngui, int lgui, char **namegui, char **seqgui, double **
 		}
 	}
 
-	pairalign( name, nlen, bseq, aseq, dseq, thereisxineachseq, mseq1, mseq2, alloclen, lastresx, distancemtx, localhomtable, ngui );
+	pairalign( name, nlen, bseq, aseq, dseq, thereisxineachseq, mseq1, mseq2, alloclen, lastresx, distancemtx, localhomtable, expdist, ngui );
 
 	fprintf( trap_g, "done.\n" );
 #if DEBUG


=====================================
core/pairlocalalignmain.c
=====================================
@@ -1,7 +1,7 @@
 #include "mltaln.h"
 int main( int argc, char **argv )
 {
-	int res = pairlocalalign( 0, 0, NULL, NULL, NULL, NULL, argc, argv );
+	int res = pairlocalalign( 0, 0, NULL, NULL, NULL, NULL, argc, argv, NULL );
 	if( res == GUI_CANCEL ) res = 0; // treeout de goto chudan wo riyousuru
 	return res;
 }


=====================================
core/serial.c deleted
=====================================
@@ -1,556 +0,0 @@
-static int treebase( int *nlen, char **aseq, int nadd, char *mergeoralign, char **mseq1, char **mseq2, int ***topol, Treedep *dep, int **memhist, double ***cpmxhist, double *effarr, double **newdistmtx, int *selfscore, int *alloclen, int (*callback)(int, int, char*) )
-{
-	int l, len1, len2, i, m, immin, immax;
-	int len1nocommongap, len2nocommongap;
-	int clus1, clus2;
-	double pscore, tscore;
-	char *indication1 = NULL, *indication2 = NULL;
-	double *effarr1 = NULL;
-	double *effarr2 = NULL;
-	int *fftlog = NULL; // fixed at 2006/07/26
-//	double dumfl = 0.0;
-	double dumdb = 0.0;
-	int ffttry;
-	int m1, m2;
-	int *gaplen = NULL;
-	int *gapmap = NULL;
-	int *alreadyaligned = NULL;
-	double **dynamicmtx = NULL;
-	double ssi, ssm, bunbo;
-	int tm, ti;
-	int gapmaplen;
-	int **localmem = NULL;
-	double **cpmxchild0, **cpmxchild1;
-	double orieff1, orieff2;
-#if SKIP
-	int **skiptable1 = NULL, **skiptable2 = NULL;
-#endif
-#if 0
-	int i, j;
-#endif
-
-
-	if( effarr1 == NULL ) 
-	{
-		effarr1 = AllocateDoubleVec( njob );
-		effarr2 = AllocateDoubleVec( njob );
-		indication1 = AllocateCharVec( 150 );
-		indication2 = AllocateCharVec( 150 );
-		fftlog = AllocateIntVec( njob );
-		gaplen = AllocateIntVec( *alloclen+10 );
-		gapmap = AllocateIntVec( *alloclen+10 );
-		alreadyaligned = AllocateIntVec( njob );
-		if( specificityconsideration )
-			dynamicmtx = AllocateDoubleMtx( nalphabets, nalphabets );
-		localmem = calloc( sizeof( int * ), 2 );
-	}
-	for( i=0; i<njob-nadd; i++ ) alreadyaligned[i] = 1;
-	for( i=njob-nadd; i<njob; i++ ) alreadyaligned[i] = 0;
-
-	if( callback && callback( 0, 50, "Progressive alignment" ) ) goto chudan_tbfast;
-
-	for( l=0; l<njob; l++ ) fftlog[l] = 1;
-
-#if 0 // chain you
-	localmem[0][0] = -1;
-	localmem[1][0] = -1;
-	clus1 = 1;// chain ni hitsuyou
-#endif
-
-#if 0
-	reporterr(       "##### fftwinsize = %d, fftthreshold = %d\n", fftWinSize, fftThreshold );
-#endif
-
-#if 0
-	for( i=0; i<njob; i++ )
-		reporterr(       "TBFAST effarr[%d] = %f\n", i, effarr[i] );
-#endif
-
-//	for( i=0; i<njob; i++ ) strcpy( aseq[i], seq[i] );
-
-
-//	writePre( njob, name, nlen, aseq, 0 );
-
-	tscore = 0.0;
-	for( l=0; l<njob-1; l++ )
-	{
-		m1 = topol[l][0][0];
-		m2 = topol[l][1][0];
-//		reporterr( " at the beginning of the loop, clus1,clus2=%d,%d\n", clus1, clus2 );
-
-//		reporterr( "l=%d, dep[l].child0=%d, dep[l].child1=%d\n", l, dep[l].child0, dep[l].child1 );
-		if( dep[l].child0 == -1 ) cpmxchild0 = NULL; else cpmxchild0 = cpmxhist[dep[l].child0];
-		if( dep[l].child1 == -1 ) cpmxchild1 = NULL; else cpmxchild1 = cpmxhist[dep[l].child1];
-//		reporterr( "cpmxchild0=%p, cpmxchild1=%p\n", cpmxchild0, cpmxchild1 );
-
-#if 0
-		if(  l > 0 && dep[l].child0 == l-1 && dep[l].child1 == -1 && dep[dep[l].child0].child1 == -1 )
-		{
-			localmem[0][clus1] = topol[l-1][1][0];
-			localmem[0][clus1+1] = -1;
-
-			localmem[1][0] = topol[l][1][0];
-			localmem[1][1] = -1;
-		}
-		else
-		{
-			localmem[0][0] = -1;
-			posinmem = topolorderz( localmem[0], topol, dep, l, 0 ) - localmem[0];
-			localmem[1][0] = -1;
-			posinmem = topolorderz( localmem[1], topol, dep, l, 1 ) - localmem[1];
-		}
-#else
-		if( dep[l].child0 == -1 ) 
-		{
-			localmem[0] = calloc( sizeof( int ), 2 );
-			localmem[0][0] = m1;
-			localmem[0][1] = -1;
-			clus1 = 1;
-		}
-		else
-		{
-			localmem[0] = memhist[dep[l].child0];
-			clus1 = intlen( localmem[0] );
-		}
-		if( dep[l].child1 == -1 ) 
-		{
-			localmem[1] = calloc( sizeof( int ), 2 );
-			localmem[1][0] = m2;
-			localmem[1][1] = -1;
-			clus2 = 1;
-		}
-		else
-		{
-			localmem[1] = memhist[dep[l].child1];
-			clus2 = intlen( localmem[1] );
-		}
-
-		if( l != njob-2 )
-		{
-			memhist[l] = calloc( sizeof( int ), clus1+clus2+1 );
-			intcpy( memhist[l], localmem[0] );
-			intcpy( memhist[l]+clus1, localmem[1] );
-			memhist[l][clus1+clus2] = -1;
-		}
-#endif
-
-		if( mergeoralign[l] == 'n' )
-		{
-//			reporterr(       "SKIP!\n" );
-//			free( topol[l][0] ); topol[l][0] = NULL;
-//			free( topol[l][1] ); topol[l][1] = NULL;
-//			free( topol[l] ); topol[l] = NULL;
-			continue;
-		}
-
-//		reporterr(       "\ndistfromtip = %f\n", dep[l].distfromtip );
-		if( specificityconsideration )
-			makedynamicmtx( dynamicmtx, n_dis_consweight_multi, dep[l].distfromtip );
-		else
-			dynamicmtx = n_dis_consweight_multi;
-//		makedynamicmtx( dynamicmtx, n_dis_consweight_multi, ( dep[l].distfromtip - 0.2 ) * 3 );
-
-
-		len1 = strlen( aseq[m1] );
-		len2 = strlen( aseq[m2] );
-		if( *alloclen < len1 + len2 )
-		{
-			reporterr(       "\nReallocating.." );
-			*alloclen = ( len1 + len2 ) + 1000;
-			ReallocateCharMtx( aseq, njob, *alloclen + 10  ); 
-			gaplen = realloc( gaplen, ( *alloclen + 10 ) * sizeof( int ) );
-			if( gaplen == NULL )
-			{
-				reporterr(       "Cannot realloc gaplen\n" );
-				exit( 1 );
-			}
-			gapmap = realloc( gapmap, ( *alloclen + 10 ) * sizeof( int ) );
-			if( gapmap == NULL )
-			{
-				reporterr(       "Cannot realloc gapmap\n" );
-				exit( 1 );
-			}
-			reporterr(       "done. *alloclen = %d\n", *alloclen );
-		}
-
-#if 1 // CHUUI@@@@
-		clus1 = fastconjuction_noname( localmem[0], aseq, mseq1, effarr1, effarr, indication1, 0.0, &orieff1 );
-		clus2 = fastconjuction_noname( localmem[1], aseq, mseq2, effarr2, effarr, indication2, 0.0, &orieff2 );
-#else
-		clus1 = fastconjuction_noname( topol[l][0], aseq, mseq1, effarr1, effarr, indication1, 0.0 );
-		clus2 = fastconjuction_noname( topol[l][1], aseq, mseq2, effarr2, effarr, indication2, 0.0 );
-//		clus1 = fastconjuction_noweight( topol[l][0], aseq, mseq1, effarr1,  indication1 );
-//		clus2 = fastconjuction_noweight( topol[l][1], aseq, mseq2, effarr2,  indication2 );
-#endif
-
-
-
-
-
-
-
-
-
-
-
-		if( mergeoralign[l] == '1' || mergeoralign[l] == '2' )
-		{
-			newgapstr = "=";
-		}
-		else
-			newgapstr = "-";
-
-		len1nocommongap = len1;
-		len2nocommongap = len2;
-		if( mergeoralign[l] == '1' ) // nai
-		{
-			findcommongaps( clus2, mseq2, gapmap );
-			commongappick( clus2, mseq2 );
-			len2nocommongap = strlen( mseq2[0] );
-		}
-		else if( mergeoralign[l] == '2' )
-		{
-			findcommongaps( clus1, mseq1, gapmap );
-			commongappick( clus1, mseq1 );
-			len1nocommongap = strlen( mseq1[0] );
-		}
-
-#if 0
-    for( i=0; i<clus1; i++ ) 
-    {
-        if( strlen( mseq1[i] ) != len1 ) 
-        {
-            reporterr(       "i = %d / %d\n", i, clus1 ); 
-            reporterr(       "hairetsu ga kowareta (in treebase, after conjuction) !\n" ); 
-            exit( 1 );
-        }
-    }
-    for( j=0; j<clus2; j++ )
-    {
-        if( strlen( mseq2[j] ) != len2 ) 
-        {
-            reporterr(       "j = %d / %d\n", j, clus2 ); 
-            reporterr(       "hairetsu ga kowareta (in treebase, after conjuction) !\n" ); 
-            exit( 1 );
-        }
-    }
-#endif
-
-
-#if 0
-    for( i=0; i<clus1; i++ ) 
-    {
-        if( strlen( mseq1[i] ) != len1 ) 
-        {
-            reporterr(       "i = %d / %d\n", i, clus1 ); 
-            reporterr(       "hairetsu ga kowareta (in treebase, after free topol) !\n" ); 
-            exit( 1 );
-        }
-    }
-    for( j=0; j<clus2; j++ )
-    {
-        if( strlen( mseq2[j] ) != len2 ) 
-        {
-            reporterr(       "j = %d / %d\n", j, clus2 ); 
-            reporterr(       "hairetsu ga kowareta (in treebase, after free topol) !\n" ); 
-            exit( 1 );
-        }
-    }
-#endif
-
-
-//		fprintf( trap_g, "\nSTEP-%d\n", l );
-//		fprintf( trap_g, "group1 = %s\n", indication1 );
-//		fprintf( trap_g, "group2 = %s\n", indication2 );
-
-//		reporterr(       "\rSTEP % 5d / %d %d-%d", l+1, njob-1, clus1, clus2 );
-		if( l < 500 || l % 100 == 0 ) reporterr(       "\rSTEP % 5d / %d ", l+1, njob-1 );
-		if( callback && callback( 0, 50+50*l/(njob-1), "Progressive alignment" ) ) goto chudan_tbfast;
-#if 0
-		reporterr( "\nclus1=%d, clus2=%d\n", clus1, clus2 );
-#endif
-
-#if 0
-		reporterr(       "STEP %d /%d\n", l+1, njob-1 );
-		reporterr(       "group1 = %.66s", indication1 );
-		if( strlen( indication1 ) > 66 ) reporterr(       "..." );
-		reporterr(       "\n" );
-		reporterr(       "group2 = %.66s", indication2 );
-		if( strlen( indication2 ) > 66 ) reporterr(       "..." );
-		reporterr(       "\n" );
-#endif
-
-/*
-		reporterr(       "before align all\n" );
-		display( aseq, njob );
-		reporterr(       "\n" );
-		reporterr(       "before align 1 %s \n", indication1 );
-		display( mseq1, clus1 );
-		reporterr(       "\n" );
-		reporterr(       "before align 2 %s \n", indication2 );
-		display( mseq2, clus2 );
-		reporterr(       "\n" );
-*/
-
-
-		if( !nevermemsave && ( alg != 'M' && ( len1 > 30000 || len2 > 30000  ) ) )
-		{
-			reporterr(       "\nlen1=%d, len2=%d, Switching to the memsave mode\n", len1, len2 );
-			alg = 'M';
-			if( commonIP ) FreeIntMtx( commonIP );
-			commonIP = NULL;
-			commonAlloc1 = 0;
-			commonAlloc2 = 0;
-		}
-
-//		if( fftlog[m1] && fftlog[m2] ) ffttry = ( nlen[m1] > clus1 && nlen[m2] > clus2 );
-		if( fftlog[m1] && fftlog[m2] ) ffttry = ( nlen[m1] > clus1 && nlen[m2] > clus2 && clus1 < 1000 && clus2 < 1000);
-		else						   ffttry = 0;
-//		ffttry = ( nlen[m1] > clus1 && nlen[m2] > clus2 && clus1 < 5000 && clus2 < 5000); // v6.708
-//		reporterr(       "f=%d, len1/fftlog[m1]=%f, clus1=%d, len2/fftlog[m2]=%f, clus2=%d\n", ffttry, (double)len1/fftlog[m1], clus1, (double)len2/fftlog[m2], clus2 );
-
-		if( force_fft || ( use_fft && ffttry ) )
-		{
-			if( l < 500 || l % 100 == 0 ) reporterr(       " f\b\b" );
-			if( alg == 'M' )
-			{
-				if( l < 500 || l % 100 == 0 ) reporterr(       "m" );
-				pscore = Falign_udpari_long( NULL, NULL, dynamicmtx, mseq1, mseq2, effarr1, effarr2, NULL, NULL, clus1, clus2, *alloclen, fftlog+m1 );
-			}
-			else
-			{
-				pscore = Falign( NULL, NULL, dynamicmtx, mseq1, mseq2, effarr1, effarr2, NULL, NULL, clus1, clus2, *alloclen, fftlog+m1, NULL, 0, NULL );
-//				reporterr(       "######### mseq1[0] = %s\n", mseq1[0] );
-			}
-		}
-		else
-		{
-			if( l < 500 || l % 100 == 0 ) reporterr(       " d\b\b" );
-			fftlog[m1] = 0;
-			switch( alg )
-			{
-				case( 'a' ):
-					pscore = Aalign( mseq1, mseq2, effarr1, effarr2, clus1, clus2, *alloclen );
-					break;
-				case( 'M' ):
-					if( l < 500 || l % 100 == 0 ) reporterr(       "m" );
-					if( l < 500 || l % 100 == 0 ) if( cpmxchild1 || cpmxchild0 ) reporterr(       " h" );
-//					reporterr(       "%d-%d", clus1, clus2 );
-					pscore = MSalignmm( dynamicmtx, mseq1, mseq2, effarr1, effarr2, clus1, clus2, *alloclen, NULL, NULL, NULL, NULL, NULL, 0, NULL, outgap, outgap, cpmxchild0, cpmxchild1, cpmxhist+l, orieff1, orieff2 );
-					break;
-				case( 'd' ):
-					if( 1 && clus1 == 1 && clus2 == 1 )
-					{
-//						reporterr(       "%d-%d", clus1, clus2 );
-						pscore = G__align11( dynamicmtx, mseq1, mseq2, *alloclen, outgap, outgap );
-					}
-					else
-					{
-//						reporterr(       "%d-%d", clus1, clus2 );
-						pscore = D__align_ls( dynamicmtx, mseq1, mseq2, effarr1, effarr2, clus1, clus2, *alloclen, 0, &dumdb, NULL, NULL, NULL, NULL, NULL, 0, NULL, outgap, outgap );
-					}
-					break;
-				case( 'A' ):
-					if( clus1 == 1 && clus2 == 1 )
-					{
-//						reporterr(       "%d-%d", clus1, clus2 );
-						pscore = G__align11( dynamicmtx, mseq1, mseq2, *alloclen, outgap, outgap );
-					}
-					else
-					{
-						if( l < 500 || l % 100 == 0 ) if( cpmxchild1 || cpmxchild0 ) reporterr(       " h" );
-//						reporterr(       "\n\n %d - %d (%d x %d) : \n", topol[l][0][0], topol[l][1][0], clus1, clus2 );
-						pscore = A__align( dynamicmtx, penalty, penalty_ex, mseq1, mseq2, effarr1, effarr2, clus1, clus2, *alloclen, 0, &dumdb, NULL, NULL, NULL, NULL, NULL, 0, NULL, outgap, outgap, localmem[0][0], 1, cpmxchild0, cpmxchild1, cpmxhist+l, orieff1, orieff2 );
-					}
-
-					break;
-				default:
-					ErrorExit( "ERROR IN SOURCE FILE" );
-			}
-		}
-#if SCOREOUT
-		reporterr(       "score = %10.2f\n", pscore );
-#endif
-		tscore += pscore;
-		nlen[m1] = 0.5 * ( nlen[m1] + nlen[m2] );
-
-//		writePre( njob, name, nlen, aseq, 0 );
-
-		if( disp ) display( aseq, njob );
-//		reporterr(       "\n" );
-
-		if( mergeoralign[l] == '1' ) // jissainiha nai. atarashii hairetsu ha saigo dakara.
-		{
-			reporterr( "Check source!!!\n" );
-			exit( 1 );
-		}
-		if( mergeoralign[l] == '2' )
-		{
-//			if( localkeeplength ) ndeleted += deletenewinsertions( clus1, clus2, mseq1, mseq2, NULL );
-//			for( i=0; i<clus1; i++ ) reporterr(       ">STEP0 mseq1[%d] = \n%s\n", i, mseq1[i] );
-//			for( i=0; i<clus2; i++ ) reporterr(       ">STEP0 mseq2[%d] = \n%s\n", i, mseq2[i] );
-			gapmaplen = strlen( mseq1[0] )-len1nocommongap+len1;
-			adjustgapmap( gapmaplen, gapmap, mseq1[0] );
-#if 0
-			reporterr( "\n" );
-			for( i=0; i<clus1; i++ ) reporterr(       ">STEP1 mseq1[%d] = \n%s\n", i, mseq1[i] );
-			for( i=0; i<clus2; i++ ) reporterr(       ">STEP1 mseq2[%d] = \n%s\n", i, mseq2[i] );
-#endif
-//			if( clus1 + clus2 < njob ) restorecommongaps( njob, aseq, topol[l][0], topol[l][1], gapmap, *alloclen, '-' );
-			if( smoothing )
-			{
-				restorecommongapssmoothly( njob, njob-(clus1+clus2), aseq, localmem[0], localmem[1], gapmap, *alloclen, '-' );
-				findnewgaps( clus1, 0, mseq1, gaplen );
-				insertnewgaps_bothorders( njob, alreadyaligned, aseq, localmem[0], localmem[1], gaplen, gapmap, gapmaplen, *alloclen, alg, '-' );
-			}
-			else
-			{
-				restorecommongaps( njob, njob-(clus1+clus2), aseq, localmem[0], localmem[1], gapmap, *alloclen, '-' );
-				findnewgaps( clus1, 0, mseq1, gaplen );
-				insertnewgaps( njob, alreadyaligned, aseq, localmem[0], localmem[1], gaplen, gapmap, *alloclen, alg, '-' );
-			}
-
-#if 0
-			reporterr( "\n" );
-			for( i=0; i<clus1; i++ ) reporterr(       ">STEP3 mseq1[%d] = \n%s\n", i, mseq1[i] );
-			for( i=0; i<clus2; i++ ) reporterr(       ">STEP3 mseq2[%d] = \n%s\n", i, mseq2[i] );
-#endif
-
-#if 0
-			for( i=0; i<njob; i++ ) eq2dash( aseq[i] );
-			for( i=0; i<clus1; i++ ) 
-			{
-				reporterr( "mseq1[%d] bef change = %s\n", i, mseq1[i] );
-				eq2dash( mseq1[i] );
-				reporterr( "mseq1[%d] aft change = %s\n", i, mseq1[i] );
-			}
-			for( i=0; i<clus2; i++ ) 
-			{
-				reporterr( "mseq2[%d] bef change = %s\n", i, mseq2[i] );
-				eq2dash( mseq2[i] );
-				reporterr( "mseq2[%d] aft change = %s\n", i, mseq2[i] );
-			}
-			for( i=0; i<clus1; i++ ) eq2dash( mseq1[i] );
-			for( i=0; i<clus2; i++ ) eq2dash( mseq2[i] );
-#endif
-
-
-			eq2dashmatometehayaku( mseq1, clus1 );
-			eq2dashmatometehayaku( mseq2, clus2 );
-
-			for( i=0; (m=localmem[1][i])>-1; i++ ) alreadyaligned[m] = 1;
-		}
-
-		if( newdistmtx ) // tsukawanai
-		{
-#if 0
-			reporterr( "group1 = " );
-			for( i=0; i<clus1; i++ ) reporterr( "%d ", topol[l][0][i] );
-			reporterr( "\n" );
-			reporterr( "group2 = " );
-			for( m=0; m<clus2; m++ ) reporterr( "%d ", topol[l][1][m] );
-			reporterr( "\n" );
-#endif
-#if SKIP
-			skiptable1 = AllocateIntMtx( clus1, 0 );
-			skiptable2 = AllocateIntMtx( clus2, 0 );
-			makeskiptable( clus1, skiptable1, mseq1 ); // allocate suru.
-			makeskiptable( clus2, skiptable2, mseq2 ); // allocate suru.
-#endif
-			for( i=0; i<clus1; i++ ) 
-			{
-#if SKIP
-//				makeskiptable( 1, skiptable1, mseq1+i ); // allocate suru.
-#endif
-				ti = localmem[0][i];
-				ssi = selfscore[localmem[0][i]];
-				for( m=0; m<clus2; m++ )
-				{
-					ssm = selfscore[localmem[1][m]];
-					tm = localmem[1][m];
-					if( ti<tm )
-					{
-						immin = ti;
-						immax = tm;
-					}
-					else
-					{
-						immin = tm;
-						immax = ti;
-					}
-					bunbo = MIN( ssi, ssm );
-					if( bunbo == 0.0 )
-						newdistmtx[immin][immax-immin] = 2.0; // 2013/Oct/17
-					else
-#if SKIP
-						newdistmtx[immin][immax-immin] = ( 1.0 - naivepairscorefast( mseq1[i], mseq2[m], skiptable1[i], skiptable2[m], penalty_dist ) / bunbo ) * 2.0;
-#else
-						newdistmtx[immin][immax-immin] = ( 1.0 - naivepairscore11( mseq1[i], mseq2[m], penalty_dist ) / bunbo ) * 2.0;
-#endif
-				}
-			}
-#if SKIP
-			FreeIntMtx( skiptable1 ); skiptable1 = NULL;
-			FreeIntMtx( skiptable2 ); skiptable2 = NULL;
-#endif
-		}
-
-//		free( topol[l][0] ); topol[l][0] = NULL;
-//		free( topol[l][1] ); topol[l][1] = NULL;
-//		free( topol[l] ); topol[l] = NULL;
-
-
-//		reporterr(       ">514\n%s\n", aseq[514] );
-		free( localmem[0] );
-		free( localmem[1] );
-	}
-
-#if SCOREOUT
-	reporterr(       "totalscore = %10.2f\n\n", tscore );
-#endif
-	Falign( NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, NULL, 0, NULL );
-	Falign_udpari_long( NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, NULL );
-	A__align( NULL, 0, 0, NULL, NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, 0, -1, -1, NULL, NULL, NULL, 0.0, 0.0 );
-	D__align( NULL,  NULL, NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, 0 );
-	G__align11( NULL, NULL, NULL, 0, 0, 0 ); // iru?
-	free( effarr1 );
-	free( effarr2 );
-	free( indication1 );
-	free( indication2 );
-	free( fftlog );
-	free( gaplen );
-	free( gapmap );
-	if( specificityconsideration )
-		FreeDoubleMtx( dynamicmtx );
-	free( alreadyaligned );
-	free( localmem );
-	effarr1 = NULL;
-	return( 0 );
-
-	chudan_tbfast:
-
-	Falign( NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, NULL, 0, NULL );
-	Falign_udpari_long( NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, NULL );
-	A__align( NULL, 0, 0, NULL, NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, 0, -1, -1, NULL, NULL, NULL, 0.0, 0.0 );
-	D__align( NULL,  NULL, NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, 0 );
-	G__align11( NULL, NULL, NULL, 0, 0, 0 ); // iru?
-	if( effarr1 ) free( effarr1 ); effarr1 = NULL;
-	if( effarr2 ) free( effarr2 ); effarr2 = NULL;
-	if( indication1 ) free( indication1 ); indication1 = NULL;
-	if( indication2 ) free( indication2 ); indication2 = NULL;
-	if( fftlog ) free( fftlog ); fftlog = NULL;
-	if( gaplen ) free( gaplen ); gaplen = NULL;
-	if( gapmap ) free( gapmap ); gapmap = NULL;
-	if( alreadyaligned ) free( alreadyaligned ); alreadyaligned = NULL;
-	if( specificityconsideration )
-	{
-		if( dynamicmtx ) FreeDoubleMtx( dynamicmtx ); dynamicmtx = NULL;
-	}
-	if( localmem ) free( localmem ); localmem = NULL;
-#if SKIP
-	if( skiptable1 ) FreeIntMtx( skiptable1 ); skiptable1 = NULL;
-	if( skiptable2 ) FreeIntMtx( skiptable2 ); skiptable2 = NULL;
-#endif
-
-	return( 1 );
-}


=====================================
core/tbfast.c
=====================================
@@ -1248,7 +1248,8 @@ void treebase( int *nlen, char **aseq, int nadd, char *mergeoralign, char **mseq
 	int nfiles;
 	double ***cpmxhist = NULL;
 	int **memhist = NULL;
-	double **cpmxchild0, **cpmxchild1;
+	double ***cpmxchild0 = NULL;
+	double ***cpmxchild1 = NULL;
 	double orieff1, orieff2;
 #if REPORTCOSTS
 	time_t starttime, startclock;
@@ -1365,8 +1366,8 @@ void treebase( int *nlen, char **aseq, int nadd, char *mergeoralign, char **mseq
 		else
 		{
 //			reporterr( "l=%d, dep[l].child0=%d, dep[l].child1=%d\n", l, dep[l].child0, dep[l].child1 );
-			if( dep[l].child0 == -1 ) cpmxchild0 = NULL; else cpmxchild0 = cpmxhist[dep[l].child0];
-			if( dep[l].child1 == -1 ) cpmxchild1 = NULL; else cpmxchild1 = cpmxhist[dep[l].child1];
+			if( dep[l].child0 == -1 ) cpmxchild0 = NULL; else cpmxchild0 = cpmxhist+dep[l].child0;
+			if( dep[l].child1 == -1 ) cpmxchild1 = NULL; else cpmxchild1 = cpmxhist+dep[l].child1;
 //			reporterr( "cpmxchild0=%p, cpmxchild1=%p\n", cpmxchild0, cpmxchild1 );
 		}
 
@@ -1717,12 +1718,27 @@ void treebase( int *nlen, char **aseq, int nadd, char *mergeoralign, char **mseq
 	reporterr( "user = %f min\n", (float)(clock()-startclock)/CLOCKS_PER_SEC/60);
 #endif
 
+#if 1 // 2021/Jun/25
+	if( cpmxhist ) 
+	{
+		for( i=0; i<njob-1; i++ )
+		{
+			if( cpmxhist[i] ) 
+			{
+//				reporterr( "freeing cpmxhist[%d]\n", i );
+				FreeDoubleMtx( cpmxhist[i] ); cpmxhist[i] = NULL;
+			}
+		}
+		free( cpmxhist ); cpmxhist = NULL;
+	}
+#else
 	if( cpmxhist[njob-2] ) 
 	{
 //		reporterr( "freeing cpmxhist[njob-2]\n" );
 		FreeDoubleMtx( cpmxhist[njob-2] ); cpmxhist[njob-2] = NULL;
 	}
 	free( cpmxhist ); cpmxhist = NULL;
+#endif
 	free( memhist ); memhist = NULL;
 
 #if SCOREOUT
@@ -1868,8 +1884,9 @@ int main( int argc, char *argv[] )
 	static double **iscore = NULL, **iscore_kozo = NULL;
 	int **skiptable;
 	static double *eff = NULL, *eff_kozo = NULL, *eff_kozo_mapped = NULL;
-	int i, j, ien, ik, jk;
+	int i, j, k, ien, ik, jk;
 	static int ***topol = NULL, ***topol_kozo = NULL;
+	double **expdist = NULL;
 	static int *addmem;
 	static Treedep *dep = NULL;
 	static double **len = NULL, **len_kozo = NULL;
@@ -2041,6 +2058,45 @@ int main( int argc, char *argv[] )
 	readData_pointer( infp, name, nlen, seq );
 	fclose( infp );
 #endif
+	if( treein )
+	{
+#if 1 // pairlocalalign() yori mae ni hitsuyou, specificityconsideration>0.0 && usertree no toki.
+		loadtree( njob, topol, len, name, nlen, dep, treeout );
+//		loadtop( njob, topol, len, name, NULL, dep ); // 2015/Jan/13, not yet checked
+		fprintf( stderr, "\ndone.\n\n" );
+//		for( i=0; i<njob-1; i++ ) reporterr( "%d-%d, %f-%f\n", topol[i][0][0], topol[i][1][0], len[i][0], len[i][1] );
+		if( callpairlocalalign && specificityconsideration>0.0 )
+		{
+			int *mem0 = calloc( sizeof( int ), njob );
+			int *mem1 = calloc( sizeof( int ), njob );
+			expdist = AllocateDoubleMtx( njob, njob );
+			for( i=0; i<njob-1; i++ ) 
+			{
+				topolorderz( mem0, topol, dep, i, 0 );
+				topolorderz( mem1, topol, dep, i, 1 );
+#if 0
+				reporterr( "mem0=\n" );
+				for( j=0; mem0[j]!=-1; j++ ) reporterr( "%d ", mem0[j] );
+				reporterr( "\n" );
+				reporterr( "mem1=\n" );
+				for( j=0; mem1[j]!=-1; j++ ) reporterr( "%d ", mem1[j] );
+				reporterr( "\n" );
+#endif
+				for( j=0; mem0[j]!=-1; j++ ) for( k=0; mem1[k]!=-1; k++ )
+				{
+					expdist[mem0[j]][mem1[k]] += ( len[i][0] + len[i][1] );
+					expdist[mem1[k]][mem0[j]] += ( len[i][0] + len[i][1] );
+				}
+			}
+#if 0
+			for( i=0; i<njob; i++ ) for( j=0; j<njob; j++ )
+				reporterr( "expdist[%d][%d] = %f\n", i, j, expdist[i][j] );
+#endif
+			free( mem0 );
+			free( mem1 );
+		}
+#endif
+	}
 
 	if( specifictarget && compacttree != 3 ) // compacttree == 3 no toki ha hat3dir/uselh no joho wo tsukau, 2016/Jan
 	{
@@ -2107,9 +2163,10 @@ int main( int argc, char *argv[] )
 //		reporterr( "pav[0]=%s\n", pav[0] );
 		if( callpairlocalalign )
 		{
-			pairlocalalign( njob, nlenmax, name, seq, iscore, localhomtable, pac, pav );
+			pairlocalalign( njob, nlenmax, name, seq, iscore, localhomtable, pac, pav, expdist );
 			arguments( tac, tav, NULL, NULL, NULL, NULL ); // anzen no tame
 			callpairlocalalign = 1; // wakarinikui.
+			if( expdist ) FreeDoubleMtx( expdist ); expdist = NULL;
 			if( fastathreshold < 0.0001 ) constraint = 0; 
 //			fprintf( stderr, "blosum %d / kimura 200\n", nblosum );
 //			fprintf( stderr, "scoremtx=%d\n", scoremtx );
@@ -2261,9 +2318,10 @@ int main( int argc, char *argv[] )
 	{
 		if( callpairlocalalign )
 		{
-			pairlocalalign( njob, nlenmax, name, seq, iscore, NULL, pac, pav );
+			pairlocalalign( njob, nlenmax, name, seq, iscore, NULL, pac, pav, expdist );
 			arguments( tac, tav, NULL, NULL, NULL, NULL ); // anzen no tame
 			callpairlocalalign = 1; // wakarinikui.
+			if( expdist ) FreeDoubleMtx( expdist ); expdist = NULL;
 			if( fastathreshold < 0.0001 ) constraint = 0; 
 			fprintf( stderr, "blosum %d / kimura 200\n", nblosum );
 			fprintf( stderr, "scoremtx=%d\n", scoremtx );
@@ -2448,16 +2506,13 @@ int main( int argc, char *argv[] )
 
 	if( treein )
 	{
-#if 0
-		if( nkozo )
-		{
-			fprintf( stderr, "Both structure and user tree have been given. Not yet supported!\n" );
-			exit( 1 );
-		}
-#endif
+#if 0 // pairlocalalign() yori mae ni idou, 2021/Jun.
 		loadtree( njob, topol, len, name, nlen, dep, treeout );
 //		loadtop( njob, topol, len, name, NULL, dep ); // 2015/Jan/13, not yet checked
 		fprintf( stderr, "\ndone.\n\n" );
+		for( i=0; i<njob-1; i++ ) reporterr( "%d-%d, %f-%f\n", topol[i][0][0], topol[i][1][0], len[i][0], len[i][1] );
+		exit( 1 );
+#endif
 	}
 	else
 	{


=====================================
core/univscript.tmpl
=====================================
@@ -5,15 +5,17 @@ for prog in $progs; do
 done
 
 make clean
-make CC="clang" CFLAGS="-O3 -arch x86_64 -mmacosx-version-min=10.9 -DMACOSX_DEPLOYMENT_TARGET=10.9" LIBS="-lm  -lpthread" ENABLE_MULTITHREAD="-Denablemultithread"
-env CC='clang -O3 -arch x86_64' GOARCH=amd64 GOOS=darwin CGO_ENABLED=0 go build --ldflags '-extldflags "-static"' dash_client.go # uwagaki
+make CC="/opt/homebrew-x86_64/bin/gcc-11" CFLAGS="-O3 -arch x86_64 -mmacosx-version-min=10.9 -DMACOSX_DEPLOYMENT_TARGET=10.9" LIBS="-static-libgcc  -lm  -lpthread" ENABLE_MULTITHREAD="-Denablemultithread"
+rm -f dash_client
+env CC='/opt/homebrew-x86_64/bin/gcc-11 -static-libgcc -O3 -arch x86_64' GOARCH=amd64 GOOS=darwin CGO_ENABLED=0 /opt/homebrew-x86_64/bin/go build --ldflags '-extldflags "-static"' dash_client.go # uwagaki
 for prog in $progs; do
 	mv $prog $prog.x86_64
 done
 
 make clean
-make CC="clang" CFLAGS="-O3 -arch arm64 -mmacosx-version-min=11.1 -DMACOSX_DEPLOYMENT_TARGET=11.1" LIBS="-lm  -lpthread" ENABLE_MULTITHREAD="-Denablemultithread"
-env CC='clang -O3 -arch arm64' GOARCH=arm64 GOOS=darwin CGO_ENABLED=0 go build --ldflags '-extldflags "-static"' dash_client.go # uwagaki
+make CC="/opt/homebrew/bin/gcc-11" CFLAGS="-static-libgcc -O3 -arch arm64 -mmacosx-version-min=11.1 -DMACOSX_DEPLOYMENT_TARGET=11.1" LIBS="-lm  -lpthread" ENABLE_MULTITHREAD="-Denablemultithread"
+rm -f dash_client
+env CC='/opt/homebrew/bin/gcc-11 -static-libgcc -O3 -arch arm64' GOARCH=arm64 GOOS=darwin CGO_ENABLED=0 /opt/homebrew/bin/go build --ldflags '-extldflags "-static"' dash_client.go # uwagaki
 for prog in $progs; do
 	mv $prog $prog.arm64
 done


=====================================
readme
=====================================
@@ -1,6 +1,6 @@
 -----------------------------------------------------------------------
   MAFFT: a multiple sequence alignment program
-  version 7.481, 2021/May/26
+  version 7.486, 2021/Jul/19
 
   http://mafft.cbrc.jp/alignment/software/
   katoh at ifrec.osaka-u.ac.jp



View it on GitLab: https://salsa.debian.org/med-team/mafft/-/commit/084720ae6bcfcbd90efef804bf7aa7bb16731de4

-- 
View it on GitLab: https://salsa.debian.org/med-team/mafft/-/commit/084720ae6bcfcbd90efef804bf7aa7bb16731de4
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20210723/34112fb0/attachment-0001.htm>


More information about the debian-med-commit mailing list