9 void arguments( int argc, char *argv[] )
46 ppenalty = NOTSPECIFIED;
47 ppenalty_OP = NOTSPECIFIED;
48 ppenalty_ex = NOTSPECIFIED;
49 ppenalty_EX = NOTSPECIFIED;
50 poffset = NOTSPECIFIED;
51 kimuraR = NOTSPECIFIED;
54 fftWinSize = NOTSPECIFIED;
55 fftThreshold = NOTSPECIFIED;
56 RNAppenalty = NOTSPECIFIED;
57 RNApthr = NOTSPECIFIED;
59 while( --argc > 0 && (*++argv)[0] == '-' )
61 while ( ( c = *++argv[0] ) )
67 fprintf( stderr, "inputfile = %s\n", inputfile );
71 RNAppenalty = (int)( atof( *++argv ) * 1000 - 0.5 );
75 ppenalty = (int)( atof( *++argv ) * 1000 - 0.5 );
79 ppenalty_ex = (int)( atof( *++argv ) * 1000 - 0.5 );
83 ppenalty_OP = (int)( atof( *++argv ) * 1000 - 0.5 );
87 ppenalty_EX = (int)( atof( *++argv ) * 1000 - 0.5 );
91 poffset = (int)( atof( *++argv ) * 1000 - 0.5 );
95 kimuraR = atoi( *++argv );
96 // fprintf( stderr, "kimuraR = %d\n", kimuraR );
100 nblosum = atoi( *++argv );
102 fprintf( stderr, "blosum %d\n", nblosum );
106 pamN = atoi( *++argv );
109 fprintf( stderr, "jtt %d\n", pamN );
113 pamN = atoi( *++argv );
116 fprintf( stderr, "TM %d\n", pamN );
120 ppslocal = (int)( atof( *++argv ) * 1000 + 0.5 );
121 pslocal = (int)( 600.0 / 1000.0 * ppslocal + 0.5);
122 // fprintf( stderr, "ppslocal = %d\n", ppslocal );
123 // fprintf( stderr, "pslocal = %d\n", pslocal );
201 /* Modified 01/08/27, default: user tree */
205 /* modification end. */
207 fftThreshold = atoi( *++argv );
211 fftWinSize = atoi( *++argv );
218 fprintf( stderr, "illegal option %c\n", c );
228 cut = atof( (*argv) );
233 fprintf( stderr, "options: Check source file !\n" );
236 if( tbitr == 1 && outgap == 0 )
238 fprintf( stderr, "conflicting options : o, m or u\n" );
241 if( alg == 'C' && outgap == 0 )
243 fprintf( stderr, "conflicting options : C, o\n" );
248 int countamino( char *s, int end )
252 if( *s++ != '-' ) val++;
257 static void WriteOptions( FILE *fp )
260 if( dorp == 'd' ) fprintf( fp, "DNA\n" );
263 if ( scoremtx == 0 ) fprintf( fp, "JTT %dPAM\n", pamN );
264 else if( scoremtx == 1 ) fprintf( fp, "BLOSUM %d\n", nblosum );
265 else if( scoremtx == 2 ) fprintf( fp, "M-Y\n" );
267 fprintf( stderr, "Gap Penalty = %+5.2f, %+5.2f, %+5.2f\n", (double)ppenalty/1000, (double)ppenalty_ex/1000, (double)poffset/1000 );
268 if( use_fft ) fprintf( fp, "FFT on\n" );
270 fprintf( fp, "tree-base method\n" );
271 if( tbrweight == 0 ) fprintf( fp, "unweighted\n" );
272 else if( tbrweight == 3 ) fprintf( fp, "clustalw-like weighting\n" );
273 if( tbitr || tbweight )
275 fprintf( fp, "iterate at each step\n" );
276 if( tbitr && tbrweight == 0 ) fprintf( fp, " unweighted\n" );
277 if( tbitr && tbrweight == 3 ) fprintf( fp, " reversely weighted\n" );
278 if( tbweight ) fprintf( fp, " weighted\n" );
282 fprintf( fp, "Gap Penalty = %+5.2f, %+5.2f, %+5.2f\n", (double)ppenalty/1000, (double)ppenalty_ex/1000, (double)poffset/1000 );
285 fprintf( fp, "Algorithm A\n" );
286 else if( alg == 'A' )
287 fprintf( fp, "Algorithm A+\n" );
288 else if( alg == 'S' )
289 fprintf( fp, "Apgorithm S\n" );
290 else if( alg == 'C' )
291 fprintf( fp, "Apgorithm A+/C\n" );
293 fprintf( fp, "Unknown algorithm\n" );
295 if( treemethod == 'x' )
296 fprintf( fp, "Tree = UPGMA (3).\n" );
297 else if( treemethod == 's' )
298 fprintf( fp, "Tree = UPGMA (2).\n" );
299 else if( treemethod == 'p' )
300 fprintf( fp, "Tree = UPGMA (1).\n" );
302 fprintf( fp, "Unknown tree.\n" );
306 fprintf( fp, "FFT on\n" );
308 fprintf( fp, "Basis : 4 nucleotides\n" );
312 fprintf( fp, "Basis : Polarity and Volume\n" );
314 fprintf( fp, "Basis : 20 amino acids\n" );
316 fprintf( fp, "Threshold of anchors = %d%%\n", fftThreshold );
317 fprintf( fp, "window size of anchors = %dsites\n", fftWinSize );
320 fprintf( fp, "FFT off\n" );
325 int main( int argc, char *argv[] )
328 static char **name, **seq, **useq;
329 static char **mseq1, **mseq2;
341 arguments( argc, argv );
345 infp = fopen( inputfile, "r" );
348 fprintf( stderr, "Cannot open %s\n", inputfile );
360 fprintf( stderr, "The number of sequences must be < %d\n", M );
361 fprintf( stderr, "Please try the splittbfast program for such large data.\n" );
365 name = AllocateCharMtx( njob, B+1 );
366 nlen = AllocateIntVec( njob );
368 seq = AllocateCharMtx( njob, nlenmax*5+1 );
369 useq = AllocateCharMtx( njob, nlenmax*5+1 );
370 aseq = AllocateCharMtx( njob, nlenmax*5+1 );
371 bseq = AllocateCharMtx( njob, nlenmax*5+1 );
372 mseq1 = AllocateCharMtx( njob, 0 );
373 mseq2 = AllocateCharMtx( njob, 0 );
374 alloclen = nlenmax*5;
376 pair1 = calloc( nlenmax*5+1, sizeof( RNApair *) );
377 pair2 = calloc( nlenmax*5+1, sizeof( RNApair *) );
378 map = AllocateFloatMtx( nlenmax+1, nlenmax );
380 eff = AllocateDoubleVec( njob );
382 readData_pointer( infp, name, nlen, seq );
385 for( i=0; i<njob; i++ ) strcpy( useq[i], seq[i] );
387 constants( njob, seq );
390 fprintf( stderr, "params = %d, %d, %d\n", penalty, penalty_ex, offset );
397 WriteOptions( trap_g );
402 fprintf( stderr, "Illeagal character %c\n", c );
406 // writePre( njob, name, nlen, seq, 0 );
408 for( i=0; i<njob; i++ ) eff[i] = 1.0;
410 // for( i=0; i<njob; i++ ) gappick0( bseq[i], seq[i] );
413 fprintf( stderr, "folding group1\n" );
414 // rnalocal( seq, useq, eff, eff, njob, njob, alloclen, pair1 );
415 rnaalifoldcall( seq, njob, pair1 );
419 fprintf( stderr, "folding group1\n" );
420 rnalocal( seq+1, useq+1, eff+1, eff+1, 1, 1, alloclen, pair2 );
421 fprintf( stderr, "aligning 1 and 2, phase 1\n" );
422 Lalignmm_hmout( seq, seq+1, eff, eff+1, 1, 1, alloclen, NULL, NULL, NULL, NULL, map );
426 lgth1 = strlen( seq[0] );
427 for( i=0; i<lgth1; i++ )
429 fprintf( stderr, "\n" );
430 if( pair1[i].pos == -1 ) continue;
431 fprintf( stderr, "i=%d (%c):%d", i, seq[0][i], pair1[i].pos );
432 if( map12[pair1[i].pos].pos == -1 ) continue;
433 fprintf( stderr, "%c -> %c ", seq[0][pair1[i].pos], seq[1][map12[pair1[i].pos].pos] );
434 if( pair2[map12[pair1[i].pos].pos].pos == -1 ) continue;
435 fprintf( stderr, "%d:%d (%c)", map12[pair1[i].pos].pos, pair2[map12[pair1[i].pos].pos].pos, seq[1][pair2[map12[pair1[i].pos].pos].pos] );
443 pairalign( name, nlen, bseq, aseq, mseq1, mseq2, eff, alloclen );
444 fprintf( trap_g, "done.\n" );
446 fprintf( stderr, "closing trap_g\n" );
450 // writePre( njob, name, nlen, aseq, !contin );
452 writeData( stdout, njob, name, nlen, aseq );
455 fprintf( stderr, "OSHIMAI\n" );