source: tags/arb-6.0/GDE/MAFFT/mafft-7.055-with-extensions/core/score.c

Last change on this file was 10371, checked in by aboeckma, 11 years ago

updated mafft version. Added extensions (no svn ignore, yet)

File size: 2.3 KB
Line 
1#include "mltaln.h"
2
3#define DEBUG 0
4
5void arguments( int argc, char *argv[] )
6{
7    int c;
8
9        ppenalty = NOTSPECIFIED;
10        ppenalty_ex = NOTSPECIFIED;
11        poffset = NOTSPECIFIED;
12        kimuraR = NOTSPECIFIED;
13        pamN = NOTSPECIFIED;
14        scoremtx = NOTSPECIFIED;
15
16    while( --argc > 0 && (*++argv)[0] == '-' )
17        {
18        while ( ( c = *++argv[0] ) )
19                {
20            switch( c )
21            {
22                                case 'f':
23                                        ppenalty = (int)( atof( *++argv ) * 1000 - 0.5 );
24                                        fprintf( stderr, "ppenalty = %d\n", ppenalty );
25                                        --argc;
26                                        goto nextoption;
27                                case 'g':
28                                        ppenalty_ex = (int)( atof( *++argv ) * 1000 - 0.5 );
29                                        fprintf( stderr, "ppenalty_ex = %d\n", ppenalty_ex );
30                                        --argc;
31                                        goto nextoption;
32                                case 'h':
33                                        poffset = (int)( atof( *++argv ) * 1000 - 0.5 );
34                                        fprintf( stderr, "poffset = %d\n", poffset );
35                                        --argc;
36                                        goto nextoption;
37                                case 'k':
38                                        kimuraR = atoi( *++argv );
39                                        fprintf( stderr, "kimuraR = %d\n", kimuraR );
40                                        --argc;
41                                        goto nextoption;
42                                case 'D':
43                                        scoremtx = -1;
44                                        break;
45                                case 'P':
46                                        scoremtx = 0;
47                                        break;
48                default:
49                    fprintf( stderr, "illegal option %c\n", c );
50                    argc = 0;
51                    break;
52            }
53                }
54                nextoption:
55                        ;
56        }
57    if( argc == 1 )
58    {
59        cut = atof( (*argv) );
60        argc--;
61    }
62}
63
64
65int main( int ac, char **av )
66{
67        int *nlen;
68        static char **name, **seq;
69        double score;
70        extern double score_calc_for_score( int, char ** );
71
72        arguments( ac, av );
73
74        getnumlen( stdin );
75        rewind( stdin );
76
77        nlen = AllocateIntVec( njob );
78        name = AllocateCharMtx( njob, B+1 );
79        seq = AllocateCharMtx( njob, nlenmax+2 );
80
81        readData_pointer( stdin, name, nlen, seq );
82
83        if( !isaligned( njob, seq ) ) ErrorExit( "Not aligned." );
84
85        constants( njob, seq );
86
87        score = score_calc_for_score( njob, seq );
88        if( scoremtx == 0 ) score += offset;
89
90        fprintf( stdout, "score = %f\n", score );
91        if     ( scoremtx ==  0 ) fprintf( stdout, "JTT %dPAM\n", pamN );
92        else if( scoremtx ==  1 ) fprintf( stdout, "Dayhoff( machigai ga aru )\n" );
93        else if( scoremtx ==  2 ) fprintf( stdout, "M-Y\n" );
94        else if( scoremtx == -1 ) fprintf( stdout, "DNA 1:%d\n", kimuraR );
95
96        fprintf( stdout, "gap penalty = %+6.2f, %+6.2f, %+6.2f\n", (double)ppenalty/1000, (double)ppenalty_ex/1000, (double)poffset/1000 );
97        exit( 0 );
98}
Note: See TracBrowser for help on using the repository browser.