13 void arguments( int argc, char *argv[] )
54 ppenalty = NOTSPECIFIED;
55 ppenalty_ex = NOTSPECIFIED;
56 poffset = NOTSPECIFIED;
57 kimuraR = NOTSPECIFIED;
60 fftWinSize = NOTSPECIFIED;
61 fftThreshold = NOTSPECIFIED;
62 RNAppenalty = NOTSPECIFIED;
63 RNAppenalty_ex = NOTSPECIFIED;
64 RNApthr = NOTSPECIFIED;
66 consweight_multi = 1.0;
69 while( --argc > 0 && (*++argv)[0] == '-' )
71 while ( ( c = *++argv[0] ) )
77 fprintf( stderr, "inputfile = %s\n", inputfile );
81 RNApthr = (int)( atof( *++argv ) * 1000 - 0.5 );
85 RNAppenalty = (int)( atof( *++argv ) * 1000 - 0.5 );
89 ppenalty = (int)( atof( *++argv ) * 1000 - 0.5 );
90 // fprintf( stderr, "ppenalty = %d\n", ppenalty );
94 ppenalty_ex = (int)( atof( *++argv ) * 1000 - 0.5 );
95 fprintf( stderr, "ppenalty_ex = %d\n", ppenalty_ex );
99 poffset = (int)( atof( *++argv ) * 1000 - 0.5 );
100 // fprintf( stderr, "poffset = %d\n", poffset );
104 kimuraR = atoi( *++argv );
105 fprintf( stderr, "kappa = %d\n", kimuraR );
109 nblosum = atoi( *++argv );
111 fprintf( stderr, "blosum %d / kimura 200\n", nblosum );
115 pamN = atoi( *++argv );
118 fprintf( stderr, "jtt/kimura %d\n", pamN );
122 pamN = atoi( *++argv );
125 fprintf( stderr, "tm %d\n", pamN );
129 fastathreshold = atof( *++argv );
134 consweight_rna = atof( *++argv );
139 consweight_multi = atof( *++argv );
250 /* Modified 01/08/27, default: user tree */
254 /* modification end. */
256 fftThreshold = atoi( *++argv );
260 fftWinSize = atoi( *++argv );
267 fprintf( stderr, "illegal option %c\n", c );
277 cut = atof( (*argv) );
282 fprintf( stderr, "options: Check source file !\n" );
285 if( tbitr == 1 && outgap == 0 )
287 fprintf( stderr, "conflicting options : o, m or u\n" );
290 if( alg == 'C' && outgap == 0 )
292 fprintf( stderr, "conflicting options : C, o\n" );
298 void treebase( int nlen[M], char **aseq, char **mseq1, char **mseq2, int ***topol, double *effarr, int *alloclen, LocalHom **localhomtable, RNApair ***singlerna, double *effarr_kozo )
303 float pscore, tscore;
304 static char *indication1, *indication2;
305 static double *effarr1 = NULL;
306 static double *effarr2 = NULL;
307 static double *effarr1_kozo = NULL;
308 static double *effarr2_kozo = NULL;
309 static LocalHom ***localhomshrink = NULL;
314 RNApair ***grouprna1, ***grouprna2;
316 if( rnakozo && rnaprediction == 'm' )
318 grouprna1 = (RNApair ***)calloc( njob, sizeof( RNApair ** ) );
319 grouprna2 = (RNApair ***)calloc( njob, sizeof( RNApair ** ) );
323 grouprna1 = grouprna2 = NULL;
326 if( effarr1 == NULL )
328 fftlog = AllocateIntVec( njob );
329 effarr1 = AllocateDoubleVec( njob );
330 effarr2 = AllocateDoubleVec( njob );
331 indication1 = AllocateCharVec( 150 );
332 indication2 = AllocateCharVec( 150 );
337 localhomshrink = (LocalHom ***)calloc( njob, sizeof( LocalHom ** ) );
338 for( i=0; i<njob; i++)
339 localhomshrink[i] = (LocalHom **)calloc( njob, sizeof( LocalHom *) );
342 effarr1_kozo = AllocateDoubleVec( njob ); //tsuneni allocate sareru.
343 effarr2_kozo = AllocateDoubleVec( njob ); //tsuneni allocate sareru.
344 for( i=0; i<njob; i++ ) effarr1_kozo[i] = 0.0;
345 for( i=0; i<njob; i++ ) effarr2_kozo[i] = 0.0;
348 for( l=0; l<njob; l++ ) fftlog[l] = 1;
351 fprintf( stderr, "##### fftwinsize = %d, fftthreshold = %d\n", fftWinSize, fftThreshold );
355 for( i=0; i<njob; i++ )
356 fprintf( stderr, "TBFAST effarr[%d] = %f\n", i, effarr[i] );
361 calcimportance( njob, effarr, aseq, localhomtable );
364 // writePre( njob, name, nlen, aseq, 0 );
367 for( l=0; l<njob-1; l++ )
371 len1 = strlen( aseq[m1] );
372 len2 = strlen( aseq[m2] );
373 if( *alloclen < len1 + len2 )
375 fprintf( stderr, "\nReallocating.." );
376 *alloclen = ( len1 + len2 ) + 1000;
377 ReallocateCharMtx( aseq, njob, *alloclen + 10 );
378 fprintf( stderr, "done. *alloclen = %d\n", *alloclen );
383 clus1 = fastconjuction_noname_kozo( topol[l][0], aseq, mseq1, effarr1, effarr, effarr1_kozo, effarr_kozo, indication1 );
384 clus2 = fastconjuction_noname_kozo( topol[l][1], aseq, mseq2, effarr2, effarr, effarr2_kozo, effarr_kozo, indication2 );
388 clus1 = fastconjuction_noname( topol[l][0], aseq, mseq1, effarr1, effarr, indication1 );
389 clus2 = fastconjuction_noname( topol[l][1], aseq, mseq2, effarr2, effarr, indication2 );
393 fprintf( trap_g, "\nSTEP-%d\n", l );
394 fprintf( trap_g, "group1 = %s\n", indication1 );
395 fprintf( trap_g, "group2 = %s\n", indication2 );
398 fprintf( stderr, "\rSTEP % 5d /%d ", l+1, njob-1 );
400 fprintf( stdout, "STEP %d /%d\n", l+1, njob-1 );
401 fprintf( stderr, "STEP %d /%d\n", l+1, njob-1 );
402 fprintf( stderr, "group1 = %.66s", indication1 );
403 if( strlen( indication1 ) > 66 ) fprintf( stderr, "..." );
404 fprintf( stderr, "\n" );
405 fprintf( stderr, "group2 = %.66s", indication2 );
406 if( strlen( indication2 ) > 66 ) fprintf( stderr, "..." );
407 fprintf( stderr, "\n" );
412 // for( i=0; i<clus1; i++ ) fprintf( stderr, "## STEP%d-eff for mseq1-%d %f\n", l+1, i, effarr1[i] );
416 fastshrinklocalhom( topol[l][0], topol[l][1], localhomtable, localhomshrink );
417 // msfastshrinklocalhom( topol[l][0], topol[l][1], localhomtable, localhomshrink );
418 // fprintf( stderr, "localhomshrink =\n" );
419 // outlocalhompt( localhomshrink, clus1, clus2 );
420 // weightimportance4( clus1, clus2, effarr1, effarr2, localhomshrink );
421 // fprintf( stderr, "after weight =\n" );
422 // outlocalhompt( localhomshrink, clus1, clus2 );
424 if( rnakozo && rnaprediction == 'm' )
426 makegrouprna( grouprna1, singlerna, topol[l][0] );
427 makegrouprna( grouprna2, singlerna, topol[l][1] );
434 fprintf( stderr, "before align all\n" );
435 display( aseq, njob );
436 fprintf( stderr, "\n" );
437 fprintf( stderr, "before align 1 %s \n", indication1 );
438 display( mseq1, clus1 );
439 fprintf( stderr, "\n" );
440 fprintf( stderr, "before align 2 %s \n", indication2 );
441 display( mseq2, clus2 );
442 fprintf( stderr, "\n" );
445 if( !nevermemsave && ( constraint != 2 && alg != 'M' && ( len1 > 10000 || len2 > 10000 ) ) )
447 fprintf( stderr, "\nlen1=%d, len2=%d, Switching to the memsave mode.\n", len1, len2 );
449 if( commonIP ) FreeIntMtx( commonIP );
455 // if( fftlog[m1] && fftlog[m2] ) ffttry = ( nlen[m1] > clus1 && nlen[m2] > clus2 );
456 if( fftlog[m1] && fftlog[m2] ) ffttry = ( nlen[m1] > clus1 && nlen[m2] > clus2 && clus1 < 1000 && clus2 < 1000 );
458 // ffttry = ( nlen[m1] > clus1 && nlen[m2] > clus2 && clus1 < 5000 && clus2 < 5000 ); // v6.708
459 // fprintf( stderr, "f=%d, len1/fftlog[m1]=%f, clus1=%d, len2/fftlog[m2]=%f, clus2=%d\n", ffttry, (float)len1/fftlog[m1], clus1, (float)len2/fftlog[m2], clus2 );
460 // fprintf( stderr, "f=%d, clus1=%d, fftlog[m1]=%d, clus2=%d, fftlog[m2]=%d\n", ffttry, clus1, fftlog[m1], clus2, fftlog[m2] );
461 if( constraint == 2 )
465 fprintf( stderr, "\n\nMemory saving mode is not supported.\n\n" );
468 fprintf( stderr, "c" );
471 imp_match_init_strict( NULL, clus1, clus2, strlen( mseq1[0] ), strlen( mseq2[0] ), mseq1, mseq2, effarr1, effarr2, effarr1_kozo, effarr2_kozo, localhomshrink, 1 );
472 if( rnakozo ) imp_rna( clus1, clus2, mseq1, mseq2, effarr1, effarr2, grouprna1, grouprna2, NULL, NULL, NULL );
473 pscore = A__align( mseq1, mseq2, effarr1, effarr2, clus1, clus2, *alloclen, localhomshrink, &dumfl, NULL, NULL, NULL, NULL );
475 else if( alg == 'H' )
477 imp_match_init_strictH( NULL, clus1, clus2, strlen( mseq1[0] ), strlen( mseq2[0] ), mseq1, mseq2, effarr1, effarr2, localhomshrink, 1 );
478 pscore = H__align( mseq1, mseq2, effarr1, effarr2, clus1, clus2, *alloclen, localhomshrink, &dumfl, NULL, NULL, NULL, NULL );
480 else if( alg == 'Q' )
482 imp_match_init_strictQ( NULL, clus1, clus2, strlen( mseq1[0] ), strlen( mseq2[0] ), mseq1, mseq2, effarr1, effarr2, localhomshrink, 1 );
483 if( rnakozo ) imp_rnaQ( clus1, clus2, mseq1, mseq2, effarr1, effarr2, grouprna1, grouprna2, NULL, NULL, NULL );
484 pscore = Q__align( mseq1, mseq2, effarr1, effarr2, clus1, clus2, *alloclen, localhomshrink, &dumfl, NULL, NULL, NULL, NULL );
486 else if( alg == 'R' )
488 imp_match_init_strictR( NULL, clus1, clus2, strlen( mseq1[0] ), strlen( mseq2[0] ), mseq1, mseq2, effarr1, effarr2, localhomshrink, 1 );
489 pscore = R__align( mseq1, mseq2, effarr1, effarr2, clus1, clus2, *alloclen, localhomshrink, &dumfl, NULL, NULL, NULL, NULL );
492 else if( force_fft || ( use_fft && ffttry ) )
494 fprintf( stderr, "f" );
497 fprintf( stderr, "m" );
498 pscore = Falign_udpari_long( mseq1, mseq2, effarr1, effarr2, clus1, clus2, *alloclen, fftlog+m1 );
501 pscore = Falign( mseq1, mseq2, effarr1, effarr2, clus1, clus2, *alloclen, fftlog+m1 );
505 fprintf( stderr, "d" );
510 pscore = Aalign( mseq1, mseq2, effarr1, effarr2, clus1, clus2, *alloclen );
513 fprintf( stderr, "m" );
514 pscore = MSalignmm( mseq1, mseq2, effarr1, effarr2, clus1, clus2, *alloclen, NULL, NULL, NULL, NULL );
517 pscore = A__align( mseq1, mseq2, effarr1, effarr2, clus1, clus2, *alloclen, NULL, &dumfl, NULL, NULL, NULL, NULL );
520 pscore = Q__align( mseq1, mseq2, effarr1, effarr2, clus1, clus2, *alloclen, NULL, &dumfl, NULL, NULL, NULL, NULL );
523 pscore = R__align( mseq1, mseq2, effarr1, effarr2, clus1, clus2, *alloclen, NULL, &dumfl, NULL, NULL, NULL, NULL );
526 pscore = H__align( mseq1, mseq2, effarr1, effarr2, clus1, clus2, *alloclen, NULL, &dumfl, NULL, NULL, NULL, NULL );
529 if( outgap && ( ( clus1 == 1 && clus2 != 1 ) || ( clus1 != 1 && clus2 == 1 ) ) )
531 pscore = translate_and_Calign( mseq1, mseq2, effarr1, effarr2, clus1, clus2, *alloclen );
535 pscore = A__align( mseq1, mseq2, effarr1, effarr2, clus1, clus2, *alloclen, NULL, &dumfl, NULL, NULL, NULL, NULL );
539 ErrorExit( "ERROR IN SOURCE FILE" );
543 nlen[m1] = 0.5 * ( nlen[m1] + nlen[m2] );
546 fprintf( stderr, "score = %10.2f\n", pscore );
550 fprintf( stderr, "after align 1 %s \n", indication1 );
551 display( mseq1, clus1 );
552 fprintf( stderr, "\n" );
553 fprintf( stderr, "after align 2 %s \n", indication2 );
554 display( mseq2, clus2 );
555 fprintf( stderr, "\n" );
558 // writePre( njob, name, nlen, aseq, 0 );
560 if( disp ) display( aseq, njob );
563 fprintf( stderr, "totalscore = %10.2f\n\n", tscore );
567 static void WriteOptions( FILE *fp )
570 if( dorp == 'd' ) fprintf( fp, "DNA\n" );
573 if ( scoremtx == 0 ) fprintf( fp, "JTT %dPAM\n", pamN );
574 else if( scoremtx == 1 ) fprintf( fp, "BLOSUM %d\n", nblosum );
575 else if( scoremtx == 2 ) fprintf( fp, "M-Y\n" );
577 fprintf( stderr, "Gap Penalty = %+5.2f, %+5.2f, %+5.2f\n", (double)ppenalty/1000, (double)ppenalty_ex/1000, (double)poffset/1000 );
578 if( use_fft ) fprintf( fp, "FFT on\n" );
580 fprintf( fp, "tree-base method\n" );
581 if( tbrweight == 0 ) fprintf( fp, "unweighted\n" );
582 else if( tbrweight == 3 ) fprintf( fp, "clustalw-like weighting\n" );
583 if( tbitr || tbweight )
585 fprintf( fp, "iterate at each step\n" );
586 if( tbitr && tbrweight == 0 ) fprintf( fp, " unweighted\n" );
587 if( tbitr && tbrweight == 3 ) fprintf( fp, " reversely weighted\n" );
588 if( tbweight ) fprintf( fp, " weighted\n" );
592 fprintf( fp, "Gap Penalty = %+5.2f, %+5.2f, %+5.2f\n", (double)ppenalty/1000, (double)ppenalty_ex/1000, (double)poffset/1000 );
595 fprintf( fp, "Algorithm A\n" );
596 else if( alg == 'A' )
597 fprintf( fp, "Algorithm A+\n" );
598 else if( alg == 'S' )
599 fprintf( fp, "Apgorithm S\n" );
600 else if( alg == 'C' )
601 fprintf( fp, "Apgorithm A+/C\n" );
603 fprintf( fp, "Unknown algorithm\n" );
605 if( treemethod == 'X' )
606 fprintf( fp, "Tree = UPGMA (mix).\n" );
607 else if( treemethod == 'E' )
608 fprintf( fp, "Tree = UPGMA (average).\n" );
609 else if( treemethod == 'q' )
610 fprintf( fp, "Tree = Minimum linkage.\n" );
612 fprintf( fp, "Unknown tree.\n" );
616 fprintf( fp, "FFT on\n" );
618 fprintf( fp, "Basis : 4 nucleotides\n" );
622 fprintf( fp, "Basis : Polarity and Volume\n" );
624 fprintf( fp, "Basis : 20 amino acids\n" );
626 fprintf( fp, "Threshold of anchors = %d%%\n", fftThreshold );
627 fprintf( fp, "window size of anchors = %dsites\n", fftWinSize );
630 fprintf( fp, "FFT off\n" );
635 int main( int argc, char *argv[] )
638 static float *selfscore;
640 static char **name, **seq;
641 static char **mseq1, **mseq2;
643 static float **iscore, **iscore_kozo;
644 static double *eff, *eff_kozo, *eff_kozo_mapped = NULL;
645 int i, j, ien, ik, jk;
646 static int ***topol, ***topol_kozo;
647 static float **len, **len_kozo;
655 LocalHom **localhomtable;
656 RNApair ***singlerna;
657 float ssi, ssj, bunbo;
658 static char *kozoarivec;
661 arguments( argc, argv );
666 infp = fopen( inputfile, "r" );
669 fprintf( stderr, "Cannot open %s\n", inputfile );
684 fprintf( stderr, "At least 2 sequences should be input!\n"
685 "Only %d sequence found.\n", njob );
689 seq = AllocateCharMtx( njob, nlenmax+1 );
690 mseq1 = AllocateCharMtx( njob, 0 );
691 mseq2 = AllocateCharMtx( njob, 0 );
693 name = AllocateCharMtx( njob, B+1 );
694 nlen = AllocateIntVec( njob );
695 selfscore = AllocateFloatVec( njob );
697 topol = AllocateIntCub( njob, 2, 0 );
698 len = AllocateFloatMtx( njob, 2 );
699 iscore = AllocateFloatHalfMtx( njob );
700 eff = AllocateDoubleVec( njob );
701 kozoarivec = AllocateCharVec( njob );
704 localhomtable = (LocalHom **)calloc( njob, sizeof( LocalHom *) );
705 for( i=0; i<njob; i++)
707 localhomtable[i] = (LocalHom *)calloc( njob, sizeof( LocalHom ) );
708 for( j=0; j<njob; j++)
710 localhomtable[i][j].start1 = -1;
711 localhomtable[i][j].end1 = -1;
712 localhomtable[i][j].start2 = -1;
713 localhomtable[i][j].end2 = -1;
714 localhomtable[i][j].overlapaa = -1.0;
715 localhomtable[i][j].opt = -1.0;
716 localhomtable[i][j].importance = -1.0;
717 localhomtable[i][j].next = NULL;
718 localhomtable[i][j].korh = 'h';
722 fprintf( stderr, "Loading 'hat3' ... " );
723 prep = fopen( "hat3", "r" );
724 if( prep == NULL ) ErrorExit( "Make hat3." );
725 readlocalhomtable( prep, njob, localhomtable, kozoarivec );
727 fprintf( stderr, "\ndone.\n" );
731 for( i=0; i<njob; i++ )
733 // fprintf( stderr, "kozoarivec[%d] = %d\n", i, kozoarivec[i] );
734 if( kozoarivec[i] ) nkozo++;
738 topol_kozo = AllocateIntCub( nkozo, 2, 0 );
739 len_kozo = AllocateFloatMtx( nkozo, 2 );
740 iscore_kozo = AllocateFloatHalfMtx( nkozo );
741 eff_kozo = AllocateDoubleVec( nkozo );
742 eff_kozo_mapped = AllocateDoubleVec( njob );
746 // outlocalhom( localhomtable, njob );
749 fprintf( stderr, "Extending localhom ... " );
750 extendlocalhom2( njob, localhomtable );
751 fprintf( stderr, "done.\n" );
756 readData( infp, name, nlen, seq );
758 readData_pointer( infp, name, nlen, seq );
762 constants( njob, seq );
765 fprintf( stderr, "params = %d, %d, %d\n", penalty, penalty_ex, offset );
772 WriteOptions( trap_g );
777 fprintf( stderr, "Illegal character %c\n", c );
781 // writePre( njob, name, nlen, seq, 0 );
788 fprintf( stderr, "Both structure and user tree have been given. Not yet supported!\n" );
792 fprintf( stderr, "Loading a tree ... " );
793 loadtree( njob, topol, len, name, nlen );
794 fprintf( stderr, "\ndone.\n\n" );
800 for( i=1; i<njob; i++ )
802 if( nlen[i] != nlen[0] )
804 fprintf( stderr, "Input pre-aligned seqences or make hat2.\n" );
809 fprintf( stderr, "Making a distance matrix .. \n" );
812 for( i=0; i<njob; i++ )
814 fprintf( stderr, "\r% 5d / %d", i, ien );
815 for( j=i; j<njob; j++ )
817 iscore[i][j-i] = score_calcp( seq[i], seq[j], nlen[0] );
818 fprintf( stderr, "i=%d,j=%d### %f\n", i, j, iscore[i][j-i] );
821 fprintf( stderr, "\ndone.\n\n" );
822 for( i=0; i<ien; i++ )
824 for( j=i+1; j<njob; j++ )
826 iscore[i][j-i] = ( 1.0 - iscore[i][j-i] / MIN( iscore[i][0], iscore[j][0] ) ) * 3;
827 fprintf( stderr, "i=%d,j=%d### %f\n", i, j, iscore[i][j-i] );
831 for( i=0; i<njob; i++ )
833 selfscore[i] = naivepairscore11( seq[i], seq[i], penalty );
835 for( i=0; i<ien; i++ )
837 if( i % 10 == 0 ) fprintf( stderr, "\r% 5d / %d", i, ien );
839 for( j=i+1; j<njob; j++ )
842 bunbo = MIN( ssi, ssj );
844 iscore[i][j-i] = 1.0;
846 iscore[i][j-i] = 1.0 - naivepairscore11( seq[i], seq[j], penalty ) / MIN( selfscore[i], selfscore[j] );
849 fprintf( stderr, "### ssj = %f\n", ssj );
850 fprintf( stderr, "### selfscore[i] = %f\n", selfscore[i] );
851 fprintf( stderr, "### selfscore[j] = %f\n", selfscore[j] );
852 fprintf( stderr, "### rawscore = %f\n", naivepairscore11( seq[i], seq[j], penalty ) );
856 fprintf( stderr, "\ndone.\n\n" );
862 fprintf( stderr, "Loading 'hat2' ... " );
863 prep = fopen( "hat2", "r" );
864 if( prep == NULL ) ErrorExit( "Make hat2." );
865 readhat2_floathalf_pointer( prep, njob, name, iscore );
867 fprintf( stderr, "done.\n" );
872 hat2p = fopen( "hat2", "w" );
873 WriteFloatHat2_pointer_halfmtx( hat2p, njob, name, iscore );
881 for( i=0; i<ien; i++ )
884 for( j=i+1; j<njob; j++ )
886 if( kozoarivec[i] && kozoarivec[j] )
888 iscore_kozo[ik][jk-ik] = iscore[i][j-i];
890 if( kozoarivec[j] ) jk++;
892 if( kozoarivec[i] ) ik++;
896 fprintf( stderr, "Constructing a UPGMA tree ... " );
899 fprintf( stderr, "Loading a topology ... " );
900 loadtop( njob, iscore, topol, len );
901 fprintf( stderr, "\ndone.\n\n" );
905 fixed_musclesupg_float_realloc_nobk_halfmtx_treeout( njob, iscore, topol, len, name, nlen );
909 fixed_musclesupg_float_realloc_nobk_halfmtx( njob, iscore, topol, len );
912 // ErrorExit( "Incorrect tree\n" );
916 // for( i=0; i<nkozo-1; i++ )
917 // for( j=i+1; j<nkozo; j++ )
918 // fprintf( stderr, "iscore_kozo[%d][%d] =~ %f\n", i, j, iscore_kozo[i][j-i] );
919 fixed_musclesupg_float_realloc_nobk_halfmtx( nkozo, iscore_kozo, topol_kozo, len_kozo );
921 fprintf( stderr, "\ndone.\n\n" );
925 orderfp = fopen( "order", "w" );
928 fprintf( stderr, "Cannot open 'order'\n" );
931 for( i=0; (j=topol[njob-2][0][i])!=-1; i++ )
933 fprintf( orderfp, "%d\n", j );
935 for( i=0; (j=topol[njob-2][1][i])!=-1; i++ )
937 fprintf( orderfp, "%d\n", j );
941 if( treeout && noalign )
943 writeData_pointer( prep_g, njob, name, nlen, seq );
944 fprintf( stderr, "\n" );
949 // countnode( njob, topol, node0 );
954 utree = 0; counteff( njob, topol, len, eff ); utree = 1;
956 counteff_simple_float( njob, topol, len, eff );
960 // counteff_simple_float( nkozo, topol_kozo, len_kozo, eff_kozo ); // single weight nanode iranai
961 for( i=0,j=0; i<njob; i++ )
965 // eff_kozo_mapped[i] = eff_kozo[j]; //
966 eff_kozo_mapped[i] = eff[i]; // single weight
970 eff_kozo_mapped[i] = 0.0;
971 // fprintf( stderr, "eff_kozo_mapped[%d] = %f\n", i, eff_kozo_mapped[i] );
972 // fprintf( stderr, " eff[%d] = %f\n", i, eff[i] );
981 for( i=0; i<njob; i++ ) eff[i] = 1.0;
984 for( i=0; i<njob; i++ )
987 eff_kozo_mapped[i] = 1.0;
989 eff_kozo_mapped[i] = 0.0;
994 FreeFloatHalfMtx( iscore, njob );
997 bseq = AllocateCharMtx( njob, nlenmax*2+1 );
998 alloclen = nlenmax*2;
1000 for( i=0; i<njob; i++ ) gappick0( bseq[i], seq[i] );
1002 if( rnakozo && rnaprediction == 'm' )
1004 singlerna = (RNApair ***)calloc( njob, sizeof( RNApair ** ) );
1005 prep = fopen( "hat4", "r" );
1006 if( prep == NULL ) ErrorExit( "Make hat4 using mccaskill." );
1007 fprintf( stderr, "Loading 'hat4' ... " );
1008 for( i=0; i<njob; i++ )
1010 nogaplen = strlen( bseq[i] );
1011 singlerna[i] = (RNApair **)calloc( nogaplen, sizeof( RNApair * ) );
1012 for( j=0; j<nogaplen; j++ )
1014 singlerna[i][j] = (RNApair *)calloc( 1, sizeof( RNApair ) );
1015 singlerna[i][j][0].bestpos = -1;
1016 singlerna[i][j][0].bestscore = -1.0;
1018 readmccaskill( prep, singlerna[i], nogaplen );
1021 fprintf( stderr, "\ndone.\n" );
1027 fprintf( stderr, "Progressive alignment ... \n" );
1028 treebase( nlen, bseq, mseq1, mseq2, topol, eff, &alloclen, localhomtable, singlerna, eff_kozo_mapped );
1029 fprintf( stderr, "\ndone.\n" );
1034 LocalHom *tmppt1, *tmppt2;
1035 for( i=0; i<njob; i++)
1037 for( j=0; j<njob; j++)
1039 tmppt1 = localhomtable[i]+j;
1040 while( tmppt2 = tmppt1->next )
1042 free( (void *)tmppt1 );
1045 free( (void *)tmppt1 );
1047 free( (void *)(localhomtable[i]+j) );
1049 free( (void *)localhomtable );
1053 fprintf( trap_g, "done.\n" );
1056 writeData_pointer( prep_g, njob, name, nlen, bseq );
1058 writeData( stdout, njob, name, nlen, bseq );
1059 writePre( njob, name, nlen, bseq, !contin );
1060 writeData_pointer( prep_g, njob, name, nlen, aseq );
1063 fprintf( stderr, "OSHIMAI\n" );
1066 if( constraint ) FreeLocalHomTable( localhomtable, njob );