--- /dev/null
+
+/* Code by anonomous and Ethan Wolf 1995. */
+
+/************************************************************************/
+/* get_defaults() is called in main() of sc2seq.c to get the default */
+/* values for parameters of the program, such as input/output files and */
+/* options. */
+/************************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "scio.h"
+#include "switches.h"
+#include "interface.h"
+
+
+/** Returns pointer to first occurance of chrs[0]. If that not present,
+ * returns pointer to first occurance of chrs[1]... If none of
+ * characters in chrs[] are present then it returns NULL.
+ * This is used to remove whitspace, tabs, returns.
+**/
+static char *strchrs(char *str, char *chrs) {
+ char *ret=NULL;
+
+ while(*chrs) {
+ if(ret=strchr(str,*chrs)) return ret;
+ chrs++;
+ }
+ return ret;
+}
+
+/************************************************************************/
+/* Reads in .paircoil file of default values that are normally input to */
+/* sc2seq in the command line. */
+/* Any required value not read in here is expected on the command line. */
+void get_defaults(char *command_line_config,
+ char *input_location, int *mode, double *bound,
+ FILE **fgin, FILE **fpin,
+ FILE **ftotal_like, FILE **fout,
+ FILE **flog,
+ FILE **fout_coils,
+ int *by_coil_or_seq,
+ char likelihoods[MAX_TABLE_NUMBER][MAXLINE],
+ char *pir_name, char *lib,
+ char multi_lib[MAX_TABLE_NUMBER][MAXFUNCTNUM],
+ int *functnum,
+ int combine_dist[MAX_TABLE_NUMBER],
+ char *print, int *main_method,
+ int *main_preprocessor_method, int *main_table,
+ int *offset_to_use,
+ int *avg_max,
+ int *Coil_Score,
+ int *ps_res_per_line,
+ char class_sc_filenames[2][MAX_CLASS_NUMBER][MAXLINE],
+ char gaussian_parameters[2][MAXLINE],
+ int num_dist[MAX_TABLE_NUMBER],
+ double init_class_prob[MAX_CLASS_NUMBER],
+ int *table_to_remove_from,
+ char *command_line,
+ int window_length[MAX_TABLE_NUMBER],
+ double scale0s[MAX_TABLE_NUMBER],
+ double scale0p[MAX_TABLE_NUMBER])
+{
+ char buf[500], *tmp, name[500];
+ FILE *config; FILE *printfile;
+ int i, number_likelihoods=0;
+ char *input_name;
+ int lib_numb=0;
+
+/******** A hack so I don't have to eliminate all the stuff using these ****/
+/******** pointers, since no longer pass them into function. ****/
+ int num_tab=0, *number_tables, number_classes=0, number_max_classes=0;
+
+ number_tables= &num_tab;
+/****************************************************************************/
+
+ strcpy(gaussian_parameters[0], "~/MULTICOIL/CONVERSION_FILES/gauss_param28+");
+
+ if (command_line) { /* Don't use options in config file. */
+ if (!strcmp(command_line,"dimer")) {
+ *table_to_remove_from = 0;
+ printf("Input data is all removed from table 1\n");
+ *mode |= POS_MODE;
+ printf("pos\n");
+ }
+ else if (!strcmp(command_line,"trimer")) {
+ *table_to_remove_from = 1;
+ printf("Input data is all removed from table 2\n");
+ *mode |= POS_MODE;
+ printf("pos\n");
+ }
+ else if (!strcmp(command_line, "dimer-1")) {
+ *mode |= TST_MODE0;
+ printf("Input is data from table 1\n");
+ *mode |= POS_MODE;
+ printf("pos\n");
+ }
+ else if (!strcmp(command_line, "trimer-1")) {
+ *mode |= TST_MODE1;
+ printf("Input is data from table 2\n");
+ *mode |= POS_MODE;
+ printf("pos\n");
+ }
+ else if (!strcmp(command_line, "negatives")) {
+ printf("Not doing pos mode");
+ }
+ else if (!strcmp(command_line, "config_file")) {
+ printf("Doing pos options as in config file\n");
+ command_line =NULL;
+ }
+ else { /* Bad command line input. **/
+ usage("paircoil");
+ exit(-1);
+ }
+
+ }
+
+/************************** For Automating output file name. ****/
+ /** Strip off directories to get just the program name. **/
+ i=strlen(input_location);
+ while ((i>=0) && (input_location[i] != '/') )
+ i--;
+ input_name= &input_location[i+1];
+/***************************/
+
+
+ /* What directory to look for paircoil defauts in. Set environment */
+ /* variable MULTICOIL_CONFIG to be a path to this file. */
+
+ if (command_line_config) { /** Read config location at command line. **/
+ strcpy(buf, command_line_config);
+ fprintf(stderr,"config = %c",buf);
+ }
+ else
+ if (tmp=getenv("MULTICOIL_CONFIG")) {
+ strcpy(buf,tmp);
+ }
+ else {
+ strcpy(buf,getenv("HOME"));
+ strcat(buf,"/MULTICOIL/multicoil_config");
+ }
+
+ if (config=fopen(buf,"r")) {
+ printf("Config file %s\n", buf);
+ while (fgets(buf,500,config)) {
+
+ if (!command_line) { /** Read from file since it wasn't **/
+ /** a command line param. **/
+ if(!strncmp(buf,"pos",3)) { /* If "pos" is in the .paircoil */
+ *mode |= POS_MODE; /* default file, then the test */
+ printf("pos\n"); /* file is assumed to be a .pos */
+ } /* file, where each seq has its */
+
+ else if(!strncmp(buf,"remove all input from table",27)) {
+ sscanf(buf,"remove all input from table %d",table_to_remove_from);
+ (*table_to_remove_from)--;
+ printf("Input is data is all removed from table %d\n",
+ (*table_to_remove_from) +1);
+ }
+
+ else if(!strncmp(buf,"input pos1",10)) {
+ *mode |= TST_MODE0;
+ printf("Input is data from table 1\n");
+ }
+ else if(!strncmp(buf,"input pos2",10)) {
+ *mode |= TST_MODE1;
+ printf("Input is data from table 2\n");
+ }
+ }
+
+
+
+ /**** Now do the rest of the possible non-command line options. *****/
+
+ if(!strncmp(buf,"genbnk",6)) { /* Get location of genbnk file */
+ sscanf(buf,"genbnk = %s",name); /* and open it. */
+ *fgin = sopen(name,"r");
+/***
+ printf("genbnk = %s\n",name);
+***/
+ }
+ else if(!strncmp(buf,"table",5)) { /* Get location of postable file */
+ sscanf(buf,"table %d = %s",&i, name);
+ fpin[i-1] = sopen(name,"r");
+/***
+ printf("table %d = %s\n",i,name);
+***/
+ (*number_tables)++;
+ }
+
+ else if(!strncmp(buf,"pir",3)) { /* Get location of pir file */
+ sscanf(buf,"pir = %s",pir_name);
+/****
+ printf("pir = %s\n",pir_name);
+***/
+ }
+ else if(!strncmp(buf,"printfile",9)) { /* File to output printouts to*/
+ sscanf(buf,"printfile = %s",print);
+ printf("printfile = %s\n",print);
+ printfile=sopen(print,"w"); /* We are going to append to this, */
+ sclose(printfile); /* So first make it empty. */
+ }
+ else if(!strncmp(buf,"likelihoods",11)) {
+ sscanf(buf,"likelihoods %d = %s",&i, likelihoods[number_likelihoods]);
+/****
+ printf("likelihoods %d = %s\n",number_likelihoods,
+ likelihoods[number_likelihoods]); ***/ /* likelihood lines. */
+ number_likelihoods++;
+ likelihoods[number_likelihoods][0]= ',';
+ }
+
+
+ else if(!strncmp(buf,"class scores combo",18)) {
+ sscanf(buf,"class scores combo %d with init prob %lf = %s",&i,
+ &init_class_prob[number_classes],
+ class_sc_filenames[0][number_classes]);
+ printf("combo class scores %d = %s with init prob %lf\n",
+ i,class_sc_filenames[0][number_classes],
+ init_class_prob[number_classes]); /* likelihood lines. */
+ number_classes++;
+ }
+
+
+ else if(!strncmp(buf,"class scores max",16)) {
+ sscanf(buf,"class scores max %d with init prob %lf = %s",&i,
+ &init_class_prob[number_max_classes],
+ class_sc_filenames[1][number_max_classes]);
+ printf("max class scores %d = %s with init prob %lf\n",
+ i,class_sc_filenames[1][number_max_classes],
+ init_class_prob[number_max_classes]); /* likelihood lines. */
+ number_max_classes++;
+ }
+
+ else if(!strncmp(buf,"gauss_param =",13))
+ sscanf(buf,"gauss_param = %s",gaussian_parameters[0]);
+
+ else if(!strncmp(buf,"gauss_param combo",17)) {
+ sscanf(buf,"gauss_param combo = %s",gaussian_parameters[0]);
+/****
+ printf("gauss_param combo = %s\n",gaussian_parameters[0]);
+****/
+ }
+
+ else if(!strncmp(buf,"gauss_param max",15)) {
+ sscanf(buf,"gauss_param max = %s",gaussian_parameters[1]);
+/***
+ printf("gauss_param max = %s\n",gaussian_parameters[1]);
+***/
+ }
+
+ else if(!strncmp(buf,"no GUI",6)) {
+ *mode |= NO_GUI;
+ printf("NO GUI\n");
+ }
+
+
+ else if(!strncmp(buf,"pair_lib",8)) { /* Read in a variable number */
+ char *end; /* of distances to be used in */
+ int val; /* pair scores. The number */
+ /* of variables is stored in */
+ printf("pair_lib = "); /* in the global variable */
+ tmp = strchr(buf, '='); /* functnum. The distances */
+ tmp++; /* are stored in */
+ /* strip leading whitespace */ /* lib[0],...,lib[functnum-1]. */
+ while(!isdigit(*tmp)&&*tmp) tmp++;
+ while(end = strchrs(tmp, " \t\n\r")) {
+ *end = 0;
+ end++;
+ /* strip leading whitespace */
+ while(*tmp&&!isdigit(*tmp)) tmp++;
+ if(*tmp) {
+ val = atoi(tmp);
+ lib[(*functnum)++] = val-1; /** scscore.c needs takes residues **/
+ /** at dist lib +1 apart. **/
+ printf("%d ", val);
+ }
+ tmp = end;
+ }
+ printf("\n");
+ }
+
+
+
+ else if(!strncmp(buf,"multi_lib",9)) { /* Read in a variable number */
+ if (! (*mode & LIB_AT_COMMAND_LINE)) { /* This flags that **/
+ /** got it at command line. **/
+ int first_table, last_table;
+ int the_table;
+ int combine_distances =1;
+
+ if (!strncmp(buf,"multi_lib dim",13)) {
+ combine_distances = 0;
+
+ if (!strncmp(buf,"multi_lib dim =",15)) {
+ first_table=0; last_table=NUMBER_TABLES;
+ } /* All tables get same lib. **/
+ else {
+ sscanf(buf,"multi_lib dim %d", &last_table);
+ first_table = last_table-1;
+ }
+ }
+ else if (!strncmp(buf,"multi_lib =",11)) {
+ combine_distances = 0;
+ first_table=0; last_table= NUMBER_TABLES;
+ } /* All tables get same lib. **/
+ else {
+ sscanf(buf,"multi_lib %d", &last_table);
+ first_table = last_table-1;
+ }
+
+ for (the_table=first_table; the_table<last_table; the_table++) {
+ combine_dist[the_table]= combine_distances;
+ num_dist[the_table]=0;
+ }
+
+ if (!strncmp(buf,"multi_lib = all",15))
+ {
+ /* For scscore.c will go through each dist on own*/
+ for (the_table=first_table; the_table<last_table; the_table++)
+ for (i=0; i<7; i++) {
+ multi_lib[the_table][i] = i;
+ num_dist[the_table] = 7;
+ combine_dist[the_table] = 0;
+ }
+ }
+
+ else {
+ char *end; /* of distances to be used in */
+ int val; /* pair scores. The number */
+ /* of variables is stored in */
+ printf("multi_lib = "); /* in the global variable */
+ tmp = strchr(buf, '='); /* functnum. The distances */
+ tmp++; /* are stored in */
+ /* strip leading whitespace */ /* lib[0],...,lib[functnum-1]. */
+ while(!isdigit(*tmp)&&*tmp) tmp++;
+ while(end = strchrs(tmp, " \t\n\r")) {
+ *end = 0;
+ end++;
+ /* strip leading whitespace */
+ while(*tmp&&!isdigit(*tmp)) tmp++;
+ if(*tmp) {
+ val = atoi(tmp);
+ for (the_table=first_table; the_table<last_table; the_table++){
+ multi_lib[the_table][num_dist[the_table]] = val-1;
+ /** scscore.c needs takes residues at dist lib +1 apart. **/
+ num_dist[the_table]+= 1;
+/** combine_dist[the_table] = combine_distances; **/
+ }
+ printf("%d ", val);
+ }
+ tmp = end;
+ }
+ for (the_table=first_table; the_table<last_table; the_table++)
+ if (num_dist[the_table] ==1) combine_dist[the_table] =0;
+
+ printf("\n");
+ }
+ }
+ }
+
+
+
+ else if(!strncmp(buf,"Maximize total like",4)) {
+ sscanf(buf,"Maximize total like = %s",name); /* Compute the sum */
+ *ftotal_like = sopen(name,"w"); /* over classes of */
+ printf("ftotal_like = %s\n",name); /* the gauss value */
+ /* for the score for various settings */
+ /* of the initial class parameters, so*/
+ /* we can choose values max total like*/
+ }
+ else if(!strncmp(buf,"out",3)) {
+ if (!strncmp(buf,"out dir",7)) { /** automate the name **/
+ sscanf(buf,"out dir = %s",name);
+ strcat(name,input_name);
+ strcat(name,".out");
+ }
+ else sscanf(buf,"out = %s",name); /* Read in the filename in which */
+ /* to output the residue scores */
+ *fout = sopen(name,"w"); /* and open it. */
+ printf("out = %s\n",name);
+ }
+
+ else if(!strncmp(buf,"sparse_out",10)) {
+ if (!strncmp(buf,"sparse_out dir",14)) { /** automate the name **/
+ sscanf(buf,"sparse_out dir = %s",name);
+ strcat(name,input_name);
+ strcat(name,".out");
+ }
+ else sscanf(buf,"sparse_out = %s",name); /*Read in filename in which */
+ /* to output the residue scores */
+ *fout = sopen(name,"w"); /* and open it. */
+ printf("sparse_out = %s\n",name);
+ *mode ^= WEB_OUT_MODE; /* Don't want web output mode. */
+ }
+
+
+ else if(!strncmp(buf,"raw_out",7)) {
+ *mode |= RAW_OUT;
+ if (!strncmp(buf,"raw_out dir",11)) { /** automate the name **/
+ sscanf(buf,"raw_out dir = %s",name);
+ strcat(name,input_name);
+ strcat(name,".raw_out");
+ }
+ else sscanf(buf,"raw_out = %s",name);
+
+ *fout= sopen(name,"w");
+ printf("Opened %s for output of raw scores\n",name);
+ }
+
+ else if(!strncmp(buf,"log",3)) {
+ if (!strncmp(buf,"log dir",7)){ /* automate the name **/
+ sscanf(buf,"log dir = %s",name);
+ strcat(name,input_name);
+ strcat(name,".log");
+
+ /**** Apend on the library distances. ***/
+ if (combine_dist[0] == 0) { /* make sure do dimension scores */
+ lib_numb=0;
+ while (lib_numb < num_dist[0]) {
+ sprintf(&buf[lib_numb],"%d",multi_lib[0][lib_numb]);
+ lib_numb++; }
+ sprintf(&buf[lib_numb],"_");
+ strncat(name,buf,num_dist[0]+1);
+
+ lib_numb=0;
+ while (lib_numb < num_dist[1]) {
+ sprintf(&buf[lib_numb],"%d",multi_lib[1][lib_numb]);
+ lib_numb++; }
+ strncat(name,buf,num_dist[1]);
+ }
+
+ } /* Read in the filename in which */
+ else sscanf(buf,"log = %s",name); /* to output the sequences which */
+ *flog = sopen(name,"w"); /* score above the PRN_MODE */
+ printf("log = %s\n",name); /* threshhold. This file will */
+ /* get human readable output. */
+ }
+
+ else if (!strncmp(buf,"Log Like Pos",12))
+ *mode |= POS_STYLE_LOG;
+
+
+
+ else if (!strncmp(buf,"By seq pos regions",18))
+ *by_coil_or_seq =1;
+
+/*************************************************************************/
+/*******Two Ways of doing same command: "coil scores" and "seq scores" **/
+/*** Although slightly diff't since they modify "by_coil_or_seq" diff'tly**/
+
+ else if(!strncmp(buf,"coil scores",11)) {
+ *by_coil_or_seq =0; /** Do coil scores. **/
+ if (!strncmp(buf,"coil scores dir",15)) { /* automate the name **/
+ sscanf(buf,"coil scores dir = %s",name);
+ strcat(name,input_name);
+ strcat(name,".coil_scores");
+ if (*mode & VER_MODE)
+ strcat(name,"_NoTxt");
+
+ /**** Apend on the library distances. ***/
+ if (combine_dist[0] == 0) { /* make sure do dimension scores */
+ lib_numb=0;
+ while (lib_numb < num_dist[0]) {
+ sprintf(&buf[lib_numb],"%d",multi_lib[0][lib_numb]);
+ lib_numb++; }
+ sprintf(&buf[lib_numb],"_");
+ strncat(name,buf,num_dist[0]+1);
+
+ lib_numb=0;
+ while (lib_numb < num_dist[1]) {
+ sprintf(&buf[lib_numb],"%d",multi_lib[1][lib_numb]);
+ lib_numb++; }
+ strncat(name,buf,num_dist[1]);
+ }
+ }
+ else sscanf(buf,"coil scores = %s",name);
+ *fout_coils = sopen(name,"w"); /* For just choosing 1 score */
+ printf("coil scores = %s\n",name); /* per pos file coil, or seq */
+ }
+
+ else if(!strncmp(buf,"seq scores",10)) {
+ *by_coil_or_seq =2; /** Do seq scores. **/
+ if (!strncmp(buf,"seq scores dir",14)) { /* automate the name **/
+ sscanf(buf,"seq scores dir = %s",name);
+ strcat(name,input_name);
+ strcat(name,".seq_scores");
+ if (*mode & VER_MODE)
+ strcat(name,"_NoTxt");
+
+ /**** Apend on the library distances. ***/
+ if (combine_dist[0] == 0) { /* make sure do dimension scores */
+ lib_numb=0;
+ while (lib_numb < num_dist[0]) {
+ sprintf(&buf[lib_numb],"%d",multi_lib[0][lib_numb]);
+ lib_numb++; }
+ sprintf(&buf[lib_numb],"_");
+ strncat(name,buf,num_dist[0]+1);
+
+ lib_numb=0;
+ while (lib_numb < num_dist[1]) {
+ sprintf(&buf[lib_numb],"%d",multi_lib[1][lib_numb]);
+ lib_numb++; }
+ strncat(name,buf,num_dist[1]);
+ }
+ }
+ else sscanf(buf,"seq scores = %s",name);
+ *fout_coils = sopen(name,"w"); /* For just choosing 1 score */
+ printf("seq scores = %s\n",name); /* per pos file coil, or seq */
+ }
+
+/*************************/
+
+ else if(!strncmp(buf,"ps res per line",15)) {/* Reads in the length of */
+ sscanf(buf,"ps res per line = %d", ps_res_per_line); /* print line */
+ fprintf(stderr,"res per line = %d\n", *ps_res_per_line);
+ }
+ else if(!strncmp(buf,"one print line",14)) {
+ *ps_res_per_line = -1; /* Flag to print on just one line. */
+ fprintf(stderr,"Sequences will be printed on one line in ps file.\n");
+ }
+
+ else if(!strncmp(buf,"max window then combine dist",28)) {
+ *mode |= MAX_WINDOW_BEFORE_COMBINE_MODE; /* In scseqadj in */
+ printf("max window before combine distances\n"); /* scscore.c, this */ /* defines how to compute score. */
+ }
+
+ else if(!strncmp(buf,"only coiled classes",19)) {
+ *mode |= ONLY_COILED_CLASSES;
+ printf("The paircoil like will be fraction of all positive classes likelihoods (no pdb- class.\n");
+ }
+
+ else if(!strncmp(buf,"ScoresAboveBound",16)) { /** Only output scores */
+ *mode |= ABOVE_BOUND_MODE; /* to score/out/txt files */
+ printf("Above Bound Mode\n"); /* that are above bound. */
+ }
+
+#ifdef TEST_VERSION /** Only for testing..... ***/
+ else if(!strncmp(buf,"Prolines",8)) {
+ *mode ^= PROLINE_FREE_MODE; /* Score Prolines */
+ printf("Score Prolines\n");
+ }
+#endif
+
+ else if(!strncmp(buf,"Show Seq",8)) {
+ *mode |= DEBUG_MODE; /* Option to get seq printed in */
+ /** printf("Show Sequences in log file\n"); **/ /* log file. */
+ *mode |= PRN_MODE; /* Print scores above bound */
+ }
+ else if(!strncmp(buf,"view",4)) {
+ *mode |= VIEW_MODE; /* Option to get a picture of */
+ printf("view\n"); /* STOCKS and PairCoils predicted*/
+ } /* coil regions in the seq. */
+ else if(!strncmp(buf,"ver",3)) {
+ *mode |= VER_MODE; /* Outputs 2 columns of maxseq */
+ printf("ver\n"); /* scores, first STOCK, then us */
+ *main_method = STOCK_PAIR;
+ } /* in log file. */
+
+ else if(!strncmp(buf,"Just Scores",11)) {
+ *mode |= VER_MODE;
+ printf ("The coil scores output will contain just scores, no text.");
+ }
+
+#ifdef TEST_VERSION /** Only want release to do pairs. */
+ else if (!strncmp(buf,"singles",7))
+ *mode ^= PAIRCOIL_PAIRS; /* Since default is 1, just XOR it. */
+#endif
+ else if (!strncmp(buf,"pairs",5))
+ *mode |= PAIRCOIL_PAIRS;
+
+
+ else if(!strncmp(buf,"prn",3)) {
+ *mode |= PRN_MODE; /* Print region scores above */
+ sscanf(buf,"prn = %lf", bound); /* threshhold prn to logfile. */
+/***
+ printf("prn\n");
+***/
+ }
+
+ else if(!strncmp(buf,"bound",5)) {
+ *mode |= PRN_MODE; /* Print region scores above */
+ sscanf(buf,"bound = %lf", bound); /* threshhold prn to logfile. */
+/***
+ printf("bound\n");
+***/
+ }
+
+
+ else if(!strncmp(buf,"window length",13)) {
+ int the_table;
+ if (!strncmp(buf,"window length =",15)) {
+ sscanf(buf,"window length = %d", &window_length[0]);
+ for (the_table =0; the_table < MAX_TABLE_NUMBER; the_table++) {
+ window_length[the_table] =window_length[0];
+ printf("window length %d = %d\n", the_table,
+ window_length[the_table]);
+ }
+ } /* All tables get same windowlength. **/
+ else {
+ sscanf(buf,"window length %d", &the_table);
+ sscanf(buf,"window length %d = %d", &the_table,
+ &window_length[the_table-1]);
+ printf("window length %d = %d\n",the_table,window_length[the_table-1]);
+ }
+ }
+
+ else if(!strncmp(buf,"scale0s",7)) {
+ int the_table;
+ if (!strncmp(buf,"scale0s =",9)) {
+ sscanf(buf,"scale0s = %lf", &scale0s[0]);
+ for (the_table =0; the_table < MAX_TABLE_NUMBER; the_table++) {
+ scale0s[the_table] =scale0s[0];
+ printf("scale0s %d = %lf\n", the_table,
+ scale0s[the_table]);
+ }
+ } /* All tables get same scale0. **/
+ else {
+ sscanf(buf,"scale0s %d", &the_table);
+ sscanf(buf,"scale0s %d = %lf", &the_table,
+ &scale0s[the_table-1]);
+ printf("scale0s %d = %lf\n",the_table,scale0s[the_table-1]);
+ }
+ }
+
+
+ else if(!strncmp(buf,"scale0p",7)) {
+ int the_table;
+ if (!strncmp(buf,"scale0p =",9)) {
+ sscanf(buf,"scale0p = %lf", &scale0p[0]);
+ for (the_table =0; the_table < MAX_TABLE_NUMBER; the_table++) {
+ scale0p[the_table] =scale0s[0];
+ printf("scale0p %d = %lf\n", the_table,
+ scale0p[the_table]);
+ }
+ } /* All tables get same scale0. **/
+ else {
+ sscanf(buf,"scale0p %d", &the_table);
+ sscanf(buf,"scale0p %d = %lf", &the_table,
+ &scale0p[the_table-1]);
+ printf("scale0p %d = %lf\n",the_table,scale0p[the_table-1]);
+ }
+ }
+/***************************************************************/
+/***********************************************************/
+
+
+
+ else if(!strncmp(buf,"method",6)) { /* Reads in the method that */
+ sscanf(buf,"method = %s", name); /* should output to fout. */
+/*****
+ printf("method = %s\n",name);
+*****/
+ if (!strcmp(name,"PairCoil")) sprintf(name,"Coil");
+ for (i=0; i<NUMBER_METHODS;i++)
+ if (!strcmp(name,methodname[i]))
+ *main_method = i;
+ }
+ else if(!strncmp(buf,"preprocessor",12)) {/* Reads in the method that */
+ sscanf(buf,"preprocessor = %s", name); /* should output to fout. */
+/*****
+ printf("preprocessor = %s\n",name);
+******/
+ if (!strcmp(name,"PairCoil")) sprintf(name,"Coil");
+ for (i=0; i<NUMBER_PREPROCESSORS;i++)
+ if (!strcmp(name,methodname[i]))
+ *main_preprocessor_method = i;
+ }
+
+
+ else if(!strncmp(buf,"default table",13)) {
+ sscanf(buf,"default table = %s", name);
+ printf ("default table = %s",name);
+ if (!strcmp(name, "dimer"))
+ *main_table =0; /* Table 0 should be dimer. */
+ else if (!strcmp(name, "trimer"))
+ *main_table =1; /* Table 1 should be trimer. */
+ else if (!strcmp(name, "combination"))
+ *main_table =2; /* Table 2 should be combination of table 0+1. */
+ else { /* Just get a table number. */
+ sscanf(name,"%d", main_table);
+ (*main_table)--; /* Human table number starts at 1, computer at 0 */
+ }
+ }
+
+
+
+/***************The following options are for dimer-trimer likelihoods******/
+ else if(!strncmp(buf,"avg_max", 7)) {
+ sscanf(buf,"avg_max = %s", name);
+ if (!strcmp(name,"avg")) *avg_max=0;
+ else if (!strcmp(name,"max")) *avg_max=1;
+ else if (!strcmp(name,"both")) *avg_max=2;
+
+ fprintf(stderr, "avg_max = %d\n", *avg_max);
+ }
+ else if(!strncmp(buf,"offset", 6)) { /* -1 means every offset. */
+ sscanf(buf,"offset = %d", offset_to_use); /* 7 means max like offset */
+ fprintf(stderr, "offset for TableDiff = %d\n", *offset_to_use);
+ }
+ else if (!strncmp(buf,"use like line", 13)) {
+ *mode |= USE_LIKE_LINE;
+ fprintf(stderr,"Using likelihood line in Pair/SingleCoil computations, not the actual prob. formula.");
+ }
+ else if (!strncmp(buf,"weighted paircoil", 17)) {
+ *mode |= WEIGHTED_PROBS;
+ fprintf(stderr,"Using weights in paircoil computation.");
+ }
+
+ else if (!strncmp(buf,"do coil avg score", 17)) {
+ *Coil_Score = 1;
+ fprintf(stderr,"\nDoing Coil avg score\n");
+ }
+
+ else if (!strncmp(buf,"do coil max score", 17)) {
+ *Coil_Score = 2;
+ fprintf(stderr,"\nDoing Coil max score\n");
+ }
+ }
+
+ }
+ else {
+ fprintf(stderr,"\nCouldn't find paircoil_config file.");
+ fprintf(stderr,"\n Assumed it would be located in %s.",buf);
+ fprintf(stderr,"\n You should either place it there, or set the environment");
+ fprintf(stderr,"\n variable PAIRCOIL_CONFIG to its location.\n");
+ exit(-1);
+ }
+}
+
+
+
+
+
+
+
+
+