#include "mltaln.h" #include #include #define DEBUG 0 #define TEST 0 int howmanyx( char *s ) { int val = 0; if( scoremtx == -1 ) { do { if( !strchr( "atgcuATGCU", *s ) ) val++; } while( *++s ); } else { do { if( !strchr( "ARNDCQEGHILKMFPSTWYV", *s ) ) val++; } while( *++s ); } return( val ); } void arguments( int argc, char *argv[] ) { int c; disopt = 0; while( --argc > 0 && (*++argv)[0] == '-' ) while ( c = *++argv[0] ) switch( c ) { case 'i': disopt = 1; break; default: fprintf( stderr, "illegal option %c\n", c ); argc = 0; break; } if( argc != 0 ) { fprintf( stderr, "options: -i\n" ); exit( 1 ); } } int main( int argc, char *argv[] ) { int ktuple; int i, j; FILE *hat2p; char **seq; char **seq1; static char name[M][B]; static char name1[M][B]; static int nlen1[M]; double **mtx; double **mtx2; static int nlen[M]; char b[B]; double max; char com[B]; int opt[M]; int res; char *home; char queryfile[B]; char datafile[B]; char fastafile[B]; char hat2file[B]; int pid = (int)getpid(); #if 0 home = getenv( "HOME" ); #else /* $HOME wo tsukau to fasta ni watasu hikisuu ga afureru */ home = NULL; #endif #if DEBUG if( home ) fprintf( stderr, "home = %s\n", home ); #endif if( !home ) home = ""; sprintf( queryfile, "%s/tmp/query-%d\0", home, pid ); sprintf( datafile, "%s/tmp/data-%d\0", home, pid ); sprintf( fastafile, "%s/tmp/fasta-%d\0", home, pid ); sprintf( hat2file, "hat2-%d\0", pid ); arguments( argc, argv ); #if 0 PreRead( stdin, &njob, &nlenmax ); #else getnumlen( stdin ); #endif rewind( stdin ); seq = AllocateCharMtx( njob, nlenmax+1 ); seq1 = AllocateCharMtx( 2, nlenmax+1 ); mtx = AllocateDoubleMtx( njob, njob ); mtx2 = AllocateDoubleMtx( njob, njob ); #if 0 FRead( stdin, name, nlen, seq ); #else readData( stdin, name, nlen, seq ); #endif if( scoremtx == -1 ) ktuple = 6; else ktuple = 1; for( i=0; i %s\0", M, M, 0, queryfile, datafile, ktuple, fastafile ); else sprintf( com, "fasta3 -Q -h -b%d -E%d -d%d %s %s %d > %s\0", M, M, 0, queryfile, datafile, ktuple, fastafile ); res = system( com ); if( res ) ErrorExit( "error in fasta" ); hat2p = fopen( fastafile, "r" ); if( hat2p == NULL ) ErrorExit( "file 'fasta.$$' does not exist\n" ); ReadFasta3( hat2p, mtx[i], njob-i, name1 ); if( i == 0 ) for( j=0; j %f\n", max, i+1, j+1, mtx[i][j], mtx2[i][j] ); } } } for( i=0; i