X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=website%2Farchive%2Fbinaries%2Fmac%2Fsrc%2Fmafft%2Fcore%2Fdndfast7.c;fp=website%2Farchive%2Fbinaries%2Fmac%2Fsrc%2Fmafft%2Fcore%2Fdndfast7.c;h=fb758b2882a3e05aeeed152fd0c62d876326ebe8;hb=dbde3fb6f00b9bb770343631a517c0e599db8528;hp=0000000000000000000000000000000000000000;hpb=85f830bbd51a7277994bd4233141016304e210c9;p=jabaws.git diff --git a/website/archive/binaries/mac/src/mafft/core/dndfast7.c b/website/archive/binaries/mac/src/mafft/core/dndfast7.c new file mode 100644 index 0000000..fb758b2 --- /dev/null +++ b/website/archive/binaries/mac/src/mafft/core/dndfast7.c @@ -0,0 +1,340 @@ +#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; + + inputfile = NULL; + disopt = 0; + divpairscore = 0; + swopt = ""; + + 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': + disopt = 1; + break; + case 'A': + swopt = "-A"; + break; + default: + fprintf( stderr, "illegal option %c\n", c ); + argc = 0; + break; + } + } + nextoption: + ; + } + if( argc != 0 ) + { + fprintf( stderr, "options: -i\n" ); + exit( 1 ); + } +} + +int main( int argc, char *argv[] ) +{ + int ktuple; + int i, j; + FILE *hat2p; + FILE *hat3p; + FILE *infp; + char **seq = NULL; // by D.Mathog + 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[1000]; + int opt[M]; + int res; + char *home; + char *fastapath; + char queryfile[B]; + char datafile[B]; + char fastafile[B]; + char hat2file[B]; + int pid = (int)getpid(); + LocalHom **localhomtable, *tmpptr; +#if 0 + home = getenv( "HOME" ); +#else /* $HOME wo tsukau to fasta ni watasu hikisuu ga afureru */ + home = NULL; +#endif + fastapath = getenv( "FASTA_4_MAFFT" ); + if( !fastapath ) + fastapath = "fasta34"; + +#if DEBUG + if( home ) fprintf( stderr, "home = %s\n", home ); +#endif + if( !home ) home = ""; + sprintf( queryfile, "%s/tmp/query-%d", home, pid ); + sprintf( datafile, "%s/tmp/data-%d", home, pid ); + sprintf( fastafile, "%s/tmp/fasta-%d", home, pid ); + sprintf( hat2file, "hat2-%d", pid ); + + + 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 + dorp = NOTSPECIFIED; + getnumlen( infp ); +#endif + + if( dorp == 'd' ) + { + scoremtx = -1; + pamN = NOTSPECIFIED; + } + else + { + nblosum = 62; + scoremtx = 1; + } + constants( njob, seq ); + + rewind( infp ); + + seq = AllocateCharMtx( njob, nlenmax+1 ); + seq1 = AllocateCharMtx( 2, nlenmax+1 ); + mtx = AllocateDoubleMtx( njob, njob ); + mtx2 = AllocateDoubleMtx( njob, njob ); + localhomtable = (LocalHom **)calloc( njob, sizeof( LocalHom *) ); + for( i=0; i %s", fastapath, swopt, M, M, M, queryfile, datafile, ktuple, fastafile ); + else + sprintf( com, "%s %s -z3 -m10 -Q -b%d -E%d -d%d %s %s %d > %s", fastapath, swopt, M, M, M, 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" ); + if( scoremtx == -1 ) + res = ReadFasta34m10_nuc( hat2p, mtx[i], i, name1, localhomtable[i] ); + else + res = ReadFasta34m10( hat2p, mtx[i], i, name1, localhomtable[i] ); + fclose( hat2p ); + + if( res < njob - i ) + { + fprintf( stderr, "count (fasta34 -z 3) = %d\n", res ); + exit( 1 ); + } + + + if( i == 0 ) + for( j=0; j %f\n", max, i+1, j+1, mtx[i][j], mtx2[i][j] ); + } + } + } + for( i=0; inext ) + { + if( tmpptr->opt == -1.0 ) continue; + fprintf( hat3p, "%d %d %d %6.3f %d %d %d %d %p\n", i, j, tmpptr->overlapaa, tmpptr->opt, tmpptr->start1, tmpptr->end1, tmpptr->start2, tmpptr->end2, (void *)tmpptr->next ); + } + } + fclose( hat3p ); +#endif + + sprintf( com, "/bin/rm %s %s %s", queryfile, datafile, fastafile ); + system( com ); + +#if 0 + sprintf( com, ALNDIR "/supgsdl < %s", hat2file ); + res = system( com ); + if( res ) ErrorExit( "error in spgsdl" ); +#endif + + sprintf( com, "mv %s hat2", hat2file ); + res = system( com ); + if( res ) ErrorExit( "error in mv" ); + + SHOWVERSION; + exit( 0 ); +}