/* Tree-dependent-iteration */ /* Devide to segments */ #include "mltaln.h" extern char **seq_g; extern char **res_g; static int intop; static int intree; void arguments( int argc, char *argv[] ) { int c; intop = 0; intree = 0; inputfile = NULL; rnakozo = 0; rnaprediction = 'm'; nevermemsave = 0; score_check = 1; fftkeika = 1; constraint = 0; fmodel = 0; kobetsubunkatsu = 1; bunkatsu = 1; nblosum = 62; niter = 100; calledByXced = 0; devide = 1; divWinSize = 20; /* 70 */ divThreshold = 65; fftscore = 1; fftRepeatStop = 0; fftNoAnchStop = 0; scmtd = 5; cooling = 1; weight = 4; utree = 1; refine = 1; check = 1; cut = 0.0; disp = 0; outgap = 1; use_fft = 0; // CHUUI dochira demo mafft.tmpl deha F force_fft = 0; alg = 'A'; /* chuui */ mix = 0; checkC = 0; tbitr = 0; treemethod = 'X'; scoremtx = 1; dorp = NOTSPECIFIED; ppenalty = NOTSPECIFIED; ppenalty_ex = NOTSPECIFIED; poffset = NOTSPECIFIED; kimuraR = NOTSPECIFIED; pamN = NOTSPECIFIED; geta2 = GETA2; fftWinSize = NOTSPECIFIED; fftThreshold = NOTSPECIFIED; RNAppenalty = NOTSPECIFIED; RNAppenalty_ex = NOTSPECIFIED; RNApthr = NOTSPECIFIED; TMorJTT = JTT; consweight_multi = 1.0; consweight_rna = 0.0; while( --argc > 0 && (*++argv)[0] == '-' ) { while ( (c = *++argv[0]) ) { switch( c ) { case 'i': inputfile = *++argv; fprintf( stderr, "inputfile = %s\n", inputfile ); --argc; goto nextoption; case 'I': niter = atoi( *++argv ); fprintf( stderr, "niter = %d\n", niter ); --argc; goto nextoption; case 'e': RNApthr = (int)( atof( *++argv ) * 1000 - 0.5 ); --argc; goto nextoption; case 'o': RNAppenalty = (int)( atof( *++argv ) * 1000 - 0.5 ); --argc; goto nextoption; case 'f': ppenalty = (int)( atof( *++argv ) * 1000 - 0.5 ); // fprintf( stderr, "ppenalty = %d\n", ppenalty ); --argc; goto nextoption; case 'g': ppenalty_ex = (int)( atof( *++argv ) * 1000 - 0.5 ); // fprintf( stderr, "ppenalty_ex = %d\n", ppenalty_ex ); --argc; goto nextoption; case 'h': poffset = (int)( atof( *++argv ) * 1000 - 0.5 ); fprintf( stderr, "poffset = %d\n", poffset ); --argc; goto nextoption; case 'k': kimuraR = atoi( *++argv ); fprintf( stderr, "kappa = %d\n", kimuraR ); --argc; goto nextoption; case 'b': nblosum = atoi( *++argv ); scoremtx = 1; fprintf( stderr, "blosum %d / kimura 200\n", nblosum ); --argc; goto nextoption; case 'j': pamN = atoi( *++argv ); scoremtx = 0; TMorJTT = JTT; fprintf( stderr, "jtt/kimura %d\n", pamN ); --argc; goto nextoption; case 'm': pamN = atoi( *++argv ); scoremtx = 0; TMorJTT = TM; fprintf( stderr, "tm %d\n", pamN ); --argc; goto nextoption; case 'l': fastathreshold = atof( *++argv ); constraint = 2; --argc; goto nextoption; case 'r': consweight_rna = atof( *++argv ); rnakozo = 1; --argc; goto nextoption; case 'c': consweight_multi = atof( *++argv ); --argc; goto nextoption; case 's' : RNAscoremtx = 'r'; break; #if 1 case 'a': fmodel = 1; break; #endif case 'N': nevermemsave = 1; break; case 'D': dorp = 'd'; break; case 'P': dorp = 'p'; break; case 'Q': alg = 'Q'; break; case 'R': rnaprediction = 'r'; break; case 'O': fftNoAnchStop = 1; break; #if 0 case 'e': fftscore = 0; break; case 'r': fmodel = -1; break; case 'R': fftRepeatStop = 1; break; #endif case 'T': kobetsubunkatsu = 0; break; case 'B': bunkatsu = 0; break; #if 0 case 'c': cooling = 1; break; case 'a': alg = 'a'; break; case 's' : treemethod = 's'; break; #endif case 'H': alg = 'H'; break; case 'A': alg = 'A'; break; case 'M': alg = 'M'; break; case 'S': alg = 'S'; break; case 'C': alg = 'C'; break; case 'F': use_fft = 1; break; case 't': weight = 4; break; case 'u': weight = 0; break; case 'U': intree = 1; break; case 'V': intop = 1; break; case 'J': utree = 0; break; case 'd': disp = 1; break; case 'Z': score_check = 0; break; case 'Y': score_check = 2; break; case 'n' : treemethod = 'n'; break; case 'X' : treemethod = 'X'; break; case 'E' : treemethod = 'E'; break; case 'q' : treemethod = 'q'; break; case 'z': fftThreshold = atoi( *++argv ); --argc; goto nextoption; case 'w': fftWinSize = atoi( *++argv ); --argc; goto nextoption; default: fprintf( stderr, "illegal option %c\n", c ); argc = 0; break; } } nextoption: ; } if( argc == 1 ) { cut = atof( (*argv) ); argc--; } if( argc != 0 ) { fprintf( stderr, "options : Check source file!\n" ); exit( 1 ); } #if 0 if( alg == 'A' && weight == 0 ) ErrorExit( "ERROR : Algorithm A+ and un-weighted\n" ); #endif } int main( int argc, char *argv[] ) { int identity; static int nlen[M]; static char name[M][B], **seq, **aseq, **bseq; static Segment *segment = NULL; static int anchors[MAXSEG]; int i, j; int iseg, nseg; int ***topol; double **len; double **eff; FILE *prep; FILE *infp; int alloclen; int returnvalue; char c; int ocut; char **seq_g_bk; LocalHom **localhomtable = NULL; // by D.Mathog RNApair ***singlerna; int nogaplen; char **nogap1seq; static char *kozoarivec; int nkozo; arguments( argc, argv ); if( inputfile ) { infp = fopen( inputfile, "r" ); if( !infp ) { fprintf( stderr, "Cannot open %s\n", inputfile ); exit( 1 ); } } else infp = stdin; #if 0 PreRead( stdin, &njob, &nlenmax ); #else getnumlen( infp ); #endif rewind( infp ); nkozo = 0; if( njob < 2 ) { fprintf( stderr, "At least 2 sequences should be input!\n" "Only %d sequence found.\n", njob ); exit( 1 ); } ocut = cut; segment = (Segment *)calloc( MAXSEG, sizeof( Segment ) ); topol = AllocateIntCub( njob, 2, njob ); len = AllocateDoubleMtx( njob, 2 ); eff = AllocateDoubleMtx( njob, njob ); seq = AllocateCharMtx( njob, nlenmax*9+1 ); seq_g = AllocateCharMtx( njob, nlenmax*9+1 ); res_g = AllocateCharMtx( njob, nlenmax*9+1 ); aseq = AllocateCharMtx( njob, nlenmax*9+1 ); bseq = AllocateCharMtx( njob, nlenmax*9+1 ); nogap1seq = AllocateCharMtx( 1, nlenmax*1+1 ); alloclen = nlenmax * 9; seq_g_bk = AllocateCharMtx( njob, 0 ); for( i=0; i 30000 ) { #if 0 if( constraint ) { fprintf( stderr, "\nnlenmax=%d, nagasugi!\n", nlenmax ); exit( 1 ); } if( nevermemsave ) { fprintf( stderr, "\nnevermemsave=1, nlenmax=%d, nagasugi!\n", nlenmax ); exit( 1 ); } #endif if( !constraint && !nevermemsave && alg != 'M' ) { fprintf( stderr, "\nnlenmax=%d, Switching to the memsave mode\n", nlenmax ); alg = 'M'; } } #if 0 Read( name, nlen, seq_g ); #else readData( infp, name, nlen, seq_g ); #endif fclose( infp ); for( i=0; i nlenmax ) nlenmax = nlen[i]; i++; } } if( nlenmax > N || njob > M ) { fprintf( stderr, "ERROR in main\n" ); exit( 1 ); } /* nlenmax = Na; */ rewind( stdin ); value = main1( nlen, argc, argv ); exit( 0 ); } #endif