Loading core/Galign11.c +104 −11 Original line number Diff line number Diff line Loading @@ -5,6 +5,9 @@ #define XXXXXXX 0 #define USE_PENALTY_EX 1 #define TERMGAPFAC 0.0 #define TERMGAPFAC_EX 0.0 #if 1 static void match_calc_mtx( double **mtx, double *match, char **s1, char **s2, int i1, int lgth2 ) { Loading Loading @@ -37,7 +40,9 @@ static double Atracking( double *lasthorizontalw, double *lastverticalw, gap = newgapstr; lgth1 = strlen( seq1[0] ); lgth2 = strlen( seq2[0] ); double wm; double wm, g; double fpenalty = (double)penalty; double fpenalty_ex = (double)penalty_ex; #if 0 Loading @@ -56,11 +61,41 @@ static double Atracking( double *lasthorizontalw, double *lastverticalw, ijp[0][j] = -( j + 1 ); } // if( tailgp == 1 || ijp[lgth1][lgth2] >= warpbase ) if( tailgp == 1 ) ; else { #if 1 // reporterr( "lastverticalw[lgth1-1] = %f\n", lastverticalw[lgth1-1] ); // reporterr( "lasthorizontalw[lgth2-1] = %f\n", lasthorizontalw[lgth2-1] ); wm = lasthorizontalw[lgth2-1] - 1.0; // lasthorizontalw[lgth2-1] yori kanarazu chiisai. for( j=lgth2-2; j>=0; j-- ) { if( (g=lasthorizontalw[j]+ ( fpenalty * TERMGAPFAC + fpenalty_ex * (lgth2-1-j) * TERMGAPFAC_EX ) ) > wm ) { wm = g; iin = lgth1-1; jin = j; ijp[lgth1][lgth2] = -( lgth2 - j ); } } for( i=lgth1-2; i>=0; i-- ) { if( ( g=lastverticalw[i]+ ( fpenalty * TERMGAPFAC + fpenalty_ex * (lgth1-1-i) * TERMGAPFAC_EX ) ) > wm ) { wm = g; iin = i; jin = lgth2-1; ijp[lgth1][lgth2] = +( lgth1 - i ); } } if( lasthorizontalw[lgth2-1] > wm ) // score ga onaji baai erabarenai { wm = lasthorizontalw[lgth2-1]; iin = lgth1-1; jin = lgth2-1; ijp[lgth1][lgth2] = 0; } #else wm = lastverticalw[0]; for( i=0; i<lgth1; i++ ) { Loading @@ -80,6 +115,7 @@ static double Atracking( double *lasthorizontalw, double *lastverticalw, ijp[lgth1][lgth2] = -( lgth2 - j ); } } #endif } Loading Loading @@ -158,19 +194,20 @@ static double Atracking( double *lasthorizontalw, double *lastverticalw, // fprintf( stderr, "%s\n", mseq1[0] ); // fprintf( stderr, "%s\n", mseq2[0] ); return( 0.0 ); return( wm ); } double G__align11( double **n_dynamicmtx, char **seq1, char **seq2, int alloclen, int headgp, int tailgp ) { // int k; register int i, j; int lasti; /* outgap == 0 -> lgth1, outgap == 1 -> lgth1+1 */ int lastj; int lgth1, lgth2; int resultlen; double wm; /* int ?????? */ double wm, wmo; /* int ?????? */ double g; double *currentw, *previousw; double fpenalty = (double)penalty; Loading @@ -178,6 +215,7 @@ double G__align11( double **n_dynamicmtx, char **seq1, char **seq2, int alloclen double fpenalty_tmp; #if USE_PENALTY_EX double fpenalty_ex = (double)penalty_ex; double fpenalty_ex_i; #endif #if 1 double *wtmp; Loading Loading @@ -428,13 +466,41 @@ double G__align11( double **n_dynamicmtx, char **seq1, char **seq2, int alloclen for( i=1; i<lgth1+1; i++ ) { initverticalw[i] += fpenalty; #if USE_PENALTY_EX // initverticalw[i] += fpenalty_ex * i; // ato de fukkatsu // reporterr( "added _ex\n" ); #endif } for( j=1; j<lgth2+1; j++ ) { currentw[j] += fpenalty; #if USE_PENALTY_EX // currentw[j] += fpenalty_ex * j; // ato de fukkatsu // reporterr( "added _ex\n" ); #endif } } else { for( i=1; i<lgth1+1; i++ ) { initverticalw[i] += fpenalty * TERMGAPFAC; #if USE_PENALTY_EX // 2018/Apr/22 initverticalw[i] += fpenalty_ex * i * TERMGAPFAC_EX; // reporterr( "added _ex\n" ); #endif } for( j=1; j<lgth2+1; j++ ) { currentw[j] += fpenalty * TERMGAPFAC; #if USE_PENALTY_EX // 2018/Apr/22 currentw[j] += fpenalty_ex * j * TERMGAPFAC_EX; // reporterr( "added _ex\n" ); #endif } } for( j=1; j<lgth2+1; ++j ) { m[j] = currentw[j-1]; mp[j] = 0; Loading Loading @@ -510,6 +576,9 @@ fprintf( stderr, "\n" ); warpjpt = warpj + 1; } if( i < lgth1 ) fpenalty_ex_i = fpenalty_ex; else fpenalty_ex_i = 0.0; // 2018/May/11 for( j=1; j<lastj; j++ ) { Loading @@ -528,12 +597,14 @@ fprintf( stderr, "\n" ); *ijppt = -( j - mpi ); } if( (g=*prept) >= mi ) // if( (g=*prept) > mi ) { mi = g; mpi = j-1; } #if USE_PENALTY_EX mi += fpenalty_ex; mi += fpenalty_ex_i; // mi += fpenalty_ex; #endif #if 0 Loading @@ -545,11 +616,13 @@ fprintf( stderr, "\n" ); *ijppt = +( i - *mpjpt ); } if( (g=*prept) >= *mjpt ) // if( (g=*prept) > *mjpt ) { *mjpt = g; *mpjpt = i-1; } #if USE_PENALTY_EX if( j < lgth2 ) // 2018/May/11 m[j] += fpenalty_ex; #endif #if 1 Loading Loading @@ -647,6 +720,7 @@ fprintf( stderr, "\n" ); } } if( trywarp ) { // fprintf( stderr, "\nwm = %f\n", wm ); Loading @@ -659,7 +733,10 @@ fprintf( stderr, "\n" ); free( prevwarpj ); } Atracking( currentw, lastverticalw, seq1, seq2, mseq1, mseq2, ijp, tailgp, warpis, warpjs, warpbase ); wmo = Atracking( currentw, lastverticalw, seq1, seq2, mseq1, mseq2, ijp, tailgp, warpis, warpjs, warpbase ); if( !tailgp ) wm = wmo; // reporterr( "wm (after tracking) = %f\n", wm ); if( warpis ) free( warpis ); if( warpjs ) free( warpjs ); Loading Loading @@ -698,6 +775,7 @@ double G__align11_noalign( double **n_dynamicmtx, int penal, int penal_ex, char double fpenalty = (double)penal; #if USE_PENALTY_EX double fpenalty_ex = (double)penal_ex; double fpenalty_ex_i; #endif #if 1 double *wtmp; Loading Loading @@ -831,10 +909,18 @@ double G__align11_noalign( double **n_dynamicmtx, int penal, int penal_ex, char for( i=1; i<lgth1+1; i++ ) { initverticalw[i] += fpenalty; #if USE_PENALTY_EX // 2018/Apr/23 // initverticalw[i] += fpenalty_ex * i; // ato de fukkatsu // reporterr( "added _ex\n" ); #endif } for( j=1; j<lgth2+1; j++ ) { currentw[j] += fpenalty; #if USE_PENALTY_EX // 2018/Apr/23 // currentw[j] += fpenalty_ex * j; // ato de fukkatsu // reporterr( "added _ex\n" ); #endif } } Loading Loading @@ -901,6 +987,10 @@ fprintf( stderr, "\n" ); mjpt = m + 1; prept = previousw; curpt = currentw + 1; if( i < lgth1 ) fpenalty_ex_i = fpenalty_ex; else fpenalty_ex_i = 0.0; // 2018/May/11 for( j=1; j<lgth2+1; j++ ) { wm = *prept; Loading @@ -915,12 +1005,13 @@ fprintf( stderr, "\n" ); { wm = g; } if( (g=*prept) >= mi ) // if( (g=*prept) >= mi ) if( (g=*prept) > mi ) // onaji hazu { mi = g; } #if USE_PENALTY_EX mi += fpenalty_ex; mi += fpenalty_ex_i; #endif #if 0 Loading @@ -930,11 +1021,13 @@ fprintf( stderr, "\n" ); { wm = g; } if( (g=*prept) >= *mjpt ) // if( (g=*prept) >= *mjpt ) if( (g=*prept) > *mjpt ) // onaji hazu { *mjpt = g; } #if USE_PENALTY_EX if( j < lgth2 ) // 2018/May/11 m[j] += fpenalty_ex; #endif Loading @@ -952,7 +1045,7 @@ fprintf( stderr, "\n" ); fprintf( stderr, "\n" ); fprintf( stderr, ">\n%s\n", mseq1[0] ); fprintf( stderr, ">\n%s\n", mseq2[0] ); fprintf( stderr, "wm = %f\n", wm ); fprintf( stderr, "wm (noalign) = %f\n", wm ); #endif return( wm ); Loading core/Salignmm.c +112 −5 Original line number Diff line number Diff line Loading @@ -9,6 +9,9 @@ #define FASTMATCHCALC 1 #define SLOW 0 #define TERMGAPFAC 0.0 #define TERMGAPFAC_EX 0.0 static TLS double **impmtx = NULL; static TLS int impalloclen = 0; Loading Loading @@ -872,6 +875,38 @@ static double Atracking( double *lasthorizontalw, double *lastverticalw, ; else { #if 1 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] ); wm = lasthorizontalw[lgth2-1] - 1.0; // lasthorizontalw[lgth2-1] yori kanarazu chiisai. for( j=lgth2-2; j>=0; j-- ) { if( (g=lasthorizontalw[j]+ ( fpenalty * TERMGAPFAC + fpenalty_ex * (lgth2-1-j) * TERMGAPFAC_EX ) ) > wm ) { wm = g; iin = lgth1-1; jin = j; ijp[lgth1][lgth2] = -( lgth2 - j ); } } for( i=lgth1-2; i>=0; i-- ) { if( ( g=lastverticalw[i]+ ( fpenalty * TERMGAPFAC + fpenalty_ex * (lgth1-1-i) * TERMGAPFAC_EX ) ) > wm ) { wm = g; iin = i; jin = lgth2-1; ijp[lgth1][lgth2] = +( lgth1 - i ); } } if( lasthorizontalw[lgth2-1] > wm ) // score ga onaji baai erabarenai { wm = lasthorizontalw[lgth2-1]; iin = lgth1-1; jin = lgth2-1; ijp[lgth1][lgth2] = 0; } #else wm = lastverticalw[0]; for( i=0; i<lgth1; i++ ) { Loading @@ -891,6 +926,7 @@ static double Atracking( double *lasthorizontalw, double *lastverticalw, ijp[lgth1][lgth2] = -( lgth2 - j ); } } #endif } for( i=0; i<lgth1+1; i++ ) Loading Loading @@ -1027,7 +1063,7 @@ static double Atracking( double *lasthorizontalw, double *lastverticalw, *gt2 = gaptable2; } return( 0.0 ); 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 ) Loading @@ -1046,6 +1082,7 @@ double A__align( double **n_dynamicmtx, char **seq1, char **seq2, double *eff1, int lgth1, lgth2; int resultlen; double wm = 0.0; /* int ?????? */ double wmo = 0.0; double g; double *currentw, *previousw; // double fpenalty = (double)penalty; Loading Loading @@ -1663,20 +1700,48 @@ double A__align( double **n_dynamicmtx, char **seq1, char **seq2, double *eff1, imp_match_calc( n_dynamicmtx, currentw, icyc, jcyc, lgth1, lgth2, seq1, seq2, eff1, eff2, localhom, 1, 0 ); #endif if( headgp == 1 ) { for( i=1; i<lgth1+1; i++ ) { // initverticalw[i] += ( ogcp1[0] + fgcp1[i-1] ) ; initverticalw[i] += ( ogcp1[0] * headgapfreq2 + fgcp1[i-1] * gapfreq2pt[0] ) ; #if USE_PENALTY_EX // 2018/Apr/23 initverticalw[i] += fpenalty_ex * i; // reporterr( "added _ex\n" ); #endif } for( j=1; j<lgth2+1; j++ ) { // currentw[j] += ( ogcp2[0] + fgcp2[j-1] ) ; currentw[j] += ( ogcp2[0] * headgapfreq1 + fgcp2[j-1] * gapfreq1pt[0] ) ; #if USE_PENALTY_EX // 2018/Apr/23 currentw[j] += fpenalty_ex * j; // reporterr( "added _ex\n" ); #endif } } else { for( i=1; i<lgth1+1; i++ ) { initverticalw[i] += fpenalty * TERMGAPFAC; // motto tanjun de yoi? #if USE_PENALTY_EX // 2018/Apr/22 initverticalw[i] += fpenalty_ex * i * TERMGAPFAC_EX; // reporterr( "added _ex\n" ); #endif } for( j=1; j<lgth2+1; j++ ) { currentw[j] += fpenalty * TERMGAPFAC; // motto tanjun de yoi? #if USE_PENALTY_EX // 2018/Apr/22 currentw[j] += fpenalty_ex * j * TERMGAPFAC_EX; // reporterr( "added _ex\n" ); #endif } } #if OUTGAP0TRY else { Loading @@ -1687,6 +1752,8 @@ double A__align( double **n_dynamicmtx, char **seq1, char **seq2, double *eff1, initverticalw[i] -= offset * i / 2.0; } #endif #if 0 fprintf( stderr, "\n " ); for( j=0; j<lgth2+1; j++ ) fprintf( stderr, " %c ", seq2[0][j] ); Loading Loading @@ -1843,6 +1910,7 @@ fprintf( stderr, "\n" ); // fprintf( stderr, "Jump to %d (%c)!", mpi, seq2[0][mpi] ); } if( (g=*prept+*ogcp2pt*gf1vapre) >= mi ) // if( (g=*prept+*ogcp2pt*gf1vapre) > mi ) { mi = g; mpi = j-1; Loading @@ -1862,6 +1930,7 @@ fprintf( stderr, "\n" ); // fprintf( stderr, "Jump to %d (%c)!", *mpjpt, seq1[0][*mpjpt] ); } if( (g=*prept+ ogcp1va* *gf2ptpre) >= *mjpt ) // if( (g=*prept+ ogcp1va* *gf2ptpre) > *mjpt ) { *mjpt = g; *mpjpt = i-1; Loading Loading @@ -1980,10 +2049,13 @@ fprintf( stderr, "\n" ); } else { // 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) ); Atracking( currentw, lastverticalw, seq1, seq2, mseq1, mseq2, ijp, icyc, jcyc, tailgp, warpis, warpjs, warpbase, &ngap1, &ngap2, reuseprofiles, >1, >2 ); // 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, >1, >2 ); if( !tailgp ) wm = wmo; } // reporterr( "wm = %f\n", wm ); #if 1 if( cpmxresult ) { Loading Loading @@ -2134,6 +2206,7 @@ double A__align_variousdist( int **which, double ***matrices, double **n_dynamic int lgth1, lgth2; int resultlen; double wm = 0.0; /* int ?????? */ double wmo = 0.0; /* int ?????? */ double g; double *currentw, *previousw; // double fpenalty = (double)penalty; Loading Loading @@ -2610,13 +2683,42 @@ double A__align_variousdist( int **which, double ***matrices, double **n_dynamic { // initverticalw[i] += ( ogcp1[0] + fgcp1[i-1] ) ; initverticalw[i] += ( ogcp1[0] * headgapfreq2 + fgcp1[i-1] * gapfreq2[0] ) ; #if USE_PENALTY_EX // 2018/Apr/23 initverticalw[i] += fpenalty_ex * i; // reporterr( "added _ex\n" ); #endif } for( j=1; j<lgth2+1; j++ ) { // currentw[j] += ( ogcp2[0] + fgcp2[j-1] ) ; currentw[j] += ( ogcp2[0] * headgapfreq1 + fgcp2[j-1] * gapfreq1[0] ) ; #if USE_PENALTY_EX // 2018/Apr/23 currentw[j] += fpenalty_ex * j; // reporterr( "added _ex\n" ); #endif } } else { for( i=1; i<lgth1+1; i++ ) { initverticalw[i] += fpenalty * TERMGAPFAC; // motto tanjun de yoi? #if USE_PENALTY_EX // 2018/Apr/22 initverticalw[i] += fpenalty_ex * i * TERMGAPFAC_EX; // reporterr( "added _ex\n" ); #endif } for( j=1; j<lgth2+1; j++ ) { currentw[j] += fpenalty * TERMGAPFAC; // motto tanjun de yoi? #if USE_PENALTY_EX // 2018/Apr/22 currentw[j] += fpenalty_ex * j * TERMGAPFAC_EX; // reporterr( "added _ex\n" ); #endif } } #if OUTGAP0TRY else { Loading Loading @@ -2806,6 +2908,7 @@ fprintf( stderr, "\n" ); // fprintf( stderr, "Jump to %d (%c)!", mpi, seq2[0][mpi] ); } if( (g=*prept+*ogcp2pt*gf1vapre) >= mi ) // if( (g=*prept+*ogcp2pt*gf1vapre) > mi ) { mi = g; mpi = j-1; Loading @@ -2825,6 +2928,7 @@ fprintf( stderr, "\n" ); // fprintf( stderr, "Jump to %d (%c)!", *mpjpt, seq1[0][*mpjpt] ); } if( (g=*prept+ ogcp1va* *gf2ptpre) >= *mjpt ) // if( (g=*prept+ ogcp1va* *gf2ptpre) > *mjpt ) { *mjpt = g; *mpjpt = i-1; Loading Loading @@ -2935,8 +3039,11 @@ fprintf( stderr, "\n" ); Atracking_localhom( impmatch, currentw, lastverticalw, seq1, seq2, mseq1, mseq2, ijp, icyc, jcyc, warpis, warpjs, warpbase, &ngap1, &ngap2, 0, NULL, NULL ); } 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. Atracking( currentw, lastverticalw, seq1, seq2, mseq1, mseq2, ijp, icyc, jcyc, tailgp, warpis, warpjs, warpbase, &ngap1, &ngap2, 0, NULL, NULL); wmo = Atracking( currentw, lastverticalw, seq1, seq2, mseq1, mseq2, ijp, icyc, jcyc, tailgp, warpis, warpjs, warpbase, &ngap1, &ngap2, 0, NULL, NULL); if( !tailgp ) wm = wmo; } if( warpis ) free( warpis ); if( warpjs ) free( warpjs ); Loading core/blosum.c +1 −0 Original line number Diff line number Diff line Loading @@ -367,6 +367,7 @@ static void overridematrix( double **matrix ) } reporterr( "Score(%c=0x%x,%c=0x%x)=%f\n", i1, i1, i2, i2, v ); matrix[i1][i2] = v; matrix[i2][i1] = v; // 2018/May/11 } } Loading core/constants.c +6 −0 Original line number Diff line number Diff line Loading @@ -714,6 +714,12 @@ void constants( int nseq, char **seq ) fprintf( stdout, "####### average1 = %f\n", average ); #endif if( average < 0.0 ) { reporterr( "\nUnrealistic scoring matrix. Give larger positive values to matches (A/A, B/B, etc).\n\n" ); exit( 1 ); } for( i=0; i<nalphabets; i++ ) for( j=0; j<nalphabets; j++ ) n_distmp[i][j] *= 600.0 / average; #if TEST Loading core/disttbfast.c +5 −2 Original line number Diff line number Diff line Loading @@ -1460,7 +1460,6 @@ static void *treebasethread( void *arg ) pthread_cond_wait( targ->treecond, targ->mutex ); // tabun iranai (*nrunpt)++; // moved, 20187/Mar/10 m1 = topol[l][0][0]; m2 = topol[l][1][0]; #if 0 Loading Loading @@ -1503,7 +1502,7 @@ static void *treebasethread( void *arg ) } #endif // moved, 2018/Mar/10. Must be after changing memhist[l] if( mergeoralign[l] == 'n' ) { // reporterr( "SKIP!\n" ); Loading @@ -1514,6 +1513,8 @@ static void *treebasethread( void *arg ) // free( topol[l][1] ); topol[l][1] = NULL; // free( topol[l] ); topol[l] = NULL; pthread_mutex_unlock( targ->mutex ); free( localmem[0] ); free( localmem[1] ); continue; } Loading Loading @@ -1975,6 +1976,8 @@ static int treebase( int *nlen, char **aseq, int nadd, char *mergeoralign, char // free( topol[l][0] ); topol[l][0] = NULL; // free( topol[l][1] ); topol[l][1] = NULL; // free( topol[l] ); topol[l] = NULL; free( localmem[0] ); free( localmem[1] ); continue; } Loading Loading
core/Galign11.c +104 −11 Original line number Diff line number Diff line Loading @@ -5,6 +5,9 @@ #define XXXXXXX 0 #define USE_PENALTY_EX 1 #define TERMGAPFAC 0.0 #define TERMGAPFAC_EX 0.0 #if 1 static void match_calc_mtx( double **mtx, double *match, char **s1, char **s2, int i1, int lgth2 ) { Loading Loading @@ -37,7 +40,9 @@ static double Atracking( double *lasthorizontalw, double *lastverticalw, gap = newgapstr; lgth1 = strlen( seq1[0] ); lgth2 = strlen( seq2[0] ); double wm; double wm, g; double fpenalty = (double)penalty; double fpenalty_ex = (double)penalty_ex; #if 0 Loading @@ -56,11 +61,41 @@ static double Atracking( double *lasthorizontalw, double *lastverticalw, ijp[0][j] = -( j + 1 ); } // if( tailgp == 1 || ijp[lgth1][lgth2] >= warpbase ) if( tailgp == 1 ) ; else { #if 1 // reporterr( "lastverticalw[lgth1-1] = %f\n", lastverticalw[lgth1-1] ); // reporterr( "lasthorizontalw[lgth2-1] = %f\n", lasthorizontalw[lgth2-1] ); wm = lasthorizontalw[lgth2-1] - 1.0; // lasthorizontalw[lgth2-1] yori kanarazu chiisai. for( j=lgth2-2; j>=0; j-- ) { if( (g=lasthorizontalw[j]+ ( fpenalty * TERMGAPFAC + fpenalty_ex * (lgth2-1-j) * TERMGAPFAC_EX ) ) > wm ) { wm = g; iin = lgth1-1; jin = j; ijp[lgth1][lgth2] = -( lgth2 - j ); } } for( i=lgth1-2; i>=0; i-- ) { if( ( g=lastverticalw[i]+ ( fpenalty * TERMGAPFAC + fpenalty_ex * (lgth1-1-i) * TERMGAPFAC_EX ) ) > wm ) { wm = g; iin = i; jin = lgth2-1; ijp[lgth1][lgth2] = +( lgth1 - i ); } } if( lasthorizontalw[lgth2-1] > wm ) // score ga onaji baai erabarenai { wm = lasthorizontalw[lgth2-1]; iin = lgth1-1; jin = lgth2-1; ijp[lgth1][lgth2] = 0; } #else wm = lastverticalw[0]; for( i=0; i<lgth1; i++ ) { Loading @@ -80,6 +115,7 @@ static double Atracking( double *lasthorizontalw, double *lastverticalw, ijp[lgth1][lgth2] = -( lgth2 - j ); } } #endif } Loading Loading @@ -158,19 +194,20 @@ static double Atracking( double *lasthorizontalw, double *lastverticalw, // fprintf( stderr, "%s\n", mseq1[0] ); // fprintf( stderr, "%s\n", mseq2[0] ); return( 0.0 ); return( wm ); } double G__align11( double **n_dynamicmtx, char **seq1, char **seq2, int alloclen, int headgp, int tailgp ) { // int k; register int i, j; int lasti; /* outgap == 0 -> lgth1, outgap == 1 -> lgth1+1 */ int lastj; int lgth1, lgth2; int resultlen; double wm; /* int ?????? */ double wm, wmo; /* int ?????? */ double g; double *currentw, *previousw; double fpenalty = (double)penalty; Loading @@ -178,6 +215,7 @@ double G__align11( double **n_dynamicmtx, char **seq1, char **seq2, int alloclen double fpenalty_tmp; #if USE_PENALTY_EX double fpenalty_ex = (double)penalty_ex; double fpenalty_ex_i; #endif #if 1 double *wtmp; Loading Loading @@ -428,13 +466,41 @@ double G__align11( double **n_dynamicmtx, char **seq1, char **seq2, int alloclen for( i=1; i<lgth1+1; i++ ) { initverticalw[i] += fpenalty; #if USE_PENALTY_EX // initverticalw[i] += fpenalty_ex * i; // ato de fukkatsu // reporterr( "added _ex\n" ); #endif } for( j=1; j<lgth2+1; j++ ) { currentw[j] += fpenalty; #if USE_PENALTY_EX // currentw[j] += fpenalty_ex * j; // ato de fukkatsu // reporterr( "added _ex\n" ); #endif } } else { for( i=1; i<lgth1+1; i++ ) { initverticalw[i] += fpenalty * TERMGAPFAC; #if USE_PENALTY_EX // 2018/Apr/22 initverticalw[i] += fpenalty_ex * i * TERMGAPFAC_EX; // reporterr( "added _ex\n" ); #endif } for( j=1; j<lgth2+1; j++ ) { currentw[j] += fpenalty * TERMGAPFAC; #if USE_PENALTY_EX // 2018/Apr/22 currentw[j] += fpenalty_ex * j * TERMGAPFAC_EX; // reporterr( "added _ex\n" ); #endif } } for( j=1; j<lgth2+1; ++j ) { m[j] = currentw[j-1]; mp[j] = 0; Loading Loading @@ -510,6 +576,9 @@ fprintf( stderr, "\n" ); warpjpt = warpj + 1; } if( i < lgth1 ) fpenalty_ex_i = fpenalty_ex; else fpenalty_ex_i = 0.0; // 2018/May/11 for( j=1; j<lastj; j++ ) { Loading @@ -528,12 +597,14 @@ fprintf( stderr, "\n" ); *ijppt = -( j - mpi ); } if( (g=*prept) >= mi ) // if( (g=*prept) > mi ) { mi = g; mpi = j-1; } #if USE_PENALTY_EX mi += fpenalty_ex; mi += fpenalty_ex_i; // mi += fpenalty_ex; #endif #if 0 Loading @@ -545,11 +616,13 @@ fprintf( stderr, "\n" ); *ijppt = +( i - *mpjpt ); } if( (g=*prept) >= *mjpt ) // if( (g=*prept) > *mjpt ) { *mjpt = g; *mpjpt = i-1; } #if USE_PENALTY_EX if( j < lgth2 ) // 2018/May/11 m[j] += fpenalty_ex; #endif #if 1 Loading Loading @@ -647,6 +720,7 @@ fprintf( stderr, "\n" ); } } if( trywarp ) { // fprintf( stderr, "\nwm = %f\n", wm ); Loading @@ -659,7 +733,10 @@ fprintf( stderr, "\n" ); free( prevwarpj ); } Atracking( currentw, lastverticalw, seq1, seq2, mseq1, mseq2, ijp, tailgp, warpis, warpjs, warpbase ); wmo = Atracking( currentw, lastverticalw, seq1, seq2, mseq1, mseq2, ijp, tailgp, warpis, warpjs, warpbase ); if( !tailgp ) wm = wmo; // reporterr( "wm (after tracking) = %f\n", wm ); if( warpis ) free( warpis ); if( warpjs ) free( warpjs ); Loading Loading @@ -698,6 +775,7 @@ double G__align11_noalign( double **n_dynamicmtx, int penal, int penal_ex, char double fpenalty = (double)penal; #if USE_PENALTY_EX double fpenalty_ex = (double)penal_ex; double fpenalty_ex_i; #endif #if 1 double *wtmp; Loading Loading @@ -831,10 +909,18 @@ double G__align11_noalign( double **n_dynamicmtx, int penal, int penal_ex, char for( i=1; i<lgth1+1; i++ ) { initverticalw[i] += fpenalty; #if USE_PENALTY_EX // 2018/Apr/23 // initverticalw[i] += fpenalty_ex * i; // ato de fukkatsu // reporterr( "added _ex\n" ); #endif } for( j=1; j<lgth2+1; j++ ) { currentw[j] += fpenalty; #if USE_PENALTY_EX // 2018/Apr/23 // currentw[j] += fpenalty_ex * j; // ato de fukkatsu // reporterr( "added _ex\n" ); #endif } } Loading Loading @@ -901,6 +987,10 @@ fprintf( stderr, "\n" ); mjpt = m + 1; prept = previousw; curpt = currentw + 1; if( i < lgth1 ) fpenalty_ex_i = fpenalty_ex; else fpenalty_ex_i = 0.0; // 2018/May/11 for( j=1; j<lgth2+1; j++ ) { wm = *prept; Loading @@ -915,12 +1005,13 @@ fprintf( stderr, "\n" ); { wm = g; } if( (g=*prept) >= mi ) // if( (g=*prept) >= mi ) if( (g=*prept) > mi ) // onaji hazu { mi = g; } #if USE_PENALTY_EX mi += fpenalty_ex; mi += fpenalty_ex_i; #endif #if 0 Loading @@ -930,11 +1021,13 @@ fprintf( stderr, "\n" ); { wm = g; } if( (g=*prept) >= *mjpt ) // if( (g=*prept) >= *mjpt ) if( (g=*prept) > *mjpt ) // onaji hazu { *mjpt = g; } #if USE_PENALTY_EX if( j < lgth2 ) // 2018/May/11 m[j] += fpenalty_ex; #endif Loading @@ -952,7 +1045,7 @@ fprintf( stderr, "\n" ); fprintf( stderr, "\n" ); fprintf( stderr, ">\n%s\n", mseq1[0] ); fprintf( stderr, ">\n%s\n", mseq2[0] ); fprintf( stderr, "wm = %f\n", wm ); fprintf( stderr, "wm (noalign) = %f\n", wm ); #endif return( wm ); Loading
core/Salignmm.c +112 −5 Original line number Diff line number Diff line Loading @@ -9,6 +9,9 @@ #define FASTMATCHCALC 1 #define SLOW 0 #define TERMGAPFAC 0.0 #define TERMGAPFAC_EX 0.0 static TLS double **impmtx = NULL; static TLS int impalloclen = 0; Loading Loading @@ -872,6 +875,38 @@ static double Atracking( double *lasthorizontalw, double *lastverticalw, ; else { #if 1 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] ); wm = lasthorizontalw[lgth2-1] - 1.0; // lasthorizontalw[lgth2-1] yori kanarazu chiisai. for( j=lgth2-2; j>=0; j-- ) { if( (g=lasthorizontalw[j]+ ( fpenalty * TERMGAPFAC + fpenalty_ex * (lgth2-1-j) * TERMGAPFAC_EX ) ) > wm ) { wm = g; iin = lgth1-1; jin = j; ijp[lgth1][lgth2] = -( lgth2 - j ); } } for( i=lgth1-2; i>=0; i-- ) { if( ( g=lastverticalw[i]+ ( fpenalty * TERMGAPFAC + fpenalty_ex * (lgth1-1-i) * TERMGAPFAC_EX ) ) > wm ) { wm = g; iin = i; jin = lgth2-1; ijp[lgth1][lgth2] = +( lgth1 - i ); } } if( lasthorizontalw[lgth2-1] > wm ) // score ga onaji baai erabarenai { wm = lasthorizontalw[lgth2-1]; iin = lgth1-1; jin = lgth2-1; ijp[lgth1][lgth2] = 0; } #else wm = lastverticalw[0]; for( i=0; i<lgth1; i++ ) { Loading @@ -891,6 +926,7 @@ static double Atracking( double *lasthorizontalw, double *lastverticalw, ijp[lgth1][lgth2] = -( lgth2 - j ); } } #endif } for( i=0; i<lgth1+1; i++ ) Loading Loading @@ -1027,7 +1063,7 @@ static double Atracking( double *lasthorizontalw, double *lastverticalw, *gt2 = gaptable2; } return( 0.0 ); 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 ) Loading @@ -1046,6 +1082,7 @@ double A__align( double **n_dynamicmtx, char **seq1, char **seq2, double *eff1, int lgth1, lgth2; int resultlen; double wm = 0.0; /* int ?????? */ double wmo = 0.0; double g; double *currentw, *previousw; // double fpenalty = (double)penalty; Loading Loading @@ -1663,20 +1700,48 @@ double A__align( double **n_dynamicmtx, char **seq1, char **seq2, double *eff1, imp_match_calc( n_dynamicmtx, currentw, icyc, jcyc, lgth1, lgth2, seq1, seq2, eff1, eff2, localhom, 1, 0 ); #endif if( headgp == 1 ) { for( i=1; i<lgth1+1; i++ ) { // initverticalw[i] += ( ogcp1[0] + fgcp1[i-1] ) ; initverticalw[i] += ( ogcp1[0] * headgapfreq2 + fgcp1[i-1] * gapfreq2pt[0] ) ; #if USE_PENALTY_EX // 2018/Apr/23 initverticalw[i] += fpenalty_ex * i; // reporterr( "added _ex\n" ); #endif } for( j=1; j<lgth2+1; j++ ) { // currentw[j] += ( ogcp2[0] + fgcp2[j-1] ) ; currentw[j] += ( ogcp2[0] * headgapfreq1 + fgcp2[j-1] * gapfreq1pt[0] ) ; #if USE_PENALTY_EX // 2018/Apr/23 currentw[j] += fpenalty_ex * j; // reporterr( "added _ex\n" ); #endif } } else { for( i=1; i<lgth1+1; i++ ) { initverticalw[i] += fpenalty * TERMGAPFAC; // motto tanjun de yoi? #if USE_PENALTY_EX // 2018/Apr/22 initverticalw[i] += fpenalty_ex * i * TERMGAPFAC_EX; // reporterr( "added _ex\n" ); #endif } for( j=1; j<lgth2+1; j++ ) { currentw[j] += fpenalty * TERMGAPFAC; // motto tanjun de yoi? #if USE_PENALTY_EX // 2018/Apr/22 currentw[j] += fpenalty_ex * j * TERMGAPFAC_EX; // reporterr( "added _ex\n" ); #endif } } #if OUTGAP0TRY else { Loading @@ -1687,6 +1752,8 @@ double A__align( double **n_dynamicmtx, char **seq1, char **seq2, double *eff1, initverticalw[i] -= offset * i / 2.0; } #endif #if 0 fprintf( stderr, "\n " ); for( j=0; j<lgth2+1; j++ ) fprintf( stderr, " %c ", seq2[0][j] ); Loading Loading @@ -1843,6 +1910,7 @@ fprintf( stderr, "\n" ); // fprintf( stderr, "Jump to %d (%c)!", mpi, seq2[0][mpi] ); } if( (g=*prept+*ogcp2pt*gf1vapre) >= mi ) // if( (g=*prept+*ogcp2pt*gf1vapre) > mi ) { mi = g; mpi = j-1; Loading @@ -1862,6 +1930,7 @@ fprintf( stderr, "\n" ); // fprintf( stderr, "Jump to %d (%c)!", *mpjpt, seq1[0][*mpjpt] ); } if( (g=*prept+ ogcp1va* *gf2ptpre) >= *mjpt ) // if( (g=*prept+ ogcp1va* *gf2ptpre) > *mjpt ) { *mjpt = g; *mpjpt = i-1; Loading Loading @@ -1980,10 +2049,13 @@ fprintf( stderr, "\n" ); } else { // 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) ); Atracking( currentw, lastverticalw, seq1, seq2, mseq1, mseq2, ijp, icyc, jcyc, tailgp, warpis, warpjs, warpbase, &ngap1, &ngap2, reuseprofiles, >1, >2 ); // 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, >1, >2 ); if( !tailgp ) wm = wmo; } // reporterr( "wm = %f\n", wm ); #if 1 if( cpmxresult ) { Loading Loading @@ -2134,6 +2206,7 @@ double A__align_variousdist( int **which, double ***matrices, double **n_dynamic int lgth1, lgth2; int resultlen; double wm = 0.0; /* int ?????? */ double wmo = 0.0; /* int ?????? */ double g; double *currentw, *previousw; // double fpenalty = (double)penalty; Loading Loading @@ -2610,13 +2683,42 @@ double A__align_variousdist( int **which, double ***matrices, double **n_dynamic { // initverticalw[i] += ( ogcp1[0] + fgcp1[i-1] ) ; initverticalw[i] += ( ogcp1[0] * headgapfreq2 + fgcp1[i-1] * gapfreq2[0] ) ; #if USE_PENALTY_EX // 2018/Apr/23 initverticalw[i] += fpenalty_ex * i; // reporterr( "added _ex\n" ); #endif } for( j=1; j<lgth2+1; j++ ) { // currentw[j] += ( ogcp2[0] + fgcp2[j-1] ) ; currentw[j] += ( ogcp2[0] * headgapfreq1 + fgcp2[j-1] * gapfreq1[0] ) ; #if USE_PENALTY_EX // 2018/Apr/23 currentw[j] += fpenalty_ex * j; // reporterr( "added _ex\n" ); #endif } } else { for( i=1; i<lgth1+1; i++ ) { initverticalw[i] += fpenalty * TERMGAPFAC; // motto tanjun de yoi? #if USE_PENALTY_EX // 2018/Apr/22 initverticalw[i] += fpenalty_ex * i * TERMGAPFAC_EX; // reporterr( "added _ex\n" ); #endif } for( j=1; j<lgth2+1; j++ ) { currentw[j] += fpenalty * TERMGAPFAC; // motto tanjun de yoi? #if USE_PENALTY_EX // 2018/Apr/22 currentw[j] += fpenalty_ex * j * TERMGAPFAC_EX; // reporterr( "added _ex\n" ); #endif } } #if OUTGAP0TRY else { Loading Loading @@ -2806,6 +2908,7 @@ fprintf( stderr, "\n" ); // fprintf( stderr, "Jump to %d (%c)!", mpi, seq2[0][mpi] ); } if( (g=*prept+*ogcp2pt*gf1vapre) >= mi ) // if( (g=*prept+*ogcp2pt*gf1vapre) > mi ) { mi = g; mpi = j-1; Loading @@ -2825,6 +2928,7 @@ fprintf( stderr, "\n" ); // fprintf( stderr, "Jump to %d (%c)!", *mpjpt, seq1[0][*mpjpt] ); } if( (g=*prept+ ogcp1va* *gf2ptpre) >= *mjpt ) // if( (g=*prept+ ogcp1va* *gf2ptpre) > *mjpt ) { *mjpt = g; *mpjpt = i-1; Loading Loading @@ -2935,8 +3039,11 @@ fprintf( stderr, "\n" ); Atracking_localhom( impmatch, currentw, lastverticalw, seq1, seq2, mseq1, mseq2, ijp, icyc, jcyc, warpis, warpjs, warpbase, &ngap1, &ngap2, 0, NULL, NULL ); } 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. Atracking( currentw, lastverticalw, seq1, seq2, mseq1, mseq2, ijp, icyc, jcyc, tailgp, warpis, warpjs, warpbase, &ngap1, &ngap2, 0, NULL, NULL); wmo = Atracking( currentw, lastverticalw, seq1, seq2, mseq1, mseq2, ijp, icyc, jcyc, tailgp, warpis, warpjs, warpbase, &ngap1, &ngap2, 0, NULL, NULL); if( !tailgp ) wm = wmo; } if( warpis ) free( warpis ); if( warpjs ) free( warpjs ); Loading
core/blosum.c +1 −0 Original line number Diff line number Diff line Loading @@ -367,6 +367,7 @@ static void overridematrix( double **matrix ) } reporterr( "Score(%c=0x%x,%c=0x%x)=%f\n", i1, i1, i2, i2, v ); matrix[i1][i2] = v; matrix[i2][i1] = v; // 2018/May/11 } } Loading
core/constants.c +6 −0 Original line number Diff line number Diff line Loading @@ -714,6 +714,12 @@ void constants( int nseq, char **seq ) fprintf( stdout, "####### average1 = %f\n", average ); #endif if( average < 0.0 ) { reporterr( "\nUnrealistic scoring matrix. Give larger positive values to matches (A/A, B/B, etc).\n\n" ); exit( 1 ); } for( i=0; i<nalphabets; i++ ) for( j=0; j<nalphabets; j++ ) n_distmp[i][j] *= 600.0 / average; #if TEST Loading
core/disttbfast.c +5 −2 Original line number Diff line number Diff line Loading @@ -1460,7 +1460,6 @@ static void *treebasethread( void *arg ) pthread_cond_wait( targ->treecond, targ->mutex ); // tabun iranai (*nrunpt)++; // moved, 20187/Mar/10 m1 = topol[l][0][0]; m2 = topol[l][1][0]; #if 0 Loading Loading @@ -1503,7 +1502,7 @@ static void *treebasethread( void *arg ) } #endif // moved, 2018/Mar/10. Must be after changing memhist[l] if( mergeoralign[l] == 'n' ) { // reporterr( "SKIP!\n" ); Loading @@ -1514,6 +1513,8 @@ static void *treebasethread( void *arg ) // free( topol[l][1] ); topol[l][1] = NULL; // free( topol[l] ); topol[l] = NULL; pthread_mutex_unlock( targ->mutex ); free( localmem[0] ); free( localmem[1] ); continue; } Loading Loading @@ -1975,6 +1976,8 @@ static int treebase( int *nlen, char **aseq, int nadd, char *mergeoralign, char // free( topol[l][0] ); topol[l][0] = NULL; // free( topol[l][1] ); topol[l][1] = NULL; // free( topol[l] ); topol[l] = NULL; free( localmem[0] ); free( localmem[1] ); continue; } Loading