7 static char *orderfile;
11 static void fillspace( char *seq, int lenmax )
13 int len = strlen( seq );
16 while( lenmax-- ) *seq++ = ' ';
20 void setmark_clustal( int nlen, int nseq, char **seq, char *mark )
51 for( i=0; i<nlen; i++ )
54 for( j=0; j<nseq; j++ )
55 if( '-' == seq[j][i] ) break;
60 for( j=0; j<nseq; j++ )
61 if( toupper( seq[0][i] ) != toupper( seq[j][i] ) ) break;
67 for( k=0; k<nstrong; k++ )
69 for( j=0; j<nseq; j++ )
71 if( !strchr( strong[k], toupper( seq[j][i] ) ) ) break;
73 if( j == nseq ) break;
80 for( k=0; k<nweaker; k++ )
82 for( j=0; j<nseq; j++ )
84 if( !strchr( weaker[k], toupper( seq[j][i] ) ) ) break;
86 if( j == nseq ) break;
97 void setmark( int nlen, int nseq, char **seq, char *mark )
101 for( i=0; i<nlen; i++ )
104 for( j=0; j<nseq; j++ )
105 if( '-' == seq[j][i] ) break;
110 for( j=0; j<nseq; j++ )
111 if( seq[0][i] != seq[j][i] ) break;
117 for( j=0; j<nseq; j++ )
118 if( amino_grp[(int)seq[0][i]] != amino_grp[(int)seq[j][i]] ) break;
128 void arguments( int argc, char *argv[] )
135 kimuraR = NOTSPECIFIED;
142 while( --argc > 0 && (*++argv)[0] == '-' )
144 while ( (c = *++argv[0]) )
150 fprintf( stderr, "inputfile = %s\n", inputfile );
155 fprintf( stderr, "comment = %s\n", comment );
160 fprintf( stderr, "orderfile = %s\n", orderfile );
164 namelen = atoi( *++argv );
165 fprintf( stderr, "namelen = %d\n", namelen );
175 fprintf( stderr, "illegal option %c\n", c );
185 fprintf( stderr, "options: Check source file !\n" );
191 int main( int argc, char *argv[] )
194 static char **name, **seq, *mark;
202 arguments( argc, argv );
207 infp = fopen( inputfile, "r" );
210 fprintf( stderr, "Cannot open %s\n", inputfile );
217 getnumlen_casepreserve( infp, &nlenmin );
220 seq = AllocateCharMtx( njob, nlenmax*2+1 );
221 mark = AllocateCharVec( nlenmax*2+1 );
222 order = AllocateIntVec( njob );
223 name = AllocateCharMtx( njob, B+1 );
224 nlen = AllocateIntVec( njob );
229 orderfp = fopen( orderfile, "r" );
232 fprintf( stderr, "Cannot open %s\n", orderfile );
235 for( i=0; i<njob; i++ )
237 fgets( gett, B-1, orderfp );
238 order[i] = atoi( gett );
244 for( i=0; i<njob; i++ ) order[i] = i;
247 readData_pointer_casepreserve( infp, name, nlen, seq );
250 if( format == 'c' || format == 'y' ) for( i=0; i<njob; i++ ) fillspace( seq[i], nlenmax );
251 constants( njob, seq );
259 // setmark( nlenmax, njob, seq, mark );
260 setmark_clustal( nlenmax, njob, seq, mark );
263 writeData_reorder_pointer( stdout, njob, name, nlen, seq, order );
264 else if( format == 'c' )
265 clustalout_pointer( stdout, njob, nlenmax, seq, name, mark, comment, order, namelen );
266 else if( format == 'y' )
267 phylipout_pointer( stdout, njob, nlenmax, seq, name, order );
269 fprintf( stderr, "Unknown format\n" );