[med-svn] [Git][med-team/mafft][master] 9 commits: New upstream version 7.453

Steffen Möller gitlab at salsa.debian.org
Thu Nov 21 16:31:29 GMT 2019



Steffen Möller pushed to branch master at Debian Med / mafft


Commits:
500ceb1b by Steffen Moeller at 2019-11-21T16:27:04Z
New upstream version 7.453
- - - - -
cdda8281 by Steffen Moeller at 2019-11-21T16:27:04Z
New upstream version

- - - - -
95ee0cbc by Steffen Moeller at 2019-11-21T16:27:06Z
Update upstream source from tag 'upstream/7.453'

Update to upstream version '7.453'
with Debian dir 228e6955f2afe9b11f609d676401a8b2a1240d97
- - - - -
a344d95f by Steffen Moeller at 2019-11-21T16:27:12Z
Standards-Version: 4.4.1

- - - - -
d43bc4cb by Steffen Moeller at 2019-11-21T16:27:13Z
Trim trailing whitespace.

Fixes lintian: file-contains-trailing-whitespace
See https://lintian.debian.org/tags/file-contains-trailing-whitespace.html for more details.

- - - - -
ffea34ad by Steffen Moeller at 2019-11-21T16:27:16Z
Use secure URI in Homepage field.

Fixes lintian: homepage-field-uses-insecure-uri
See https://lintian.debian.org/tags/homepage-field-uses-insecure-uri.html for more details.

- - - - -
5a8b08f0 by Steffen Moeller at 2019-11-21T16:27:16Z
Set fields Upstream-Name, Upstream-Contact in debian/copyright.
- - - - -
7752e006 by Steffen Moeller at 2019-11-21T16:27:16Z
Remove obsolete fields Name, Contact from debian/upstream/metadata.
- - - - -
dc6b6077 by Steffen Moeller at 2019-11-21T16:28:04Z
Upload to unstable

- - - - -


24 changed files:

- MPI/Makefile
- core/Falign.c
- core/MSalignmm.c
- core/Salignmm.c
- core/addfunctions.c
- core/addsingle.c
- core/dash_client.go
- core/disttbfast.c
- core/functions.h
- core/io.c
- core/mafft-profile.c
- core/mafft.tmpl
- core/makedirectionlist.c
- core/mltaln.h
- core/serial.c
- core/setdirection.c
- core/splittbfast.c
- core/tbfast.c
- debian/changelog
- debian/control
- debian/copyright
- debian/upstream/metadata
- readme
- test/script


Changes:

=====================================
MPI/Makefile
=====================================
@@ -14,7 +14,7 @@ CFLAGS := -O3
 #CFLAGS =  -O0  -fPIC -pedantic -Wall -std=c99 -g -DMALLOC_CHECK_=3 # for shark, valgrind
 # CFLAGS := -O0 -g -ipo -no-prec-div -xHost -std=c99
 TARGET_ARCH := 
-LDLIBS := -lm -lrt   # -lrt?
+LDLIBS := -lm -lrt -lpthread  # -lrt?
 
 
 ENABLE_MULTITHREAD := -Denablemultithread


=====================================
core/Falign.c
=====================================
@@ -9,6 +9,7 @@ static TLS int n20or4or2;
 #define RND   0
 #define DEBUG 0
 
+
 #if RND // by D.Mathog
 static void generateRndSeq( char *seq, int len )
 {
@@ -714,7 +715,7 @@ system( "/usr/bin/gnuplot list.plot" );
 				if( clus1 == 1 && clus2 == 1 )
 					G__align11( n_dynamicmtx, tmpres1, tmpres2, alloclen, headgp, tailgp );
 				else
-					A__align( n_dynamicmtx, tmpres1, tmpres2, eff1, eff2, clus1, clus2, alloclen, 0, &dumdb, NULL, NULL, NULL, NULL, NULL, 0, NULL, headgp, tailgp, -1, -1, NULL, NULL, NULL, 0.0, 0.0 );
+					A__align( n_dynamicmtx, penalty, penalty_ex, tmpres1, tmpres2, eff1, eff2, clus1, clus2, alloclen, 0, &dumdb, NULL, NULL, NULL, NULL, NULL, 0, NULL, headgp, tailgp, -1, -1, NULL, NULL, NULL, 0.0, 0.0 );
 				break;
 			default:
 				fprintf( stderr, "alg = %c\n", alg );
@@ -825,9 +826,9 @@ double Falign( int **whichmtx, double ***scoringmatrices, double **n_dynamicmtx,
 			mymergesort( 0, 0, NULL );
 			alignableReagion( 0, 0, NULL, NULL, NULL, NULL, NULL );
 			fft( 0, NULL, 1 );
-			A__align( NULL, 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 );
+			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 );
-			A__align_variousdist( NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, 0 );
+			A__align_variousdist( NULL, NULL, NULL, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, 0 );
 			D__align_variousdist( NULL, NULL, NULL, NULL, 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 );
 			blockAlign2( NULL, NULL, NULL, NULL, NULL, NULL );
@@ -1400,6 +1401,7 @@ system( "less seqVec2 < /dev/tty > /dev/tty" );
 		if( i == count-2 ) tailgp = outgap; else tailgp = 1;
 
 
+#if 0
 		if( cut1[i] ) // chuui
 		{
 //			getkyokaigap( sgap1, tmpres1, nlen-1, clus1 );
@@ -1422,6 +1424,25 @@ system( "less seqVec2 < /dev/tty > /dev/tty" );
 			for( j=0; j<clus1; j++ ) egap1[j] = 'o';
 			for( j=0; j<clus2; j++ ) egap2[j] = 'o';
 		}
+#else
+		if( cut1[i] )
+			getkyokaigap( sgap1, seq1, cut1[i]-1, clus1 );
+		else
+			for( j=0; j<clus1; j++ ) sgap1[j] = 'o';
+		if( cut2[i] )
+			getkyokaigap( sgap2, seq2, cut2[i]-1, clus2 );
+		else
+			for( j=0; j<clus2; j++ ) sgap2[j] = 'o';
+
+		if( cut1[i+1] != len1 )
+			getkyokaigap( egap1, seq1, cut1[i+1], clus1 );
+		else    
+			for( j=0; j<clus1; j++ ) egap1[j] = 'o';
+		if( cut2[i+1] != len2 )
+			getkyokaigap( egap2, seq2, cut2[i+1], clus2 );
+		else    
+			for( j=0; j<clus2; j++ ) egap2[j] = 'o';
+#endif
 #if 0
 		{
 			fprintf( stderr, "kyokkaigap1(%d)=", cut1[i]-1 );
@@ -1456,6 +1477,10 @@ system( "less seqVec2 < /dev/tty > /dev/tty" );
 		fprintf( stderr, "DP %03d / %03d\r", i+1, count-1 );
 #endif
 #endif
+
+		//reporterr( "cut1[] = %d\n", cut1[i] );
+		//reporterr( "cut2[] = %d\n", cut2[i] );
+
 		for( j=0; j<clus1; j++ )
 		{
 			strncpy( tmpres1[j], seq1[j]+cut1[i], cut1[i+1]-cut1[i] );
@@ -1541,10 +1566,10 @@ system( "less seqVec2 < /dev/tty > /dev/tty" );
 				{
 					if( scoringmatrices ) // called by tditeration.c
 					{
-						totalscore += A__align_variousdist( whichmtx, scoringmatrices, NULL, tmpres1, tmpres2, eff1, eff2, eff1s, eff2s, clus1, clus2, alloclen, 0, &dumdb, sgap1, sgap2, egap1, egap2, chudanpt, chudanref, chudanres, headgp, tailgp );
+						totalscore += A__align_variousdist( whichmtx, scoringmatrices, NULL, penalty, penalty_ex, tmpres1, tmpres2, eff1, eff2, eff1s, eff2s, clus1, clus2, alloclen, 0, &dumdb, sgap1, sgap2, egap1, egap2, chudanpt, chudanref, chudanres, headgp, tailgp );
 					}
 					else
-						totalscore += A__align( n_dynamicmtx, tmpres1, tmpres2, eff1, eff2, clus1, clus2, alloclen, 0, &dumdb, sgap1, sgap2, egap1, egap2, chudanpt, chudanref, chudanres, headgp, tailgp, -1, -1, NULL, NULL, NULL, 0.0, 0.0 );
+						totalscore += A__align( n_dynamicmtx, penalty, penalty_ex, tmpres1, tmpres2, eff1, eff2, clus1, clus2, alloclen, 0, &dumdb, sgap1, sgap2, egap1, egap2, chudanpt, chudanref, chudanres, headgp, tailgp, -1, -1, NULL, NULL, NULL, 0.0, 0.0 );
 				}
 				break;
 			default:
@@ -1607,15 +1632,108 @@ system( "less seqVec2 < /dev/tty > /dev/tty" );
 
 
 
+// 2019/Jun
+static double estimategapfreq( int n, char **s )
+{
+	int i, j, len;
+	char *seq, *pt1, *pt2;
+	double f, fv;
+
+	len = strlen( s[0] );
+	seq = calloc( len+1, sizeof( char ) );
+
+	fv = 0.0;
+	for( i=0; i<n; i++  )
+	{
+		pt1 = s[i];
+		while( *pt1 == '-' ) pt1++;
+		pt2 = seq;
+		while( *pt1 != 0 ) *pt2++ = *pt1++;
+		*pt2 = *pt1; // 0
+		pt1 = pt2-1;
+		while( *pt1 == '-' ) pt1--;
+		*(pt1+1) = 0;	
+//		reporterr( "seq[i]=%s\n", s[i] );
+//		reporterr( "seq=%s\n", seq );
+		len = pt1-seq+1;
+		f = 0.0;
+		for( j=0; j<len; j++ )
+			if( seq[j] == '-' ) f+=1.0;
+		fv += f/(double)len;
+	}
+	free( seq );
+	return( fv/(double)n );
+}
+
+static int terminalmargin( int lshorter, double groupsizefac )
+{
+	return ( lshorter * 2.0 + 100 ) * groupsizefac;
+//	return ( lshorter * 1.1 + 10 ) * groupsizefac;
+}
 
+static int estimatenogaplen( int n, char **s, int start, int end )
+{
+	int i, j, l, d, o;
+	int minl;
+	char *c;
 
+	if( start < end ) d = 1; else d = -1;
 
+	reporterr( "\nin estimatenogaplen, d=%d\n", d );
 
+	minl = (end-start)*d;
+	c = calloc( minl, sizeof( char ) );
 
-/*
-sakujo wo kentou (2010/10/05)
-*/
-double Falign_udpari_long( 
+	for( j=start; j!=end; j+=d )
+	{
+		o = 0;
+		for( i=0; i<n; i++ )
+		{
+			if( s[i][j] != '-' ) o++;
+			if( o >= n / 2 ) break;
+		}
+		if( o >= n/2 ) c[(j-start)*d] = 'o';
+		else c[(j-start)*d] = '-';
+	}
+	c[(j-start)*d] = 0;
+
+	reporterr( "c=%s\n", c );
+
+	l = 0;
+	for( j=start; j!=end; j+=d )
+		if( c[j] == 'o' ) l++;
+	reporterr( "l=%d\n", l );
+	free( c );
+	return( l );
+}
+
+static int nogapmargin( int n, char **s, int start, int end, int m )
+{
+	int i, j, l, d;
+	int minl;
+
+	if( start < end ) d = 1; else d = -1;
+
+//	reporterr( "\nin nogapmargin, d=%d\n", d );
+
+	minl = (end-start)*d;
+	for( i=0; i<n; i++ )
+	{
+		l = 0;
+		for( j=start; j!=end; j+=d )
+		{
+			if( s[i][j] != '-' ) l++;
+			if( l>m ) break;
+		}
+//		reporterr( "i=%d, l=%d, j=%d\n", i, l, j );
+		if( (j-start)*d < minl ) minl = (j-start)*d;
+	}
+	minl += 1;
+//	reporterr( "minl=%d, so returning %d\n", minl, start+minl*d );
+	return( start + minl*d );
+}
+
+double Falign_givenanchors( ExtAnch *pairanch, 
 			  int **whichmtx, double ***scoringmatrices, 
 			  double **n_dynamicmtx,
 			  char  **seq1, char  **seq2, 
@@ -1624,48 +1742,54 @@ double Falign_udpari_long(
 			  int    clus1, int    clus2,
 			  int alloclen, int *fftlog )
 {
-	int i, j, k, l, m, maxk;
+
+	int i, j;
 	int nlen, nlen2, nlen4;
 	static TLS int prevalloclen = 0;
-	static TLS int crossscoresize = 0;
-	static TLS char **tmpseq1 = NULL;
-	static TLS char **tmpseq2 = NULL;
-	static TLS char **tmpptr1 = NULL;
-	static TLS char **tmpptr2 = NULL;
+	//static TLS int crossscoresize = 0;
+	//static TLS char **tmpseq1 = NULL;
+	//static TLS char **tmpseq2 = NULL;
+	//static TLS char **tmpptr1 = NULL;
+	//static TLS char **tmpptr2 = NULL;
 	static TLS char **tmpres1 = NULL;
 	static TLS char **tmpres2 = NULL;
 	static TLS char **result1 = NULL;
 	static TLS char **result2 = NULL;
 #if RND
-	static TLS char **rndseq1 = NULL;
-	static TLS char **rndseq2 = NULL;
-#endif
-	static TLS Fukusosuu **seqVector1 = NULL;
-	static TLS Fukusosuu **seqVector2 = NULL;
-	static TLS Fukusosuu **naiseki = NULL;   
-	static TLS Fukusosuu *naisekiNoWa = NULL; 
-	static TLS double *soukan = NULL;
-	static TLS double **crossscore = NULL;
+	//static TLS char **rndseq1 = NULL;
+	//static TLS char **rndseq2 = NULL;
+#endif
+	//static TLS Fukusosuu **seqVector1 = NULL;
+	//static TLS Fukusosuu **seqVector2 = NULL;
+	//static TLS Fukusosuu **naiseki = NULL;   
+	//static TLS Fukusosuu *naisekiNoWa = NULL; 
+	//static TLS double *soukan = NULL;
+	//static TLS double **crossscore = NULL;
 	int nlentmp;
-	static TLS int *kouho = NULL;
-	static TLS Segment *segment = NULL;
-	static TLS Segment *segment1 = NULL;
-	static TLS Segment *segment2 = NULL;
-	static TLS Segment **sortedseg1 = NULL;
-	static TLS Segment **sortedseg2 = NULL;
+	//static TLS int *kouho = NULL;
+	//static TLS Segment *segment = NULL;
+	//static TLS Segment *segment1 = NULL;
+	//static TLS Segment *segment2 = NULL;
+	//static TLS Segment **sortedseg1 = NULL;
+	//static TLS Segment **sortedseg2 = NULL;
+	static TLS int *alignorcopy = NULL;
 	static TLS int *cut1 = NULL;
 	static TLS int *cut2 = NULL;
 	static TLS char *sgap1, *egap1, *sgap2, *egap2;
 	static TLS int localalloclen = 0;
-	int lag;
-	int tmpint;
+//	int lag;
+//	int tmpint;
 	int count, count0;
 	int len1, len2;
 	int totallen;
 	double totalscore;
-	int nkouho = 0;
+//	int nkouho = 0;
 	int headgp, tailgp;
 //	double dumfl = 0.0;
+	int orilen1, orilen2;
+	int cutadd;
+	int starttermcut1, starttermcut2, endtermcut1, endtermcut2;
+	double marginfac1, marginfac2;
 
 	if( seq1 == NULL )
 	{
@@ -1674,45 +1798,46 @@ double Falign_udpari_long(
 //			fprintf( stderr, "### Freeing localarrays in Falign\n" );
 			localalloclen = 0;
 			prevalloclen = 0;
-			crossscoresize = 0;
+			//crossscoresize = 0;
 			mymergesort( 0, 0, NULL );
-			alignableReagion( 0, 0, NULL, NULL, NULL, NULL, NULL );
-			fft( 0, NULL, 1 );
-			A__align( NULL, 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 );
-			A__align_variousdist( NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, 0 );
+			//alignableReagion( 0, 0, NULL, NULL, NULL, NULL, NULL );
+			//fft( 0, NULL, 1 );
+			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 );
+			A__align_variousdist( NULL, NULL, NULL, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, 0 );
 			D__align_variousdist( NULL, NULL, NULL, NULL, 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 );
-			blockAlign2( NULL, NULL, NULL, NULL, NULL, NULL );
-			if( crossscore ) FreeDoubleMtx( crossscore );
-			crossscore = NULL; // reallocate sareru kanousei ga arunode.
+			//blockAlign2( NULL, NULL, NULL, NULL, NULL, NULL );
+			//if( crossscore ) FreeDoubleMtx( crossscore );
+			//crossscore = NULL; // reallocate sareru kanousei ga arunode.
 			FreeCharMtx( result1 ); result1 = NULL;
 			FreeCharMtx( result2 );
 			FreeCharMtx( tmpres1 );
 			FreeCharMtx( tmpres2 );
-			FreeCharMtx( tmpseq1 );
-			FreeCharMtx( tmpseq2 );
+			//FreeCharMtx( tmpseq1 );
+			//FreeCharMtx( tmpseq2 );
 			free( sgap1 );
 			free( egap1 );
 			free( sgap2 );
 			free( egap2 );
-			free( kouho );
+			//free( kouho );
+			free( alignorcopy );
 			free( cut1 );
 			free( cut2 );
-			free( tmpptr1 );
-			free( tmpptr2 );
-			free( segment );
-			free( segment1 );
-			free( segment2 );
-			free( sortedseg1 );
-			free( sortedseg2 );
-			if( !kobetsubunkatsu )
-			{
-				FreeFukusosuuMtx ( seqVector1 );
-				FreeFukusosuuMtx ( seqVector2 );
-				FreeFukusosuuVec( naisekiNoWa );
-				FreeFukusosuuMtx( naiseki );
-				FreeDoubleVec( soukan );
-			}
+			//free( tmpptr1 );
+			//free( tmpptr2 );
+			//free( segment );
+			//free( segment1 );
+			//free( segment2 );
+			//free( sortedseg1 );
+			//free( sortedseg2 );
+			//if( !kobetsubunkatsu )
+			//{
+			//	FreeFukusosuuMtx ( seqVector1 );
+			//	FreeFukusosuuMtx ( seqVector2 );
+			//	FreeFukusosuuVec( naisekiNoWa );
+			//	FreeFukusosuuMtx( naiseki );
+			//	FreeDoubleVec( soukan );
+			//}
 		}
 		else
 		{
@@ -1764,83 +1889,73 @@ double Falign_udpari_long(
 		egap1 = AllocateCharVec( njob );
 		sgap2 = AllocateCharVec( njob );
 		egap2 = AllocateCharVec( njob );
-		kouho = AllocateIntVec( NKOUHO_LONG );
+		//kouho = AllocateIntVec( NKOUHO_LONG );
+		alignorcopy = AllocateIntVec( MAXSEG );
 		cut1 = AllocateIntVec( MAXSEG );
 		cut2 = AllocateIntVec( MAXSEG );
-		tmpptr1 = AllocateCharMtx( njob, 0 );
-		tmpptr2 = AllocateCharMtx( njob, 0 );
-		segment = (Segment *)calloc( MAXSEG, sizeof( Segment ) );
-		segment1 = (Segment *)calloc( MAXSEG, sizeof( Segment ) );
-		segment2 = (Segment *)calloc( MAXSEG, sizeof( Segment ) );
-		sortedseg1 = (Segment **)calloc( MAXSEG, sizeof( Segment * ) );
-		sortedseg2 = (Segment **)calloc( MAXSEG, sizeof( Segment * ) );
-		if( !( segment && segment1 && segment2 && sortedseg1 && sortedseg2 ) )
-			ErrorExit( "Allocation error\n" );
-
-		if     ( scoremtx == -1 ) n20or4or2 = 1;
-		else if( fftscore )       n20or4or2 = 1;
-		else                      n20or4or2 = 20;
+		//tmpptr1 = AllocateCharMtx( njob, 0 );
+		//tmpptr2 = AllocateCharMtx( njob, 0 );
+		//segment = (Segment *)calloc( MAXSEG, sizeof( Segment ) );
+		//segment1 = (Segment *)calloc( MAXSEG, sizeof( Segment ) );
+		//segment2 = (Segment *)calloc( MAXSEG, sizeof( Segment ) );
+		//sortedseg1 = (Segment **)calloc( MAXSEG, sizeof( Segment * ) );
+		//sortedseg2 = (Segment **)calloc( MAXSEG, sizeof( Segment * ) );
+		//if( !( segment && segment1 && segment2 && sortedseg1 && sortedseg2 ) )
+		//	ErrorExit( "Allocation error\n" );
+
+		//if     ( scoremtx == -1 ) n20or4or2 = 1;
+		//else if( fftscore )       n20or4or2 = 1;
+		//else                      n20or4or2 = 20;
 	}
 	if( localalloclen < nlen )
 	{
 		if( localalloclen )
 		{
 #if 1
-			if( !kobetsubunkatsu )
-			{
-				FreeFukusosuuMtx ( seqVector1 );
-				FreeFukusosuuMtx ( seqVector2 );
-				FreeFukusosuuVec( naisekiNoWa );
-				FreeFukusosuuMtx( naiseki );
-				FreeDoubleVec( soukan );
-			}
-			FreeCharMtx( tmpseq1 );
-			FreeCharMtx( tmpseq2 );
+			//if( !kobetsubunkatsu )
+			//{
+			//	FreeFukusosuuMtx ( seqVector1 );
+			//	FreeFukusosuuMtx ( seqVector2 );
+			//	FreeFukusosuuVec( naisekiNoWa );
+			//	FreeFukusosuuMtx( naiseki );
+			//	FreeDoubleVec( soukan );
+			//}
+			//FreeCharMtx( tmpseq1 );
+			//FreeCharMtx( tmpseq2 );
 #endif
 #if RND
-			FreeCharMtx( rndseq1 );
-			FreeCharMtx( rndseq2 );
+			//FreeCharMtx( rndseq1 );
+			//FreeCharMtx( rndseq2 );
 #endif
 		}
 
 
-		tmpseq1 = AllocateCharMtx( njob, nlen );
-		tmpseq2 = AllocateCharMtx( njob, nlen );
-		if( !kobetsubunkatsu )
-		{
-			naisekiNoWa = AllocateFukusosuuVec( nlen );
-			naiseki = AllocateFukusosuuMtx( n20or4or2, nlen );
-			seqVector1 = AllocateFukusosuuMtx( n20or4or2, nlen+1 );
-			seqVector2 = AllocateFukusosuuMtx( n20or4or2, nlen+1 );
-			soukan = AllocateDoubleVec( nlen+1 );
-		}
+		//tmpseq1 = AllocateCharMtx( njob, nlen );
+		//tmpseq2 = AllocateCharMtx( njob, nlen );
+		//if( !kobetsubunkatsu )
+		//{
+		//	naisekiNoWa = AllocateFukusosuuVec( nlen );
+		//	naiseki = AllocateFukusosuuMtx( n20or4or2, nlen );
+		//	seqVector1 = AllocateFukusosuuMtx( n20or4or2, nlen+1 );
+		//	seqVector2 = AllocateFukusosuuMtx( n20or4or2, nlen+1 );
+		//	soukan = AllocateDoubleVec( nlen+1 );
+		//}
 #if RND
-		rndseq1 = AllocateCharMtx( njob, nlen );
-		rndseq2 = AllocateCharMtx( njob, nlen );
-		for( i=0; i<njob; i++ )
-		{
-			generateRndSeq( rndseq1[i], nlen );
-			generateRndSeq( rndseq2[i], nlen );
-		}
+		//rndseq1 = AllocateCharMtx( njob, nlen );
+		//rndseq2 = AllocateCharMtx( njob, nlen );
+		//for( i=0; i<njob; i++ )
+		//{
+		//	generateRndSeq( rndseq1[i], nlen );
+		//	generateRndSeq( rndseq2[i], nlen );
+		//}
 #endif
 		localalloclen = nlen;
 	}
 	
+#if 0
 	for( j=0; j<clus1; j++ ) strcpy( tmpseq1[j], seq1[j] );
 	for( j=0; j<clus2; j++ ) strcpy( tmpseq2[j], seq2[j] );
 
-#if 0
-fftfp = fopen( "input_of_Falign", "w" );
-fprintf( fftfp, "nlen = %d\n", nlen );
-fprintf( fftfp, "seq1: ( %d sequences ) \n", clus1 );
-for( i=0; i<clus1; i++ )
-	fprintf( fftfp, "%s\n", seq1[i] );
-fprintf( fftfp, "seq2: ( %d sequences ) \n", clus2 );
-for( i=0; i<clus2; i++ )
-	fprintf( fftfp, "%s\n", seq2[i] );
-fclose( fftfp );
-system( "less input_of_Falign < /dev/tty > /dev/tty" );
-#endif
 	if( !kobetsubunkatsu )
 	{
 		if( fftkeika ) fprintf( stderr,  " FFT ... " );
@@ -1873,19 +1988,6 @@ system( "less input_of_Falign < /dev/tty > /dev/tty" );
 		{
 			vec_init2( seqVector1, rndseq1[i], eff1[i], len1, nlen );
 		}
-#endif
-#if 0
-fftfp = fopen( "seqVec", "w" );
-fprintf( fftfp, "before transform\n" );
-for( k=0; k<n20or4or2; k++ ) 
-{
-   fprintf( fftfp, "nlen=%d\n", nlen );
-   fprintf( fftfp, "%c\n", amino[k] );
-   for( l=0; l<nlen; l++ )
-   fprintf( fftfp, "%f %f\n", seqVector1[k][l].R, seqVector1[k][l].I );
-}
-fclose( fftfp );
-system( "less seqVec < /dev/tty > /dev/tty" );
 #endif
 
 		for( j=0; j<n20or4or2; j++ ) vec_init( seqVector2[j], nlen );
@@ -1918,36 +2020,12 @@ system( "less seqVec < /dev/tty > /dev/tty" );
 		}
 #endif
 
-#if 0
-fftfp = fopen( "seqVec2", "w" );
-fprintf( fftfp, "before fft\n" );
-for( k=0; k<n20or4or2; k++ ) 
-{
-   fprintf( fftfp, "%c\n", amino[k] );
-   for( l=0; l<nlen; l++ )
-   fprintf( fftfp, "%f %f\n", seqVector2[k][l].R, seqVector2[k][l].I );
-}
-fclose( fftfp );
-system( "less seqVec2 < /dev/tty > /dev/tty" );
-#endif
 
 		for( j=0; j<n20or4or2; j++ )
 		{
 			fft( nlen, seqVector2[j], 0 );
 			fft( nlen, seqVector1[j], 0 );
 		}
-#if 0
-fftfp = fopen( "seqVec2", "w" );
-fprintf( fftfp, "#after fft\n" );
-for( k=0; k<n20or4or2; k++ ) 
-{
-   fprintf( fftfp, "#%c\n", amino[k] );
-   for( l=0; l<nlen; l++ )
-	   fprintf( fftfp, "%f %f\n", seqVector2[k][l].R, seqVector2[k][l].I );
-}
-fclose( fftfp );
-system( "less seqVec2 < /dev/tty > /dev/tty" );
-#endif
 
 		for( k=0; k<n20or4or2; k++ ) 
 		{
@@ -1965,14 +2043,6 @@ system( "less seqVec2 < /dev/tty > /dev/tty" );
 			}
 		}
 	
-#if 0
-	fftfp = fopen( "naisekiNoWa", "w" );
-	fprintf( fftfp, "#Before fft\n" );
-	for( l=0; l<nlen; l++ )
-		fprintf( fftfp, "%d  %f %f\n", l, naisekiNoWa[l].R, naisekiNoWa[l].I ); 
-	fclose( fftfp );
-	system( "less naisekiNoWa < /dev/tty > /dev/tty " );
-#endif
 
 		fft( -nlen, naisekiNoWa, 0 );
 	
@@ -1981,29 +2051,6 @@ system( "less seqVec2 < /dev/tty > /dev/tty" );
 		for( m=nlen2+1; m<nlen; m++ ) 
 			soukan[m] = naisekiNoWa[nlen+nlen2-m].R;
 
-#if 0
-	fftfp = fopen( "naisekiNoWa", "w" );
-	fprintf( fftfp, "#After fft\n" );
-	for( l=0; l<nlen; l++ )
-		fprintf( fftfp, "%d  %f\n", l, naisekiNoWa[l].R ); 
-	fclose( fftfp );
-	fftfp = fopen( "list.plot", "w"  );
-	fprintf( fftfp, "plot 'naisekiNoWa'\npause -1" );
-	fclose( fftfp );
-	system( "/usr/bin/gnuplot list.plot &" );
-#endif
-#if 0
-	fprintf( stderr, "soukan\n" );
-	for( l=0; l<nlen; l++ )
-		fprintf( stderr, "%d  %f\n", l-nlen2, soukan[l] ); 
-#if 0
-	fftfp = fopen( "list.plot", "w"  );
-	fprintf( fftfp, "plot 'frt'\n pause +1" );
-	fclose( fftfp );
-	system( "/usr/bin/gnuplot list.plot" );
-#endif
-#endif
-
 
 		nkouho = getKouho( kouho, NKOUHO_LONG, soukan, nlen );
 
@@ -2022,11 +2069,6 @@ system( "less seqVec2 < /dev/tty > /dev/tty" );
 
 
 
-#define CAND 0
-#if CAND
-	fftfp = fopen( "cand", "w" );
-	fclose( fftfp );
-#endif
 	if( kobetsubunkatsu )
 	{
 		maxk = 1;
@@ -2043,15 +2085,6 @@ system( "less seqVec2 < /dev/tty > /dev/tty" );
 		if( lag <= -len1 || len2 <= lag ) continue;
 //		fprintf( stderr, "k=%d, lag=%d\n", k, lag );
 		zurasu2( lag, clus1, clus2, seq1, seq2, tmpptr1, tmpptr2 );
-#if CAND
-		fftfp = fopen( "cand", "a" );
-		fprintf( fftfp, ">Candidate No.%d lag = %d\n", k+1, lag );
-		fprintf( fftfp, "%s\n", tmpptr1[0] );
-		fprintf( fftfp, ">Candidate No.%d lag = %d\n", k+1, lag );
-		fprintf( fftfp, "%s\n", tmpptr2[0] );
-		fprintf( fftfp, ">\n", k+1, lag );
-		fclose( fftfp );
-#endif
 
 //		fprintf( stderr, "lag = %d\n", lag );
 		tmpint = alignableReagion( clus1, clus2, tmpptr1, tmpptr2, eff1, eff2, segment+count );
@@ -2270,18 +2303,1122 @@ system( "less seqVec2 < /dev/tty > /dev/tty" );
 	
 		}
 	}
+	//uwagaki!
+#endif
 
-//	exit( 0 );
+	marginfac1 = 1.0 + estimategapfreq( clus1, seq1 );
+	marginfac2 = 1.0 + estimategapfreq( clus2, seq2 );
+	starttermcut1 = starttermcut2 = 0;
+	endtermcut1 = endtermcut2 = 0;
+//	reporterr( "marginfac1=%f\n", marginfac1 );
+//	reporterr( "marginfac2=%f\n", marginfac2 );
 
-#if 0
-	fftfp = fopen( "fft", "a" );
-	fprintf( fftfp, "RESULT after sort:\n" );
-	for( l=0; l<count; l++ )
+//	reporterr( "length1,length2=%d,%d\n", len1, len2  );
+//	reporterr( "pairanch when uwagaki: %d:%d\n", pairanch[0].starti, pairanch[0].startj );
+//	reporterr( "pairanch when uwagaki: i=%d, j=%d\n", pairanch[0].i, pairanch[0].j );
+	count = count0 = 0;
+	cut1[0] = 0;
+	cut2[0] = 0;
+	alignorcopy[0] = 'a';
+//	while( pairanch[count].i == 0 &&  pairanch[count].j == 0 ) // ato de kentou
+	while( pairanch[count0].i > -1 )
 	{
-		fprintf( fftfp, "cut[%d]=%d, ", l, segment1[l].center );
-		fprintf( fftfp, "%d\n", segment2[l].center );
-	}
-	fclose( fftfp );
+		if( pairanch[count0].starti == -1 ) 
+		{
+			count0++;
+			continue;
+		}
+		if( count+2 > MAXSEG -3 ) ErrorExit( "TOO MANY SEGMENTS.\n" );
+#if 1 // mattan no tansaku hann'i wo seigen
+		if( count == 0 ) 	
+		{
+//			if( pairanch[count0].starti - pairanch[count0].startj > TERMINALSEGMENTLENGTH ) // you kentou
+//			nogaplen1 = estimatenogaplen( clus1, seq1, pairanch[count0].starti, 0 );
+//			nogaplen2 = estimatenogaplen( clus2, seq2, pairanch[count0].startj, 0 );
+			if( pairanch[count0].starti > terminalmargin(pairanch[count0].startj,marginfac1) )
+			{
+//				alignorcopy[1] = 'A';
+//				reporterr( "check 1, because starti=%d > startj=%d -> %d (clus1=%d)\n", pairanch[count0].starti, pairanch[count0].startj, terminalmargin(pairanch[count0].startj,marginfac1), clus1 );
+				cutadd = pairanch[count0].starti - terminalmargin(pairanch[count0].startj,marginfac1);
+//				reporterr( "cutadd(1)=%d\n", cutadd );
+//				if( 1 || cutadd > TERMINALMARGIN(0) ) // iranai
+				{
+					cut1[1] = cutadd;
+					cut2[1] = 0;
+					count += 1;
+					alignorcopy[1] = 'A';
+					starttermcut1 = 1;
+				}
+			}
+			else if( pairanch[count0].startj > terminalmargin(pairanch[count0].starti, marginfac2) )
+			{
+//				alignorcopy[1] = 'A';
+//				reporterr( "check 2, because startj=%d > starti=%d -> %d (clus2=%d)\n", pairanch[count0].startj, pairanch[count0].starti, terminalmargin(pairanch[count0].starti,marginfac2), clus2 );
+				cutadd = pairanch[count0].startj - terminalmargin( pairanch[count0].starti, marginfac2 );
+//				reporterr( "cutadd(2)=%d\n", cutadd );
+				{
+					cut1[1] = 0;
+					cut2[1] = cutadd;
+					count += 1;
+					alignorcopy[1] = 'A';
+					starttermcut2 = 1;
+				}
+			}
+		}
+#endif
+#if 1
+//		reporterr( "pairanch when uwagaki: %d:%d\n", pairanch[count0].starti, pairanch[count0].startj );
+		cut1[count+1] = pairanch[count0].starti;
+		cut2[count+1] = pairanch[count0].startj;
+		alignorcopy[count+1] = 'c';
+		count += 1;
+
+#if 1
+		if( pairanch[count0].endi - cut1[count] == pairanch[count0].endj - cut2[count] )
+		while( pairanch[count0].endi+1 - cut1[count] > 100 && pairanch[count0].endj+1 - cut2[count] > 100 )
+		{
+			reporterr( "added an anchor, because the length is %d,%d > 100\n", pairanch[count0].endi+1 - cut1[count], pairanch[count0].endj+1 - cut2[count] );
+			cut1[count+1] = cut1[count] + 100;
+			cut2[count+1] = cut2[count] + 100;
+			alignorcopy[count+1] = 'c';
+			count += 1;
+		}
+#endif
+
+		cut1[count+1] = pairanch[count0].endi+1;
+		cut2[count+1] = pairanch[count0].endj+1;
+		alignorcopy[count+1] = 'a';
+//		reporterr( "\n###cut at %d and %d / %d\n", cut1[count+1], cut1[count+2], len1 );
+//		reporterr( "\n###cut at %d and %d / %d\n", cut2[count+1], cut2[count+2], len2 );
+		count += 1;
+		count0++;
+	}
+
+#if 1 // mattan no tansaku hanni wo seigen
+	alignorcopy[count] = 'a';
+//	if( count > 1 && (len1-cut1[count]) > (len2-cut2[count]) + 2*TERMINALSEGMENTLENGTH ) // 2 ha tekitou
+	if( count > 1 && (len1-cut1[count]) > terminalmargin(len2-cut2[count],marginfac1) )
+	{
+//		reporterr( "last\n" );
+//		alignorcopy[count] = 'A'; // mae no wo uwagaki
+		//reporterr( "insert one anchor to restrict terminal gap length, 1, cut1[count]=%d, cut2[count]=%d\n", cut1[count], cut2[count] );
+		//alignorcopy[count] = 'A'; // mae no wo uwagaki
+//		cut1[count+1] = cut1[count] + TERMINALSEGMENTLENGTH;
+//		cut1[count+1] = cut1[count] + (len2-cut2[count]) + TERMINALSEGMENTLENGTH;
+
+		cutadd = len1 - 1 - ( (len1-cut1[count]) - terminalmargin(len2-cut2[count], marginfac1) ); // wakarinikuikedo
+
+//		if( 1 || len1-1 - cutadd > TERMINALMARGIN(0) )
+		{
+			alignorcopy[count] = 'A'; // mae no wo uwagaki
+			cut1[count+1] = cutadd;
+			cut2[count+1] = len2;
+			alignorcopy[count+1] = 'a';
+			cut1[count+2] = len1;
+			cut2[count+2] = len2;
+			alignorcopy[count+2] = 'c'; // tsukawanai
+			count += 1;
+			endtermcut1 = 1;
+		}
+	}
+//	else if( count > 1 && (len2-cut2[count]) > (len1-cut1[count])  + 2*TERMINALSEGMENTLENGTH ) // 2 ha tekitou
+	else if( count > 1 && (len2-cut2[count]) > terminalmargin(len1-cut1[count],marginfac2) )
+	{
+//		reporterr( "last\n" );
+//		alignorcopy[count] = 'A'; // mae no wo uwagaki
+		//reporterr( "insert one anchor to restrict terminal gap length, 2, cut1[count]=%d, cut2[count]=%d\n", cut1[count], cut2[count] );
+		//alignorcopy[count] = 'A'; // mae no wo uwagaki
+		cutadd = len2 - 1 - ( (len2-cut2[count]) - terminalmargin(len1-cut1[count], marginfac2) );
+
+//		if( 1 || len2-1 - cutadd > TERMINALMARGIN(0) ) // iranai
+		{
+			alignorcopy[count] = 'A'; // mae no wo uwagaki
+			cut1[count+1] = len1;
+			cut2[count+1] = cutadd;
+			alignorcopy[count+1] = 'a';
+			cut1[count+2] = len1;
+			cut2[count+2] = len2;
+			alignorcopy[count+2] = 'c'; // tsukawanai
+			count += 1;
+			endtermcut2 = 1;
+		}
+	}
+#endif
+
+	if( cut1[count] != len1 || cut2[count] != len2 )
+	{
+		cut1[count+1] = len1;
+		cut2[count+1] = len2;
+		alignorcopy[count+1] = 'c'; // tsukawanai kedo
+		count += 1;
+	}
+	count += 1;
+
+
+#if 0
+	for( i=0; i<count; i++ )
+	{
+		reporterr( "cut1[%d],cut2[%d]=%d,%d, alignorcopy=%c\n", i, i, cut1[i], cut2[i], alignorcopy[i] );
+	}
+#endif
+
+
+#else
+		reporterr( "pairanch when uwagaki: %d:%d\n", pairanch[count0].starti, pairanch[count0].startj );
+		cut1[count+1] = pairanch[count0].starti;
+		cut2[count+1] = pairanch[count0].startj;
+		reporterr( "###cut at %d and %d\n", cut1[count+1], cut1[count+2] );
+		reporterr( "###cut at %d and %d\n", cut2[count+1], cut2[count+2] );
+		count += 1;
+		count0++;
+	}
+	cut1[count+1] = len1;
+	cut2[count+1] = len2;
+	count += 2;
+#endif
+
+	totallen = 0;
+	for( j=0; j<clus1; j++ ) result1[j][0] = 0;
+	for( j=0; j<clus2; j++ ) result2[j][0] = 0;
+	totalscore = 0.0;
+	*fftlog = -1;
+//exit( 1 );
+	for( i=0; i<count-1; i++ )
+	{
+		//reporterr( "\ni=%d / %d \n\n", i, count );
+		*fftlog += 1;
+		if( i == 0 || ( i == 1 && alignorcopy[1] == 'A' ) ) headgp = outgap; else headgp = 1;
+		if( i == count-2 || ( i == count-3 && alignorcopy[count-3] == 'A' ) ) tailgp = outgap; else tailgp = 1;
+		//reporterr( "i=%d, headgp=%d\n", i, headgp );
+		//reporterr( "i=%d, tailgp=%d\n", i, tailgp );
+
+		//for( j=0; j<clus1; j++ ) reporterr( "Cut seq 0-%d at %d\n", j, cut1[i] );
+		//for( j=0; j<clus2; j++ ) reporterr( "Cut seq 1-%d at %d\n", j, cut2[i] );
+
+#if 0 // hoka mo atode henkou suru
+		if( cut1[i] )
+		{
+//			getkyokaigap( sgap1, seq1, cut1[i]-1, clus1 );
+//			getkyokaigap( sgap2, seq2, cut2[i]-1, clus2 );
+			getkyokaigap( sgap1, tmpres1, nlen-1, clus1 );
+			getkyokaigap( sgap2, tmpres2, nlen-1, clus2 );
+		}
+		else
+		{
+			for( j=0; j<clus1; j++ ) sgap1[j] = 'o';
+			for( j=0; j<clus2; j++ ) sgap2[j] = 'o';
+		}
+		if( cut1[i+1] != len1 )
+		{       
+			getkyokaigap( egap1, seq1, cut1[i+1], clus1 );
+			getkyokaigap( egap2, seq2, cut2[i+1], clus2 );
+		}       
+		else    
+		{       
+			for( j=0; j<clus1; j++ ) egap1[j] = 'o';
+			for( j=0; j<clus2; j++ ) egap2[j] = 'o';
+		}
+#else
+		if( cut1[i] )
+			getkyokaigap( sgap1, seq1, cut1[i]-1, clus1 );
+		else
+			for( j=0; j<clus1; j++ ) sgap1[j] = 'o';
+		if( cut2[i] )
+			getkyokaigap( sgap2, seq2, cut2[i]-1, clus2 );
+		else
+			for( j=0; j<clus2; j++ ) sgap2[j] = 'o';
+
+		if( cut1[i+1] != len1 )
+			getkyokaigap( egap1, seq1, cut1[i+1], clus1 );
+		else    
+			for( j=0; j<clus1; j++ ) egap1[j] = 'o';
+		if( cut2[i+1] != len2 )
+			getkyokaigap( egap2, seq2, cut2[i+1], clus2 );
+		else    
+			for( j=0; j<clus2; j++ ) egap2[j] = 'o';
+#endif
+#if DEBUG
+		fprintf( stderr, "DP %03d / %03d %4d to ", i+1, count-1, totallen );
+#else
+#if 1
+		if( 1 || fftkeika ) fprintf( stderr, "DP %05d / %05d \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b", i+1, count-1 );
+#endif
+#endif
+		for( j=0; j<clus1; j++ )
+		{
+//			if( cut1[i+1]-cut1[i] <= 0 )
+//				fprintf( stderr, "### cut1[i+1]=%d, cut1[i]=%d\n", cut1[i+1], cut1[i] );
+			strncpy( tmpres1[j], seq1[j]+cut1[i], cut1[i+1]-cut1[i] );
+			tmpres1[j][cut1[i+1]-cut1[i]] = 0;
+		}
+		orilen1 = strlen( tmpres1[0] );
+//		if( kobetsubunkatsu && fftkeika && i%2==0 ) commongappick( clus1, tmpres1 ); // for last-restricted alignment
+		if( kobetsubunkatsu && fftkeika ) commongappick( clus1, tmpres1 ); //dvtditr $B$K8F$P$l$?$H$-(B fftkeika=1
+//		if( kobetsubunkatsu ) commongappick( clus1, tmpres1 );
+		for( j=0; j<clus2; j++ )
+		{
+//			fprintf( stderr, "### cut2[i+1]-cut2[i] = %d\n", cut2[i+1]-cut2[i] );
+//			if( cut2[i+1]-cut2[i] <= 0 )
+//				fprintf( stderr, "### cut2[i+1]=%d, cut2[i]=%d\n", cut2[i+1], cut2[i] );
+			strncpy( tmpres2[j], seq2[j]+cut2[i], cut2[i+1]-cut2[i] );
+			tmpres2[j][cut2[i+1]-cut2[i]] = 0;
+		}
+		orilen2 = strlen( tmpres2[0] );
+//		if( kobetsubunkatsu && fftkeika && i%2==0 ) commongappick( clus2, tmpres2 ); // for last-restricted alignment
+		if( kobetsubunkatsu && fftkeika ) commongappick( clus2, tmpres2 ); //dvtditr $B$K8F$P$l$?$H$-(B fftkeika=1
+//		if( kobetsubunkatsu ) commongappick( clus2, tmpres2 );
+
+		if( constraint )
+		{
+			fprintf( stderr, "Not supported\n" );
+			exit( 1 );
+		}
+#if 0
+		fprintf( stderr, "i=%d, before alignment", i );
+		fprintf( stderr, "%4d\n", totallen );
+		fprintf( stderr, "\n\n" );
+		for( j=0; j<clus1; j++ ) 
+		{
+			fprintf( stderr, "%s\n", tmpres1[j] );
+		}
+		fprintf( stderr, "-------\n" );
+		for( j=0; j<clus2; j++ ) 
+		{
+			fprintf( stderr, "%s\n", tmpres2[j] );
+		}
+#endif
+
+#if 0
+		fprintf( stdout, "writing input\n" );
+		for( j=0; j<clus1; j++ )
+		{
+			fprintf( stdout, ">%d of GROUP1\n", j );
+			fprintf( stdout, "%s\n", tmpres1[j] );
+		}
+		for( j=0; j<clus2; j++ )
+		{
+			fprintf( stdout, ">%d of GROUP2\n", j );
+			fprintf( stdout, "%s\n", tmpres2[j] );
+		}
+		fflush( stdout );
+#endif
+//		reporterr( "i=%d, orilen1=%d, len1=%d, strlen(tmpseq1[0])=%d\n", i, orilen1, len1, strlen(tmpres1[0]) );
+//		if( i%2 == 1 && orilen1==len1 && orilen1==orilen2 && orilen1==strlen( tmpres1[0] ) ) // zenchou itchi no toki nomi
+//		if( 0 && i%2 == 1 && orilen1==orilen2 && orilen1==strlen( tmpres1[0] ) && !strcmp( tmpres1[0], tmpres2[0] ) ) // ato de fukkatsu saseru
+		if( alignorcopy[i] == 'c'  && orilen1==orilen2 && orilen1==strlen( tmpres1[0] ) && !strcmp( tmpres1[0], tmpres2[0] ) ) // ato de fukkatsu saseru
+		{
+//			checklength = 1;
+#if 0
+			reporterr( "\ncopying\n" );
+			for( j=0; j<clus1; j++ )
+				reporterr( "tmpres1[j] = %s\n", tmpres1[j] );
+			for( j=0; j<clus2; j++ )
+				reporterr( "tmpres2[j] = %s\n", tmpres2[j] );
+#endif
+//			if( strlen( tmpres1[0] ) != strlen( tmpres2[0] ) )
+//			{
+//				reporterr( "Length differs? %d != %d\n", strlen( tmpres1[0] ), strlen( tmpres2[0] ) );
+//				reporterr( "i=%d / %d\n", i, count-1 );
+//				exit( 1 );
+//			}
+		}
+		else
+		{
+//			reporterr( "\naligning %d x %d\n", strlen(tmpres1[0]), strlen(tmpres2[0]) );
+			{
+				//reporterr( "alignorcopy=%c, i=%d, seq1=%s\n", alignorcopy[i], i, tmpres1[0] );
+				//reporterr( "alignorcopy=%c, i=%d, seq2=%s\n", alignorcopy[i], i, tmpres2[0] );
+				if( alignorcopy[i] == 'A' ) // penalty_exx ..
+//				if( 0 && alignorcopy[i] == 'A' ) // CHUUI! 'A' mukou
+				{
+					int penalty_exx;
+					if( penalty_ex == 0 ) penalty_exx = -179; // == --exp 0.1 toriaezu
+					else penalty_exx = penalty_ex;
+					//reporterr( "i=%d, nomemsave, TERMINAL, penalty_exx = %d\n", i, penalty_exx );
+					if( scoringmatrices ) // called by tditeration.c
+						totalscore += A__align_variousdist( whichmtx, scoringmatrices, NULL, penalty, penalty_exx, tmpres1, tmpres2, eff1, eff2, eff1s, eff2s, clus1, clus2, alloclen, 0, NULL, sgap1, sgap2, egap1, egap2, NULL, 0, NULL, headgp, tailgp );
+					else
+						totalscore += A__align( n_dynamicmtx, penalty, penalty_exx, tmpres1, tmpres2, eff1, eff2, clus1, clus2, alloclen, 0, NULL, sgap1, sgap2, egap1, egap2, NULL, 0, NULL, headgp, tailgp, -1, -1, NULL, NULL, NULL, 0.0, 0.0 );
+					//use_getrusage();
+				}
+				else if( alg == 'A' )
+//				else if( alg == 'A' || alignorcopy[i] == 'A' ) // hitomazu
+				{
+					if( scoringmatrices ) // called by tditeration.c
+						totalscore += A__align_variousdist( whichmtx, scoringmatrices, NULL, penalty, penalty_ex, tmpres1, tmpres2, eff1, eff2, eff1s, eff2s, clus1, clus2, alloclen, 0, NULL, sgap1, sgap2, egap1, egap2, NULL, 0, NULL, headgp, tailgp );
+					else
+						totalscore += A__align( n_dynamicmtx, penalty, penalty_ex, tmpres1, tmpres2, eff1, eff2, clus1, clus2, alloclen, 0, NULL, sgap1, sgap2, egap1, egap2, NULL, 0, NULL, headgp, tailgp, -1, -1, NULL, NULL, NULL, 0.0, 0.0 );
+				}
+				else if( alg == 'M' )
+				{
+					if( scoringmatrices ) // called by tditeration.c
+						totalscore += MSalignmm_variousdist( NULL, scoringmatrices, NULL, tmpres1, tmpres2, eff1, eff2, eff1s, eff2s, clus1, clus2, alloclen, sgap1, sgap2, egap1, egap2, NULL, 0, NULL, headgp, tailgp );
+					else
+						totalscore += MSalignmm( n_dynamicmtx, tmpres1, tmpres2, eff1, eff2, clus1, clus2, alloclen, sgap1, sgap2, egap1, egap2, NULL, 0, NULL, headgp, tailgp, NULL, NULL, NULL, 0.0, 0.0 );
+				}
+				else
+				{
+					fprintf( stderr, "alg = %c\n", alg );
+					ErrorExit( "ERROR IN SOURCE FILE Falign.c" );
+				}
+			}
+		}
+
+		if( i == 1 && alignorcopy[i] == 'A' )
+		{
+			if( starttermcut1 )
+			{
+				for( j=0; j<clus2; j++ ) if( tmpres2[j][0] != '-' ) break;
+				if( j<clus2 ) reporterr( "There may be a problem in a hard-coded parameter (1).  Please contact katoh at ifrec.osaka-u.ac.jp\n" );
+			}
+			else if( starttermcut2 )
+			{
+				for( j=0; j<clus1; j++ ) if( tmpres1[j][0] != '-' ) break;
+				if( j<clus1 ) reporterr( "There may be a problem in a hard-coded parameter (2).  Please contact katoh at ifrec.osaka-u.ac.jp\n" );
+			}
+			else
+				break;
+		}
+		else if( alignorcopy[i] == 'A' )
+		{	
+			int tmplen;
+			if( endtermcut1 )
+			{
+				tmplen = strlen( tmpres2[j] );
+				for( j=0; j<clus2; j++ ) if( tmpres2[j][tmplen-1] != '-' ) break;
+				if( j<clus2 ) reporterr( "There may be a problem in a hard-coded parameter (3).  Please contact katoh at ifrec.osaka-u.ac.jp\n" );
+			}
+			else if( endtermcut2 )
+			{
+				tmplen = strlen( tmpres1[j] );
+				for( j=0; j<clus1; j++ ) if( tmpres1[j][tmplen-1] != '-' ) break;
+				if( j<clus1 ) reporterr( "There may be a problem in a hard-coded parameter (4).  Please contact katoh at ifrec.osaka-u.ac.jp\n" );
+			}
+			else
+				break;
+		}
+
+		nlen = strlen( tmpres1[0] );
+
+		if( totallen + nlen > alloclen )
+		{
+			fprintf( stderr, "totallen=%d +  nlen=%d > alloclen = %d\n", totallen, nlen, alloclen );
+			ErrorExit( "LENGTH OVER in Falign\n " );
+		}
+		for( j=0; j<clus1; j++ ) strcat( result1[j], tmpres1[j] );
+		for( j=0; j<clus2; j++ ) strcat( result2[j], tmpres2[j] );
+		totallen += nlen;
+#if 0
+		fprintf( stderr, "i=%d", i );
+		fprintf( stderr, "%4d\n", totallen );
+		fprintf( stderr, "\n\n" );
+		for( j=0; j<clus1; j++ ) 
+		{
+			fprintf( stderr, "%s\n", tmpres1[j] );
+		}
+		fprintf( stderr, "-------\n" );
+		for( j=0; j<clus2; j++ ) 
+		{
+			fprintf( stderr, "%s\n", tmpres2[j] );
+		}
+#endif
+	}
+#if KEIKA
+	fprintf( stderr, "DP ... done   \n" );
+#endif
+
+	for( j=0; j<clus1; j++ ) strcpy( seq1[j], result1[j] );
+	for( j=0; j<clus2; j++ ) strcpy( seq2[j], result2[j] );
+#if 0
+	fprintf( stderr, "keika \n\n" );
+	for( j=0; j<clus1; j++ ) 
+	{
+		fprintf( stderr, ">group1-%d\n%s\n", j, result1[j] );
+	}
+	fprintf( stderr, "- - - - - - - - - - -\n" );
+	for( j=0; j<clus2; j++ ) 
+	{
+		fprintf( stderr, ">group2-%d\n%s\n", j, result2[j] );
+	}
+	if( clus1 == 2 ) exit( 1 );
+#endif
+	return( totalscore );
+}
+
+
+
+
+
+/*
+sakujo wo kentou (2010/10/05)
+*/
+double Falign_udpari_long( 
+			  int **whichmtx, double ***scoringmatrices, 
+			  double **n_dynamicmtx,
+			  char  **seq1, char  **seq2, 
+			  double *eff1, double *eff2, 
+			  double **eff1s, double **eff2s,
+			  int    clus1, int    clus2,
+			  int alloclen, int *fftlog )
+{
+	int i, j, k, l, m, maxk;
+	int nlen, nlen2, nlen4;
+	static TLS int prevalloclen = 0;
+	static TLS int crossscoresize = 0;
+	static TLS char **tmpseq1 = NULL;
+	static TLS char **tmpseq2 = NULL;
+	static TLS char **tmpptr1 = NULL;
+	static TLS char **tmpptr2 = NULL;
+	static TLS char **tmpres1 = NULL;
+	static TLS char **tmpres2 = NULL;
+	static TLS char **result1 = NULL;
+	static TLS char **result2 = NULL;
+#if RND
+	static TLS char **rndseq1 = NULL;
+	static TLS char **rndseq2 = NULL;
+#endif
+	static TLS Fukusosuu **seqVector1 = NULL;
+	static TLS Fukusosuu **seqVector2 = NULL;
+	static TLS Fukusosuu **naiseki = NULL;   
+	static TLS Fukusosuu *naisekiNoWa = NULL; 
+	static TLS double *soukan = NULL;
+	static TLS double **crossscore = NULL;
+	int nlentmp;
+	static TLS int *kouho = NULL;
+	static TLS Segment *segment = NULL;
+	static TLS Segment *segment1 = NULL;
+	static TLS Segment *segment2 = NULL;
+	static TLS Segment **sortedseg1 = NULL;
+	static TLS Segment **sortedseg2 = NULL;
+	static TLS int *cut1 = NULL;
+	static TLS int *cut2 = NULL;
+	static TLS char *sgap1, *egap1, *sgap2, *egap2;
+	static TLS int localalloclen = 0;
+	int lag;
+	int tmpint;
+	int count, count0;
+	int len1, len2;
+	int totallen;
+	double totalscore;
+	int nkouho = 0;
+	int headgp, tailgp;
+//	double dumfl = 0.0;
+
+	if( seq1 == NULL )
+	{
+		if( result1 ) 
+		{
+//			fprintf( stderr, "### Freeing localarrays in Falign\n" );
+			localalloclen = 0;
+			prevalloclen = 0;
+			crossscoresize = 0;
+			mymergesort( 0, 0, NULL );
+			alignableReagion( 0, 0, NULL, NULL, NULL, NULL, NULL );
+			fft( 0, NULL, 1 );
+			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 );
+			A__align_variousdist( NULL, NULL, NULL, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, 0 );
+			D__align_variousdist( NULL, NULL, NULL, NULL, 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 );
+			blockAlign2( NULL, NULL, NULL, NULL, NULL, NULL );
+			if( crossscore ) FreeDoubleMtx( crossscore );
+			crossscore = NULL; // reallocate sareru kanousei ga arunode.
+			FreeCharMtx( result1 ); result1 = NULL;
+			FreeCharMtx( result2 );
+			FreeCharMtx( tmpres1 );
+			FreeCharMtx( tmpres2 );
+			FreeCharMtx( tmpseq1 );
+			FreeCharMtx( tmpseq2 );
+			free( sgap1 );
+			free( egap1 );
+			free( sgap2 );
+			free( egap2 );
+			free( kouho );
+			free( cut1 );
+			free( cut2 );
+			free( tmpptr1 );
+			free( tmpptr2 );
+			free( segment );
+			free( segment1 );
+			free( segment2 );
+			free( sortedseg1 );
+			free( sortedseg2 );
+			if( !kobetsubunkatsu )
+			{
+				FreeFukusosuuMtx ( seqVector1 );
+				FreeFukusosuuMtx ( seqVector2 );
+				FreeFukusosuuVec( naisekiNoWa );
+				FreeFukusosuuMtx( naiseki );
+				FreeDoubleVec( soukan );
+			}
+		}
+		else
+		{
+//			fprintf( stderr, "Did not allocate localarrays in Falign\n" );
+		}
+
+		return( 0.0 );
+	}
+
+
+
+	len1 = strlen( seq1[0] );
+	len2 = strlen( seq2[0] );
+	nlentmp = MAX( len1, len2 );
+
+	nlen = 1;
+	while( nlentmp >= nlen ) nlen <<= 1;
+#if 0
+	fprintf( stderr, "###   nlen    = %d\n", nlen );
+#endif
+
+	nlen2 = nlen/2; nlen4 = nlen2 / 2;
+
+#if 0
+	fprintf( stderr, "len1 = %d, len2 = %d\n", len1, len2 );
+	fprintf( stderr, "nlentmp = %d, nlen = %d\n", nlentmp, nlen );
+#endif
+
+	if( prevalloclen != alloclen ) // Falign_noudp mo kaeru
+	{
+		if( prevalloclen )
+		{
+			FreeCharMtx( result1 );
+			FreeCharMtx( result2 );
+			FreeCharMtx( tmpres1 );
+			FreeCharMtx( tmpres2 );
+		}
+//		fprintf( stderr, "\n\n\nreallocating ...\n" ); 
+		result1 = AllocateCharMtx( njob, alloclen );
+		result2 = AllocateCharMtx( njob, alloclen );
+		tmpres1 = AllocateCharMtx( njob, alloclen );
+		tmpres2 = AllocateCharMtx( njob, alloclen );
+		prevalloclen = alloclen;
+	}
+
+	if( !localalloclen )
+	{
+		sgap1 = AllocateCharVec( njob );
+		egap1 = AllocateCharVec( njob );
+		sgap2 = AllocateCharVec( njob );
+		egap2 = AllocateCharVec( njob );
+		kouho = AllocateIntVec( NKOUHO_LONG );
+		cut1 = AllocateIntVec( MAXSEG );
+		cut2 = AllocateIntVec( MAXSEG );
+		tmpptr1 = AllocateCharMtx( njob, 0 );
+		tmpptr2 = AllocateCharMtx( njob, 0 );
+		segment = (Segment *)calloc( MAXSEG, sizeof( Segment ) );
+		segment1 = (Segment *)calloc( MAXSEG, sizeof( Segment ) );
+		segment2 = (Segment *)calloc( MAXSEG, sizeof( Segment ) );
+		sortedseg1 = (Segment **)calloc( MAXSEG, sizeof( Segment * ) );
+		sortedseg2 = (Segment **)calloc( MAXSEG, sizeof( Segment * ) );
+		if( !( segment && segment1 && segment2 && sortedseg1 && sortedseg2 ) )
+			ErrorExit( "Allocation error\n" );
+
+		if     ( scoremtx == -1 ) n20or4or2 = 1;
+		else if( fftscore )       n20or4or2 = 1;
+		else                      n20or4or2 = 20;
+	}
+	if( localalloclen < nlen )
+	{
+		if( localalloclen )
+		{
+#if 1
+			if( !kobetsubunkatsu )
+			{
+				FreeFukusosuuMtx ( seqVector1 );
+				FreeFukusosuuMtx ( seqVector2 );
+				FreeFukusosuuVec( naisekiNoWa );
+				FreeFukusosuuMtx( naiseki );
+				FreeDoubleVec( soukan );
+			}
+			FreeCharMtx( tmpseq1 );
+			FreeCharMtx( tmpseq2 );
+#endif
+#if RND
+			FreeCharMtx( rndseq1 );
+			FreeCharMtx( rndseq2 );
+#endif
+		}
+
+
+		tmpseq1 = AllocateCharMtx( njob, nlen );
+		tmpseq2 = AllocateCharMtx( njob, nlen );
+		if( !kobetsubunkatsu )
+		{
+			naisekiNoWa = AllocateFukusosuuVec( nlen );
+			naiseki = AllocateFukusosuuMtx( n20or4or2, nlen );
+			seqVector1 = AllocateFukusosuuMtx( n20or4or2, nlen+1 );
+			seqVector2 = AllocateFukusosuuMtx( n20or4or2, nlen+1 );
+			soukan = AllocateDoubleVec( nlen+1 );
+		}
+#if RND
+		rndseq1 = AllocateCharMtx( njob, nlen );
+		rndseq2 = AllocateCharMtx( njob, nlen );
+		for( i=0; i<njob; i++ )
+		{
+			generateRndSeq( rndseq1[i], nlen );
+			generateRndSeq( rndseq2[i], nlen );
+		}
+#endif
+		localalloclen = nlen;
+	}
+	
+	for( j=0; j<clus1; j++ ) strcpy( tmpseq1[j], seq1[j] );
+	for( j=0; j<clus2; j++ ) strcpy( tmpseq2[j], seq2[j] );
+
+#if 0
+fftfp = fopen( "input_of_Falign", "w" );
+fprintf( fftfp, "nlen = %d\n", nlen );
+fprintf( fftfp, "seq1: ( %d sequences ) \n", clus1 );
+for( i=0; i<clus1; i++ )
+	fprintf( fftfp, "%s\n", seq1[i] );
+fprintf( fftfp, "seq2: ( %d sequences ) \n", clus2 );
+for( i=0; i<clus2; i++ )
+	fprintf( fftfp, "%s\n", seq2[i] );
+fclose( fftfp );
+system( "less input_of_Falign < /dev/tty > /dev/tty" );
+#endif
+	if( !kobetsubunkatsu )
+	{
+		if( fftkeika ) fprintf( stderr,  " FFT ... " );
+
+		for( j=0; j<n20or4or2; j++ ) vec_init( seqVector1[j], nlen );
+		if( scoremtx == -1 )
+		{
+			for( i=0; i<clus1; i++ )
+				seq_vec_4( seqVector1[0], eff1[i], tmpseq1[i] );
+		}
+		else if( fftscore )
+		{
+			for( i=0; i<clus1; i++ )
+			{
+#if 0
+				seq_vec_2( seqVector1[0], polarity, eff1[i], tmpseq1[i] );
+				seq_vec_2( seqVector1[1], volume,   eff1[i], tmpseq1[i] );
+#else
+				seq_vec_5( seqVector1[0], polarity, volume, eff1[i], tmpseq1[i] );
+#endif
+			}
+		}
+		else
+		{
+			for( i=0; i<clus1; i++ )
+				seq_vec_3( seqVector1, eff1[i], tmpseq1[i] );
+		}
+#if RND
+		for( i=0; i<clus1; i++ )
+		{
+			vec_init2( seqVector1, rndseq1[i], eff1[i], len1, nlen );
+		}
+#endif
+#if 0
+fftfp = fopen( "seqVec", "w" );
+fprintf( fftfp, "before transform\n" );
+for( k=0; k<n20or4or2; k++ ) 
+{
+   fprintf( fftfp, "nlen=%d\n", nlen );
+   fprintf( fftfp, "%c\n", amino[k] );
+   for( l=0; l<nlen; l++ )
+   fprintf( fftfp, "%f %f\n", seqVector1[k][l].R, seqVector1[k][l].I );
+}
+fclose( fftfp );
+system( "less seqVec < /dev/tty > /dev/tty" );
+#endif
+
+		for( j=0; j<n20or4or2; j++ ) vec_init( seqVector2[j], nlen );
+		if( scoremtx == -1 )
+		{
+			for( i=0; i<clus2; i++ )
+				seq_vec_4( seqVector2[0], eff2[i], tmpseq2[i] );
+		}
+		else if( fftscore )
+		{
+			for( i=0; i<clus2; i++ )
+			{
+#if 0
+				seq_vec_2( seqVector2[0], polarity, eff2[i], tmpseq2[i] );
+				seq_vec_2( seqVector2[1], volume,   eff2[i], tmpseq2[i] );
+#else
+				seq_vec_5( seqVector2[0], polarity, volume, eff2[i], tmpseq2[i] );
+#endif
+			}
+		}
+		else
+		{
+			for( i=0; i<clus2; i++ )
+				seq_vec_3( seqVector2, eff2[i], tmpseq2[i] );
+		}
+#if RND
+		for( i=0; i<clus2; i++ )
+		{
+			vec_init2( seqVector2, rndseq2[i], eff2[i], len2, nlen );
+		}
+#endif
+
+#if 0
+fftfp = fopen( "seqVec2", "w" );
+fprintf( fftfp, "before fft\n" );
+for( k=0; k<n20or4or2; k++ ) 
+{
+   fprintf( fftfp, "%c\n", amino[k] );
+   for( l=0; l<nlen; l++ )
+   fprintf( fftfp, "%f %f\n", seqVector2[k][l].R, seqVector2[k][l].I );
+}
+fclose( fftfp );
+system( "less seqVec2 < /dev/tty > /dev/tty" );
+#endif
+
+		for( j=0; j<n20or4or2; j++ )
+		{
+			fft( nlen, seqVector2[j], 0 );
+			fft( nlen, seqVector1[j], 0 );
+		}
+#if 0
+fftfp = fopen( "seqVec2", "w" );
+fprintf( fftfp, "#after fft\n" );
+for( k=0; k<n20or4or2; k++ ) 
+{
+   fprintf( fftfp, "#%c\n", amino[k] );
+   for( l=0; l<nlen; l++ )
+	   fprintf( fftfp, "%f %f\n", seqVector2[k][l].R, seqVector2[k][l].I );
+}
+fclose( fftfp );
+system( "less seqVec2 < /dev/tty > /dev/tty" );
+#endif
+
+		for( k=0; k<n20or4or2; k++ ) 
+		{
+			for( l=0; l<nlen; l++ ) 
+				calcNaiseki( naiseki[k]+l, seqVector1[k]+l, seqVector2[k]+l );
+		}
+		for( l=0; l<nlen; l++ ) 
+		{
+			naisekiNoWa[l].R = 0.0;
+			naisekiNoWa[l].I = 0.0;
+			for( k=0; k<n20or4or2; k++ ) 
+			{
+				naisekiNoWa[l].R += naiseki[k][l].R;
+				naisekiNoWa[l].I += naiseki[k][l].I;
+			}
+		}
+	
+#if 0
+	fftfp = fopen( "naisekiNoWa", "w" );
+	fprintf( fftfp, "#Before fft\n" );
+	for( l=0; l<nlen; l++ )
+		fprintf( fftfp, "%d  %f %f\n", l, naisekiNoWa[l].R, naisekiNoWa[l].I ); 
+	fclose( fftfp );
+	system( "less naisekiNoWa < /dev/tty > /dev/tty " );
+#endif
+
+		fft( -nlen, naisekiNoWa, 0 );
+	
+		for( m=0; m<=nlen2; m++ ) 
+			soukan[m] = naisekiNoWa[nlen2-m].R;
+		for( m=nlen2+1; m<nlen; m++ ) 
+			soukan[m] = naisekiNoWa[nlen+nlen2-m].R;
+
+#if 0
+	fftfp = fopen( "naisekiNoWa", "w" );
+	fprintf( fftfp, "#After fft\n" );
+	for( l=0; l<nlen; l++ )
+		fprintf( fftfp, "%d  %f\n", l, naisekiNoWa[l].R ); 
+	fclose( fftfp );
+	fftfp = fopen( "list.plot", "w"  );
+	fprintf( fftfp, "plot 'naisekiNoWa'\npause -1" );
+	fclose( fftfp );
+	system( "/usr/bin/gnuplot list.plot &" );
+#endif
+#if 0
+	fprintf( stderr, "soukan\n" );
+	for( l=0; l<nlen; l++ )
+		fprintf( stderr, "%d  %f\n", l-nlen2, soukan[l] ); 
+#if 0
+	fftfp = fopen( "list.plot", "w"  );
+	fprintf( fftfp, "plot 'frt'\n pause +1" );
+	fclose( fftfp );
+	system( "/usr/bin/gnuplot list.plot" );
+#endif
+#endif
+
+
+		nkouho = getKouho( kouho, NKOUHO_LONG, soukan, nlen );
+
+#if 0
+		for( i=0; i<nkouho; i++ )
+		{
+			fprintf( stderr, "kouho[%d] = %d\n", i, kouho[i] );
+		}
+#endif
+	}
+
+#if KEIKA
+	fprintf( stderr, "Searching anchors ... " );
+#endif
+	count = 0;
+
+
+
+#define CAND 0
+#if CAND
+	fftfp = fopen( "cand", "w" );
+	fclose( fftfp );
+#endif
+	if( kobetsubunkatsu )
+	{
+		maxk = 1;
+		kouho[0] = 0;
+	}
+	else
+	{
+		maxk = nkouho;
+	}
+
+	for( k=0; k<maxk; k++ ) 
+	{
+		lag = kouho[k];
+		if( lag <= -len1 || len2 <= lag ) continue;
+//		fprintf( stderr, "k=%d, lag=%d\n", k, lag );
+		zurasu2( lag, clus1, clus2, seq1, seq2, tmpptr1, tmpptr2 );
+#if CAND
+		fftfp = fopen( "cand", "a" );
+		fprintf( fftfp, ">Candidate No.%d lag = %d\n", k+1, lag );
+		fprintf( fftfp, "%s\n", tmpptr1[0] );
+		fprintf( fftfp, ">Candidate No.%d lag = %d\n", k+1, lag );
+		fprintf( fftfp, "%s\n", tmpptr2[0] );
+		fprintf( fftfp, ">\n", k+1, lag );
+		fclose( fftfp );
+#endif
+
+//		fprintf( stderr, "lag = %d\n", lag );
+		tmpint = alignableReagion( clus1, clus2, tmpptr1, tmpptr2, eff1, eff2, segment+count );
+//		fprintf( stderr, "lag = %d, %d found\n", lag, tmpint );
+
+//		if( lag == -50 ) exit( 1 );
+		
+		if( count+tmpint > MAXSEG -3 ) ErrorExit( "TOO MANY SEGMENTS.\n" );
+
+//		fprintf( stderr, "##### k=%d / %d\n", k, maxk );
+//		if( tmpint == 0 ) break; // 060430 iinoka ? // 090530 yameta
+		while( tmpint-- > 0 )
+		{
+#if 0
+			if( segment[count].end - segment[count].start < fftWinSize )
+			{
+				count++;
+				continue;
+			}
+#endif
+			if( lag > 0 )
+			{
+				segment1[count].start  = segment[count].start ;
+				segment1[count].end    = segment[count].end   ;
+				segment1[count].center = segment[count].center;
+				segment1[count].score  = segment[count].score;
+
+				segment2[count].start  = segment[count].start  + lag;
+				segment2[count].end    = segment[count].end    + lag;
+				segment2[count].center = segment[count].center + lag;
+				segment2[count].score  = segment[count].score       ;
+			}
+			else
+			{
+				segment1[count].start  = segment[count].start  - lag;
+				segment1[count].end    = segment[count].end    - lag;
+				segment1[count].center = segment[count].center - lag;
+				segment1[count].score  = segment[count].score       ;
+
+				segment2[count].start  = segment[count].start ;
+				segment2[count].end    = segment[count].end   ;
+				segment2[count].center = segment[count].center;
+				segment2[count].score  = segment[count].score ;
+			}
+#if 0
+			fprintf( stderr, "##### k=%d / %d\n", k, maxk );
+			fprintf( stderr, "anchor %d, score = %f\n", count, segment1[count].score );
+			fprintf( stderr, "in 1 %d\n", segment1[count].center );
+			fprintf( stderr, "in 2 %d\n", segment2[count].center );
+#endif
+			segment1[count].pair = &segment2[count];
+			segment2[count].pair = &segment1[count];
+			count++;
+#if 0
+			fprintf( stderr, "count=%d\n", count );
+#endif
+		}
+	}
+#if 1
+	if( !kobetsubunkatsu )
+		if( fftkeika ) fprintf( stderr, "done. (%d anchors) ", count );
+#endif
+	if( !count && fftNoAnchStop )
+		ErrorExit( "Cannot detect anchor!" );
+#if 0
+	fprintf( stderr, "RESULT before sort:\n" );
+	for( l=0; l<count+1; l++ )
+	{
+		fprintf( stderr, "cut[%d]=%d, ", l, segment1[l].center );
+		fprintf( stderr, "%d score = %f\n", segment2[l].center, segment1[l].score );
+	}
+#endif
+
+	for( i=0; i<count; i++ )
+	{
+		sortedseg1[i] = &segment1[i];
+		sortedseg2[i] = &segment2[i];
+	}
+#if 0
+	tmpsort( count, sortedseg1 ); 
+	tmpsort( count, sortedseg2 ); 
+	qsort( sortedseg1, count, sizeof( Segment * ), segcmp );
+	qsort( sortedseg2, count, sizeof( Segment * ), segcmp );
+#else
+	mymergesort( 0, count-1, sortedseg1 ); 
+	mymergesort( 0, count-1, sortedseg2 ); 
+#endif
+	for( i=0; i<count; i++ ) sortedseg1[i]->number = i;
+	for( i=0; i<count; i++ ) sortedseg2[i]->number = i;
+
+
+
+	if( kobetsubunkatsu )
+	{
+		for( i=0; i<count; i++ )
+	    {
+			cut1[i+1] = sortedseg1[i]->center;
+			cut2[i+1] = sortedseg2[i]->center;
+		}
+		cut1[0] = 0;
+		cut2[0] = 0;
+		cut1[count+1] = len1;
+		cut2[count+1] = len2;
+		count += 2;
+	}
+
+	else
+	{
+		if( count < 5000 )
+		{
+			if( crossscoresize < count+2 )
+			{
+				crossscoresize = count+2;
+#if 1
+				if( fftkeika ) fprintf( stderr, "######allocating crossscore, size = %d\n", crossscoresize );
+#endif
+				if( crossscore ) FreeDoubleMtx( crossscore );
+				crossscore = AllocateDoubleMtx( crossscoresize, crossscoresize );
+			}
+			for( i=0; i<count+2; i++ ) for( j=0; j<count+2; j++ )
+				crossscore[i][j] = 0.0;
+			for( i=0; i<count; i++ )
+			{
+				crossscore[segment1[i].number+1][segment1[i].pair->number+1] = segment1[i].score;
+				cut1[i+1] = sortedseg1[i]->center;
+				cut2[i+1] = sortedseg2[i]->center;
+			}
+	
+#if 0
+			fprintf( stderr, "AFTER SORT\n" );
+			for( i=0; i<count+1; i++ ) fprintf( stderr, "%d, %d\n", cut1[i], cut2[i] );
+			fprintf( stderr, "crossscore = \n" );
+			for( i=0; i<count+1; i++ )
+			{
+				for( j=0; j<count+1; j++ )
+					fprintf( stderr, "%.0f ", crossscore[i][j] );
+				fprintf( stderr, "\n" );
+			}
+#endif
+
+			crossscore[0][0] = 10000000.0;
+			cut1[0] = 0; 
+			cut2[0] = 0;
+			crossscore[count+1][count+1] = 10000000.0;
+			cut1[count+1] = len1;
+			cut2[count+1] = len2;
+			count += 2;
+			count0 = count;
+		
+//			fprintf( stderr, "\n\n\ncalling blockAlign2\n\n\n\n" );
+			blockAlign2( cut1, cut2, sortedseg1, sortedseg2, crossscore, &count );
+	
+//			if( count-count0 )
+//				fprintf( stderr, "%d unused anchors\n", count0-count );
+	
+			if( !kobetsubunkatsu && fftkeika )
+				fprintf( stderr, "%d anchors found\n", count );
+			if( fftkeika )
+			{
+				if( count0 > count )
+				{
+#if 0
+					fprintf( stderr, "\7 REPEAT!? \n" ); 
+#else
+					fprintf( stderr, "REPEAT!? \n" ); 
+#endif
+					if( fftRepeatStop ) exit( 1 );
+				}
+#if KEIKA
+				else fprintf( stderr, "done\n" );
+#endif
+			}
+		}
+
+
+		else
+		{
+			fprintf( stderr, "\nMany anchors were found. The upper-level DP is skipped.\n\n" );
+
+			cut1[0] = 0; 
+			cut2[0] = 0;
+			count0 = 0;
+			for( i=0; i<count; i++ )
+			{
+//				fprintf( stderr, "i=%d, %d-%d ?\n", i, sortedseg1[i]->center, sortedseg1[i]->pair->center );
+				if( sortedseg1[i]->center > cut1[count0]
+				 && sortedseg1[i]->pair->center > cut2[count0] )
+				{
+					count0++;
+					cut1[count0] = sortedseg1[i]->center;
+					cut2[count0] = sortedseg1[i]->pair->center;
+				}
+				else
+				{
+					if( i && sortedseg1[i]->score > sortedseg1[i-1]->score )
+					{
+						if( sortedseg1[i]->center > cut1[count0-1]
+						 && sortedseg1[i]->pair->center > cut2[count0-1] )
+						{
+							cut1[count0] = sortedseg1[i]->center;
+							cut2[count0] = sortedseg1[i]->pair->center;
+						}
+						else
+						{
+//							count0--;
+						}
+					}
+				}
+			}
+//			if( count-count0 )
+//				fprintf( stderr, "%d anchors unused\n", count-count0 );
+			cut1[count0+1] = len1;
+			cut2[count0+1] = len2;
+			count = count0 + 2;
+			count0 = count;
+	
+		}
+	}
+
+//	exit( 0 );
+
+#if 0
+	fftfp = fopen( "fft", "a" );
+	fprintf( fftfp, "RESULT after sort:\n" );
+	for( l=0; l<count; l++ )
+	{
+		fprintf( fftfp, "cut[%d]=%d, ", l, segment1[l].center );
+		fprintf( fftfp, "%d\n", segment2[l].center );
+	}
+	fclose( fftfp );
 #endif
 
 #if 0
@@ -2308,6 +3445,7 @@ system( "less seqVec2 < /dev/tty > /dev/tty" );
 		if( i == 0 ) headgp = outgap; else headgp = 1;
 		if( i == count-2 ) tailgp = outgap; else tailgp = 1;
 
+#if 0
 		if( cut1[i] )
 		{
 //			getkyokaigap( sgap1, seq1, cut1[i]-1, clus1 );
@@ -2330,6 +3468,26 @@ system( "less seqVec2 < /dev/tty > /dev/tty" );
 			for( j=0; j<clus1; j++ ) egap1[j] = 'o';
 			for( j=0; j<clus2; j++ ) egap2[j] = 'o';
 		}
+#else
+		if( cut1[i] )
+			getkyokaigap( sgap1, seq1, cut1[i]-1, clus1 );
+		else
+			for( j=0; j<clus1; j++ ) sgap1[j] = 'o';
+		if( cut2[i] )
+			getkyokaigap( sgap2, seq2, cut2[i]-1, clus2 );
+		else
+			for( j=0; j<clus2; j++ ) sgap2[j] = 'o';
+
+		if( cut1[i+1] != len1 )
+			getkyokaigap( egap1, seq1, cut1[i+1], clus1 );
+		else    
+			for( j=0; j<clus1; j++ ) egap1[j] = 'o';
+		if( cut2[i+1] != len2 )
+			getkyokaigap( egap2, seq2, cut2[i+1], clus2 );
+		else    
+			for( j=0; j<clus2; j++ ) egap2[j] = 'o';
+#endif
+
 #if DEBUG
 		fprintf( stderr, "DP %03d / %03d %4d to ", i+1, count-1, totallen );
 #else


=====================================
core/MSalignmm.c
=====================================
@@ -719,6 +719,7 @@ static double MSalignmm_tanni( double **n_dynamicmtx, int icyc, int jcyc, double
 	lgth1 = ien-ist+1;
 	lgth2 = jen-jst+1;
 
+
 #if STOREWM
 	strncpy( ttt1, seq1[0]+ist, lgth1 ); ttt1[lgth1] = 0;
 	strncpy( ttt2, seq2[0]+jst, lgth2 ); ttt2[lgth2] = 0;
@@ -2124,6 +2125,7 @@ double MSalignmm( double **n_dynamicmtx, char **seq1, char **seq2, double *eff1,
 	nglen1 = seqlen( seq1[0] );
 	nglen2 = seqlen( seq2[0] );
 
+
 #if 0
 	fprintf( stderr, "\n" );
 	for( i=0; i<icyc; i++ ) fprintf( stderr, "seq1[%d] at root = %s\n", i, seq1[i] );
@@ -2134,6 +2136,7 @@ double MSalignmm( double **n_dynamicmtx, char **seq1, char **seq2, double *eff1,
 	lgth1 = strlen( seq1[0] );
 	lgth2 = strlen( seq2[0] );
 
+
 	ll1 = ( (int)(lgth1) ) + 100;
 	ll2 = ( (int)(lgth2) ) + 100;
 


=====================================
core/Salignmm.c
=====================================
@@ -819,6 +819,7 @@ static void createfgresult( double **gapfresult, int limk, double eff1, double e
 }
 
 static double Atracking( double *lasthorizontalw, double *lastverticalw, 
+						double fpenalty, double fpenalty_ex,
 						char **seq1, char **seq2, 
                         char **mseq1, char **mseq2, 
                         int **ijp, int icyc, int jcyc,
@@ -876,8 +877,8 @@ static double Atracking( double *lasthorizontalw, double *lastverticalw,
 	else
 	{
 #if 1
-		double fpenalty = (double)penalty;
-		double fpenalty_ex = (double)penalty_ex;
+//		double fpenalty = (double)penalty;
+//		double fpenalty_ex = (double)penalty_ex;
 		double g;
 //		reporterr( "in S, lastverticalw[lgth1-1] = %f\n", lastverticalw[lgth1-1] );
 //		reporterr( "in S, lasthorizontalw[lgth2-1] = %f\n", lasthorizontalw[lgth2-1] );
@@ -1066,7 +1067,7 @@ static double Atracking( double *lasthorizontalw, double *lastverticalw,
 	return( wm );
 }
 
-double A__align( double **n_dynamicmtx, 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 */
 {
 
@@ -1087,7 +1088,7 @@ double A__align( double **n_dynamicmtx, char **seq1, char **seq2, double *eff1,
 	double *currentw, *previousw;
 //	double fpenalty = (double)penalty;
 #if USE_PENALTY_EX
-	double fpenalty_ex = (double)penalty_ex;
+	double fpenalty_ex = (double)penalty_ex_l;
 #endif
 #if 1
 	double *wtmp;
@@ -1121,7 +1122,7 @@ double A__align( double **n_dynamicmtx, char **seq1, char **seq2, double *eff1,
 	double *gapfreq1pt;
 	static TLS double *gapfreq2;
 	double *gapfreq2pt;
-	double fpenalty = (double)penalty;
+	double fpenalty = (double)penalty_l;
 	double fpenalty_shift = (double)penalty_shift;
 	double *fgcp2pt;
 	double *ogcp2pt;
@@ -2050,7 +2051,7 @@ fprintf( stderr, "\n" );
 	else
 	{
 //		wmo = Atracking( currentw, lastverticalw, seq1, seq2, mseq1, mseq2, ijp, icyc, jcyc, tailgp, warpis, warpjs, warpbase, &ngap1, &ngap2, reuseprofiles, eff1, eff2, cpmxresult, cpmx1pt, cpmx2pt, gapfreq1pt, gapfreq2pt, ogcp1opt, ogcp2opt, fgcp1opt, fgcp2opt, orieff1, orieff2, (cpmx1pt!=cpmx1), (cpmx2pt!=cpmx2) );
-		wmo = Atracking( currentw, lastverticalw, seq1, seq2, mseq1, mseq2, ijp, icyc, jcyc, tailgp, warpis, warpjs, warpbase, &ngap1, &ngap2, reuseprofiles, &gt1, &gt2 );
+		wmo = Atracking( currentw, lastverticalw, fpenalty, fpenalty_ex, seq1, seq2, mseq1, mseq2, ijp, icyc, jcyc, tailgp, warpis, warpjs, warpbase, &ngap1, &ngap2, reuseprofiles, &gt1, &gt2 );
 		if( !tailgp ) wm = wmo;
 	}
 
@@ -2194,7 +2195,7 @@ double A__align_gapmap( char **seq1, char **seq2, double *eff1, double *eff2, in
 }
 
 
-double A__align_variousdist( int **which, double ***matrices, double **n_dynamicmtx, char **seq1, char **seq2, double *eff1, double *eff2, double **eff1s, double **eff2s, 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 )
+double A__align_variousdist( int **which, double ***matrices, double **n_dynamicmtx, int penalty_l, int penalty_ex_l, char **seq1, char **seq2, double *eff1, double *eff2, double **eff1s, double **eff2s, 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 )
 /* score no keisan no sai motokaraaru gap no atukai ni mondai ga aru */
 {
 
@@ -2211,7 +2212,7 @@ double A__align_variousdist( int **which, double ***matrices, double **n_dynamic
 	double *currentw, *previousw;
 //	double fpenalty = (double)penalty;
 #if USE_PENALTY_EX
-	double fpenalty_ex = (double)penalty_ex;
+	double fpenalty_ex = (double)penalty_ex_l;
 #endif
 #if 1
 	double *wtmp;
@@ -2240,7 +2241,7 @@ double A__align_variousdist( int **which, double ***matrices, double **n_dynamic
 	static TLS int orlgth1 = 0, orlgth2 = 0;
 	static TLS double *gapfreq1;
 	static TLS double *gapfreq2;
-	double fpenalty = (double)penalty;
+	double fpenalty = (double)penalty_l;
 	double fpenalty_shift = (double)penalty_shift;
 	double *fgcp2pt;
 	double *ogcp2pt;
@@ -3041,7 +3042,7 @@ fprintf( stderr, "\n" );
 	else
 	{
 //		Atracking( currentw, lastverticalw, seq1, seq2, mseq1, mseq2, ijp, icyc, jcyc, tailgp, warpis, warpjs, warpbase, &ngap1, &ngap2, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0.0, 0.0, 1, 1 ); // NULL x 11 ha atode awaseru.
-		wmo = Atracking( currentw, lastverticalw, seq1, seq2, mseq1, mseq2, ijp, icyc, jcyc, tailgp, warpis, warpjs, warpbase, &ngap1, &ngap2, 0, NULL, NULL);
+		wmo = Atracking( currentw, lastverticalw, fpenalty, fpenalty_ex, seq1, seq2, mseq1, mseq2, ijp, icyc, jcyc, tailgp, warpis, warpjs, warpbase, &ngap1, &ngap2, 0, NULL, NULL);
 		if( !tailgp ) wm = wmo;
 	}
 


=====================================
core/addfunctions.c
=====================================
@@ -86,7 +86,7 @@ void profilealignment2( int n0, int n2, char **aln0, char **aln2, int alloclen,
 	if( alg == 'M' )
 		MSalignmm( n_dis_consweight_multi, aln0, aln2, effarr0, effarr2, n0, n2, alloclen, NULL, NULL, NULL, NULL, NULL, 0, NULL, 1, 1, NULL, NULL, NULL, 0.0, 0.0 ); //outgap=1, 2014/Dec/1
 	else
-		A__align( n_dis_consweight_multi, aln0, aln2, effarr0, effarr2, n0, n2, alloclen, 0, &dumdb, NULL, NULL, NULL, NULL, NULL, 0, NULL, 1, 1, -1, -1, NULL, NULL, NULL, 0.0, 0.0 ); //outgap=1, 2014/Dec/1
+		A__align( n_dis_consweight_multi, penalty, penalty_ex, aln0, aln2, effarr0, effarr2, n0, n2, alloclen, 0, &dumdb, NULL, NULL, NULL, NULL, NULL, 0, NULL, 1, 1, -1, -1, NULL, NULL, NULL, 0.0, 0.0 ); //outgap=1, 2014/Dec/1
 
 	newlen = strlen( aln0[0] );
 
@@ -211,7 +211,7 @@ static void profilealignment( int n0, int n1, int n2, char **aln0, char **aln1,
 	if( alg == 'M' )
 		MSalignmm( n_dis_consweight_multi, aln0, aln2, effarr0, effarr2, n0, n2, alloclen, NULL, NULL, NULL, NULL, NULL, 0, NULL, 1, 1, NULL, NULL, NULL, 0.0, 0.0 ); //outgap=1, 2014/Dec/1
 	else
-		A__align( n_dis_consweight_multi, aln0, aln2, effarr0, effarr2, n0, n2, alloclen, 0, &dumdb, NULL, NULL, NULL, NULL, NULL, 0, NULL, 1, 1, -1, -1, NULL, NULL, NULL, 0.0, 0.0 ); //outgap=1, 2014/Dec/1
+		A__align( n_dis_consweight_multi, penalty, penalty_ex, aln0, aln2, effarr0, effarr2, n0, n2, alloclen, 0, &dumdb, NULL, NULL, NULL, NULL, NULL, 0, NULL, 1, 1, -1, -1, NULL, NULL, NULL, 0.0, 0.0 ); //outgap=1, 2014/Dec/1
 
 	newlen = strlen( aln0[0] );
 


=====================================
core/addsingle.c
=====================================
@@ -1397,7 +1397,7 @@ static double treebase( int nseq, int *nlen, char **aseq, int nadd, char *mergeo
 			{
 				imp_match_init_strict( NULL, clus1, clus2, strlen( mseq1[0] ), strlen( mseq2[0] ), mseq1, mseq2, effarr1, effarr2, effarr1_kozo, effarr2_kozo, localhomshrink, NULL, 1, topol[l][0], topol[l][1], NULL, NULL, NULL, -1, 0 );
 				if( rnakozo ) imp_rna( clus1, clus2, mseq1, mseq2, effarr1, effarr2, grouprna1, grouprna2, NULL, NULL, NULL );
-				pscore = A__align( n_dis_consweight_multi, mseq1, mseq2, effarr1, effarr2, clus1, clus2, *alloclen, constraint, &dumdb, NULL, NULL, NULL, NULL, NULL, 0, NULL, outgap, outgap, -1, -1, NULL, NULL, NULL, 0.0, 0.0 ); // cpmxchild0 tsukaeru??
+				pscore = A__align( n_dis_consweight_multi, penalty, penalty_ex, mseq1, mseq2, effarr1, effarr2, clus1, clus2, *alloclen, constraint, &dumdb, NULL, NULL, NULL, NULL, NULL, 0, NULL, outgap, outgap, -1, -1, NULL, NULL, NULL, 0.0, 0.0 ); // cpmxchild0 tsukaeru??
 			}
 			else if( alg == 'Q' )
 			{
@@ -1430,7 +1430,7 @@ static double treebase( int nseq, int *nlen, char **aseq, int nadd, char *mergeo
 					pscore = MSalignmm( n_dis_consweight_multi, mseq1, mseq2, effarr1, effarr2, clus1, clus2, *alloclen, NULL, NULL, NULL, NULL, NULL, 0, NULL, outgap, outgap, NULL, NULL, NULL, 0.0, 0.0 );
 					break;
 				case( 'A' ):
-					pscore = A__align( n_dis_consweight_multi, mseq1, mseq2, effarr1, effarr2, clus1, clus2, *alloclen, 0, &dumdb, NULL, NULL, NULL, NULL, NULL, 0, NULL, outgap, outgap, -1, -1, NULL, NULL, NULL, 0.0, 0.0 ); // cpmxchild0 tsukaeru??
+					pscore = A__align( n_dis_consweight_multi, penalty, penalty_ex, mseq1, mseq2, effarr1, effarr2, clus1, clus2, *alloclen, 0, &dumdb, NULL, NULL, NULL, NULL, NULL, 0, NULL, outgap, outgap, -1, -1, NULL, NULL, NULL, 0.0, 0.0 ); // cpmxchild0 tsukaeru??
 					break;
 				default:
 					ErrorExit( "ERROR IN SOURCE FILE" );
@@ -1974,7 +1974,7 @@ static void	*addsinglethread( void *arg )
 		if( mseq1 ) free( mseq1 ); mseq1 = NULL;
 		if( mseq2 ) free( mseq2 ); mseq2 = NULL;
 		Falign( NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, NULL, 0, NULL );
-		A__align( NULL, 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 );
+		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 );
 		if( commonIP ) FreeIntMtx( commonIP );
 		commonIP = NULL;
 		commonAlloc1 = commonAlloc2 = 0;


=====================================
core/dash_client.go
=====================================
@@ -16,7 +16,7 @@ import(
     "time"
 )
 
-var VersionNumber = 1.0
+var VersionNumber = 1.1
 var Debug = false
 var NumberOfQueryTries = 12
 var HTTPClient = &http.Client{}
@@ -939,6 +939,7 @@ func filter_sequences_and_hat3(sequence_file_path string, hat3_path string,
     //Write Cleaned Sequences
     new_sequence_file, err := os.Create(sequence_file_path)
     check(err)
+    defer new_sequence_file.Close()
     for _, old_index := range(existing_hat3_indexes) {
         sequence := sequence_data[old_index]
         sequence_lines := fmt.Sprintf(">%s\n%s", sequence.Label, sequence.Sequence)
@@ -1346,6 +1347,7 @@ func main() {
     fmt.Println("Combining original sequences with DASH sequences...")
     dash_sequences := ParseFASTA(sequences_output_path)
     final_sequence_file, err := os.Create(sequences_output_path)
+    check(err)
     for _, sequence := range(dash_sequences) {
         fmt.Fprintln(final_sequence_file,
             fmt.Sprintf(">%s\n%s", sequence.Label, sequence.Sequence))


=====================================
core/disttbfast.c
=====================================
@@ -26,6 +26,7 @@ static int mapout;
 static int smoothing;
 static double maxdistmtxsize;
 static int nthreadtb;
+static int useexternalanchors;
 
 #if 0
 #define PLENFACA 0.0123
@@ -124,6 +125,8 @@ typedef struct _treebasethread_arg
 	char *mergeoralign;
 	double **newdistmtx;
 	int *selfscore;
+	ExtAnch *extanch;
+	int **anchindex;
 	pthread_mutex_t *mutex;
 	pthread_cond_t *treecond;
 } treebasethread_arg_t;
@@ -164,6 +167,7 @@ void arguments( int argc, char *argv[] )
 	calledByXced = 0;
 	devide = 0;
 	use_fft = 0;
+	useexternalanchors = 0;
 	force_fft = 0;
 	fftscore = 1;
 	fftRepeatStop = 0;
@@ -406,6 +410,8 @@ void arguments( int argc, char *argv[] )
 				case 'F':
 					use_fft = 1;
 					break;
+				case 'l':
+					useexternalanchors = 1;
 				case 'G':
 					use_fft = 1;
 					force_fft = 1;
@@ -1333,6 +1339,436 @@ static void *distancematrixthread( void *arg )
 	}
 }
 
+static void recountpositions( ExtAnch *pairanch, int n1, int n2, char **seq1, char **seq2 ) // loop no junban kentou
+{
+	int i, j, k, len, pos;
+	int *map;
+
+	len = strlen( seq1[0] )+1;
+	map = calloc( sizeof( int ), len );
+	
+	for( k=0; k<n1; k++ )
+	{
+		pos = 0;
+		for( i=0; i<len; i++ )
+		{
+			if( seq1[k][i] != '-' )
+			{
+				map[pos] = i;
+				pos++;
+			}
+		}
+
+		for( j=0; pairanch[j].i>-1; j++ )
+		{
+			if( pairanch[j].i == k ) 
+			{
+//				reporterr( "pairanch[%d].endi: %d->%d\n", j, pairanch[j].endi, map[pairanch[j].endi] );
+				pairanch[j].starti = map[pairanch[j].starti];
+				pairanch[j].endi = map[pairanch[j].endi];
+			}
+		}
+	}
+	free( map );
+
+	len = strlen( seq2[0] )+1;
+	map = calloc( sizeof( int ), len );
+	for( k=0; k<n2; k++ )
+	{
+		pos = 0;
+		for( i=0; i<len; i++ )
+		{
+			if( seq2[k][i] != '-' )
+			{
+				map[pos] = i;
+				pos++;
+			}
+		}
+		for( j=0; pairanch[j].i>-1; j++ )
+		{
+			if( pairanch[j].j == k )
+			{
+//				reporterr( "pairanch[%d].endj: %d->%d\n", j, pairanch[j].endj, map[pairanch[j].endj] );
+				pairanch[j].startj = map[pairanch[j].startj];
+				pairanch[j].endj = map[pairanch[j].endj];
+			}
+		}
+	}
+	free( map );
+}
+
+static int anchidcomp( const void *p, const void *q )
+{
+	if ( ((ExtAnch *)q)->i != ((ExtAnch *)p)->i )
+		return ((ExtAnch *)p)->i - ((ExtAnch *)q)->i;
+	return ((ExtAnch *)p)->j - ((ExtAnch *)q)->j;
+}
+
+static int anchcomp( const void *p, const void *q )
+{
+	if ( ((ExtAnch *)q)->starti != ((ExtAnch *)p)->starti )
+		return ((ExtAnch *)p)->starti - ((ExtAnch *)q)->starti;
+	return (int)((void *)p - (void *)q);
+}
+
+static int anchscorecomp( const void *p, const void *q )
+{
+	if ( ((ExtAnch *)q)->score != ((ExtAnch *)p)->score )
+		return ((ExtAnch *)q)->score - ((ExtAnch *)p)->score;
+	return (int)((void *)q - (void *)p);
+}
+
+
+static void indexanchors( ExtAnch *a, int **idx )
+{
+	int n;
+	for( n=0; a[n].i>-1; n++ )
+		;
+
+	qsort( a, n, sizeof( ExtAnch ), anchidcomp );
+
+
+	for( n=0; a[n].i>-1; n++ )
+	{
+//		reporterr( "%d, %dx%d, %d-%d x %d-%d\n", n, a[n].i, a[n].j, a[n].starti, a[n].endi, a[n].startj, a[n].endj );
+		if( idx[a[n].i][a[n].j] == -1 ) idx[a[n].i][a[n].j] = n;
+	}
+#if 0
+	int m;
+	for( n=0; n<njob; n++ ) for( m=n+1; m<njob; m++ )
+		reporterr( "%dx%d -> %d\n", n, m, idx[n][m] );
+	exit( 1 );
+#endif
+}
+
+static void checkanchors_internal( ExtAnch *a )
+{
+	int p, q, r, s;
+	int i, j;
+	int consistent;
+	int m;
+#if 0
+	reporterr( "before sortscore\n" );
+	for( p=0; a[p].i>-1; p++ )
+	{
+		reporterr( "a[%d].starti,j=%d,%d, score=%d\n", p, a[p].starti, a[p].startj, a[p].score );
+	}
+#endif
+
+
+	for( r=0; a[r].i>-1; )
+	{
+		i = a[r].i;
+		j = a[r].j;
+		s = r;
+		for( ; i==a[r].i && j==a[r].j; r++ )
+			;
+//		reporterr( "s=%d, r=%d\n", s, r );
+
+		qsort( a+s, r-s, sizeof( ExtAnch ), anchscorecomp );
+#if 0
+		reporterr( "after sortscore\n" );
+		for( p=s; p<r; p++ )
+		{
+			reporterr( "a[%d].starti,j=%d,%d, score=%d\n", p, a[p].starti, a[p].startj, a[p].score );
+		}
+#endif
+
+		for( p=s; p<r; p++ ) 
+		{
+			if( a[p].starti == -1 ) continue;
+			consistent = 1;
+			m = 0;
+			for( q=p+1; q<r; q++ )
+			{
+				if( a[q].starti == -1 ) continue;
+#if 0
+				reporterr( "p=%d, q=%d\n", p, q );
+				reporterr( "p: a[%d].starti,j=%d,%d, score=%d\n", p, a[p].starti, a[p].startj, a[p].score );
+				reporterr( "q: a[%d].starti,j=%d,%d, score=%d\n", q, a[q].starti, a[q].startj, a[q].score );
+#endif
+	
+				if( a[p].endi == a[q].endi && a[p].starti == a[q].starti && a[p].endj == a[q].endj && a[p].startj == a[q].startj ) 
+				{
+//					reporterr( "identical\n" );
+//					reporterr( "p: a[%d].regi,regj=%d-%d,%d-%d, score=%d\n", p, a[p].starti, a[p].endi, a[p].startj, a[p].endj, a[p].score );
+//					reporterr( "q: a[%d].regi,regj=%d-%d,%d-%d, score=%d\n", q, a[q].starti, a[q].endi, a[q].startj, a[q].endj, a[q].score );
+					;
+				}
+				else if( a[p].endi < a[q].starti && a[p].endj < a[q].startj ) 
+				{
+//					reporterr( "consistent\n" );
+					;
+				}
+//				else if( a[p].endi == a[q].starti && a[p].endj < a[q].startj && a[q].starti<a[q].endi ) 
+//				{
+//					a[q].starti += 1; // 1 zai overlap
+//				}
+//				else if( a[p].endi < a[q].starti && a[p].endj == a[q].startj && a[q].startj<a[q].endj ) 
+//				{
+//					a[q].startj += 1; // 1 zai overlap
+//				}
+				else if( a[q].endi < a[p].starti && a[q].endj < a[p].startj )
+				{
+//					reporterr( "consistent\n" );
+					;
+				}
+//				else if( a[q].endi == a[p].starti && a[q].endj < a[p].startj && a[q].starti<a[q].endi ) // bug in v7.442
+//				{
+//					a[q].endi -= 1; // 1 zai overlap
+//				}
+//				else if( a[q].endi < a[p].starti && a[q].endj == a[p].startj && a[q].startj<a[q].endj )
+//				{
+//					a[q].endj -= 1; // 1 zai overlap
+//				}
+				else 
+				{
+					consistent = 0;
+					if( a[q].score > m ) m = a[q].score;
+//					reporterr( "INconsistent\n" );
+//					reporterr( "p=%d, q=%d\n", p, q );
+//					reporterr( "p: a[%d].regi,regj=%d-%d,%d-%d, score=%d\n", p, a[p].starti, a[p].endi, a[p].startj, a[p].endj, a[p].score );
+//					reporterr( "q: a[%d].regi,regj=%d-%d,%d-%d, score=%d\n", q, a[q].starti, a[q].endi, a[q].startj, a[q].endj, a[q].score );
+//					a[q].starti = a[q].startj = a[q].startj = a[q].endj = -1;
+//					a[q].score = a[p].score - a[q].score; // ??
+//					a[q].score = ( a[p].score + a[q].score ) / 2; // ??
+					a[q].score = 0;
+				}
+			}
+			if( !consistent )
+//				a[p].score = ( a[p].score + m ) / 2; // >= 0
+				a[p].score -= m; // >= 0
+//				a[p].score = 0;
+		}
+	}
+
+#if 0
+	reporterr( "after filtering\n" );
+	for( p=0; a[p].i>-1; p++ )
+	{
+		reporterr( "a[%d].starti,j=%d,%d, score=%d\n", p, a[p].starti, a[p].startj, a[p].score );
+	}
+	exit( 1 );
+#endif
+}
+
+static void checkanchors_strongestfirst( ExtAnch *a, int s )
+{
+	int p, q;
+#if 0
+	reporterr( "before sortscore\n" );
+	for( p=0; a[p].i>-1; p++ )
+	{
+		reporterr( "a[%d].starti,j=%d,%d, score=%d\n", p, a[p].starti, a[p].startj, a[p].score );
+	}
+#endif
+	qsort( a, s, sizeof( ExtAnch ), anchscorecomp );
+	for( p=0; a[p].i>-1; p++ )
+	{
+		if( a[p].starti == -1 ) continue;
+//		reporterr( "P score=%d, %d-%d, %d-%d\n", a[p].score, a[p].starti, a[p].endi, a[p].startj, a[p].endj );
+		for( q=p+1; a[q].i>-1; q++ )
+		{
+			if( a[q].starti == -1 ) continue;
+//			reporterr( "Q score=%d, %d-%d, %d-%d\n", a[q].score, a[q].starti, a[q].endi, a[q].startj, a[q].endj );
+			if( a[p].endi < a[q].starti && a[p].endj < a[q].startj ) 
+			{
+//				reporterr( "consistent\n" );
+				;
+			}
+			else if( a[p].endi == a[q].starti && a[p].endj < a[q].startj && a[q].starti<a[q].endi ) 
+			{
+				a[q].starti += 1; // 1 zai overlap
+			}
+			else if( a[p].endi < a[q].starti && a[p].endj == a[q].startj && a[q].startj<a[q].endj ) 
+			{
+				a[q].startj += 1; // 1 zai overlap
+			}
+			else if( a[q].endi < a[p].starti && a[q].endj < a[p].startj )
+			{
+//				reporterr( "consistent\n" );
+				;
+			}
+			else if( a[q].endi == a[p].starti && a[q].endj < a[p].startj && a[q].starti<a[q].endi ) // bug in v7.442
+			{
+				a[q].endi -= 1; // 1 zai overlap
+			}
+			else if( a[q].endi < a[p].starti && a[q].endj == a[p].startj && a[q].startj<a[q].endj )
+			{
+				a[q].endj -= 1; // 1 zai overlap
+			}
+			else 
+			{
+//				reporterr( "INconsistent\n" );
+				a[q].starti = a[q].startj = a[q].startj = a[q].endj = -1;
+			}
+		}
+	}
+#if 0
+	reporterr( "after filtering\n" );
+	for( p=0; a[p].i>-1; p++ )
+	{
+		reporterr( "a[%d].starti,j=%d,%d, score=%d\n", p, a[p].starti, a[p].startj, a[p].score );
+	}
+//	exit( 1 );
+#endif
+
+	qsort( a, s, sizeof( ExtAnch ), anchcomp );
+}
+
+
+static void	pickpairanch( ExtAnch **pairanch, ExtAnch *extanch, int **anchindex, int n1, int n2, int *m1, int *m2, char **seq1, char **seq2 ) // loop no junban wo kaeta hou ga iikamo
+{
+	int i, j, k, s;
+	s = 0;
+#if 0
+	reporterr( "m1,m2=\n" );
+	for( i=0; i<n1; i++ ) for( j=0; j<n2; j++ )
+	{
+		reporterr( "%d,%d\n", m1[i], m2[j] );
+	}
+#endif
+	for( i=0; i<n1; i++ ) for( j=0; j<n2; j++ )
+	{
+#if 1
+		if( m1[i] < m2[j] ) 
+		{
+//			reporterr( "%dx%d, %dx%d -> jump to %d\n", i, j, m1[i], m2[j], anchindex[m1[i]][m2[j]] );
+			k = anchindex[m1[i]][m2[j]];
+			while( ( k!=-1 ) && ( extanch[k].i == m1[i] && extanch[k].j == m2[j] ) )
+			{
+				s++;
+				k++;
+			}
+		}
+		else
+		{
+//			reporterr( "%dx%d, %dx%d -> jump to %d\n", j, i, m1[i], m2[j], anchindex[m2[j]][m1[i]] );
+			k = anchindex[m2[j]][m1[i]];
+			while( ( k!=-1 ) && ( extanch[k].i == m2[j] && extanch[k].j == m1[i] ) )
+			{
+				s++;
+				k++;
+			}
+		}
+#else
+		k = 0;
+		while( extanch[k].i > -1 ) // kanari muda
+		{
+			//reporterr( "m1[i],m2[j]=%d,%d ? extanch[k].i,j=%d,%d k=%d\n", m1[i], m2[j], extanch[k].i, extanch[k].j, k );
+			if( ( extanch[k].i == m1[i] && extanch[k].j == m2[j] ) || ( extanch[k].i == m2[j] && extanch[k].j == m1[i] ) ) 
+			{
+				//reporterr( "hit, extanch[k].startj=%d\n", extanch[k].startj );
+				s++;
+			}
+			k++;
+		}
+#endif
+	}
+	*pairanch = calloc( sizeof( ExtAnch ), s+1 );
+
+	s = 0;
+	for( i=0; i<n1; i++ ) for( j=0; j<n2; j++ )
+	{
+#if 1
+		if( m1[i] < m2[j] ) 
+		{
+			k = anchindex[m1[i]][m2[j]];
+			while( ( k!=-1 ) && ( extanch[k].i == m1[i] && extanch[k].j == m2[j] ) )
+			{
+//				if( extanch[k].starti + 1 < extanch[k].endi )
+				{
+					(*pairanch)[s].i = i;
+					(*pairanch)[s].j = j;
+					(*pairanch)[s].starti = extanch[k].starti; // map mae
+					(*pairanch)[s].endi = extanch[k].endi; // map mae
+					(*pairanch)[s].startj = extanch[k].startj; // map mae 
+					(*pairanch)[s].endj = extanch[k].endj; // map mae
+					(*pairanch)[s].score = extanch[k].score;
+					s++;
+				}
+				k++;
+			}
+		}
+		else
+		{
+			k = anchindex[m2[j]][m1[i]];
+			while( ( k!=-1 ) && ( extanch[k].i == m2[j] && extanch[k].j == m1[i] ) )
+			{
+//				if( extanch[k].starti + 1 < extanch[k].endi )
+				{
+					(*pairanch)[s].i = i;
+					(*pairanch)[s].j = j;
+					(*pairanch)[s].starti = extanch[k].startj; // map mae
+					(*pairanch)[s].endi = extanch[k].endj; // map mae
+					(*pairanch)[s].startj = extanch[k].starti; // map mae 
+					(*pairanch)[s].endj = extanch[k].endi; // map mae
+					(*pairanch)[s].score = extanch[k].score;
+					s++;
+				}
+				k++;
+			}
+		}
+#else
+		k = 0;
+		while( extanch[k].i > -1 ) // kanari muda
+		{
+			if( extanch[k].i == m1[i] && extanch[k].j == m2[j] )
+			{
+				(*pairanch)[s].i = i;
+				(*pairanch)[s].j = j;
+				(*pairanch)[s].starti = extanch[k].starti; // map mae
+				(*pairanch)[s].endi = extanch[k].endi; // map mae
+				(*pairanch)[s].startj = extanch[k].startj; // map mae 
+				(*pairanch)[s].endj = extanch[k].endj; // map mae
+				(*pairanch)[s].score = extanch[k].score;
+				s++;
+			}
+			if( extanch[k].j == m1[i] && extanch[k].i == m2[j] )
+			{
+				(*pairanch)[s].i = i;
+				(*pairanch)[s].j = j;
+				(*pairanch)[s].starti = extanch[k].startj; // map mae
+				(*pairanch)[s].endi = extanch[k].endj; // map mae
+				(*pairanch)[s].startj = extanch[k].starti; // map mae 
+				(*pairanch)[s].endj = extanch[k].endi; // map mae
+				(*pairanch)[s].score = extanch[k].score;
+				s++;
+			}
+			k++;
+		}
+#endif
+	}
+	(*pairanch)[s].i = (*pairanch)[s].j = -1;
+
+	recountpositions( *pairanch, n1, n2, seq1, seq2 );
+//	truncateseq_group( *pairanch, seq1, seq2, n1, n2 );
+//	copybackanchors( *pairanch, ddn1, n2, seq1, seq2 ); // tabun dame
+
+#if 0
+	reporterr( "Before check\n" );
+	for( k=0; (*pairanch)[k].i>-1; k++ )
+	{
+		if( (*pairanch)[k].starti!=-1)
+			reporterr( "seq1-%d,seq2-%d %d-%d,%d-%d\n", (*pairanch)[k].i, (*pairanch)[k].j, (*pairanch)[k].starti, (*pairanch)[k].endi, (*pairanch)[k].startj, (*pairanch)[k].endj );
+	}
+#endif
+
+
+	checkanchors_strongestfirst( *pairanch, s );
+
+//	qsort( *pairanch, s, sizeof( ExtAnch ), anchcomp );
+//	checkanchors_new( *pairanch );
+
+#if 0
+	reporterr( "After check\n" );
+	for( k=0; (*pairanch)[k].i>-1; k++ )
+	{
+		if( (*pairanch)[k].starti!=-1)
+			reporterr( "seq1-%d,seq2-%d %d-%d,%d-%d\n", (*pairanch)[k].i, (*pairanch)[k].j, (*pairanch)[k].starti, (*pairanch)[k].endi, (*pairanch)[k].startj, (*pairanch)[k].endj );
+	}
+#endif
+}
 
 static void *treebasethread( void *arg )
 {
@@ -1353,6 +1789,8 @@ static void *treebasethread( void *arg )
 	char *mergeoralign = targ->mergeoralign;
 	double **newdistmtx = targ->newdistmtx;
 	int *selfscore = targ->selfscore;
+	ExtAnch *extanch = targ->extanch;
+	int **anchindex = targ->anchindex;
 
 	char **mseq1, **mseq2;
 	char **localcopy;
@@ -1374,6 +1812,7 @@ static void *treebasethread( void *arg )
 	int **localmem = NULL;
 	double **cpmxchild0, **cpmxchild1;
 	double orieff1, orieff2;
+	ExtAnch *pairanch = NULL;
 #if SKIP
 	int **skiptable1 = NULL, **skiptable2 = NULL;
 #endif
@@ -1383,6 +1822,7 @@ static void *treebasethread( void *arg )
 
 
 
+	tscore = 0;
 	mseq1 = AllocateCharMtx( njob, 0 );
 	mseq2 = AllocateCharMtx( njob, 0 );
 	localcopy = calloc( njob, sizeof( char * ) );
@@ -1422,7 +1862,8 @@ static void *treebasethread( void *arg )
 			commonIP = NULL;
 			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,  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 );
+			Falign_givenanchors( NULL, 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( mseq1 );
@@ -1665,7 +2106,16 @@ static void *treebasethread( void *arg )
 //		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( useexternalanchors )
+		{
+//			reporterr( "%%%% %d vs %d\n", m1, m2 );
+			pickpairanch( &pairanch, extanch, anchindex, clus1, clus2, localmem[0], localmem[1], mseq1, mseq2 );
+//			reporterr( "pairanch: %d:%d\n", pairanch[0].starti, pairanch[0].startj );
+			pscore = Falign_givenanchors( pairanch, NULL, NULL, dynamicmtx, mseq1, mseq2, effarr1, effarr2, NULL, NULL, clus1, clus2, *alloclen, fftlog+m1 );
+			free( pairanch );
+			pairanch = NULL;
+		}
+		else if( force_fft || ( use_fft && ffttry ) )
 		{
 			if( l < 500 || l % 100 == 0 ) reporterr(       " f\b\b" );
 			if( alg == 'M' )
@@ -1715,7 +2165,7 @@ static void *treebasethread( void *arg )
 					{
 //						reporterr(       "%d-%d", clus1, clus2 );
 						if( l < 500 || l % 100 == 0 ) if( cpmxchild1 || cpmxchild0 ) reporterr(       " h" );
-						pscore = A__align( dynamicmtx, 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 );
+						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;
 				default:
@@ -1834,7 +2284,7 @@ static void *treebasethread( void *arg )
 }
 #endif
 
-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*) )
+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, ExtAnch *extanch, int **anchindex, int *alloclen, int (*callback)(int, int, char*) )
 {
 	int l, len1, len2, i, m, immin, immax;
 	int len1nocommongap, len2nocommongap;
@@ -1858,6 +2308,7 @@ static int treebase( int *nlen, char **aseq, int nadd, char *mergeoralign, char
 	int **localmem = NULL;
 	double **cpmxchild0, **cpmxchild1;
 	double orieff1, orieff2;
+	ExtAnch *pairanch;
 #if SKIP
 	int **skiptable1 = NULL, **skiptable2 = NULL;
 #endif
@@ -2147,7 +2598,15 @@ static int treebase( int *nlen, char **aseq, int nadd, char *mergeoralign, char
 //		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( useexternalanchors )
+		{
+			pickpairanch( &pairanch, extanch, anchindex, clus1, clus2, localmem[0], localmem[1], mseq1, mseq2 );
+//			reporterr( "pairanch: %d:%d\n", pairanch[0].starti, pairanch[0].startj );
+			pscore = Falign_givenanchors( pairanch, NULL, NULL, dynamicmtx, mseq1, mseq2, effarr1, effarr2, NULL, NULL, clus1, clus2, *alloclen, fftlog+m1 );
+			free( pairanch );
+			pairanch = NULL;
+		}
+		else if( force_fft || ( use_fft && ffttry ) )
 		{
 			if( l < 500 || l % 100 == 0 ) reporterr(       " f\b\b" );
 			if( alg == 'M' )
@@ -2198,7 +2657,7 @@ static int treebase( int *nlen, char **aseq, int nadd, char *mergeoralign, char
 					{
 						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, 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 );
+						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;
@@ -2333,6 +2792,16 @@ static int treebase( int *nlen, char **aseq, int nadd, char *mergeoralign, char
 #endif
 		}
 
+#if 0
+		if( localmem[1][0] == 13 ) 
+		{
+			reporterr( "OUTPUT!\n" );
+			for( i=0; i<clus1; i++ ) reporterr( ">g1\n%s\n", mseq1[i] );
+			for( i=0; i<clus2; i++ ) reporterr( ">g2\n%s\n", mseq2[i] );
+			exit( 1 );
+		}
+#endif
+
 //		free( topol[l][0] ); topol[l][0] = NULL;
 //		free( topol[l][1] ); topol[l][1] = NULL;
 //		free( topol[l] ); topol[l] = NULL;
@@ -2348,7 +2817,8 @@ static int treebase( int *nlen, char **aseq, int nadd, char *mergeoralign, char
 #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,  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 );
+	Falign_givenanchors( NULL, 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 );
@@ -2369,7 +2839,8 @@ static int treebase( int *nlen, char **aseq, int nadd, char *mergeoralign, char
 
 	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,  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 );
+	Falign_givenanchors( NULL, 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;
@@ -2561,6 +3032,8 @@ int disttbfast( int ngui, int lgui, char **namegui, char **seqgui, int argc, cha
 	double *mindist = NULL;
 	double **partmtx = NULL;
 // for compacttree
+	ExtAnch *extanch = NULL;
+	int **anchindex = NULL;
 
 
 	if( ngui )
@@ -2672,6 +3145,7 @@ int disttbfast( int ngui, int lgui, char **namegui, char **seqgui, int argc, cha
 	}
 
 
+
 	seq = AllocateCharMtx( njob, nlenmax*1+1 );
 	mseq1 = AllocateCharMtx( njob, 0 );
 	mseq2 = AllocateCharMtx( njob, 0 );
@@ -2704,6 +3178,27 @@ int disttbfast( int ngui, int lgui, char **namegui, char **seqgui, int argc, cha
 	}
 #endif
 
+	if( useexternalanchors ) // nogaplen ha ato de uwagaki sareru kamo
+	{
+		char *tmpseq = calloc( nlenmax+5, sizeof( char ) );
+		for( i=0; i<njob; i++ )
+		{
+//			reporterr( "i=%d, nlenmax=%d, len=%d\n", i, nlenmax, strlen( seq[i] ) );
+			gappick0( tmpseq, seq[i] );
+			nogaplen[i] = strlen( tmpseq );
+		}
+		extanch = calloc( sizeof( ExtAnch ), 1 );
+		extanch[0].i=-1;
+		extanch[0].j=-1;
+		reporterr( "reading anchors\n" );
+		readexternalanchors( &extanch, njob, nogaplen ); // allocate sareru
+		anchindex = AllocateIntMtx( njob, njob ); // sukoshi muda
+		for( i=0; i<njob; i++ ) for( j=0; j<njob; j++ ) anchindex[i][j] = -1;
+		reporterr( "sorting anchors\n" );
+		indexanchors( extanch, anchindex );
+		//checkanchors_internal( extanch ); // comment out -> equivalent to v7.448
+		free( tmpseq );
+	}
 
 	constants( njob, seq );
 
@@ -3761,6 +4256,8 @@ int disttbfast( int ngui, int lgui, char **namegui, char **seqgui, int argc, cha
 				targ[i].alloclenpt = &alloclen;
 				targ[i].fftlog = fftlog;
 				targ[i].mergeoralign = mergeoralign;
+				targ[i].extanch = extanch;
+				targ[i].anchindex = anchindex;
 #if 1 // tsuneni SEPARATELYCALCPAIRDISTS
 				targ[i].newdistmtx = NULL;
 				targ[i].selfscore = NULL;
@@ -3805,7 +4302,7 @@ int disttbfast( int ngui, int lgui, char **namegui, char **seqgui, int argc, cha
 #endif
 			{
 //				if( treebase( keeplength && (iguidetree==nguidetree-1), nlen, bseq, nadd, mergeoralign, mseq1, mseq2, topol, dep, eff, NULL, NULL, deletemap, deletelag, &alloclen, callback ) ) goto chudan;
-				if( treebase( nlen, bseq, nadd, mergeoralign, mseq1, mseq2, topol, dep, memhist, cpmxhist, eff, NULL, NULL, &alloclen, callback ) ) goto chudan;
+				if( treebase( nlen, bseq, nadd, mergeoralign, mseq1, mseq2, topol, dep, memhist, cpmxhist, eff, NULL, NULL, extanch, anchindex, &alloclen, callback ) ) goto chudan;
 			}
 		}
 
@@ -4161,6 +4658,11 @@ int disttbfast( int ngui, int lgui, char **namegui, char **seqgui, int argc, cha
 		free( subalnpt );
 		free( preservegaps );
 	}
+	if( useexternalanchors )
+	{
+		free( extanch );
+		FreeIntMtx( anchindex );
+	}
 
 
 #if 1 // seqgui[i] =  bseq[i] no toki bseq ha free shinai


=====================================
core/functions.h
=====================================
@@ -147,13 +147,14 @@ extern double Lalignmm_hmout( char **seq1, char **seq2, double *eff1, double *ef
 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, 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, 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( 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 );
 extern double Fgetlag( double **scoringmtx, char  **seq1, char  **seq2, double *eff1, double *eff2, int    clus1, int    clus2, int alloclen );
 extern double Falign( int **whichmtx, double ***scoringmatrices, double **scoreingmtx, char  **seq1, char  **seq2, double *eff1, double *eff2, double **eff1s, double **eff2s, int    clus1, int    clus2, int alloclen, int *fftlog, int *, int, int * );
 extern double Falign_udpari_long( int **whichmtx, double ***scoringmatrices, double **scoringmtx, char  **seq1, char  **seq2, double *eff1, double *eff2, double **eff1s, double **eff2s, int    clus1, int    clus2, int alloclen, int *fftlog );
+extern double Falign_givenanchors( ExtAnch *extanch, int **whichmtx, double ***scoringmatrices, double **scoringmtx, char  **seq1, char  **seq2, double *eff1, double *eff2, double **eff1s, double **eff2s, int    clus1, int    clus2, int alloclen, int *fftlog );
 double Falign_localhom( int **which, double ***scoringmatrices, double **scoreingmtx, char  **seq1, char  **seq2, double *eff1, double *eff2, double **eff1s, double **eff2s, int    clus1, int    clus2, int alloclen, int constraint, double *totalimpmatch, int *gapmap1, int *gapmap2, int *chudanpt, int chudanref, int *chudanres );
 extern double part_imp_match_out_sc( int i1, int j1 );
 extern void part_imp_match_init_strict( 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 *memlist1, int *memlist2 );
@@ -423,3 +424,4 @@ extern void limitlh( int *uselh, Lennum *in, int size, int limit );
 
 extern double distdp_noalign( char *s1, char *s2, double selfscore1, double selfscore2, int alloclen ); // tbfast.c kara yobareru
 extern void getweightfromname( int n, double *w, char **name );
+extern void readexternalanchors( ExtAnch **extanch, int nseq, int *nogaplen );


=====================================
core/io.c
=====================================
@@ -60,13 +60,45 @@ char creverse( char f )
 	return( table[(int)f] );
 }
 
+static int countc( char *s, char q )
+{
+	int v = 0;
+	while( *s )
+		if( *s++ == q ) v++;
+	return( v );
+}
+
+static void ttou( char *s )
+{
+	int v = 0;
+	while( *s )
+	{
+		if( *s == 't' ) *s = 'u';
+		else if( *s == 'T' ) *s = 'U';
+		s++;
+	}
+}
+
 void sreverse( char *r, char *s )
 {
+	int numt = countc( s, 't' ) + countc( s, 'T' );
+	int numu = countc( s, 'u' ) + countc( s, 'U' );
+
+//	reporterr( "numt=%d, numu=%d\n", numt, numu );
+//	reporterr( "s=%s\n", s );
+
 	r += strlen( s );
 	*r-- = 0;
 	while( *s )
 		*r-- = creverse( *s++ );
 //		*r-- = ( *s++ );
+	if( numu > numt )
+	{
+//		reporterr( "RNA!\n" );
+//		reporterr( "r before ttou =%s\n", r );
+		ttou( r+1 );
+//		reporterr( "r after ttou =%s\n", r );
+	}
 }
 
 void gappick_samestring( char *seq )
@@ -6157,7 +6189,7 @@ void use_getrusage(void)
 	if (getrusage(RUSAGE_SELF, &r) != 0) {
 		/*Failure*/
 	}
-	fprintf(stderr, "maxrss = %ld MB\n", r.ru_maxrss/1000);
+	fprintf(stderr, "\nmaxrss = %ld MB\n", r.ru_maxrss/1000);
 }
 
 #endif
@@ -6243,3 +6275,73 @@ void commongappick( int nseq, char **seq )
 
 #endif
 }
+
+void readexternalanchors( ExtAnch **extanch, int nseq, int *nogaplen )
+{
+	FILE *fp;
+	int size, lineno;
+	char buf[10000];
+	fp = fopen( "_externalanchors", "r" );
+
+	if( fp == NULL )
+	{
+		reporterr( "Cannot open _externalanchors\n" );
+		exit( 1 );
+	}
+
+	size = 0;
+	lineno = 0;
+	while( 1 )
+	{
+		lineno++;
+//		reporterr( "size = %d\n", size );
+		fgets( buf, 9999, fp );
+		if( feof( fp ) ) break;
+
+		if( buf[0] == '#' ) continue;
+
+//		reporterr( "buf=%s\n", buf );
+		*extanch = realloc( *extanch, sizeof( ExtAnch ) * (size+2) );
+		if( *extanch == NULL )
+		{
+			reporterr( "Cannot realloc *extanch\n" );
+			exit( 1 );
+		}
+
+		sscanf( buf, "%d %d %d %d %d %d %d", &(((*extanch)+size)->i), &(((*extanch)+size)->j), &(((*extanch)+size)->starti), &(((*extanch)+size)->endi), &(((*extanch)+size)->startj), &(((*extanch)+size)->endj), &(((*extanch)+size)->score) );
+//		reporterr( "i=%d, j=%d, %d-%d, %d-%d, score=%d\n", (*extanch)[size].i, (*extanch)[size].j, (*extanch)[size].starti, (*extanch)[size].endi, (*extanch)[size].startj, (*extanch)[size].endj, (*extanch)[size].score );
+
+		((*extanch)+size)->i -= 1; // 1-origin -> 0-origin
+		((*extanch)+size)->j -= 1; // 1-origin -> 0-origin
+		((*extanch)+size)->starti -= 1; 
+		((*extanch)+size)->startj -= 1;
+		((*extanch)+size)->endi -= 1;
+		((*extanch)+size)->endj -= 1;
+
+		if( (*extanch)[size].i >= nseq || (*extanch)[size].j >= nseq )
+		{
+			reporterr( "\nOut of range?  The input file has %d sequences but pair %d-%d was specified in line %d.\nNote that sequence IDs are counted from 1.\n", nseq, (*extanch)[size].i+1, (*extanch)[size].j+1, lineno );
+			exit( 1 );
+		}
+		if( (*extanch)[size].i >= (*extanch)[size].j )
+		{
+			reporterr( "\nFormat problem?  \"%d %d\" in line %d.\nThe sequence id of the first column must be less than the second.\n", (*extanch)[size].i+1, (*extanch)[size].j+1, lineno );
+			exit( 1 );
+		}
+		if( (*extanch)[size].starti > nogaplen[(*extanch)[size].i] )
+		{
+			reporterr( "\nOut of range?  len(seq%d)=%d, but anchor=%d in line %d.\nNote that position is counted from 1.\n", (*extanch)[size].i+1, nogaplen[(*extanch)[size].i], (*extanch)[size].starti+1, lineno );
+			exit( 1 );
+		}
+		if( (*extanch)[size].startj > nogaplen[(*extanch)[size].j] )
+		{
+			reporterr( "\nOut of range?  len(seq%d)=%d, but anchor=%d in line %d.\nNote that position is counted from 1.\n", (*extanch)[size].j, nogaplen[(*extanch)[size].j]+1, (*extanch)[size].startj+1, lineno );
+			exit( 1 );
+		}
+
+		size++;
+		(*extanch)[size].i = (*extanch)[size].j = -1;
+
+	}
+	fclose( fp );
+}


=====================================
core/mafft-profile.c
=====================================
@@ -262,7 +262,7 @@ void GroupAlign( int nseq1, int nseq2, char **name, int *nlen, char **seq, char
 		if( alg == 'M' )
 			pscore = MSalignmm( n_dis_consweight_multi, mseq1, mseq2, effarr1, effarr2, clus1, clus2, alloclen, NULL, NULL, NULL, NULL, NULL, 0, NULL, outgap, outgap, NULL, NULL, NULL, 0.0, 0.0 );
 		else
-			pscore = A__align( n_dis_consweight_multi, mseq1, mseq2, effarr1, effarr2, clus1, clus2, alloclen, 0, &dumdb, NULL, NULL, NULL, NULL, NULL, 0, NULL, outgap, outgap, -1, -1, NULL, NULL, NULL, 0.0, 0.0 );
+			pscore = A__align( n_dis_consweight_multi, penalty, penalty_ex, mseq1, mseq2, effarr1, effarr2, clus1, clus2, alloclen, 0, &dumdb, NULL, NULL, NULL, NULL, NULL, 0, NULL, outgap, outgap, -1, -1, NULL, NULL, NULL, 0.0, 0.0 );
 	}
 #if DEBUG
 		time2 = getrusage_sec();


=====================================
core/mafft.tmpl
=====================================
@@ -1,7 +1,7 @@
 #! /bin/bash 
 er=0;
 myself=`dirname "$0"`/`basename "$0"`; export myself
-version="v7.429 (2019/Jul/1)"; export version
+version="v7.453 (2019/Nov/8)"; export version
 LANG=C; export LANG
 os=`uname`
 progname=`basename "$0"`
@@ -214,6 +214,7 @@ dafs=$defaultdafs
 mccaskill=$defaultmccaskill
 contrafold=$defaultcontrafold
 progressfile="/dev/stderr"
+anchorfile="/dev/null"
 debug=0
 sw=0
 algopt=$defaultalgopt
@@ -530,6 +531,17 @@ if [ $# -gt 0 ]; then
 		elif [ "$1" = "--out" ]; then 
 			shift   
 			outputfile="$1"
+		elif [ "$1" = "--anchors" ]; then 
+			shift
+			anchorfile="$1"
+			anchoropt=" -l "
+#			memopt=" -M -B "      # ato de kentou
+#			memopt=" -N "         # no memsave
+			if [ ! -e "$anchorfile" ]; then
+				echo "Cannot open $anchorfile" 1>&2
+				echo "" 1>&2
+				exit
+			fi
 		elif [ "$1" = "--thread" ]; then 
 			shift
 			if ! expr "$1" : "[0-9\-]" > /dev/null ; then
@@ -1047,6 +1059,7 @@ function removetmpfile() { # for MPI
 			cat "$laraparams"     | tr "\r" "\n" | grep -v "^$" > "$TMPFILE/_lara.params"
 			cat "$pdblist"        | tr "\r" "\n" | grep -v "^$" > "$TMPFILE/pdblist"
 			cat "$ownlist"        | tr "\r" "\n" | grep -v "^$" > "$TMPFILE/ownlist"
+			cat "$anchorfile"     | tr "\r" "\n" | grep -v "^$" > "$TMPFILE/_externalanchors"
 
 			SAVEIFS=$IFS
 			IFS='\n'
@@ -1878,19 +1891,19 @@ function removetmpfile() { # for MPI
 			fi
 		fi
 		if [ $iterate -gt 0 ]; then
-			echo 'Iterative refinment is not supported for --'$treeext  1>>"$progressfile"
+			echo 'Iterative refinment is not supported for --large or --'$treeext  1>>"$progressfile"
 			echo '' 1>>"$progressfile"
 			exit 1
 		fi
 		if [ $fragment -ne 0 ]; then
-			echo '--addfragments, --addfull or --addlong is not yet supported for --'$treeext  1>>"$progressfile"
+			echo '--addfragments, --addfull or --addlong is not yet supported for --large or --'$treeext  1>>"$progressfile"
 			echo "Use --add newsequences --$treeext" 1>>"$progressfile"
 			echo "Or, --addfragments (long, full) newsequences, without --"$treeext 1>>"$progressfile"
 			echo '' 1>>"$progressfile"
 			exit 1
 		fi
 		if [ "$mergetable" != "/dev/null" ]; then # 2018/Mar/2
-			echo '--merge is not yet supported for --'$treeext  1>>"$progressfile"
+			echo '--merge is not yet supported for --large or --'$treeext  1>>"$progressfile"
 			echo "Use --merge without --"$treeext 1>>"$progressfile"
 			echo '' 1>>"$progressfile"
 			exit 1
@@ -1925,6 +1938,7 @@ function removetmpfile() { # for MPI
 			bunkatsuopt=" -B "  # fftnsi demo bunktasu shinai
 			if [ "$add2ndhalfarg" != " " ]; then
 				if [ $auto -eq 1 -o $iterate -gt 0 ]; then
+					echo '' 1>>"$progressfile"
 					echo 'The --keeplength and --mapout options are not supported' 1>>"$progressfile"
 					echo 'with the --auto or --maxiterate >0 options.' 1>>"$progressfile"
 					echo 'Use the --maxiterate 0 option (= progressive method).' 1>>"$progressfile"
@@ -1933,10 +1947,19 @@ function removetmpfile() { # for MPI
 				fi
 			fi
 		fi
+		
 
 #		cycle=1 # chuui 2014Aug19
 #		iterate=0
 #		treealg=" -q "  ## 2012/01/24  ## removed 2012/02/06
+	else
+		if [ "$add2ndhalfarg" != " " ]; then
+			echo '' 1>>"$progressfile"
+			echo 'The --keeplength and --mapout options are supported' 1>>"$progressfile"
+			echo 'only with --add, --addfragments or --addlong.' 1>>"$progressfile"
+			echo '' 1>>"$progressfile"
+			exit 1
+		fi
 	fi
 
 
@@ -2093,15 +2116,15 @@ function removetmpfile() { # for MPI
 	fi
 
 	if [ $outputformat = "clustal" -a $outorder = "aligned" ]; then
-		outputopt=" -c $strategy -r _order$$ $f2clext "
+		outputopt=" -c $strategy -r $TMPFILE/order $f2clext "
 	elif [ $outputformat = "clustal" -a $outorder = "input" ]; then
 		outputopt=" -c $strategy  $f2clext "
 	elif [ $outputformat = "phylip" -a $outorder = "aligned" ]; then
-		outputopt=" -y -r _order$$ "
+		outputopt=" -y -r $TMPFILE/order "
 	elif [ $outputformat = "phylip" -a $outorder = "input" ]; then
 		outputopt=" -y "
 	elif [ $outputformat = "pir" -a $outorder = "aligned" ]; then
-		outputopt=" -f -r _order$$ "
+		outputopt=" -f -r $TMPFILE/order "
 	else
 		outputopt="-f"
 	fi
@@ -2524,7 +2547,7 @@ function removetmpfile() { # for MPI
 			if [ $fragment -ne 0 ]; then 
 				"$prefix/addsingle" -Q 100 $legacygapopt -W $tuplesize -O $outnum $addsinglearg $addarg $add2ndhalfarg -C $numthreads $memopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -f "-"$gop  -h $aof  $param_fft $localparam   $algopt $treealg $scoreoutarg < infile   > /dev/null 2>>"$progressfile" || exit 1
 			else
-				"$prefix/disttbfast" -q $npickup -E $cycledisttbfast -V "-"$gopdist  -s $unalignlevel $legacygapopt $mergearg -W $tuplesize $termgapopt $outnum $addarg $add2ndhalfarg -C $numthreads-$numthreadstb $memopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -g $gexp -f "-"$gop -Q $spfactor -h $aof  $param_fft $algopt $treealg $scoreoutarg < infile   > pre 2>>"$progressfile" || exit 1
+				"$prefix/disttbfast" -q $npickup -E $cycledisttbfast -V "-"$gopdist  -s $unalignlevel $legacygapopt $mergearg -W $tuplesize $termgapopt $outnum $addarg $add2ndhalfarg -C $numthreads-$numthreadstb $memopt $weightopt $treeinopt $treeoutopt $distoutopt $seqtype $model -g $gexp -f "-"$gop -Q $spfactor -h $aof  $param_fft $algopt $treealg $scoreoutarg $anchoropt < infile   > pre 2>>"$progressfile" || exit 1
 				mv hat3.seed hat3
 			fi
 		fi
@@ -2542,7 +2565,7 @@ function removetmpfile() { # for MPI
 		done
 		if [ $iterate -gt 0 ]; then
 			if [ $distance = "ktuples" ]; then
-			    "$prefix/dndpre" $model -M 2 -C $numthreads < pre     > /dev/null 2>>"$progressfile" || exit 1
+			    "$prefix/dndpre" $seqtype $model -M 2 -C $numthreads < pre     > /dev/null 2>>"$progressfile" || exit 1
 			fi
 			"$prefix/dvtditr" -W $minimumweight $bunkatsuopt -E $fixthreshold -s $unalignlevel  $legacygapopt $mergearg $outnum -C $numthreadsit -t $randomseed $rnaoptit $memopt $scorecalcopt $localparam -z 50 $seqtype $model -f "-"$gop -Q $spfactor -h $aof  -I $iterate $weightopt $treeinopt $algoptit $treealg -p $parallelizationstrategy  $scoreoutarg  -K $nadd < pre     > /dev/null 2>>"$progressfile" || exit 1
 		fi
@@ -2653,13 +2676,13 @@ function removetmpfile() { # for MPI
 
 	if [ "$outputopt" != "-f" -o "$windows" = "yes" ]; then # Windows deha kaigyo code wo f2cl de modosu.
 #		ln -s "$TMPFILE/order" _order$$ # f2cl ga space ari filename ni taiou shiteinainode
-		cp "$TMPFILE/order" _order$$ # ln -s no error wo sakeru
+#		cp "$TMPFILE/order" _order$$ # ln -s no error wo sakeru
 		if [ "$outputfile" = "" ]; then
 			"$prefix/f2cl" -n $namelength $outputopt < "$TMPFILE/pre" 2>"/dev/null" || exit 1
 		else
 			"$prefix/f2cl" -n $namelength $outputopt < "$TMPFILE/pre" > "$outputfile" 2>"/dev/null" || exit 1
 		fi
-		rm _order$$
+#		rm _order$$
 	else
 		if [ "$outputfile" = "" ]; then
 			cat < "$TMPFILE/pre" || exit 1


=====================================
core/makedirectionlist.c
=====================================
@@ -857,6 +857,7 @@ int main( int argc, char *argv[] )
 
 		reporterr( "Step 1/2\n" );
 
+
 		if( !dodp )
 		{
 			if( nadd )
@@ -879,7 +880,6 @@ int main( int argc, char *argv[] )
 				istart = 0;
 			for( i=istart; i<njob; i++ ) 
 			{
-
 				gappick0( tmpseq, seq[i] );
 				strcpy( seq[i], tmpseq );
 				sreverse( revseq, tmpseq );


=====================================
core/mltaln.h
=====================================
@@ -37,7 +37,7 @@
 
 
 
-#define VERSION "7.429"
+#define VERSION "7.453"
 #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
@@ -321,7 +321,16 @@ typedef struct _pairnum
 	int n1;
 } Pairnum;
 
-
+typedef struct _extanch
+{
+	int i;
+	int j;
+	int starti;
+	int endi;
+	int startj;
+	int endj;
+	int score;
+} ExtAnch;
 
 #include "fft.h"
 #include "dp.h"


=====================================
core/serial.c
=====================================
@@ -360,7 +360,7 @@ static int treebase( int *nlen, char **aseq, int nadd, char *mergeoralign, char
 					{
 						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, 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 );
+						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;
@@ -510,7 +510,7 @@ static int treebase( int *nlen, char **aseq, int nadd, char *mergeoralign, char
 #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,  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 );
+	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 );
@@ -531,7 +531,7 @@ static int treebase( int *nlen, char **aseq, int nadd, char *mergeoralign, char
 
 	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,  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 );
+	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;


=====================================
core/setdirection.c
=====================================
@@ -137,6 +137,7 @@ int main( int argc, char *argv[] )
 		}
 		if( line[1] == 'R' )
 		{
+
 			directions[i] = 'R';
 			sreverse( tmpseq, seq[i] );
 			strcpy( seq[i], tmpseq );


=====================================
core/splittbfast.c
=====================================
@@ -1050,7 +1050,7 @@ static void pairalign( int nseq, int *nlen, char **seq, int *mem1, int *mem2, do
 				else
 				{
 //					fprintf( stderr, "%d-%d", clus1, clus2 );
-					pscore = A__align( n_dis_consweight_multi, mseq1, mseq2, effarr1, effarr2, clus1, clus2, *alloclen, 0, &dumdb, NULL, NULL, NULL, NULL, NULL, 0, NULL, outgap, outgap, -1, -1, NULL, NULL, NULL, 0.0, 0.0 );
+					pscore = A__align( n_dis_consweight_multi, penalty, penalty_ex, mseq1, mseq2, effarr1, effarr2, clus1, clus2, *alloclen, 0, &dumdb, NULL, NULL, NULL, NULL, NULL, 0, NULL, outgap, outgap, -1, -1, NULL, NULL, NULL, 0.0, 0.0 );
 				}
 				break;
 			default:


=====================================
core/tbfast.c
=====================================
@@ -891,7 +891,7 @@ static void *treebasethread( void *arg ) // seed && compacttree==3 niha taioushi
 			commonIP = NULL;
 			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, 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 );
+			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 );
 			partA__align( NULL, NULL, NULL, NULL, 0, 0, 0, 0, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL );
 			G__align11( NULL, NULL, NULL, 0, 0, 0 ); // iru?
@@ -1108,7 +1108,7 @@ static void *treebasethread( void *arg ) // seed && compacttree==3 niha taioushi
 			{
 				imp_match_init_strict( NULL, clus1, clus2, strlen( mseq1[0] ), strlen( mseq2[0] ), mseq1, mseq2, effarr1, effarr2, effarr1_kozo, effarr2_kozo, localhomshrink, swaplist, 1, localmem[0], localmem[1], uselh, NULL, NULL, (compacttree==3)?l:-1, 0 ); // seedinlh, nfiles ni ha taiou shiteinai
 				if( rnakozo ) imp_rna( clus1, clus2, mseq1, mseq2, effarr1, effarr2, grouprna1, grouprna2, NULL, NULL, NULL );
-				pscore = A__align( dynamicmtx, mseq1, mseq2, effarr1, effarr2, clus1, clus2, *alloclen, constraint, &dumdb, NULL, NULL, NULL, NULL, NULL, 0, NULL, outgap, outgap, -1, -1, NULL, NULL, NULL, 0.0, 0.0 ); // cpmxhist mitaiou
+				pscore = A__align( dynamicmtx, penalty, penalty_ex, mseq1, mseq2, effarr1, effarr2, clus1, clus2, *alloclen, constraint, &dumdb, NULL, NULL, NULL, NULL, NULL, 0, NULL, outgap, outgap, -1, -1, NULL, NULL, NULL, 0.0, 0.0 ); // cpmxhist mitaiou
 			}
 			if( alg == 'd' )
 			{
@@ -1147,7 +1147,7 @@ static void *treebasethread( void *arg ) // seed && compacttree==3 niha taioushi
 					pscore = MSalignmm( dynamicmtx, mseq1, mseq2, effarr1, effarr2, clus1, clus2, *alloclen, NULL, NULL, NULL, NULL, NULL, 0, NULL, outgap, outgap, NULL, NULL, NULL, 0.0, 0.0 ); // cpmxhist mitaiou
 					break;
 				case( 'A' ):
-					pscore = A__align( dynamicmtx, mseq1, mseq2, effarr1, effarr2, clus1, clus2, *alloclen, 0, &dumdb, NULL, NULL, NULL, NULL, NULL, 0, NULL, outgap, outgap, -1, -1, NULL, NULL, NULL, 0.0, 0.0 ); // cpmxhist mitaiou
+					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, NULL, NULL, NULL, 0.0, 0.0 ); // cpmxhist mitaiou
 					break;
 				case( 'd' ):
 					pscore = D__align( dynamicmtx, mseq1, mseq2, effarr1, effarr2, clus1, clus2, *alloclen, 0, &dumdb, NULL, NULL, NULL, NULL, NULL, 0, NULL, outgap, outgap );
@@ -1590,7 +1590,7 @@ void treebase( int *nlen, char **aseq, int nadd, char *mergeoralign, char **mseq
 #if REPORTCOSTS
 //				reporterr(       "\n\n %d - %d (%d x %d) : \n", topol[l][0][0], topol[l][1][0], clus1, clus2 );
 #endif
-				pscore = A__align( dynamicmtx, mseq1, mseq2, effarr1, effarr2, clus1, clus2, *alloclen, constraint, &dumdb, NULL, NULL, NULL, NULL, NULL, 0, NULL, outgap, outgap, localmem[0][0], 1, cpmxchild0, cpmxchild1, cpmxhist+l, orieff1, orieff2 );
+				pscore = A__align( dynamicmtx, penalty, penalty_ex, mseq1, mseq2, effarr1, effarr2, clus1, clus2, *alloclen, constraint, &dumdb, NULL, NULL, NULL, NULL, NULL, 0, NULL, outgap, outgap, localmem[0][0], 1, cpmxchild0, cpmxchild1, cpmxhist+l, orieff1, orieff2 );
 			}
 			if( alg == 'd' )
 			{
@@ -1629,7 +1629,7 @@ void treebase( int *nlen, char **aseq, int nadd, char *mergeoralign, char **mseq
 					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( 'A' ):
-					pscore = A__align( dynamicmtx, 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 );
+					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;
 				case( 'd' ):
 					pscore = D__align( dynamicmtx, mseq1, mseq2, effarr1, effarr2, clus1, clus2, *alloclen, 0, &dumdb, NULL, NULL, NULL, NULL, NULL, 0, NULL, outgap, outgap );
@@ -1765,8 +1765,8 @@ void treebase( int *nlen, char **aseq, int nadd, char *mergeoralign, char **mseq
 	free( effarr1_kozo );
 	free( effarr2_kozo );
 	Falign( NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, NULL, 0, NULL );
-	D__align( NULL,  NULL, NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, 0 );
-	A__align( NULL,  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 );
+	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 );
 	imp_match_init_strictD( NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, 0, 0 );
 	imp_match_init_strict( NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, 0, 0 );
 	FreeCommonIP();


=====================================
debian/changelog
=====================================
@@ -1,3 +1,15 @@
+mafft (7.453-1) unstable; urgency=medium
+
+  * Team upload.
+  * New upstream version
+  * Standards-Version: 4.4.1
+  * Trim trailing whitespace.
+  * Use secure URI in Homepage field.
+  * Set fields Upstream-Name, Upstream-Contact in debian/copyright.
+  * Remove obsolete fields Name, Contact from debian/upstream/metadata.
+
+ -- Steffen Moeller <moeller at debian.org>  Thu, 21 Nov 2019 17:27:17 +0100
+
 mafft (7.429-1) unstable; urgency=medium
 
   * Team upload.
@@ -389,4 +401,3 @@ mafft (6.240-1) unstable; urgency=low
   * Initial release (Closes: #409640)
 
  -- Charles Plessy <charles-debian-nospam at plessy.org>  Sat,  9 Jun 2007 12:06:43 +0900
-


=====================================
debian/control
=====================================
@@ -5,10 +5,10 @@ Uploaders: Charles Plessy <plessy at debian.org>,
 Section: science
 Priority: optional
 Build-Depends: debhelper-compat (= 12)
-Standards-Version: 4.4.0
+Standards-Version: 4.4.1
 Vcs-Browser: https://salsa.debian.org/med-team/mafft
 Vcs-Git: https://salsa.debian.org/med-team/mafft.git
-Homepage: http://mafft.cbrc.jp/alignment/software/
+Homepage: https://mafft.cbrc.jp/alignment/software/
 
 Package: mafft
 Architecture: any


=====================================
debian/copyright
=====================================
@@ -4,6 +4,8 @@ Comment: Debian only distributes MAFFT without its extensions.
  The mafft-*-with-extensions-src.tgz upstream packages have an ‘extensions’
  directory, which contains code from the Vienna RNA package, that does not allow
  commercial use and is therefore unsuitable for Debian.
+Upstream-Name: MAFFT
+Upstream-Contact: Kazutaka Katoh <kazutaka.katoh at aist.go.jp>
 
 Files: *
 Copyright: 2009–2017 Kazutaka Katoh


=====================================
debian/upstream/metadata
=====================================
@@ -1,34 +1,30 @@
-Contact: Kazutaka Katoh <kazutaka.katoh at aist.go.jp>
-Name: MAFFT
 Reference:
- - Author: Katoh, Kazutaka and Toh, Hiroyuki
-   Title: Recent developments in the MAFFT multiple sequence alignment program
-   Journal: Brief Bioinform
-   Year: 2008
-   Volume: 9
-   Number: 4
-   Pages: 286-298
-   DOI: 10.1093/bib/bbn013
-   PMID: 18372315
-   URL: http://bib.oxfordjournals.org/cgi/content/abstract/9/4/286
- - Author: K. Katoh and G. Asimenos and H. Toh
-   Title: Multiple alignment of DNA sequences with MAFFT
-   Journal: Methods Mol Biol.
-   Volume: 537
-   Pages: 39-64
-   Year: 2009
-   PMID: 19378139
-   DOI: 10.1007/978-1-59745-251-9_3
-   URL: "http://www.springerprotocols.com/Abstract/doi/\
-    10.1007/978-1-59745-251-9_3"
-   eprint: "http://www.springerprotocols.com/Pdf/doi/\
-    10.1007/978-1-59745-251-9_3?encCode=RklCOjNfOS0xNTItNTQ3OTUtMS04Nzk="
+- Author: Katoh, Kazutaka and Toh, Hiroyuki
+  Title: Recent developments in the MAFFT multiple sequence alignment program
+  Journal: Brief Bioinform
+  Year: 2008
+  Volume: 9
+  Number: 4
+  Pages: 286-298
+  DOI: 10.1093/bib/bbn013
+  PMID: 18372315
+  URL: http://bib.oxfordjournals.org/cgi/content/abstract/9/4/286
+- Author: K. Katoh and G. Asimenos and H. Toh
+  Title: Multiple alignment of DNA sequences with MAFFT
+  Journal: Methods Mol Biol.
+  Volume: 537
+  Pages: 39-64
+  Year: 2009
+  PMID: 19378139
+  DOI: 10.1007/978-1-59745-251-9_3
+  URL: "http://www.springerprotocols.com/Abstract/doi/10.1007/978-1-59745-251-9_3"
+  eprint: "http://www.springerprotocols.com/Pdf/doi/10.1007/978-1-59745-251-9_3?encCode=RklCOjNfOS0xNTItNTQ3OTUtMS04Nzk="
 Registry:
- - Name: bio.tools
-   Entry: NA
- - Name: SciCrunch
-   Entry: SCR_011811
- - Name: OMICtools
-   Entry: OMICS_00979
- - Name: conda:bioconda
-   Entry: mafft
+- Name: bio.tools
+  Entry: NA
+- Name: SciCrunch
+  Entry: SCR_011811
+- Name: OMICtools
+  Entry: OMICS_00979
+- Name: conda:bioconda
+  Entry: mafft


=====================================
readme
=====================================
@@ -1,6 +1,6 @@
 -----------------------------------------------------------------------
   MAFFT: a multiple sequence alignment program
-  version 7.429, 2019/Jul/1
+  version 7.453, 2019/Nov/8
 
   http://mafft.cbrc.jp/alignment/software/
   katoh at ifrec.osaka-u.ac.jp


=====================================
test/script
=====================================
@@ -1,34 +1,37 @@
 mafft sample > x
-diff x sample.fftns2 || exit
+diff x sample.fftns2 >& /dev/null || exit 1
 
 mafft --maxiterate 100  sample > x
-diff x sample.fftnsi || exit
+diff x sample.fftnsi >& /dev/null || exit 1
 
 mafft --dpparttree sample > x
-diff x sample.dpparttree || exit
+diff x sample.dpparttree >& /dev/null || exit 1
 
 mafft --globalpair sample > x
-diff x sample.gins1 || exit
+diff x sample.gins1 >& /dev/null || exit 1
 
 mafft --globalpair --maxiterate 100 sample > x
-diff x sample.ginsi || exit
+diff x sample.ginsi >& /dev/null || exit 1
 
 mafft --allowshift --globalpair --maxiterate 100 sample > x
-diff x sample.ginsi.allowshift || exit
+diff x sample.ginsi.allowshift >& /dev/null || exit 1
 
 mafft --localpair sample > x
-diff x sample.lins1 || exit
+diff x sample.lins1 >& /dev/null || exit 1
 
 mafft --localpair --maxiterate 100 sample > x
-diff x sample.linsi || exit
+diff x sample.linsi >& /dev/null || exit 1
 
 mafft --parttree sample > x
-diff x sample.parttree || exit
+diff x sample.parttree >& /dev/null || exit 1
 
 mafft-qinsi samplerna > x
-diff x samplerna.qinsi || exit
+diff x samplerna.qinsi >& /dev/null || exit 1
 
 mafft-xinsi samplerna > x
-diff x samplerna.xinsi || exit
+diff x samplerna.xinsi >& /dev/null || exit 1
 
+echo 'OK'
 rm x
+
+exit 0



View it on GitLab: https://salsa.debian.org/med-team/mafft/compare/4a2eb189ca3c181148705c16dc4fd4e6b88844ea...dc6b60775d94c20e4c41bcb3c2d979d32761d8f9

-- 
View it on GitLab: https://salsa.debian.org/med-team/mafft/compare/4a2eb189ca3c181148705c16dc4fd4e6b88844ea...dc6b60775d94c20e4c41bcb3c2d979d32761d8f9
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/20191121/263cbd76/attachment-0001.html>


More information about the debian-med-commit mailing list