if( seg == NULL )
{
- free( work ); work = NULL;
+ if( work ) free( work );
+ work = NULL;
+ allo = 0;
return;
}
}
-double Fgetlag( char **seq1, char **seq2,
+double Fgetlag(
+ double **n_dynamicmtx,
+ char **seq1, char **seq2,
double *eff1, double *eff2,
int clus1, int clus2,
int alloclen )
int count, count0;
int len1, len2;
int totallen;
- float dumfl = 0.0;
+ double dumdb = 0.0;
int headgp, tailgp;
len1 = strlen( seq1[0] );
Aalign( tmpres1, tmpres2, eff1, eff2, clus1, clus2, alloclen );
break;
case( 'M' ):
- MSalignmm( tmpres1, tmpres2, eff1, eff2, clus1, clus2, alloclen, NULL, NULL, NULL, NULL, NULL, 0, NULL, headgp, tailgp );
+ MSalignmm( n_dynamicmtx, tmpres1, tmpres2, eff1, eff2, clus1, clus2, alloclen, NULL, NULL, NULL, NULL, NULL, 0, NULL, headgp, tailgp );
break;
case( 'A' ):
if( clus1 == 1 && clus2 == 1 )
- G__align11( tmpres1, tmpres2, alloclen, headgp, tailgp );
+ G__align11( n_dynamicmtx, tmpres1, tmpres2, alloclen, headgp, tailgp );
else
- A__align( tmpres1, tmpres2, eff1, eff2, clus1, clus2, alloclen, NULL, &dumfl, NULL, NULL, NULL, NULL, NULL, 0, NULL, headgp, tailgp );
- break;
- case( 'H' ):
- if( clus1 == 1 && clus2 == 1 )
- G__align11( tmpres1, tmpres2, alloclen, headgp, tailgp );
- else
- H__align( tmpres1, tmpres2, eff1, eff2, clus1, clus2, alloclen, NULL, &dumfl, NULL, NULL, NULL, NULL );
- break;
- case( 'Q' ):
- if( clus1 == 1 && clus2 == 1 )
- G__align11( tmpres1, tmpres2, alloclen, headgp, tailgp );
- else
- Q__align( tmpres1, tmpres2, eff1, eff2, clus1, clus2, alloclen, NULL, &dumfl, NULL, NULL, NULL, NULL );
+ A__align( n_dynamicmtx, tmpres1, tmpres2, eff1, eff2, clus1, clus2, alloclen, NULL, &dumdb, NULL, NULL, NULL, NULL, NULL, 0, NULL, headgp, tailgp, -1, -1 );
break;
default:
fprintf( stderr, "alg = %c\n", alg );
-float Falign( char **seq1, char **seq2,
+double Falign( 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 *chudanpt, int chudanref, int *chudanres )
int count, count0;
int len1, len2;
int totallen;
- float totalscore;
- float dumfl = 0.0;
+ double totalscore;
+ double dumdb = 0.0;
int headgp, tailgp;
{
// 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, NULL, NULL, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, 0 );
- G__align11( NULL, NULL, 0, 0, 0 );
+ A__align( NULL, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, 0, -1, -1 );
+ D__align( NULL, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 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, NULL, 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, NULL, 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 );
- FreeCharMtx( result1 );
+ crossscore = NULL;
+ FreeCharMtx( result1 ); result1 = NULL;
FreeCharMtx( result2 );
FreeCharMtx( tmpres1 );
FreeCharMtx( tmpres2 );
+
#define CAND 0
#if CAND
fftfp = fopen( "cand", "w" );
totalscore += Aalign( tmpres1, tmpres2, eff1, eff2, clus1, clus2, alloclen );
break;
case( 'M' ):
- totalscore += MSalignmm( tmpres1, tmpres2, eff1, eff2, clus1, clus2, alloclen, sgap1, sgap2, egap1, egap2, chudanpt, chudanref, chudanres, headgp, tailgp );
+ 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, chudanpt, chudanref, chudanres, headgp, tailgp );
+ else
+ totalscore += MSalignmm( n_dynamicmtx, tmpres1, tmpres2, eff1, eff2, clus1, clus2, alloclen, sgap1, sgap2, egap1, egap2, chudanpt, chudanref, chudanres, headgp, tailgp );
+// totalscore += MSalignmm( n_dis_consweight_multi, tmpres1, tmpres2, eff1, eff2, clus1, clus2, alloclen, sgap1, sgap2, egap1, egap2, chudanpt, chudanref, chudanres, headgp, tailgp );
break;
- case( 'A' ):
+ case( 'd' ):
if( clus1 == 1 && clus2 == 1 )
{
- totalscore += G__align11( tmpres1, tmpres2, alloclen, headgp, tailgp );
+ totalscore += G__align11( n_dynamicmtx, tmpres1, tmpres2, alloclen, headgp, tailgp );
}
else
- totalscore += A__align( tmpres1, tmpres2, eff1, eff2, clus1, clus2, alloclen, NULL, &dumfl, sgap1, sgap2, egap1, egap2, chudanpt, chudanref, chudanres, headgp, tailgp );
- break;
- case( 'H' ):
- if( clus1 == 1 && clus2 == 1 )
{
- totalscore += G__align11( tmpres1, tmpres2, alloclen, headgp, tailgp );
+ if( scoringmatrices ) // called by tditeration.c
+ {
+ totalscore += D__align_variousdist( whichmtx, scoringmatrices, NULL, tmpres1, tmpres2, eff1, eff2, eff1s, eff2s, clus1, clus2, alloclen, NULL, &dumdb, sgap1, sgap2, egap1, egap2, chudanpt, chudanref, chudanres, headgp, tailgp );
+ }
+ else
+ totalscore += D__align( n_dynamicmtx, tmpres1, tmpres2, eff1, eff2, clus1, clus2, alloclen, NULL, &dumdb, sgap1, sgap2, egap1, egap2, chudanpt, chudanref, chudanres, headgp, tailgp );
}
- else
- totalscore += H__align( tmpres1, tmpres2, eff1, eff2, clus1, clus2, alloclen, NULL, &dumfl, sgap1, sgap2, egap1, egap2 );
break;
- case( 'Q' ):
+ case( 'A' ):
if( clus1 == 1 && clus2 == 1 )
{
- totalscore += G__align11( tmpres1, tmpres2, alloclen, headgp, tailgp );
+ totalscore += G__align11( n_dynamicmtx, tmpres1, tmpres2, alloclen, headgp, tailgp );
}
else
- totalscore += Q__align( tmpres1, tmpres2, eff1, eff2, clus1, clus2, alloclen, NULL, &dumfl, sgap1, sgap2, egap1, egap2 );
+ {
+ if( scoringmatrices ) // called by tditeration.c
+ {
+ totalscore += A__align_variousdist( whichmtx, scoringmatrices, NULL, tmpres1, tmpres2, eff1, eff2, eff1s, eff2s, clus1, clus2, alloclen, NULL, &dumdb, sgap1, sgap2, egap1, egap2, chudanpt, chudanref, chudanres, headgp, tailgp );
+ }
+ else
+ totalscore += A__align( n_dynamicmtx, tmpres1, tmpres2, eff1, eff2, clus1, clus2, alloclen, NULL, &dumdb, sgap1, sgap2, egap1, egap2, chudanpt, chudanref, chudanres, headgp, tailgp, -1, -1 );
+ }
break;
default:
fprintf( stderr, "alg = %c\n", alg );
for( j=0; j<clus2; j++ ) strcat( result2[j], tmpres2[j] );
totallen += nlen;
#if 0
- fprintf( stderr, "i=%d", i );
+ fprintf( stderr, "$#####$$$$ i=%d", i );
fprintf( stderr, "%4d\n", totallen );
fprintf( stderr, "\n\n" );
for( j=0; j<clus1; j++ )
#if 0
for( j=0; j<clus1; j++ )
{
- fprintf( stderr, "%s\n", result1[j] );
+ fprintf( stderr, "in Falign, %s\n", result1[j] );
}
fprintf( stderr, "- - - - - - - - - - -\n" );
for( j=0; j<clus2; j++ )
{
- fprintf( stderr, "%s\n", result2[j] );
+ fprintf( stderr, "in Falign, %s\n", result2[j] );
}
#endif
return( totalscore );
/*
sakujo wo kentou (2010/10/05)
*/
-float Falign_udpari_long( char **seq1, char **seq2,
+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 count, count0;
int len1, len2;
int totallen;
- float totalscore;
+ double totalscore;
int nkouho = 0;
int headgp, tailgp;
-// float dumfl = 0.0;
+// 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, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, NULL, 0, 0, -1, -1 );
+ A__align_variousdist( NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, 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, NULL, 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 );
+ }
switch( alg )
{
case( 'M' ):
- totalscore += MSalignmm( tmpres1, tmpres2, eff1, eff2, clus1, clus2, alloclen, sgap1, sgap2, egap1, egap2, NULL, 0, NULL, headgp, tailgp );
+ 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 );
break;
default:
fprintf( stderr, "alg = %c\n", alg );