JPRED-2 Add sources of all binaries (except alscript) to Git
[jpred.git] / sources / multicoil / initialization.c
1 #include "sc.h"
2 #include <stdio.h>
3 #include "sc2seq.h"   /* This also includes scconst.h, sc.h, interface.h */
4 #include "options.h"
5 #include "scconst.h"
6 #include "switches.h"
7
8 extern int WINDOW;
9 extern double SCALE0;
10
11
12 void initialize( int *num_dist0, int window_length[MAX_TABLE_NUMBER],  double scale0s[MAX_TABLE_NUMBER], double scale0p[MAX_TABLE_NUMBER], FILE *fpin0, char likelihoods[MAX_TABLE_NUMBER][MAXLINE], char *pir_name0, char *print,   char gauss_param[2][MAXLINE], int *mode,double init_class_prob[MAX_CLASS_NUMBER])
13 {
14   
15   int i;
16
17   *mode |= PROLINE_FREE_MODE;  /* Default mode is Proline Free. */
18   *mode |= PAIRCOIL_PAIRS;     /*  Always default to pairs for PairCoil */
19
20   *mode |= USE_LIKE_LINE;
21   *mode |= WEB_OUT_MODE;       /* Make the out file by default be the  */
22                                /* list of the seq and registers and probs */
23                                /* instead of the raw list of tuples of    */
24                                /* scores needed for plotting and making   */
25                                /* gaussians.                              */
26
27   *num_dist0=0;
28   for (i=0; i< MAX_TABLE_NUMBER; i++) {
29     window_length[i]=WINDOW;
30     scale0s[i] = SCALE0;   /** Set to default **/
31     scale0p[i] = SCALE0;
32     likelihoods[i][0]=',';  /** A hack to check if get it in get_defaults */
33   }
34   fpin0=NULL;
35   *pir_name0=',';        /** A hack to check if get it in get_defaults */
36
37   strcpy(print,"/dev/null");   
38
39   gauss_param[0][0]= ',';   /* Used as flag in multivariate_like.c. */
40   gauss_param[1][0]= ',';
41   
42   init_class_prob[0] = .015;   /* Dimer probability*/
43   init_class_prob[1] = .009;   /* Trimer probablity*/
44   init_class_prob[2] = .976;   /*  Non-coiled prob. */
45 }
46
47
48 void read_command_line(int argc, char *argv[], char **command_line_pointer,
49                              int combine_dist[MAX_TABLE_NUMBER],
50                              int *mode,
51                              int num_dist[MAX_TABLE_NUMBER],
52                              char multi_lib[MAX_TABLE_NUMBER][MAXFUNCTNUM],
53                              char **command_line_config)
54 {
55   int number=0;
56   int max_libnum;
57
58   if (argc>2)
59     if (!strcmp(argv[argc-2],CONFIG_SWITCH)) {
60       *command_line_config = argv[argc-1];
61       printf("got command config %s\n", argv[argc-1]);
62       argc = argc-2;
63     }
64
65   if ((argc >= 3) && (argc <=5)) { 
66                   /* Ignore pos options and removal options in config file */
67     *command_line_pointer = argv[2];   
68           /** This could point to the table to remove from. **/
69     if (argc >= 4) {
70       combine_dist[0]=1;
71       combine_dist[1]=1;
72       *mode |= LIB_AT_COMMAND_LINE;
73
74       num_dist[0]=strlen(argv[3]);
75       max_libnum = num_dist[0];
76
77       if (argc ==5) {
78         num_dist[1]=strlen(argv[4]);
79         if (num_dist[1] > max_libnum) max_libnum = num_dist[1];
80       }
81       else num_dist[1]=num_dist[0];
82        while (number < max_libnum) {
83         if (num_dist[0] > number) {
84           multi_lib[0][number]= argv[3][number] - '0';
85         }
86         if (argc == 4) multi_lib[1][number] =multi_lib[0][number];
87         else if (num_dist[1] > number) 
88           multi_lib[1][number]= argv[4][number]- '0'; 
89         number++;
90       }
91       
92     }
93   }
94   else if (argc != 2){
95     /*    fprintf(stderr,"Usage: xcoil <file-name>\n"); */
96     usage(argv[0]);
97     exit(-1);
98   }
99 }
100
101
102
103 int old_num_dim(int number_multi_lib, int number_of_distances) {
104   
105   if ( (number_multi_lib > 1) || (number_of_distances == 1))
106     return(7);
107   else return(1);
108 }
109
110
111
112
113