7 #define USE_PENALTY_EX 0
13 static TLS int reccycle = 0;
16 static void match_calc( float *match, float **cpmx1, float **cpmx2, int i1, int lgth2, float **floatwork, int **intwork, int initialize )
20 float **cpmxpd = floatwork;
21 int **cpmxpdn = intwork;
30 for( j=0; j<lgth2; j++ )
37 cpmxpd[j][count] = cpmx2[j][l];
38 cpmxpdn[j][count] = l;
42 cpmxpdn[j][count] = -1;
51 scarr[l] += n_dis[k][l] * cpmx1[i1][k];
54 #if 0 /* ¤³¤ì¤ò»È¤¦¤È¤
\ad¤Ïfloatwork¤Î¥¢¥í¥±¡¼¥È¤òµÕ¤Ë¤¹¤ë */
56 float *fpt, **fptpt, *fpt2;
64 ipt=*iptpt,fpt=*fptpt;
66 *fpt2 += scarr[*ipt++] * *fpt++;
67 fpt2++,iptpt++,fptpt++;
70 for( j=0; j<lgth2; j++ )
73 for( k=0; cpmxpdn[j][k]>-1; k++ )
74 match[j] += scarr[cpmxpdn[j][k]] * cpmxpd[j][k];
83 for( k=0; (cpkd=(*cpmxpdnpt)[k])>-1; k++ )
84 *matchpt += scarr[cpkd] * (*cpmxpdpt)[k];
92 static float Atracking( float *lasthorizontalw, float *lastverticalw,
93 char **seq1, char **seq2,
94 char **mseq1, char **mseq2,
95 int **ijp, int icyc, int jcyc,
96 int ist, int ien, int jst, int jen,
97 int fulllen1, int fulllen2, int tailgp )
99 int i, j, l, iin, jin, ifi, jfi, lgth1, lgth2, k, klim;
100 char *gaptable1, *gt1bk;
101 char *gaptable2, *gt2bk;
106 gt1bk = AllocateCharVec( lgth1+lgth2+1 );
107 gt2bk = AllocateCharVec( lgth1+lgth2+1 );
110 for( i=0; i<lgth1; i++ )
112 fprintf( stderr, "lastverticalw[%d] = %f\n", i, lastverticalw[i] );
117 // fprintf( stderr, "in Atracking, tailgp=%d, ien=%d, fulllen1=%d, jen=%d, fulllen2=%d\n", tailgp, ien, fulllen1, jen, fulllen2 );
121 else if( ien == fulllen1-1 || jen == fulllen2-1 )
123 // fprintf( stderr, "searching lasthorizontalw and lasthorizontalw\n" );
124 wm = lastverticalw[0];
125 for( i=0; i<lgth1; i++ )
127 if( lastverticalw[i] >= wm )
129 wm = lastverticalw[i];
130 iin = i; jin = lgth2-1;
131 ijp[lgth1][lgth2] = +( lgth1 - i );
134 for( j=0; j<lgth2; j++ )
136 if( lasthorizontalw[j] >= wm )
138 wm = lasthorizontalw[j];
139 iin = lgth1-1; jin = j;
140 ijp[lgth1][lgth2] = -( lgth2 - j );
145 else if( jen == fulllen2-1 )
147 fprintf( stderr, "searching lastverticalw\n" );
148 wm = lastverticalw[0];
149 for( i=0; i<lgth1; i++ )
151 if( lastverticalw[i] >= wm )
153 wm = lastverticalw[i];
154 iin = i; jin = lgth2-1;
155 ijp[lgth1][lgth2] = +( lgth1 - i );
159 else if( ien == fulllen1-1 )
161 fprintf( stderr, "searching lasthorizontalw\n" );
162 wm = lasthorizontalw[0];
163 for( j=0; j<lgth2; j++ )
165 if( lasthorizontalw[j] >= wm )
167 wm = lasthorizontalw[j];
168 iin = lgth1-1; jin = j;
169 ijp[lgth1][lgth2] = -( lgth2 - j );
175 for( i=0; i<lgth1+1; i++ )
179 for( j=0; j<lgth2+1; j++ )
181 ijp[0][j] = -( j + 1 );
185 gaptable1 = gt1bk + lgth1+lgth2;
187 gaptable2 = gt2bk + lgth1+lgth2;
190 // if( lgth2 == 1 ) fprintf( stderr, "in Atracking, mseq1 = %s, mseq2 = %s\n", mseq1[0], mseq2[0] );
192 iin = lgth1; jin = lgth2;
194 for( k=0; k<=klim; k++ )
196 if( ijp[iin][jin] < 0 )
198 ifi = iin-1; jfi = jin+ijp[iin][jin];
200 else if( ijp[iin][jin] > 0 )
202 ifi = iin-ijp[iin][jin]; jfi = jin-1;
206 ifi = iin-1; jfi = jin-1;
222 if( iin <= 0 || jin <= 0 ) break;
226 iin = ifi; jin = jfi;
230 for( i=0; i<icyc; i++ ) gapireru( mseq1[i], seq1[i]+ist, gaptable1 );
231 for( j=0; j<jcyc; j++ ) gapireru( mseq2[j], seq2[j]+jst, gaptable2 );
236 // fprintf( stderr, "in Atracking (owari), mseq1 = %s\n", mseq1[0] );
237 // fprintf( stderr, "in Atracking (owari), mseq2 = %s\n", mseq2[0] );
241 static float MSalignmm_tanni( int icyc, int jcyc, double *eff1, double *eff2, char **seq1, char **seq2, float **cpmx1, float **cpmx2, int ist, int ien, int jst, int jen, int alloclen, int fulllen1, int fulllen2, char **mseq1, char **mseq2, float **gapinfo, int headgp, int tailgp )
242 /* score no keisan no sai motokaraaru gap no atukai ni mondai ga aru */
248 float wm = 0.0; /* int ?????? */
250 float *currentw, *previousw;
252 float fpenalty_ex = (float)penalty_ex;
257 float *mjpt, *prept, *curpt;
264 float *initverticalw; /* kufuu sureba iranai */
265 float *lastverticalw; /* kufuu sureba iranai */
276 // char **aseq1bk, **aseq2bk;
279 ogcp1 = gapinfo[0] + ist;
280 fgcp1 = gapinfo[1] + ist;
281 ogcp2 = gapinfo[2] + jst;
282 fgcp2 = gapinfo[3] + jst;
285 char ttt1[10000], ttt2[10000];
293 strncpy( ttt1, seq1[0]+ist, lgth1 ); ttt1[lgth1] = 0;
294 strncpy( ttt2, seq2[0]+jst, lgth2 ); ttt2[lgth2] = 0;
296 fprintf( stderr, "in _tanni ist,ien = %d,%d, lgth1=%d\n", ist, ien, lgth1 );
297 fprintf( stderr, "in _tanni jst,jen = %d,%d, lgth2=%d\n", jst, jen, lgth2 );
298 fprintf( stderr, "ttt1 = %s\n", ttt1 );
299 fprintf( stderr, "ttt2 = %s\n", ttt2 );
303 fprintf( stderr, "in _tanni ist,ien = %d,%d, fulllen1=%d\n", ist, ien, fulllen1 );
304 fprintf( stderr, "in _tanni jst,jen = %d,%d, fulllen2=%d\n", jst, jen, fulllen2 );
305 fprintf( stderr, "in _tanni seq1[0] = %-*.*s\n", ien-ist+1, ien-ist+1, seq1[0]+ist );
306 fprintf( stderr, "in _tanni seq2[0] = %-*.*s\n", jen-jst+1, jen-jst+1, seq2[0]+jst );
310 ll1 = ( (int)(lgth1) ) + 100;
311 ll2 = ( (int)(lgth2) ) + 100;
313 // aseq1 = AllocateCharMtx( icyc, 0 );
314 // aseq2 = AllocateCharMtx( jcyc, 0 );
315 // aseq1bk = AllocateCharMtx( icyc, lgth1+lgth2+100 );
316 // aseq2bk = AllocateCharMtx( jcyc, lgth1+lgth2+100 );
317 // for( i=0; i<icyc; i++ ) aseq1[i] = aseq1bk[i];
318 // for( i=0; i<jcyc; i++ ) aseq2[i] = aseq2bk[i];
320 w1 = AllocateFloatVec( ll2+2 );
321 w2 = AllocateFloatVec( ll2+2 );
323 initverticalw = AllocateFloatVec( ll1+2 );
324 lastverticalw = AllocateFloatVec( ll1+2 );
326 m = AllocateFloatVec( ll2+2 );
327 mp = AllocateIntVec( ll2+2 );
329 floatwork = AllocateFloatMtx( MAX( ll1, ll2 )+2, 27 );
330 intwork = AllocateIntMtx( MAX( ll1, ll2 )+2, 27 );
333 intmtx = AllocateIntMtx( ll1+1, ll2+1 );
340 match_calc( initverticalw, cpmx2+jst, cpmx1+ist, 0, lgth1, floatwork, intwork, 1 );
342 match_calc( currentw, cpmx1+ist, cpmx2+jst, 0, lgth2, floatwork, intwork, 1 );
344 if( headgp || ist != 0 )
346 for( i=1; i<lgth1+1; i++ )
348 initverticalw[i] += ( ogcp1[0] + fgcp1[i-1] ) ;
351 if( headgp || jst != 0 )
353 for( j=1; j<lgth2+1; j++ )
355 currentw[j] += ( ogcp2[0] + fgcp2[j-1] ) ;
359 for( j=1; j<lgth2+1; ++j )
361 m[j] = currentw[j-1] + ogcp1[1]; mp[j] = 0;;
364 lastverticalw[0] = currentw[lgth2-1];
368 if( tailgp || jen != fulllen2-1 ) lasti = lgth1+1; else lasti = lgth1;
369 // if( 1 ) lasti = lgth1+1; else lasti = lgth1;
370 for( i=1; i<lasti; i++ )
373 previousw = currentw;
376 previousw[0] = initverticalw[i-1];
378 match_calc( currentw, cpmx1+ist, cpmx2+jst, i, lgth2, floatwork, intwork, 0 );
379 currentw[0] = initverticalw[i];
381 mi = previousw[0] + ogcp2[1];
387 curpt = currentw + 1;
389 // if( tailgp && jen != fulllen2-1 ) lastj = lgth2+1; else lastj = lgth2;
391 for( j=1; j<lastj; j++ )
397 fprintf( stderr, "%5.0f->", wm );
401 fprintf( stderr, "%5.0f?", g );
406 *ijppt = -( j - mpi );
408 g = *prept + ogcp2[j];
418 g = *mjpt + fgcp1[i-1];
420 fprintf( stderr, "%5.0f?", g );
425 *ijppt = +( i - *mpjpt );
427 g = *prept + ogcp1[i];
438 fprintf( stderr, "%5.0f ", wm );
449 lastverticalw[i] = currentw[lgth2-1];
452 // fprintf( stderr, "wm = %f\n", wm );
454 Atracking( currentw, lastverticalw, seq1, seq2, mseq1, mseq2, ijp, icyc, jcyc, ist, ien, jst, jen, fulllen1, fulllen2, tailgp );
456 fprintf( stderr, "res in _tanni mseq1[0] = %s\n", mseq1[0] );
457 fprintf( stderr, "res in _tanni mseq2[0] = %s\n", mseq2[0] );
460 // for( i=0; i<icyc; i++ ) strcpy( mseq1[i], aseq1[i] );
461 // for( i=0; i<jcyc; i++ ) strcpy( mseq2[i], aseq2[i] );
463 // fprintf( stderr, "in _tanni, aseq1 = %s\n", aseq1[0] );
464 // fprintf( stderr, "in _tanni, mseq1 = %s\n", mseq1[0] );
468 FreeFloatVec( initverticalw );
469 FreeFloatVec( lastverticalw );
475 FreeFloatMtx( floatwork );
476 FreeIntMtx( intwork );
478 FreeIntMtx( intmtx );
481 // FreeCharMtx( aseq1bk );
482 // FreeCharMtx( aseq2bk );
491 static void freearrays_rec1(
492 float *w1, float *w2, float *initverticalw, float *lastverticalw,
493 float *midw, float *midm, float *midn,
494 int *jumpbacki, int *jumpbackj, int *jumpforwi, int *jumpforwj, int *jumpdummi, int *jumpdummj,
496 float **floatwork, int **intwork
498 , float **WMMTX, float **WMMTX2
505 FreeFloatVec( initverticalw );
506 FreeFloatVec( lastverticalw );
507 FreeFloatVec( midw );
508 FreeFloatVec( midm );
509 FreeFloatVec( midn );
511 FreeIntVec( jumpbacki );
512 FreeIntVec( jumpbackj );
513 FreeIntVec( jumpforwi );
514 FreeIntVec( jumpforwj );
515 FreeIntVec( jumpdummi );
516 FreeIntVec( jumpdummj );
521 FreeFloatMtx( floatwork );
522 FreeIntMtx( intwork );
525 FreeFloatMtx( WMMTX );
526 FreeFloatMtx( WMMTX2 );
530 static void freearrays_rec2( char *gaps, char **aseq1, char **aseq2 )
537 FreeCharMtx( aseq1 );
538 FreeCharMtx( aseq2 );
542 static float MSalignmm_rec( int icyc, int jcyc, double *eff1, double *eff2, char **seq1, char **seq2, float **cpmx1, float **cpmx2, int ist, int ien, int jst, int jen, int alloclen, int fulllen1, int fulllen2, char **mseq1, char **mseq2, int depth, float **gapinfo, int *chudanpt, int chudanref, int *chudanres, int headgp, int tailgp )
543 /* score no keisan no sai motokaraaru gap no atukai ni mondai ga aru */
549 char **aseq1, **aseq2;
550 int ll1, ll2, l, len;
551 int lasti, lastj, imid;
552 int jmid = 0; // by D.Mathog, a guess
553 float wm = 0.0; /* int ?????? */
555 float *currentw, *previousw;
557 float fpenalty_ex = (float)penalty_ex;
565 float *mjpt, *prept, *curpt;
570 float *initverticalw; /* kufuu sureba iranai */
571 float *lastverticalw; /* kufuu sureba iranai */
588 int *jumpdummi; //muda
589 int *jumpdummj = NULL; // by D.Mathog, a guess
590 int jumpi, jumpj = 0; // by D.Mathog, a guess
600 static TLS char ttt1[50000];
601 static TLS char ttt2[50000];
606 nglen1 = seqlen( seq1[0] );
607 nglen2 = seqlen( seq2[0] );
610 // fprintf( stderr, "fulllen1 = %d, fulllen2 = %d, headgp = %d, tailgp = %d\n", fulllen1, fulllen2, headgp, tailgp );
612 ogcp1 = gapinfo[0] + ist;
613 fgcp1 = gapinfo[1] + ist;
614 ogcp2 = gapinfo[2] + jst;
615 fgcp2 = gapinfo[3] + jst;
624 // fprintf( stderr, "\nWARNING: lgth1 = %d\n", lgth1 );
626 // fprintf( stderr, "\nWARNING: lgth2 = %d\n", lgth2 );
631 fprintf( stderr, "==== MSalign (depth=%d, reccycle=%d), ist=%d, ien=%d, jst=%d, jen=%d\n", depth, reccycle, ist, ien, jst, jen );
632 strncpy( ttt1, seq1[0]+ist, lgth1 );
633 strncpy( ttt2, seq2[0]+jst, lgth2 );
636 fprintf( stderr, "seq1 = %s\n", ttt1 );
637 fprintf( stderr, "seq2 = %s\n", ttt2 );
639 if( lgth2 <= 0 ) // lgth1 <= 0 ha?
641 // fprintf( stderr, "\n\n==== jimei\n\n" );
643 for( i=0; i<icyc; i++ )
645 strncpy( mseq1[i], seq1[i]+ist, lgth1 );
648 for( i=0; i<jcyc; i++ )
651 for( j=0; j<lgth1; j++ )
652 strcat( mseq2[i], "-" );
655 // fprintf( stderr, "==== mseq1[0] (%d) = %s\n", depth, mseq1[0] );
656 // fprintf( stderr, "==== mseq2[0] (%d) = %s\n", depth, mseq2[0] );
662 aseq1 = AllocateCharMtx( icyc, 0 );
663 aseq2 = AllocateCharMtx( jcyc, 0 );
664 for( i=0; i<icyc; i++ ) aseq1[i] = mseq1[i];
665 for( i=0; i<jcyc; i++ ) aseq2[i] = mseq2[i];
667 aseq1 = AllocateCharMtx( icyc, lgth1+lgth2+100 );
668 aseq2 = AllocateCharMtx( jcyc, lgth1+lgth2+100 );
671 // fprintf( stderr, "####(s) seq1[0] (%d) = \n%-*.*s\n (a%d-a%d)\n", depth, ien-ist+1, ien-ist+1, seq1[0]+ist, ist, ien );
672 // fprintf( stderr, "####(s) seq2[0] (%d) = \n%-*.*s\n (b%d-b%d)\n", depth, jen-jst+1, jen-jst+1, seq2[0]+jst, jst, jen );
674 // if( lgth1 < DPTANNI && lgth2 < DPTANNI ) // & dato lgth ==1 no kanousei ga arunode yokunai
675 // if( lgth1 < DPTANNI ) // kore mo lgth2 ga mijikasugiru kanousei ari
676 if( lgth1 < DPTANNI || lgth2 < DPTANNI ) // zettai ni anzen ka?
678 // fprintf( stderr, "==== Going to _tanni\n" );
680 value = MSalignmm_tanni( icyc, jcyc, eff1, eff2, seq1, seq2, cpmx1, cpmx2, ist, ien, jst, jen, alloclen, fulllen1, fulllen2, aseq1, aseq2, gapinfo, headgp, tailgp );
687 for( i=0; i<icyc; i++ ) strcpy( mseq1[i], aseq1[i] );
688 for( i=0; i<jcyc; i++ ) strcpy( mseq2[i], aseq2[i] );
690 FreeCharMtx( aseq1 );
691 FreeCharMtx( aseq2 );
694 // fprintf( stderr, "value = %f\n", value );
698 // fprintf( stderr, "Trying to divide the mtx\n" );
700 ll1 = ( (int)(lgth1) ) + 100;
701 ll2 = ( (int)(lgth2) ) + 100;
703 // fprintf( stderr, "ll1,ll2=%d,%d\n", ll1, ll2 );
705 w1 = AllocateFloatVec( ll2+2 );
706 w2 = AllocateFloatVec( ll2+2 );
707 // match = AllocateFloatVec( ll2+2 );
708 midw = AllocateFloatVec( ll2+2 );
709 midn = AllocateFloatVec( ll2+2 );
710 midm = AllocateFloatVec( ll2+2 );
711 jumpbacki = AllocateIntVec( ll2+2 );
712 jumpbackj = AllocateIntVec( ll2+2 );
713 jumpforwi = AllocateIntVec( ll2+2 );
714 jumpforwj = AllocateIntVec( ll2+2 );
715 jumpdummi = AllocateIntVec( ll2+2 );
716 jumpdummj = AllocateIntVec( ll2+2 );
718 initverticalw = AllocateFloatVec( ll1+2 );
719 lastverticalw = AllocateFloatVec( ll1+2 );
721 m = AllocateFloatVec( ll2+2 );
722 mp = AllocateIntVec( ll2+2 );
723 gaps = AllocateCharVec( MAX( ll1, ll2 ) + 2 );
725 floatwork = AllocateFloatMtx( MAX( ll1, ll2 )+2, 26 );
726 intwork = AllocateIntMtx( MAX( ll1, ll2 )+2, 26 );
729 fprintf( stderr, "succeeded\n" );
733 WMMTX = AllocateFloatMtx( ll1, ll2 );
734 WMMTX2 = AllocateFloatMtx( ll1, ll2 );
737 shortmtx = AllocateShortMtx( ll1, ll2 );
740 fprintf( stderr, "succeeded\n\n" );
749 match_calc( initverticalw, cpmx2+jst, cpmx1+ist, 0, lgth1, floatwork, intwork, 1 );
751 match_calc( currentw, cpmx1+ist, cpmx2+jst, 0, lgth2, floatwork, intwork, 1 );
753 for( i=1; i<lgth1+1; i++ )
755 initverticalw[i] += ( ogcp1[0] + fgcp1[i-1] ) ;
757 for( j=1; j<lgth2+1; j++ )
759 currentw[j] += ( ogcp2[0] + fgcp2[j-1] ) ;
763 WMMTX[0][0] = initverticalw[0];
764 for( i=1; i<lgth1+1; i++ )
766 WMMTX[i][0] = initverticalw[i];
768 for( j=1; j<lgth2+1; j++ )
770 WMMTX[0][j] = currentw[j];
775 for( j=1; j<lgth2+1; ++j )
777 m[j] = currentw[j-1] + ogcp1[1];
778 // m[j] = currentw[j-1];
782 lastverticalw[0] = currentw[lgth2-1];
786 jumpi = 0; // atode kawaru.
789 for( i=1; i<lasti; i++ )
791 for( i=1; i<=imid; i++ )
794 #ifdef enablemultithread
795 // fprintf( stderr, "chudan = %d, %d\n", *chudanpt, chudanref );
796 if( chudanpt && *chudanpt != chudanref )
798 // fprintf( stderr, "\n\n## CHUUDAN!!! zenhan\n" );
802 w1, w2, initverticalw, lastverticalw, midw, midm, midn,
803 jumpbacki, jumpbackj, jumpforwi, jumpforwj, jumpdummi, jumpdummj,
810 freearrays_rec2( gaps, aseq1, aseq2 );
815 previousw = currentw;
818 previousw[0] = initverticalw[i-1];
820 match_calc( currentw, cpmx1+ist, cpmx2+jst, i, lgth2, floatwork, intwork, 0 );
821 currentw[0] = initverticalw[i];
827 if( i == imid ) midm[0] = m[0];
829 mi = previousw[0] + ogcp2[1];
830 // mi = previousw[0];
834 // ijppt = ijp[i] + 1;
837 curpt = currentw + 1;
842 for( j=1; j<lastj; j++ )
848 fprintf( stderr, "%5.0f->", wm );
851 // g = mi + fpenalty;
853 fprintf( stderr, "%5.0f?", g );
858 // *ijppt = -( j - mpi );
860 g = *prept + ogcp2[j];
871 g = *mjpt + fgcp1[i-1];
872 // g = *mjpt + fpenalty;
874 fprintf( stderr, "%5.0f?", g );
879 // *ijppt = +( i - *mpjpt );
883 g = *prept + ogcp1[i];
895 fprintf( stderr, "%5.0f ", wm );
900 WMMTX[i][j] = *curpt;
901 WMMTX2[i][j] = *mjpt;
904 if( i == imid ) //muda
906 jumpbackj[j] = *mpjpt; // muda atode matomeru
907 jumpbacki[j] = mpi; // muda atode matomeru
908 // fprintf( stderr, "jumpbackj[%d] in forward dp is %d\n", j, *mpjpt );
909 // fprintf( stderr, "jumpbacki[%d] in forward dp is %d\n", j, mpi );
915 // fprintf( stderr, "m[%d] = %f\n", j, m[j] );
922 lastverticalw[i] = currentw[lgth2-1];
925 WMMTX2[i][lgth2] = m[lgth2-1];
931 for( j=0; j<lgth2; j++ ) midw[j] = currentw[j];
932 for( j=0; j<lgth2; j++ ) midm[j] = m[j];
936 // for( j=0; j<lgth2; j++ ) midw[j] = WMMTX[imid][j];
937 // for( j=0; j<lgth2; j++ ) midm[j] = WMMTX2[imid][j];
940 for( i=0; i<lgth1; i++ )
942 for( j=0; j<lgth2; j++ )
944 fprintf( stderr, "% 10.2f ", WMMTX[i][j] );
946 fprintf( stderr, "\n" );
948 fprintf( stderr, "\n" );
949 fprintf( stderr, "WMMTX2 = \n" );
950 for( i=0; i<lgth1; i++ )
952 for( j=0; j<lgth2; j++ )
954 fprintf( stderr, "% 10.2f ", WMMTX2[i][j] );
956 fprintf( stderr, "\n" );
958 fprintf( stderr, "\n" );
963 match_calc( initverticalw, cpmx2+jst, cpmx1+ist, lgth2-1, lgth1, floatwork, intwork, 1 );
964 match_calc( currentw, cpmx1+ist, cpmx2+jst, lgth1-1, lgth2, floatwork, intwork, 1 );
966 for( i=0; i<lgth1-1; i++ )
968 initverticalw[i] += ( fgcp1[lgth1-1] + ogcp1[i+1] );
969 // initverticalw[i] += fpenalty;
971 for( j=0; j<lgth2-1; j++ )
973 currentw[j] += ( fgcp2[lgth2-1] + ogcp2[j+1] );
974 // currentw[j] += fpenalty;
978 for( i=0; i<lgth1-1; i++ )
980 WMMTX[i][lgth2-1] += ( fgcp1[lgth1-1] + ogcp1[i+1] );
981 fprintf( stderr, "fgcp1[lgth1-1] + ogcp1[i+1] = %f\n", fgcp1[lgth1-1] + ogcp1[i+1] );
983 for( j=0; j<lgth2-1; j++ )
985 WMMTX[lgth1-1][j] += ( fgcp2[lgth2-1] + ogcp2[j+1] );
986 fprintf( stderr, "fgcp2[lgth2-1] + ogcp2[j+1] = %f\n", fgcp2[lgth2-1] + ogcp2[j+1] );
995 for( j=lgth2-1; j>0; --j )
997 m[j-1] = currentw[j] + fgcp2[lgth2-2];
998 // m[j-1] = currentw[j];
1002 // for( j=0; j<lgth2; j++ ) m[j] = 0.0;
1003 // m[lgth2-1] ha irunoka?
1006 // for( i=lgth1-2; i>=imid; i-- )
1007 firstm = -9999999.9;
1008 // firstmp = lgth1-1;
1010 for( i=lgth1-2; i>-1; i-- )
1012 #ifdef enablemultithread
1013 // fprintf( stderr, "chudan = %d, %d\n", *chudanpt, chudanref );
1014 if( chudanpt && *chudanpt != chudanref )
1016 // fprintf( stderr, "\n\n## CHUUDAN!!! kouhan\n" );
1020 w1, w2, initverticalw, lastverticalw, midw, midm, midn,
1021 jumpbacki, jumpbackj, jumpforwi, jumpforwj, jumpdummi, jumpdummj,
1028 freearrays_rec2( gaps, aseq1, aseq2 );
1033 previousw = currentw;
1035 previousw[lgth2-1] = initverticalw[i+1];
1036 // match_calc( currentw, seq1, seq2, i, lgth2 );
1037 match_calc( currentw, cpmx1+ist, cpmx2+jst, i, lgth2, floatwork, intwork, 0 );
1039 currentw[lgth2-1] = initverticalw[i];
1041 // m[lgth2] = fgcp1[i];
1042 // WMMTX2[i][lgth2] += m[lgth2];
1043 // fprintf( stderr, "m[] = %f\n", m[lgth2] );
1045 mi = previousw[lgth2-1] + fgcp2[lgth2-2];
1046 // mi = previousw[lgth2-1];
1049 mjpt = m + lgth2 - 2;
1050 prept = previousw + lgth2 - 1;
1051 curpt = currentw + lgth2 - 2;
1052 mpjpt = mp + lgth2 - 2;
1055 for( j=lgth2-2; j>-1; j-- )
1061 g = mi + ogcp2[j+1];
1062 // g = mi + fpenalty;
1070 g = *prept + fgcp2[j];
1074 // fprintf( stderr, "i,j=%d,%d - renewed! mpi = %d\n", i, j, j+1 );
1083 // fprintf( stderr, "i,j=%d,%d *mpjpt = %d\n", i, j, *mpjpt );
1084 g = *mjpt + ogcp1[i+1];
1085 // g = *mjpt + fpenalty;
1093 // if( i == imid )fprintf( stderr, "i,j=%d,%d \n", i, j );
1094 g = *prept + fgcp1[i];
1103 m[j] += fpenalty_ex;
1106 if( i == jumpi || i == imid - 1 )
1108 jumpforwi[j] = ijpi; //muda
1109 jumpforwj[j] = ijpj; //muda
1110 // fprintf( stderr, "jumpfori[%d] = %d\n", j, ijpi );
1111 // fprintf( stderr, "jumpforj[%d] = %d\n", j, ijpj );
1113 if( i == imid ) // muda
1116 // midm[j+1] += *mjpt + fpenalty; //??????
1117 midm[j+1] += *mjpt; //??????
1121 // midn[j] += mi + fpenalty; //????
1122 midn[j] += mi; //????
1126 // WMMTX2[i][j+1] += *mjpt + fpenalty;
1127 WMMTX2[i][j+1] += *mjpt;
1136 // fprintf( stderr, "adding *mjpt (=%f) to WMMTX2[%d][%d]\n", *mjpt, i, j+1 );
1137 g = *prept + fgcp1[i];
1144 WMMTX2[i][j+1] += firstm;
1146 if( i == imid ) midm[j+1] += firstm;
1153 // if( depth == 1 ) fprintf( stderr, "maxwm!! = %f\n", maxwm );
1154 for( j=2; j<lgth2-1; j++ )
1162 // if( depth == 1 ) fprintf( stderr, "maxwm!! = %f\n", maxwm );
1164 for( j=0; j<lgth2+1; j++ )
1172 // if( depth == 1 ) fprintf( stderr, "maxwm!! = %f\n", maxwm );
1175 // if( depth == 1 ) fprintf( stderr, "maxwm!! = %f\n", maxwm );
1178 // fprintf( stderr, "### imid=%d, jmid=%d\n", imid, jmid );
1182 if( jmid > 0 && midn[jmid-1] > wm ) //060413
1185 jumpj = jumpbacki[jmid];
1187 // fprintf( stderr, "rejump (n)\n" );
1189 if( midm[jmid] > wm )
1191 jumpi = jumpbackj[jmid];
1194 // fprintf( stderr, "rejump (m) jumpi=%d\n", jumpi );
1198 // fprintf( stderr, "--> imid=%d, jmid=%d\n", imid, jmid );
1199 // fprintf( stderr, "--> jumpi=%d, jumpj=%d\n", jumpi, jumpj );
1201 fprintf( stderr, "imid = %d\n", imid );
1202 fprintf( stderr, "midn = \n" );
1203 for( j=0; j<lgth2; j++ )
1205 fprintf( stderr, "% 7.1f ", midn[j] );
1207 fprintf( stderr, "\n" );
1208 fprintf( stderr, "midw = \n" );
1209 for( j=0; j<lgth2; j++ )
1211 fprintf( stderr, "% 7.1f ", midw[j] );
1213 fprintf( stderr, "\n" );
1214 fprintf( stderr, "midm = \n" );
1215 for( j=0; j<lgth2; j++ )
1217 fprintf( stderr, "% 7.1f ", midm[j] );
1219 fprintf( stderr, "\n" );
1221 // fprintf( stderr, "maxwm = %f\n", maxwm );
1223 if( i == jumpi ) //saki?
1225 // fprintf( stderr, "#### FIRST i=%d, jumpi<imid=%d<%d, ist=%d, ien=%d, firstmp=%d, lgth1=%d\n", i, jumpi, imid, ist, ien, firstmp, lgth1 );
1226 // fprintf( stderr, "#### mark 1\n" );
1227 // fprintf( stderr, "imid, jumpi = %d,%d\n", imid, jumpi );
1228 // fprintf( stderr, "jmid, jumpj = %d,%d\n", jmid, jumpj );
1232 // fprintf( stderr, "#### CHUI2!\n" );
1233 jumpj = 0; jmid = 1;
1234 #if 0 // v6.823 made
1242 // if( 1 || firstmp > 100 ) // naze 100
1243 if( imid < firstmp-1 ) // naze 100
1259 else if( jmid == lgth2 )
1261 fprintf( stderr, "CHUI1!\n" );
1263 imid=jumpforwi[0]; jmid=lgth2-1;
1266 else if( jmid >= lgth2 )
1268 // fprintf( stderr, "CHUI1!\n" );
1269 jumpi=imid-1; jmid=lgth2;
1275 // fprintf( stderr, "#### CHUI3!\n" );
1276 imid = jumpforwi[jumpj];
1277 jmid = jumpforwj[jumpj];
1278 if( imid == jumpi ) jumpi = imid-1;
1281 fprintf( stderr, "jumpi -> %d\n", jumpi );
1282 fprintf( stderr, "jumpj -> %d\n", jumpj );
1283 fprintf( stderr, "imid -> %d\n", imid );
1284 fprintf( stderr, "jmid -> %d\n", jmid );
1286 // fprintf( stderr, "#### FINAL i=%d, jumpi<imid=%d<%d, ist=%d, ien=%d, firstmp=%d\n", i, jumpi, imid, ist, ien, firstmp );
1296 // fprintf( stderr, "imid = %d, but jumpi = %d\n", imid, jumpi );
1297 // fprintf( stderr, "jmid = %d, but jumpj = %d\n", jmid, jumpj );
1299 // for( j=0; j<lgth2; j++ ) midw[j] += currentw[j];
1300 // for( j=0; j<lgth2; j++ ) midm[j] += m[j+1];
1301 // for( j=0; j<lgth2; j++ ) midw[j] += WMMTX[imid][j];
1302 // for( j=0; j<lgth2; j++ ) midw[j] += WMMTX[imid][j];
1306 fprintf( stderr, "WMMTX = \n" );
1307 for( i=0; i<lgth1; i++ )
1309 fprintf( stderr, "%d ", i );
1310 for( j=0; j<lgth2; j++ )
1312 fprintf( stderr, "% 7.2f ", WMMTX[i][j] );
1314 fprintf( stderr, "\n" );
1316 // fprintf( stderr, "WMMTX2 = (p = %f)\n", fpenalty );
1317 for( i=0; i<lgth1; i++ )
1319 fprintf( stderr, "%d ", i );
1320 for( j=0; j<lgth2+1; j++ )
1322 fprintf( stderr, "% 7.2f ", WMMTX2[i][j] );
1324 fprintf( stderr, "\n" );
1327 fprintf( stderr, "jumpbacki = \n" );
1328 for( j=0; j<lgth2; j++ )
1330 fprintf( stderr, "% 7d ", jumpbacki[j] );
1332 fprintf( stderr, "\n" );
1333 fprintf( stderr, "jumpbackj = \n" );
1334 for( j=0; j<lgth2; j++ )
1336 fprintf( stderr, "% 7d ", jumpbackj[j] );
1338 fprintf( stderr, "\n" );
1339 fprintf( stderr, "jumpforwi = \n" );
1340 for( j=0; j<lgth2; j++ )
1342 fprintf( stderr, "% 7d ", jumpforwi[j] );
1344 fprintf( stderr, "\n" );
1345 fprintf( stderr, "jumpforwj = \n" );
1346 for( j=0; j<lgth2; j++ )
1348 fprintf( stderr, "% 7d ", jumpforwj[j] );
1350 fprintf( stderr, "\n" );
1356 // Atracking( currentw, lastverticalw, seq1, seq2, mseq1, mseq2, cpmx1, cpmx2, ijp, icyc, jcyc );
1359 resultlen = strlen( mseq1[0] );
1360 if( alloclen < resultlen || resultlen > N )
1362 fprintf( stderr, "alloclen=%d, resultlen=%d, N=%d\n", alloclen, resultlen, N );
1363 ErrorExit( "LENGTH OVER!\n" );
1370 fprintf( stderr, "jumpi = %d, imid = %d\n", jumpi, imid );
1371 fprintf( stderr, "jumpj = %d, jmid = %d\n", jumpj, jmid );
1373 fprintf( stderr, "imid = %d\n", imid );
1374 fprintf( stderr, "jmid = %d\n", jmid );
1379 w1, w2, initverticalw, lastverticalw, midw, midm, midn,
1380 jumpbacki, jumpbackj, jumpforwi, jumpforwj, jumpdummi, jumpdummj,
1389 // fprintf( stderr, "==== calling myself (first)\n" );
1391 value = MSalignmm_rec( icyc, jcyc, eff1, eff2, seq1, seq2, cpmx1, cpmx2, ist, ist+jumpi, jst, jst+jumpj, alloclen, fulllen1, fulllen2, aseq1, aseq2, depth, gapinfo, NULL, 0, NULL, headgp, tailgp ); // chudan mada
1393 fprintf( stderr, "aseq1[0] = %s\n", aseq1[0] );
1394 fprintf( stderr, "aseq2[0] = %s\n", aseq2[0] );
1398 for( i=0; i<icyc; i++ ) strcpy( mseq1[i], aseq1[i] );
1399 for( i=0; i<jcyc; i++ ) strcpy( mseq2[i], aseq2[i] );
1402 // fprintf( stderr, "====(f) aseq1[0] (%d) = %s (%d-%d)\n", depth, aseq1[0], ist, ien );
1403 // fprintf( stderr, "====(f) aseq2[0] (%d) = %s (%d-%d)\n", depth, aseq2[0], jst, jen );
1405 len = strlen( mseq1[0] );
1406 // fprintf( stderr, "len = %d\n", len );
1407 l = jmid - jumpj - 1;
1408 // fprintf( stderr, "l=%d\n", l );
1411 for( i=0; i<l; i++ ) gaps[i] = '-'; gaps[i] = 0;
1412 for( i=0; i<icyc; i++ )
1414 strcat( mseq1[i], gaps );
1415 mseq1[i][len+l] = 0;
1417 for( j=0; j<jcyc; j++ )
1419 strncat( mseq2[j], seq2[j]+jst+jumpj+1, l );
1420 mseq2[j][len+l] = 0;
1422 // fprintf( stderr, "penalizing (2) .. %f(%d), %f(%d)\n", ogcp2[jumpj+1], jumpj+1, fgcp2[jmid-1], jmid-1 );
1423 value += ( ogcp2[jumpj+1] + fgcp2[jmid-1] );
1424 // value += fpenalty;
1426 len = strlen( mseq1[0] );
1427 l = imid - jumpi - 1;
1428 // fprintf( stderr, "l=%d\n", l );
1431 for( i=0; i<l; i++ ) gaps[i] = '-'; gaps[i] = 0;
1432 for( i=0; i<icyc; i++ )
1434 strncat( mseq1[i], seq1[i]+ist+jumpi+1, l );
1435 mseq1[i][len+l] = 0;
1437 for( j=0; j<jcyc; j++ )
1439 strcat( mseq2[j], gaps );
1440 mseq2[j][len+l] = 0;
1443 // for( i=0; i<lgth1; i++ ) fprintf( stderr, "ogcp1[%d] = %f\n", i, ogcp1[i] );
1444 // for( i=0; i<lgth1; i++ ) fprintf( stderr, "fgcp1[%d] = %f\n", i, fgcp1[i] );
1447 // fprintf( stderr, "penalizing (1) .. ogcp1[%d] = %f, fgcp1[%d] = %f\n", jumpi+1, ogcp1[jumpi+1], imid-1, fgcp1[imid-1] );
1448 value += ( ogcp1[jumpi+1] + fgcp1[imid-1] );
1449 // value += fpenalty;
1452 for( i=0; i<icyc; i++ ) fprintf( stderr, "after gapfill mseq1[%d]=%s\n", i, mseq1[i] );
1453 for( i=0; i<jcyc; i++ ) fprintf( stderr, "after gapfill mseq2[%d]=%s\n", i, mseq2[i] );
1456 // fprintf( stderr, "==== calling myself (second)\n" );
1459 alnlen = strlen( aseq1[0] );
1460 for( i=0; i<icyc; i++ ) aseq1[i] += alnlen;
1461 for( i=0; i<jcyc; i++ ) aseq2[i] += alnlen;
1464 value += MSalignmm_rec( icyc, jcyc, eff1, eff2, seq1, seq2, cpmx1, cpmx2, ist+imid, ien, jst+jmid, jen, alloclen, fulllen1, fulllen2, aseq1, aseq2, depth, gapinfo, NULL, 0, NULL, headgp, tailgp ); // chudan mada
1466 fprintf( stderr, "aseq1[0] = %s\n", aseq1[0] );
1467 fprintf( stderr, "aseq2[0] = %s\n", aseq2[0] );
1473 if( value - maxwm > 1 || maxwm - value > 1 )
1475 fprintf( stderr, "WARNING value = %f, but maxwm = %f\n", value, maxwm );
1476 for( i=0; i<icyc; i++ )
1478 fprintf( stderr, ">1-%d\n%s\n", i, mseq1[i] );
1479 fprintf( stderr, "%s\n", aseq1[i] );
1481 for( i=0; i<jcyc; i++ )
1483 fprintf( stderr, ">2-%d\n%s\n", i, mseq2[i] );
1484 fprintf( stderr, "%s\n", aseq2[i] );
1491 fprintf( stderr, "value = %.0f, maxwm = %.0f -> ok\n", value, maxwm );
1497 for( i=0; i<icyc; i++ ) strcat( mseq1[i], aseq1[i] );
1498 for( i=0; i<jcyc; i++ ) strcat( mseq2[i], aseq2[i] );
1501 // fprintf( stderr, "====(s) aseq1[0] (%d) = \n%s\n (a%d-a%d)\n", depth, mseq1[0], ist, ien );
1502 // fprintf( stderr, "====(s) aseq2[0] (%d) = \n%s\n (b%d-b%d)\n", depth, mseq2[0], jst, jen );
1504 freearrays_rec2( gaps, aseq1, aseq2 );
1507 if( seqlen( seq1[0] ) != nglen1 )
1509 fprintf( stderr, "bug! hairetsu ga kowareta! (nglen1) seqlen(seq1[0])=%d but nglen1=%d\n", seqlen( seq1[0] ), nglen1 );
1510 fprintf( stderr, "seq1[0] = %s\n", seq1[0] );
1514 fprintf( stderr, "nglen1 is ok in _rec\n" );
1515 if( seqlen( seq2[0] ) != nglen2 )
1517 fprintf( stderr, "bug! hairetsu ga kowareta! (nglen2) seqlen(seq2[0])=%d but nglen2=%d\n", seqlen( seq2[0] ), nglen2 );
1521 fprintf( stderr, "nglen2 is ok in _rec\n" );
1527 static void freearrays(
1539 FreeFloatVec( ogcp1 );
1540 FreeFloatVec( ogcp2 );
1541 FreeFloatVec( fgcp1 );
1542 FreeFloatVec( fgcp2 );
1543 FreeFloatMtx( cpmx1 );
1544 FreeFloatMtx( cpmx2 );
1545 free( (void *)gapinfo );
1547 FreeCharMtx( mseq1 );
1548 FreeCharMtx( mseq2 );
1551 float MSalignmm( char **seq1, char **seq2, double *eff1, double *eff2, int icyc, int jcyc, int alloclen, char *sgap1, char *sgap2, char *egap1, char *egap2, int *chudanpt, int chudanref, int *chudanres, int headgp, int tailgp )
1552 /* score no keisan no sai motokaraaru gap no atukai ni mondai ga aru */
1558 float wm = 0.0; /* int ?????? */
1568 float fpenalty = (float)penalty;
1572 fprintf( stderr, "eff in SA+++align\n" );
1573 for( i=0; i<icyc; i++ ) fprintf( stderr, "eff1[%d] = %f\n", i, eff1[i] );
1576 nglen1 = seqlen( seq1[0] );
1577 nglen2 = seqlen( seq2[0] );
1580 fprintf( stderr, "\n" );
1581 for( i=0; i<icyc; i++ ) fprintf( stderr, "seq1[%d] at root = %s\n", i, seq1[i] );
1582 for( j=0; j<jcyc; j++ ) fprintf( stderr, "seq2[%d] at root = %s\n", j, seq2[j] );
1583 fprintf( stderr, "\n" );
1586 lgth1 = strlen( seq1[0] );
1587 lgth2 = strlen( seq2[0] );
1589 ll1 = ( (int)(lgth1) ) + 100;
1590 ll2 = ( (int)(lgth2) ) + 100;
1592 mseq1 = AllocateCharMtx( icyc, ll1+ll2 );
1593 mseq2 = AllocateCharMtx( jcyc, ll1+ll2 );
1595 gapinfo = AllocateFloatMtx( 4, 0 );
1596 ogcp1 = AllocateFloatVec( ll1+2 );
1597 ogcp2 = AllocateFloatVec( ll2+2 );
1598 fgcp1 = AllocateFloatVec( ll1+2 );
1599 fgcp2 = AllocateFloatVec( ll2+2 );
1602 cpmx1 = AllocateFloatMtx( ll1+2, 27 );
1603 cpmx2 = AllocateFloatMtx( ll2+2, 27 );
1605 for( i=0; i<icyc; i++ )
1607 if( strlen( seq1[i] ) != lgth1 )
1609 fprintf( stderr, "i = %d / %d\n", i, icyc );
1610 fprintf( stderr, "bug! hairetsu ga kowareta!\n" );
1614 for( j=0; j<jcyc; j++ )
1616 if( strlen( seq2[j] ) != lgth2 )
1618 fprintf( stderr, "j = %d / %d\n", j, jcyc );
1619 fprintf( stderr, "bug! hairetsu ga kowareta!\n" );
1624 MScpmx_calc_new( seq1, cpmx1, eff1, lgth1, icyc );
1625 MScpmx_calc_new( seq2, cpmx2, eff2, lgth2, jcyc );
1632 new_OpeningGapCount( ogcp1, icyc, seq1, eff1, lgth1, sgap1 );
1633 new_OpeningGapCount( ogcp2, jcyc, seq2, eff2, lgth2, sgap2 );
1634 new_FinalGapCount( fgcp1, icyc, seq1, eff1, lgth1, egap2 );
1635 new_FinalGapCount( fgcp2, jcyc, seq2, eff2, lgth2, egap2 );
1639 st_OpeningGapCount( ogcp1, icyc, seq1, eff1, lgth1 );
1640 st_OpeningGapCount( ogcp2, jcyc, seq2, eff2, lgth2 );
1641 st_FinalGapCount( fgcp1, icyc, seq1, eff1, lgth1 );
1642 st_FinalGapCount( fgcp2, jcyc, seq2, eff2, lgth2 );
1646 for( i=0; i<lgth1; i++ )
1648 ogcp1[i] = 0.5 * ( 1.0 - ogcp1[i] ) * fpenalty;
1649 fgcp1[i] = 0.5 * ( 1.0 - fgcp1[i] ) * fpenalty;
1650 // fprintf( stderr, "fgcp1[%d] = %f\n", i, fgcp1[i] );
1652 for( i=0; i<lgth2; i++ )
1654 ogcp2[i] = 0.5 * ( 1.0 - ogcp2[i] ) * fpenalty;
1655 fgcp2[i] = 0.5 * ( 1.0 - fgcp2[i] ) * fpenalty;
1656 // fprintf( stderr, "fgcp2[%d] = %f\n", i, fgcp2[i] );
1659 for( i=0; i<lgth1; i++ )
1661 ogcp1[i] = 0.5 * fpenalty;
1662 fgcp1[i] = 0.5 * fpenalty;
1664 for( i=0; i<lgth2; i++ )
1666 ogcp2[i] = 0.5 * fpenalty;
1667 fgcp2[i] = 0.5 * fpenalty;
1678 fprintf( stdout, "in MSalignmm.c\n" );
1679 for( i=0; i<icyc; i++ )
1681 fprintf( stdout, ">%d of GROUP1\n", i );
1682 fprintf( stdout, "%s\n", seq1[i] );
1684 for( i=0; i<jcyc; i++ )
1686 fprintf( stdout, ">%d of GROUP2\n", i );
1687 fprintf( stdout, "%s\n", seq2[i] );
1692 wm = MSalignmm_rec( icyc, jcyc, eff1, eff2, seq1, seq2, cpmx1, cpmx2, 0, lgth1-1, 0, lgth2-1, alloclen, lgth1, lgth2, mseq1, mseq2, 0, gapinfo, chudanpt, chudanref, chudanres, headgp, tailgp );
1693 #ifdef enablemultithread
1694 if( chudanres && *chudanres )
1696 // fprintf( stderr, "\n\n## CHUUDAN!!! relay\n" );
1698 freearrays( ogcp1, ogcp2, fgcp1, fgcp2, cpmx1, cpmx2, gapinfo, mseq1, mseq2 );
1704 fprintf( stderr, " seq1[0] = %s\n", seq1[0] );
1705 fprintf( stderr, " seq2[0] = %s\n", seq2[0] );
1706 fprintf( stderr, "mseq1[0] = %s\n", mseq1[0] );
1707 fprintf( stderr, "mseq2[0] = %s\n", mseq2[0] );
1710 // fprintf( stderr, "wm = %f\n", wm );
1713 for( i=0; i<icyc; i++ ) strcpy( seq1[i], mseq1[i] );
1714 for( i=0; i<jcyc; i++ ) strcpy( seq2[i], mseq2[i] );
1716 if( seqlen( seq1[0] ) != nglen1 )
1718 fprintf( stderr, "bug! hairetsu ga kowareta! (nglen1) seqlen(seq1[0])=%d but nglen1=%d\n", seqlen( seq1[0] ), nglen1 );
1719 fprintf( stderr, "seq1[0] = %s\n", seq1[0] );
1722 if( seqlen( seq2[0] ) != nglen2 )
1724 fprintf( stderr, "bug! hairetsu ga kowareta! (nglen2) seqlen(seq2[0])=%d but nglen2=%d\n", seqlen( seq2[0] ), nglen2 );
1729 freearrays( ogcp1, ogcp2, fgcp1, fgcp2, cpmx1, cpmx2, gapinfo, mseq1, mseq2 );
1731 lgth1 = strlen( seq1[0] );
1732 lgth2 = strlen( seq2[0] );
1733 for( i=0; i<icyc; i++ )
1735 if( strlen( seq1[i] ) != lgth1 )
1737 fprintf( stderr, "i = %d / %d\n", i, icyc );
1738 fprintf( stderr, "hairetsu ga kowareta (end of MSalignmm) !\n" );
1742 for( j=0; j<jcyc; j++ )
1744 if( strlen( seq2[j] ) != lgth2 )
1746 fprintf( stderr, "j = %d / %d\n", j, jcyc );
1747 fprintf( stderr, "hairetsu ga kowareta (end of MSalignmm) !\n" );