Commits

Qian Zhu  committed 034210d

Added function in SeekEvaluator to test signficance of dataset weights of a query
Added interface in SeekMiner to allow weighting by variance of query genes, or user-given weighting

  • Participants
  • Parent commits 1fe3781

Comments (0)

Files changed (14)

File src/seekcentral.cpp

 	current_sm = sm;
 
 	for(i=0; i<m_vecstrAllQuery.size(); i++){
-
 		//simulated weight case ======================
 		/*if(simulateWeight && redoWithEqual>=1) //1 or 2 
 			current_sm = EQUAL;
 			}
 			fill(wc.begin(), wc.end(), (float)0);
 		}
-
-
 		//fprintf(stderr, "2 %lu\n", CMeta::GetMemoryUsage());
 
 		#pragma omp parallel for \
 		shared(customGoldStd) \
 		private(dd, d, j) \
-		firstprivate(iSearchDatasets, iQuery) \
+		firstprivate(i, iSearchDatasets, iQuery) \
 		schedule(dynamic)
 		for(dd=0; dd<iSearchDatasets; dd++){
 			d = allRDatasets[dd];

File src/seekreader.cpp

 	fprintf(stderr, "Finished reading query genes' correlations\n");
 	ret = system("date +%s%N 1>&2");
 	if(bNetwork && CSeekNetwork::Send(iClient, 
-		"Finished reading databaselets and query centric")==-1){
+		"Finished reading query genes' correlations")==-1){
 		fprintf(stderr, "Error sending client message\n");
 		return false;
 	}

File tools/SeekEvaluator/SeekEvaluator.cpp

 #include "cmdline.h"
 
 enum QUERY_MODE{
-	SINGLE_QUERY, MULTI_QUERY
+	SINGLE_QUERY, MULTI_QUERY, MULTI_DWEIGHT
 };
 
 enum METRIC{
 	istream*			pistm;
 	vector<string>		vecstrLine, vecstrGenes, vecstrDBs, vecstrQuery;
 	char				acBuffer[ c_iBuffer ];
-	size_t				i, j;
+	size_t				i, j, k;
 
 
 	if( cmdline_parser( iArgs, aszArgs, &sArgs ) ) {
 	enum QUERY_MODE qmode;
 	if(sArgs.single_flag==1) qmode = SINGLE_QUERY;
 	else if(sArgs.aggregate_flag==1) qmode = MULTI_QUERY;
+	else if(sArgs.multi_weight_flag==1) qmode = MULTI_DWEIGHT;
 
 	enum METRIC met;
 	if(sArgs.rbp_flag==1) met = RBP;
 
 	}
 
+	if(qmode == MULTI_DWEIGHT){
+		string dweightList = sArgs.dweight_list_arg;
+		vector<string> vecstrList;
+		CSeekTools::ReadListOneColumn(dweightList, vecstrList);
+		int numDataset = 0;
+
+		for(j=0; j<vecstrList.size(); j++){
+			vector<float> ww;
+			CSeekTools::ReadArray(vecstrList[j].c_str(), ww);
+			vector<AResultFloat> sortedDatasets;
+			sortedDatasets.resize(ww.size());
+			numDataset = ww.size();
+			for(i=0; i<sortedDatasets.size(); i++){
+				sortedDatasets[i].i = i;
+				sortedDatasets[i].f = ww[i];
+			}
+			sort(sortedDatasets.begin(), sortedDatasets.end());
+			/*for(i=0; i<sortedDatasets.size(); i++){
+				fprintf(stderr, "%.2e\t%s\n", sortedDatasets[i].f, 
+					vecstrDatasets[sortedDatasets[i].i].c_str());
+			}*/
+			vector<int> depth;
+			depth.push_back((int) ((float)numDataset * 0.005));	
+			depth.push_back((int) ((float)numDataset * 0.01));	
+			depth.push_back((int) ((float)numDataset * 0.05));	
+			depth.push_back((int) ((float)numDataset * 0.10));	
+			depth.push_back((int) ((float)numDataset * 0.20));	
+			depth.push_back((int) ((float)numDataset * 0.50));	
+			vector<float> avg;
+			for(i=0; i<depth.size(); i++){
+				float a = 0;
+				for(k=0; k<depth[i]; k++)
+					a+=sortedDatasets[k].f;
+				a /= (float) depth[i];
+				avg.push_back(a);
+			}
+			for(i=0; i<depth.size(); i++){
+				fprintf(stderr, "%.3e\t", avg[i]);
+			}
+			fprintf(stderr, "\n");
+		}
+
+	}
+
 
 #ifdef WIN32
 	pthread_win32_process_detach_np( );

File tools/SeekEvaluator/SeekEvaluator.ggo

 								flag	off
 option	"aggregate"			M	"Evaluate multiple queries and aggregates results"
 								flag	off
+option	"multi_weight"		T	"Evaluate multiple queries' dataset weight files"
+								flag	off
 
 section	"Metric"
 option	"fixed_pr"			z	"Precision at depth X"
 option	"input"				i	"Gene mapping file"
 								string typestr="filename"	yes
 
-section "Input required by dataset weight display"
+section "Input required by dataset weight display (single .dweight file)"
 option	"dataset_map"		I	"Dataset mapping file, only required for displaying dataset weights"
 								string typestr="filename"
 option	"weight"			w	"Dataset weight file, (*.dweight)"
 								string typestr="filename"
 
+section "Input required by multi-query dataset weight display"
+option	"dweight_list"		Z	"List of dweight files"
+								string typestr="filename"
+
 section "Options for all"
 option	"fold_over_random"	f	"Fold-over-random"
 								flag	off
 								string typestr="filename"
 option	"include_list"		Y	"List of annotated genes"
 								string typestr="filename"
-								
+
+
 section "Output"
 option	"dir_out"			d	"Output directory"
 								string typestr="directory"	yes

File tools/SeekEvaluator/cmdline.c

 /*
-  File autogenerated by gengetopt version 2.22.5
+  File autogenerated by gengetopt version 2.22
   generated with the following command:
   gengetopt -iSeekEvaluator.ggo --default-optional -u -N -e 
 
 #include <stdlib.h>
 #include <string.h>
 
-#ifndef FIX_UNUSED
-#define FIX_UNUSED(X) (void) (X) /* avoid warnings for unused params */
-#endif
-
-#include <getopt.h>
+#include "getopt.h"
 
 #include "cmdline.h"
 
   "\nMode:",
   "  -O, --single                 Evaluate one query's rank list result  \n                                 (default=off)",
   "  -M, --aggregate              Evaluate multiple queries and aggregates results \n                                  (default=off)",
+  "  -T, --multi_weight           Evaluate multiple queries' dataset weight files  \n                                 (default=off)",
   "\nMetric:",
   "  -z, --fixed_pr               Precision at depth X  (default=off)",
   "  -r, --rbp                    Rank biased precision (requires parameter p to \n                                 be set)  (default=off)",
   "  -E, --display_all            Display the metric for all queries  \n                                 (default=off)",
   "\nInput required by all:",
   "  -i, --input=filename         Gene mapping file",
-  "\nInput required by dataset weight display:",
+  "\nInput required by dataset weight display (single .dweight file):",
   "  -I, --dataset_map=filename   Dataset mapping file, only required for \n                                 displaying dataset weights",
   "  -w, --weight=filename        Dataset weight file, (*.dweight)",
+  "\nInput required by multi-query dataset weight display:",
+  "  -Z, --dweight_list=filename  List of dweight files",
   "\nOptions for all:",
   "  -f, --fold_over_random       Fold-over-random  (default=off)",
   "  -P, --p_value                Simulated p-value  (default=off)",
 void clear_args (struct gengetopt_args_info *args_info);
 
 static int
-cmdline_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info,
+cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info,
                         struct cmdline_parser_params *params, const char *additional_error);
 
 static int
   args_info->version_given = 0 ;
   args_info->single_given = 0 ;
   args_info->aggregate_given = 0 ;
+  args_info->multi_weight_given = 0 ;
   args_info->fixed_pr_given = 0 ;
   args_info->rbp_given = 0 ;
   args_info->avgp_given = 0 ;
   args_info->input_given = 0 ;
   args_info->dataset_map_given = 0 ;
   args_info->weight_given = 0 ;
+  args_info->dweight_list_given = 0 ;
   args_info->fold_over_random_given = 0 ;
   args_info->p_value_given = 0 ;
   args_info->random_dir_given = 0 ;
 static
 void clear_args (struct gengetopt_args_info *args_info)
 {
-  FIX_UNUSED (args_info);
   args_info->single_flag = 0;
   args_info->aggregate_flag = 0;
+  args_info->multi_weight_flag = 0;
   args_info->fixed_pr_flag = 0;
   args_info->rbp_flag = 0;
   args_info->avgp_flag = 0;
   args_info->dataset_map_orig = NULL;
   args_info->weight_arg = NULL;
   args_info->weight_orig = NULL;
+  args_info->dweight_list_arg = NULL;
+  args_info->dweight_list_orig = NULL;
   args_info->fold_over_random_flag = 0;
   args_info->p_value_flag = 0;
   args_info->random_dir_arg = NULL;
   args_info->version_help = gengetopt_args_info_help[1] ;
   args_info->single_help = gengetopt_args_info_help[3] ;
   args_info->aggregate_help = gengetopt_args_info_help[4] ;
-  args_info->fixed_pr_help = gengetopt_args_info_help[6] ;
-  args_info->rbp_help = gengetopt_args_info_help[7] ;
-  args_info->avgp_help = gengetopt_args_info_help[8] ;
-  args_info->pr_help = gengetopt_args_info_help[9] ;
-  args_info->pr_all_help = gengetopt_args_info_help[10] ;
-  args_info->auc_help = gengetopt_args_info_help[11] ;
-  args_info->x_int_help = gengetopt_args_info_help[12] ;
-  args_info->x_per_help = gengetopt_args_info_help[13] ;
-  args_info->rbp_p_help = gengetopt_args_info_help[14] ;
-  args_info->dislay_only_help = gengetopt_args_info_help[15] ;
-  args_info->display_weight_help = gengetopt_args_info_help[16] ;
-  args_info->agg_avg_help = gengetopt_args_info_help[18] ;
-  args_info->agg_quartile_help = gengetopt_args_info_help[19] ;
-  args_info->agg_ranksum_help = gengetopt_args_info_help[20] ;
-  args_info->agg_scoresum_help = gengetopt_args_info_help[21] ;
-  args_info->display_all_help = gengetopt_args_info_help[22] ;
-  args_info->input_help = gengetopt_args_info_help[24] ;
-  args_info->dataset_map_help = gengetopt_args_info_help[26] ;
-  args_info->weight_help = gengetopt_args_info_help[27] ;
-  args_info->fold_over_random_help = gengetopt_args_info_help[29] ;
-  args_info->p_value_help = gengetopt_args_info_help[30] ;
-  args_info->random_dir_help = gengetopt_args_info_help[31] ;
-  args_info->random_num_help = gengetopt_args_info_help[32] ;
-  args_info->goldstd_help = gengetopt_args_info_help[34] ;
-  args_info->gscore_help = gengetopt_args_info_help[35] ;
-  args_info->query_help = gengetopt_args_info_help[36] ;
-  args_info->exclude_help = gengetopt_args_info_help[37] ;
-  args_info->nan_help = gengetopt_args_info_help[38] ;
-  args_info->goldstd_list_help = gengetopt_args_info_help[40] ;
-  args_info->gscore_list_help = gengetopt_args_info_help[41] ;
-  args_info->query_list_help = gengetopt_args_info_help[42] ;
-  args_info->exclude_list_help = gengetopt_args_info_help[43] ;
-  args_info->include_list_help = gengetopt_args_info_help[44] ;
-  args_info->dir_out_help = gengetopt_args_info_help[46] ;
+  args_info->multi_weight_help = gengetopt_args_info_help[5] ;
+  args_info->fixed_pr_help = gengetopt_args_info_help[7] ;
+  args_info->rbp_help = gengetopt_args_info_help[8] ;
+  args_info->avgp_help = gengetopt_args_info_help[9] ;
+  args_info->pr_help = gengetopt_args_info_help[10] ;
+  args_info->pr_all_help = gengetopt_args_info_help[11] ;
+  args_info->auc_help = gengetopt_args_info_help[12] ;
+  args_info->x_int_help = gengetopt_args_info_help[13] ;
+  args_info->x_per_help = gengetopt_args_info_help[14] ;
+  args_info->rbp_p_help = gengetopt_args_info_help[15] ;
+  args_info->dislay_only_help = gengetopt_args_info_help[16] ;
+  args_info->display_weight_help = gengetopt_args_info_help[17] ;
+  args_info->agg_avg_help = gengetopt_args_info_help[19] ;
+  args_info->agg_quartile_help = gengetopt_args_info_help[20] ;
+  args_info->agg_ranksum_help = gengetopt_args_info_help[21] ;
+  args_info->agg_scoresum_help = gengetopt_args_info_help[22] ;
+  args_info->display_all_help = gengetopt_args_info_help[23] ;
+  args_info->input_help = gengetopt_args_info_help[25] ;
+  args_info->dataset_map_help = gengetopt_args_info_help[27] ;
+  args_info->weight_help = gengetopt_args_info_help[28] ;
+  args_info->dweight_list_help = gengetopt_args_info_help[30] ;
+  args_info->fold_over_random_help = gengetopt_args_info_help[32] ;
+  args_info->p_value_help = gengetopt_args_info_help[33] ;
+  args_info->random_dir_help = gengetopt_args_info_help[34] ;
+  args_info->random_num_help = gengetopt_args_info_help[35] ;
+  args_info->goldstd_help = gengetopt_args_info_help[37] ;
+  args_info->gscore_help = gengetopt_args_info_help[38] ;
+  args_info->query_help = gengetopt_args_info_help[39] ;
+  args_info->exclude_help = gengetopt_args_info_help[40] ;
+  args_info->nan_help = gengetopt_args_info_help[41] ;
+  args_info->goldstd_list_help = gengetopt_args_info_help[43] ;
+  args_info->gscore_list_help = gengetopt_args_info_help[44] ;
+  args_info->query_list_help = gengetopt_args_info_help[45] ;
+  args_info->exclude_list_help = gengetopt_args_info_help[46] ;
+  args_info->include_list_help = gengetopt_args_info_help[47] ;
+  args_info->dir_out_help = gengetopt_args_info_help[49] ;
   
 }
 
 void
 cmdline_parser_print_version (void)
 {
-  printf ("%s %s\n",
-     (strlen(CMDLINE_PARSER_PACKAGE_NAME) ? CMDLINE_PARSER_PACKAGE_NAME : CMDLINE_PARSER_PACKAGE),
-     CMDLINE_PARSER_VERSION);
+  printf ("%s %s\n", CMDLINE_PARSER_PACKAGE, CMDLINE_PARSER_VERSION);
 }
 
 static void print_help_common(void) {
   printf("\n");
 
   if (strlen(gengetopt_args_info_description) > 0)
-    printf("%s\n\n", gengetopt_args_info_description);
+    printf("%s\n", gengetopt_args_info_description);
 }
 
 void
   clear_args (args_info);
   init_args_info (args_info);
 
-  args_info->inputs = 0;
+  args_info->inputs = NULL;
   args_info->inputs_num = 0;
 }
 
   free_string_field (&(args_info->dataset_map_orig));
   free_string_field (&(args_info->weight_arg));
   free_string_field (&(args_info->weight_orig));
+  free_string_field (&(args_info->dweight_list_arg));
+  free_string_field (&(args_info->dweight_list_orig));
   free_string_field (&(args_info->random_dir_arg));
   free_string_field (&(args_info->random_dir_orig));
   free_string_field (&(args_info->random_num_orig));
 
 
 static void
-write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[])
+write_into_file(FILE *outfile, const char *opt, const char *arg, char *values[])
 {
-  FIX_UNUSED (values);
   if (arg) {
     fprintf(outfile, "%s=\"%s\"\n", opt, arg);
   } else {
     write_into_file(outfile, "single", 0, 0 );
   if (args_info->aggregate_given)
     write_into_file(outfile, "aggregate", 0, 0 );
+  if (args_info->multi_weight_given)
+    write_into_file(outfile, "multi_weight", 0, 0 );
   if (args_info->fixed_pr_given)
     write_into_file(outfile, "fixed_pr", 0, 0 );
   if (args_info->rbp_given)
     write_into_file(outfile, "dataset_map", args_info->dataset_map_orig, 0);
   if (args_info->weight_given)
     write_into_file(outfile, "weight", args_info->weight_orig, 0);
+  if (args_info->dweight_list_given)
+    write_into_file(outfile, "dweight_list", args_info->dweight_list_orig, 0);
   if (args_info->fold_over_random_given)
     write_into_file(outfile, "fold_over_random", 0, 0 );
   if (args_info->p_value_given)
 char *
 gengetopt_strdup (const char *s)
 {
-  char *result = 0;
+  char *result = NULL;
   if (!s)
     return result;
 
 }
 
 int
-cmdline_parser (int argc, char **argv, struct gengetopt_args_info *args_info)
+cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info)
 {
   return cmdline_parser2 (argc, argv, args_info, 0, 1, 1);
 }
 
 int
-cmdline_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info,
+cmdline_parser_ext (int argc, char * const *argv, struct gengetopt_args_info *args_info,
                    struct cmdline_parser_params *params)
 {
   int result;
-  result = cmdline_parser_internal (argc, argv, args_info, params, 0);
+  result = cmdline_parser_internal (argc, argv, args_info, params, NULL);
 
   return result;
 }
 
 int
-cmdline_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required)
+cmdline_parser2 (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required)
 {
   int result;
   struct cmdline_parser_params params;
   params.check_ambiguity = 0;
   params.print_errors = 1;
 
-  result = cmdline_parser_internal (argc, argv, args_info, &params, 0);
+  result = cmdline_parser_internal (argc, argv, args_info, &params, NULL);
 
   return result;
 }
 {
   int result = EXIT_SUCCESS;
 
-  if (cmdline_parser_required2(args_info, prog_name, 0) > 0)
+  if (cmdline_parser_required2(args_info, prog_name, NULL) > 0)
     result = EXIT_FAILURE;
 
   return result;
 cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error)
 {
   int error = 0;
-  FIX_UNUSED (additional_error);
 
   /* checks for required options */
   if (! args_info->input_given)
 static
 int update_arg(void *field, char **orig_field,
                unsigned int *field_given, unsigned int *prev_given, 
-               char *value, const char *possible_values[],
-               const char *default_value,
+               char *value, char *possible_values[], const char *default_value,
                cmdline_parser_arg_type arg_type,
                int check_ambiguity, int override,
                int no_free, int multiple_option,
   const char *val = value;
   int found;
   char **string_field;
-  FIX_UNUSED (field);
 
   stop_char = 0;
   found = 0;
       return 1; /* failure */
     }
 
-  FIX_UNUSED (default_value);
     
   if (field_given && *field_given && ! override)
     return 0;
 
 
 int
-cmdline_parser_internal (
-  int argc, char **argv, struct gengetopt_args_info *args_info,
+cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info,
                         struct cmdline_parser_params *params, const char *additional_error)
 {
   int c;	/* Character of the parsed option.  */
         { "version",	0, NULL, 'V' },
         { "single",	0, NULL, 'O' },
         { "aggregate",	0, NULL, 'M' },
+        { "multi_weight",	0, NULL, 'T' },
         { "fixed_pr",	0, NULL, 'z' },
         { "rbp",	0, NULL, 'r' },
         { "avgp",	0, NULL, 'a' },
         { "input",	1, NULL, 'i' },
         { "dataset_map",	1, NULL, 'I' },
         { "weight",	1, NULL, 'w' },
+        { "dweight_list",	1, NULL, 'Z' },
         { "fold_over_random",	0, NULL, 'f' },
         { "p_value",	0, NULL, 'P' },
         { "random_dir",	1, NULL, 'R' },
         { "exclude_list",	1, NULL, 'X' },
         { "include_list",	1, NULL, 'Y' },
         { "dir_out",	1, NULL, 'd' },
-        { 0,  0, 0, 0 }
+        { NULL,	0, NULL, 0 }
       };
 
-      c = getopt_long (argc, argv, "hVOMzratcux:e:p:FWABCDEi:I:w:fPR:N:s:g:q:y:n:S:G:Q:X:Y:d:", long_options, &option_index);
+      c = getopt_long (argc, argv, "hVOMTzratcux:e:p:FWABCDEi:I:w:Z:fPR:N:s:g:q:y:n:S:G:Q:X:Y:d:", long_options, &option_index);
 
       if (c == -1) break;	/* Exit from `while (1)' loop.  */
 
             goto failure;
         
           break;
+        case 'T':	/* Evaluate multiple queries' dataset weight files.  */
+        
+        
+          if (update_arg((void *)&(args_info->multi_weight_flag), 0, &(args_info->multi_weight_given),
+              &(local_args_info.multi_weight_given), optarg, 0, 0, ARG_FLAG,
+              check_ambiguity, override, 1, 0, "multi_weight", 'T',
+              additional_error))
+            goto failure;
+        
+          break;
         case 'z':	/* Precision at depth X.  */
         
         
             goto failure;
         
           break;
+        case 'Z':	/* List of dweight files.  */
+        
+        
+          if (update_arg( (void *)&(args_info->dweight_list_arg), 
+               &(args_info->dweight_list_orig), &(args_info->dweight_list_given),
+              &(local_args_info.dweight_list_given), optarg, 0, 0, ARG_STRING,
+              check_ambiguity, override, 0, 0,
+              "dweight_list", 'Z',
+              additional_error))
+            goto failure;
+        
+          break;
         case 'f':	/* Fold-over-random.  */
         
         

File tools/SeekEvaluator/cmdline.h

 /** @file cmdline.h
  *  @brief The header file for the command line option parser
- *  generated by GNU Gengetopt version 2.22.5
+ *  generated by GNU Gengetopt version 2.22
  *  http://www.gnu.org/software/gengetopt.
  *  DO NOT modify this file, since it can be overwritten
  *  @author GNU Gengetopt by Lorenzo Bettini */
 #endif /* __cplusplus */
 
 #ifndef CMDLINE_PARSER_PACKAGE
-/** @brief the program name (used for printing errors) */
+/** @brief the program name */
 #define CMDLINE_PARSER_PACKAGE "SeekEvaluator"
 #endif
 
-#ifndef CMDLINE_PARSER_PACKAGE_NAME
-/** @brief the complete program name (used for help and version) */
-#define CMDLINE_PARSER_PACKAGE_NAME "SeekEvaluator"
-#endif
-
 #ifndef CMDLINE_PARSER_VERSION
 /** @brief the program version */
 #define CMDLINE_PARSER_VERSION "1.0"
   const char *single_help; /**< @brief Evaluate one query's rank list result help description.  */
   int aggregate_flag;	/**< @brief Evaluate multiple queries and aggregates results (default=off).  */
   const char *aggregate_help; /**< @brief Evaluate multiple queries and aggregates results help description.  */
+  int multi_weight_flag;	/**< @brief Evaluate multiple queries' dataset weight files (default=off).  */
+  const char *multi_weight_help; /**< @brief Evaluate multiple queries' dataset weight files help description.  */
   int fixed_pr_flag;	/**< @brief Precision at depth X (default=off).  */
   const char *fixed_pr_help; /**< @brief Precision at depth X help description.  */
   int rbp_flag;	/**< @brief Rank biased precision (requires parameter p to be set) (default=off).  */
   char * weight_arg;	/**< @brief Dataset weight file, (*.dweight).  */
   char * weight_orig;	/**< @brief Dataset weight file, (*.dweight) original value given at command line.  */
   const char *weight_help; /**< @brief Dataset weight file, (*.dweight) help description.  */
+  char * dweight_list_arg;	/**< @brief List of dweight files.  */
+  char * dweight_list_orig;	/**< @brief List of dweight files original value given at command line.  */
+  const char *dweight_list_help; /**< @brief List of dweight files help description.  */
   int fold_over_random_flag;	/**< @brief Fold-over-random (default=off).  */
   const char *fold_over_random_help; /**< @brief Fold-over-random help description.  */
   int p_value_flag;	/**< @brief Simulated p-value (default=off).  */
   unsigned int version_given ;	/**< @brief Whether version was given.  */
   unsigned int single_given ;	/**< @brief Whether single was given.  */
   unsigned int aggregate_given ;	/**< @brief Whether aggregate was given.  */
+  unsigned int multi_weight_given ;	/**< @brief Whether multi_weight was given.  */
   unsigned int fixed_pr_given ;	/**< @brief Whether fixed_pr was given.  */
   unsigned int rbp_given ;	/**< @brief Whether rbp was given.  */
   unsigned int avgp_given ;	/**< @brief Whether avgp was given.  */
   unsigned int input_given ;	/**< @brief Whether input was given.  */
   unsigned int dataset_map_given ;	/**< @brief Whether dataset_map was given.  */
   unsigned int weight_given ;	/**< @brief Whether weight was given.  */
+  unsigned int dweight_list_given ;	/**< @brief Whether dweight_list was given.  */
   unsigned int fold_over_random_given ;	/**< @brief Whether fold_over_random was given.  */
   unsigned int p_value_given ;	/**< @brief Whether p_value was given.  */
   unsigned int random_dir_given ;	/**< @brief Whether random_dir was given.  */
  * @param args_info the structure where option information will be stored
  * @return 0 if everything went fine, NON 0 if an error took place
  */
-int cmdline_parser (int argc, char **argv,
+int cmdline_parser (int argc, char * const *argv,
   struct gengetopt_args_info *args_info);
 
 /**
  * @return 0 if everything went fine, NON 0 if an error took place
  * @deprecated use cmdline_parser_ext() instead
  */
-int cmdline_parser2 (int argc, char **argv,
+int cmdline_parser2 (int argc, char * const *argv,
   struct gengetopt_args_info *args_info,
   int override, int initialize, int check_required);
 
  * @param params additional parameters for the parser
  * @return 0 if everything went fine, NON 0 if an error took place
  */
-int cmdline_parser_ext (int argc, char **argv,
+int cmdline_parser_ext (int argc, char * const *argv,
   struct gengetopt_args_info *args_info,
   struct cmdline_parser_params *params);
 

File tools/SeekMiner/SeekMiner.cpp

 		csfinal->EqualWeightSearch();
 	}else if(method=="ORDER_STAT"){
 		csfinal->OrderStatistics();
+	}else if(method=="USER"){
+		string uw = sArgs.user_weight_list_arg;
+		vector<string> uww;
+		if(!CSeekTools::ReadListOneColumn(uw.c_str(), uww)){
+			fprintf(stderr, "Error reading user weight list\n");
+			return -1;
+		}
+		vector<vector<float> > fw;
+		fw.resize(uww.size());
+		for(i=0; i<uww.size(); i++){
+			if(!CSeekTools::ReadArray(uww[i].c_str(), fw[i])){
+				return -1;
+			}
+		}
+		csfinal->WeightSearch(fw);
+	}else if(method=="VAR"){
+		for(i=0; i<cc.size(); i++){
+			CSeekDBSetting* pc = cc[i];
+			if(pc->GetValue("gvar")=="NULL"){
+				fprintf(stderr, "Must specify gvar directory!\n");
+				return -1;
+			}
+		}
+		if(bSimulateWeight){
+			fprintf(stderr, "simulate weight option is not supported for variance-based weighting\n");
+			return -1;
+		}
+		csfinal->VarianceWeightSearch();
 	}
-
 	//csfinal->WeightSearch(csk_weight_copy);
 	//csfinal->CVCustomSearch(newQ, rnd, PART_M, FOLD, RATE);
 	//csfinal->EqualWeightSearch();

File tools/SeekMiner/SeekMiner.ggo

 								int	default="1000"	yes
 
 section "Dataset weighting"
-option	"weighting_method"	V	"Weighting method: query cross-validated weighting (CV), equal weighting (EQUAL), order statistics weighting (ORDER_STAT)"
-								values="CV","EQUAL","ORDER_STAT" default="CV"
+option	"weighting_method"	V	"Weighting method: query cross-validated weighting (CV), equal weighting (EQUAL), order statistics weighting (ORDER_STAT), variance weighting (VAR), user-given weighting (USER)"
+								values="CV","EQUAL","ORDER_STAT","VAR","USER" default="CV"
 
 section "Optional - Functional Network Expansion"
 option	"func_db"			w	"Functional network db path"
 option	"func_logit"		l	"Functional network, integrate using logit values"
 								flag	off
 
+section "Optional - User-given Weighting"
+option	"user_weight_list"	J	"List of pre-computed dataset weight files (.dweight)"
+								string typestr="filename"
+
 section "Optional - Random simulations"
 option	"random"			S	"Generate random ranking score"
 								flag	off
 section "Options for Dataset weighting"
 option	"per_q_required"	C	"Fraction (max 1.0) of query required to correlate with a gene, in order to count the gene's query score. A gene may not correlate with a query gene if it is absent, or its correlation with query does not pass cut-off (specified by --score_cutoff). Use this with caution. Be careful if using with --score_cutoff."
 								float default="0.0"
+
+section "Options for CV-based dataset weighting"
 option	"CV_partition"		I	"The query partitioning method (for CV weighting): Leave-One-In, Leave-One-Out, X-Fold."
 								values="LOI","LOO","XFOLD" default="LOI"
 option	"CV_fold"			X	"The number of folds (for X-fold partitioning)."

File tools/SeekMiner/cmdline.c

 /*
-  File autogenerated by gengetopt version 2.22.5
+  File autogenerated by gengetopt version 2.22
   generated with the following command:
-  /usr/bin/gengetopt -iSeekMiner.ggo --default-optional -u -N -e 
+  gengetopt -iSeekMiner.ggo --default-optional -u -N -e 
 
   The developers of gengetopt consider the fixed text that goes in all
   gengetopt output files to be in the public domain:
 #include <stdlib.h>
 #include <string.h>
 
-#ifndef FIX_UNUSED
-#define FIX_UNUSED(X) (void) (X) /* avoid warnings for unused params */
-#endif
-
-#include <getopt.h>
+#include "getopt.h"
 
 #include "cmdline.h"
 
   "  -Q, --quant=filename          quant file (assuming all datasets use the same \n                                  quantization)",
   "  -n, --num_db=INT              Number of databaselets in database  \n                                  (default=`1000')",
   "\nDataset weighting:",
-  "  -V, --weighting_method=STRING Weighting method: query cross-validated \n                                  weighting (CV), equal weighting (EQUAL), \n                                  order statistics weighting (ORDER_STAT)  \n                                  (possible values=\"CV\", \"EQUAL\", \n                                  \"ORDER_STAT\" default=`CV')",
+  "  -V, --weighting_method=STRING Weighting method: query cross-validated \n                                  weighting (CV), equal weighting (EQUAL), \n                                  order statistics weighting (ORDER_STAT), \n                                  variance weighting (VAR), user-given \n                                  weighting (USER)  (possible values=\"CV\", \n                                  \"EQUAL\", \"ORDER_STAT\", \"VAR\", \"USER\" \n                                  default=`CV')",
   "\nOptional - Functional Network Expansion:",
   "  -w, --func_db=directory       Functional network db path",
   "  -f, --func_n=INT              Functional network number of databaselets  \n                                  (default=`1000')",
   "  -R, --func_quant=filename     Functional network quant file",
   "  -F, --func_dset=filename      Functional network dset-list file (1 dataset)",
   "  -l, --func_logit              Functional network, integrate using logit \n                                  values  (default=off)",
+  "\nOptional - User-given Weighting:",
+  "  -J, --user_weight_list=filename\n                                List of pre-computed dataset weight files \n                                  (.dweight)",
   "\nOptional - Random simulations:",
   "  -S, --random                  Generate random ranking score  (default=off)",
   "  -t, --num_random=INT          Number of repetitions of generating random \n                                  rankings  (default=`10')",
   "  -e, --square_z                If z_score is selected, take the square the \n                                  z-scores. Usually used in conjunction with \n                                  --score-cutoff.  (default=off)",
   "\nOptions for Dataset weighting:",
   "  -C, --per_q_required=FLOAT    Fraction (max 1.0) of query required to \n                                  correlate with a gene, in order to count the \n                                  gene's query score. A gene may not correlate \n                                  with a query gene if it is absent, or its \n                                  correlation with query does not pass cut-off \n                                  (specified by --score_cutoff). Use this with \n                                  caution. Be careful if using with \n                                  --score_cutoff.  (default=`0.0')",
+  "\nOptions for CV-based dataset weighting:",
   "  -I, --CV_partition=STRING     The query partitioning method (for CV \n                                  weighting): Leave-One-In, Leave-One-Out, \n                                  X-Fold.  (possible values=\"LOI\", \"LOO\", \n                                  \"XFOLD\" default=`LOI')",
   "  -X, --CV_fold=INT             The number of folds (for X-fold partitioning).  \n                                  (default=`5')",
   "  -G, --CV_rbp_p=FLOAT          The parameter p for RBP scoring of each \n                                  partition for its query gene retrieval (for \n                                  CV weighting).  (default=`0.99')",
 void clear_args (struct gengetopt_args_info *args_info);
 
 static int
-cmdline_parser_internal (int argc, char **argv, struct gengetopt_args_info *args_info,
+cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info,
                         struct cmdline_parser_params *params, const char *additional_error);
 
 static int
 cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error);
 
-const char *cmdline_parser_weighting_method_values[] = {"CV", "EQUAL", "ORDER_STAT", 0}; /*< Possible values for weighting_method. */
-const char *cmdline_parser_dist_measure_values[] = {"pearson", "z_score", 0}; /*< Possible values for dist_measure. */
-const char *cmdline_parser_CV_partition_values[] = {"LOI", "LOO", "XFOLD", 0}; /*< Possible values for CV_partition. */
+char *cmdline_parser_weighting_method_values[] = {"CV", "EQUAL", "ORDER_STAT", "VAR", "USER", 0} ;	/* Possible values for weighting_method.  */
+char *cmdline_parser_dist_measure_values[] = {"pearson", "z_score", 0} ;	/* Possible values for dist_measure.  */
+char *cmdline_parser_CV_partition_values[] = {"LOI", "LOO", "XFOLD", 0} ;	/* Possible values for CV_partition.  */
 
 static char *
 gengetopt_strdup (const char *s);
   args_info->func_quant_given = 0 ;
   args_info->func_dset_given = 0 ;
   args_info->func_logit_given = 0 ;
+  args_info->user_weight_list_given = 0 ;
   args_info->random_given = 0 ;
   args_info->num_random_given = 0 ;
   args_info->dist_measure_given = 0 ;
 static
 void clear_args (struct gengetopt_args_info *args_info)
 {
-  FIX_UNUSED (args_info);
   args_info->dset_arg = NULL;
   args_info->dset_orig = NULL;
   args_info->search_dset_arg = gengetopt_strdup ("NA");
   args_info->func_dset_arg = NULL;
   args_info->func_dset_orig = NULL;
   args_info->func_logit_flag = 0;
+  args_info->user_weight_list_arg = NULL;
+  args_info->user_weight_list_orig = NULL;
   args_info->random_flag = 0;
   args_info->num_random_arg = 10;
   args_info->num_random_orig = NULL;
   args_info->func_quant_help = gengetopt_args_info_help[20] ;
   args_info->func_dset_help = gengetopt_args_info_help[21] ;
   args_info->func_logit_help = gengetopt_args_info_help[22] ;
-  args_info->random_help = gengetopt_args_info_help[24] ;
-  args_info->num_random_help = gengetopt_args_info_help[25] ;
-  args_info->dist_measure_help = gengetopt_args_info_help[27] ;
-  args_info->norm_subavg_help = gengetopt_args_info_help[28] ;
-  args_info->norm_subavg_plat_help = gengetopt_args_info_help[29] ;
-  args_info->score_cutoff_help = gengetopt_args_info_help[30] ;
-  args_info->square_z_help = gengetopt_args_info_help[31] ;
-  args_info->per_q_required_help = gengetopt_args_info_help[33] ;
-  args_info->CV_partition_help = gengetopt_args_info_help[34] ;
-  args_info->CV_fold_help = gengetopt_args_info_help[35] ;
-  args_info->CV_rbp_p_help = gengetopt_args_info_help[36] ;
-  args_info->is_nibble_help = gengetopt_args_info_help[38] ;
-  args_info->buffer_help = gengetopt_args_info_help[39] ;
-  args_info->output_text_help = gengetopt_args_info_help[40] ;
-  args_info->output_dir_help = gengetopt_args_info_help[41] ;
-  args_info->output_w_comp_help = gengetopt_args_info_help[42] ;
-  args_info->simulate_w_help = gengetopt_args_info_help[43] ;
-  args_info->additional_db_help = gengetopt_args_info_help[44] ;
+  args_info->user_weight_list_help = gengetopt_args_info_help[24] ;
+  args_info->random_help = gengetopt_args_info_help[26] ;
+  args_info->num_random_help = gengetopt_args_info_help[27] ;
+  args_info->dist_measure_help = gengetopt_args_info_help[29] ;
+  args_info->norm_subavg_help = gengetopt_args_info_help[30] ;
+  args_info->norm_subavg_plat_help = gengetopt_args_info_help[31] ;
+  args_info->score_cutoff_help = gengetopt_args_info_help[32] ;
+  args_info->square_z_help = gengetopt_args_info_help[33] ;
+  args_info->per_q_required_help = gengetopt_args_info_help[35] ;
+  args_info->CV_partition_help = gengetopt_args_info_help[37] ;
+  args_info->CV_fold_help = gengetopt_args_info_help[38] ;
+  args_info->CV_rbp_p_help = gengetopt_args_info_help[39] ;
+  args_info->is_nibble_help = gengetopt_args_info_help[41] ;
+  args_info->buffer_help = gengetopt_args_info_help[42] ;
+  args_info->output_text_help = gengetopt_args_info_help[43] ;
+  args_info->output_dir_help = gengetopt_args_info_help[44] ;
+  args_info->output_w_comp_help = gengetopt_args_info_help[45] ;
+  args_info->simulate_w_help = gengetopt_args_info_help[46] ;
+  args_info->additional_db_help = gengetopt_args_info_help[47] ;
   
 }
 
 void
 cmdline_parser_print_version (void)
 {
-  printf ("%s %s\n",
-     (strlen(CMDLINE_PARSER_PACKAGE_NAME) ? CMDLINE_PARSER_PACKAGE_NAME : CMDLINE_PARSER_PACKAGE),
-     CMDLINE_PARSER_VERSION);
+  printf ("%s %s\n", CMDLINE_PARSER_PACKAGE, CMDLINE_PARSER_VERSION);
 }
 
 static void print_help_common(void) {
   printf("\n");
 
   if (strlen(gengetopt_args_info_description) > 0)
-    printf("%s\n\n", gengetopt_args_info_description);
+    printf("%s\n", gengetopt_args_info_description);
 }
 
 void
   clear_args (args_info);
   init_args_info (args_info);
 
-  args_info->inputs = 0;
+  args_info->inputs = NULL;
   args_info->inputs_num = 0;
 }
 
   free_string_field (&(args_info->func_quant_orig));
   free_string_field (&(args_info->func_dset_arg));
   free_string_field (&(args_info->func_dset_orig));
+  free_string_field (&(args_info->user_weight_list_arg));
+  free_string_field (&(args_info->user_weight_list_orig));
   free_string_field (&(args_info->num_random_orig));
   free_string_field (&(args_info->dist_measure_arg));
   free_string_field (&(args_info->dist_measure_orig));
  * -2 if more than one value has matched
  */
 static int
-check_possible_values(const char *val, const char *values[])
+check_possible_values(const char *val, char *values[])
 {
   int i, found, last;
   size_t len;
 
 
 static void
-write_into_file(FILE *outfile, const char *opt, const char *arg, const char *values[])
+write_into_file(FILE *outfile, const char *opt, const char *arg, char *values[])
 {
   int found = -1;
   if (arg) {
     write_into_file(outfile, "func_dset", args_info->func_dset_orig, 0);
   if (args_info->func_logit_given)
     write_into_file(outfile, "func_logit", 0, 0 );
+  if (args_info->user_weight_list_given)
+    write_into_file(outfile, "user_weight_list", args_info->user_weight_list_orig, 0);
   if (args_info->random_given)
     write_into_file(outfile, "random", 0, 0 );
   if (args_info->num_random_given)
 char *
 gengetopt_strdup (const char *s)
 {
-  char *result = 0;
+  char *result = NULL;
   if (!s)
     return result;
 
 }
 
 int
-cmdline_parser (int argc, char **argv, struct gengetopt_args_info *args_info)
+cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_info)
 {
   return cmdline_parser2 (argc, argv, args_info, 0, 1, 1);
 }
 
 int
-cmdline_parser_ext (int argc, char **argv, struct gengetopt_args_info *args_info,
+cmdline_parser_ext (int argc, char * const *argv, struct gengetopt_args_info *args_info,
                    struct cmdline_parser_params *params)
 {
   int result;
-  result = cmdline_parser_internal (argc, argv, args_info, params, 0);
+  result = cmdline_parser_internal (argc, argv, args_info, params, NULL);
 
   return result;
 }
 
 int
-cmdline_parser2 (int argc, char **argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required)
+cmdline_parser2 (int argc, char * const *argv, struct gengetopt_args_info *args_info, int override, int initialize, int check_required)
 {
   int result;
   struct cmdline_parser_params params;
   params.check_ambiguity = 0;
   params.print_errors = 1;
 
-  result = cmdline_parser_internal (argc, argv, args_info, &params, 0);
+  result = cmdline_parser_internal (argc, argv, args_info, &params, NULL);
 
   return result;
 }
 {
   int result = EXIT_SUCCESS;
 
-  if (cmdline_parser_required2(args_info, prog_name, 0) > 0)
+  if (cmdline_parser_required2(args_info, prog_name, NULL) > 0)
     result = EXIT_FAILURE;
 
   return result;
 cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error)
 {
   int error = 0;
-  FIX_UNUSED (additional_error);
 
   /* checks for required options */
   if (! args_info->dset_given)
 static
 int update_arg(void *field, char **orig_field,
                unsigned int *field_given, unsigned int *prev_given, 
-               char *value, const char *possible_values[],
-               const char *default_value,
+               char *value, char *possible_values[], const char *default_value,
                cmdline_parser_arg_type arg_type,
                int check_ambiguity, int override,
                int no_free, int multiple_option,
   const char *val = value;
   int found;
   char **string_field;
-  FIX_UNUSED (field);
 
   stop_char = 0;
   found = 0;
 
 
 int
-cmdline_parser_internal (
-  int argc, char **argv, struct gengetopt_args_info *args_info,
+cmdline_parser_internal (int argc, char * const *argv, struct gengetopt_args_info *args_info,
                         struct cmdline_parser_params *params, const char *additional_error)
 {
   int c;	/* Character of the parsed option.  */
         { "func_quant",	1, NULL, 'R' },
         { "func_dset",	1, NULL, 'F' },
         { "func_logit",	0, NULL, 'l' },
+        { "user_weight_list",	1, NULL, 'J' },
         { "random",	0, NULL, 'S' },
         { "num_random",	1, NULL, 't' },
         { "dist_measure",	1, NULL, 'z' },
         { "output_w_comp",	0, NULL, 'Y' },
         { "simulate_w",	0, NULL, 'E' },
         { "additional_db",	1, NULL, 'B' },
-        { 0,  0, 0, 0 }
+        { NULL,	0, NULL, 0 }
       };
 
-      c = getopt_long (argc, argv, "hx:D:i:q:d:p:P:u:U:Q:n:V:w:f:W:R:F:lSt:z:mMc:eC:I:X:G:Nb:Oo:YEB:", long_options, &option_index);
+      c = getopt_long (argc, argv, "hx:D:i:q:d:p:P:u:U:Q:n:V:w:f:W:R:F:lJ:St:z:mMc:eC:I:X:G:Nb:Oo:YEB:", long_options, &option_index);
 
       if (c == -1) break;	/* Exit from `while (1)' loop.  */
 
             goto failure;
         
           break;
-        case 'V':	/* Weighting method: query cross-validated weighting (CV), equal weighting (EQUAL), order statistics weighting (ORDER_STAT).  */
+        case 'V':	/* Weighting method: query cross-validated weighting (CV), equal weighting (EQUAL), order statistics weighting (ORDER_STAT), variance weighting (VAR), user-given weighting (USER).  */
         
         
           if (update_arg( (void *)&(args_info->weighting_method_arg), 
             goto failure;
         
           break;
+        case 'J':	/* List of pre-computed dataset weight files (.dweight).  */
+        
+        
+          if (update_arg( (void *)&(args_info->user_weight_list_arg), 
+               &(args_info->user_weight_list_orig), &(args_info->user_weight_list_given),
+              &(local_args_info.user_weight_list_given), optarg, 0, 0, ARG_STRING,
+              check_ambiguity, override, 0, 0,
+              "user_weight_list", 'J',
+              additional_error))
+            goto failure;
+        
+          break;
         case 'S':	/* Generate random ranking score.  */
         
         

File tools/SeekMiner/cmdline.h

 /** @file cmdline.h
  *  @brief The header file for the command line option parser
- *  generated by GNU Gengetopt version 2.22.5
+ *  generated by GNU Gengetopt version 2.22
  *  http://www.gnu.org/software/gengetopt.
  *  DO NOT modify this file, since it can be overwritten
  *  @author GNU Gengetopt by Lorenzo Bettini */
 #endif /* __cplusplus */
 
 #ifndef CMDLINE_PARSER_PACKAGE
-/** @brief the program name (used for printing errors) */
+/** @brief the program name */
 #define CMDLINE_PARSER_PACKAGE "SeekMiner"
 #endif
 
-#ifndef CMDLINE_PARSER_PACKAGE_NAME
-/** @brief the complete program name (used for help and version) */
-#define CMDLINE_PARSER_PACKAGE_NAME "SeekMiner"
-#endif
-
 #ifndef CMDLINE_PARSER_VERSION
 /** @brief the program version */
 #define CMDLINE_PARSER_VERSION "1.0"
   int num_db_arg;	/**< @brief Number of databaselets in database (default='1000').  */
   char * num_db_orig;	/**< @brief Number of databaselets in database original value given at command line.  */
   const char *num_db_help; /**< @brief Number of databaselets in database help description.  */
-  char * weighting_method_arg;	/**< @brief Weighting method: query cross-validated weighting (CV), equal weighting (EQUAL), order statistics weighting (ORDER_STAT) (default='CV').  */
-  char * weighting_method_orig;	/**< @brief Weighting method: query cross-validated weighting (CV), equal weighting (EQUAL), order statistics weighting (ORDER_STAT) original value given at command line.  */
-  const char *weighting_method_help; /**< @brief Weighting method: query cross-validated weighting (CV), equal weighting (EQUAL), order statistics weighting (ORDER_STAT) help description.  */
+  char * weighting_method_arg;	/**< @brief Weighting method: query cross-validated weighting (CV), equal weighting (EQUAL), order statistics weighting (ORDER_STAT), variance weighting (VAR), user-given weighting (USER) (default='CV').  */
+  char * weighting_method_orig;	/**< @brief Weighting method: query cross-validated weighting (CV), equal weighting (EQUAL), order statistics weighting (ORDER_STAT), variance weighting (VAR), user-given weighting (USER) original value given at command line.  */
+  const char *weighting_method_help; /**< @brief Weighting method: query cross-validated weighting (CV), equal weighting (EQUAL), order statistics weighting (ORDER_STAT), variance weighting (VAR), user-given weighting (USER) help description.  */
   char * func_db_arg;	/**< @brief Functional network db path.  */
   char * func_db_orig;	/**< @brief Functional network db path original value given at command line.  */
   const char *func_db_help; /**< @brief Functional network db path help description.  */
   const char *func_dset_help; /**< @brief Functional network dset-list file (1 dataset) help description.  */
   int func_logit_flag;	/**< @brief Functional network, integrate using logit values (default=off).  */
   const char *func_logit_help; /**< @brief Functional network, integrate using logit values help description.  */
+  char * user_weight_list_arg;	/**< @brief List of pre-computed dataset weight files (.dweight).  */
+  char * user_weight_list_orig;	/**< @brief List of pre-computed dataset weight files (.dweight) original value given at command line.  */
+  const char *user_weight_list_help; /**< @brief List of pre-computed dataset weight files (.dweight) help description.  */
   int random_flag;	/**< @brief Generate random ranking score (default=off).  */
   const char *random_help; /**< @brief Generate random ranking score help description.  */
   int num_random_arg;	/**< @brief Number of repetitions of generating random rankings (default='10').  */
   unsigned int func_quant_given ;	/**< @brief Whether func_quant was given.  */
   unsigned int func_dset_given ;	/**< @brief Whether func_dset was given.  */
   unsigned int func_logit_given ;	/**< @brief Whether func_logit was given.  */
+  unsigned int user_weight_list_given ;	/**< @brief Whether user_weight_list was given.  */
   unsigned int random_given ;	/**< @brief Whether random was given.  */
   unsigned int num_random_given ;	/**< @brief Whether num_random was given.  */
   unsigned int dist_measure_given ;	/**< @brief Whether dist_measure was given.  */
  * @param args_info the structure where option information will be stored
  * @return 0 if everything went fine, NON 0 if an error took place
  */
-int cmdline_parser (int argc, char **argv,
+int cmdline_parser (int argc, char * const *argv,
   struct gengetopt_args_info *args_info);
 
 /**
  * @return 0 if everything went fine, NON 0 if an error took place
  * @deprecated use cmdline_parser_ext() instead
  */
-int cmdline_parser2 (int argc, char **argv,
+int cmdline_parser2 (int argc, char * const *argv,
   struct gengetopt_args_info *args_info,
   int override, int initialize, int check_required);
 
  * @param params additional parameters for the parser
  * @return 0 if everything went fine, NON 0 if an error took place
  */
-int cmdline_parser_ext (int argc, char **argv,
+int cmdline_parser_ext (int argc, char * const *argv,
   struct gengetopt_args_info *args_info,
   struct cmdline_parser_params *params);
 
 int cmdline_parser_required (struct gengetopt_args_info *args_info,
   const char *prog_name);
 
-extern const char *cmdline_parser_weighting_method_values[];  /**< @brief Possible values for weighting_method. */
-extern const char *cmdline_parser_dist_measure_values[];  /**< @brief Possible values for dist_measure. */
-extern const char *cmdline_parser_CV_partition_values[];  /**< @brief Possible values for CV_partition. */
+extern char *cmdline_parser_weighting_method_values[] ;	/**< @brief Possible values for weighting_method.  */
+extern char *cmdline_parser_dist_measure_values[] ;	/**< @brief Possible values for dist_measure.  */
+extern char *cmdline_parser_CV_partition_values[] ;	/**< @brief Possible values for CV_partition.  */
 
 
 #ifdef __cplusplus

File tools/SeekReader/SeekReader.cpp

 	for(i=0; i<vecstrGenes.size(); i++)
 		mapstrintGene[vecstrGenes[i]] = i;
 
+	if(sArgs.weight2_flag==1){
+		vector<string> vecstrDataset;
+		if(!CSeekTools::ReadListOneColumn(sArgs.dweight_map_arg, vecstrDataset))
+			return false;
+
+		vector<vector<float> > vec_score;
+		vector<vector<float> > orig_score;
+		utype i, j;
+		int num_query = sArgs.dweight_num_arg; //random query
+		orig_score.resize(num_query);
+
+		vec_score.resize(vecstrDataset.size());
+		for(j=0; j<vec_score.size(); j++)
+			vec_score[j].resize(num_query);
+
+		char x[256];
+		for(i=0; i<num_query; i++){ //i is query id
+			vector<float> v;
+			sprintf(x, "%s/%d.dweight", sArgs.dweight_dir_arg, i);
+			CSeekTools::ReadArray(x, v);
+			orig_score[i] = v;
+			for(j=0; j<vec_score.size(); j++) //j is dataset id
+				vec_score[j][i] = v[j];
+		}
+
+		for(j=0; j<vec_score.size(); j++)
+			sort(vec_score[j].begin(), vec_score[j].end());
+
+		int test_num_query = sArgs.dweight_test_num_arg;
+		for(i=0; i<test_num_query; i++){ //i is query id
+			fprintf(stderr, "Query %d\n", i);
+			vector<float> v;
+			sprintf(x, "%s/%d.dweight", sArgs.dweight_test_dir_arg, i);
+			CSeekTools::ReadArray(x, v);
+			for(j=0; j<v.size(); j++){
+				utype k = 0;
+				for(k=0; k<num_query; k++){
+					if(v[j]<vec_score[j][k])
+						break;
+				}
+				fprintf(stderr, "%s\t%.3e\t%d\n", vecstrDataset[j].c_str(), v[j], k);
+			}
+		}
+		fprintf(stderr, "Done!\n");
+	}
+
 	if(sArgs.weight_flag==1){
 		vector<string> vecstrDataset;
 		if(!CSeekTools::ReadListOneColumn(sArgs.dweight_map_arg, vecstrDataset))
 
 	if(sArgs.comp_ranking_flag==1){
 		utype i, j;
-
-		//Extra 1: Conversion for the first parameter=========================
-		vector<string> vecID, vecEntrez;
-		if(!CSeekTools::ReadListTwoColumns("/tmp/entrez_gene_map.txt", vecID, vecEntrez))
-			return false;
-		vector<string> vecE, vecS;
-		map<string,string> mapEntrezGeneSymbol;
-		if(!CSeekTools::ReadListTwoColumns("/tmp/gene_entrez_symbol.txt", vecE, vecS))
-			return false;
-		for(i=0; i<vecE.size(); i++)
-			mapEntrezGeneSymbol[vecE[i]] = vecS[i];
-		//====================================================================
-
 		int num_query = sArgs.gscore_num1_arg; //random query
 		char x[256];
 		for(i=0; i<num_query; i++){ //i is query id
 			sprintf(x, "%s/%d.gscore", sArgs.gscore_dir2_arg, i);
 			CSeekTools::ReadArray(x, v2);
 			vector<CPair<float> > cp1, cp2;
-
-			//Extra 1======================================================
-			for(j=0; j<v1.size(); j++){
-				CPair<float> cp;
-				map<string,string>::iterator it = mapEntrezGeneSymbol.find(vecEntrez[j]);
-				if(it==mapEntrezGeneSymbol.end()) continue;
-				map<string,utype>::iterator it2 = mapstrintGene.find(it->second);
-				if(it2==mapstrintGene.end()) continue;
-				cp.i = it2->second;
-				cp.v = v1[j];
-				cp1.push_back(cp);
-			}
-			for(j=0; j<v2.size(); j++){
-				CPair<float> cp;
-				cp.i = (utype) j;
-				cp.v = v2[j];
-				cp2.push_back(cp);
-			}
-			//=============================================================
-
-			//Previously==================
-			/*cp1.resize(v1.size());
+			cp1.resize(v1.size());
 			cp2.resize(v2.size());
 			for(j=0; j<v1.size(); j++){
 				cp1[j].i = (utype) j;
 				cp1[j].v = v1[j];
 				cp2[j].i = (utype) j;
 				cp2[j].v = v2[j];
-			}*/
-			//============================
-
+			}
 			sort(cp1.begin(), cp1.end(), CDescendingValue<float>());
 			sort(cp2.begin(), cp2.end(), CDescendingValue<float>());
 			vector<char> presence;
 			fprintf(stderr, "Query %d %d\n", i, count);
 		}
 	}
-
 	if(sArgs.dataset_flag==1){
 		string db = sArgs.db_arg;
 		string dset_list = sArgs.dset_list_arg;
 			fprintf(stderr, "Requires: -x, -X, -d -p\n");
 			return false;
 		}
+
 		vector<string> vecstrDP, vecstrUserDP;
 		//dataset-platform mapping (required)
 		if(!CSeekTools::ReadListTwoColumns(sArgs.db_arg, vecstrDatasets, vecstrDP))

File tools/SeekReader/SeekReader.ggo

 								flag	off
 option	"weight"			W	"Test dataset weights"
 								flag	off
+option	"weight2"			U	"Test dataset weights 2"
+								flag	off
 option	"comp_ranking"		C	"Compare two rankings (*.gscore files)"
 								flag	off
 

File tools/SeekReader/cmdline.c

 /*
   File autogenerated by gengetopt version 2.22
   generated with the following command:
-  /memex/qzhu/usr/bin/gengetopt -iSeekReader.ggo --default-optional -u -N -e 
+  gengetopt -iSeekReader.ggo --default-optional -u -N -e 
 
   The developers of gengetopt consider the fixed text that goes in all
   gengetopt output files to be in the public domain:
   "  -D, --databaselet             Display values from databaselet(s)  \n                                  (default=off)",
   "  -A, --dataset                 Check which datasets contain query of interest, \n                                  based on .gpres file  (default=off)",
   "  -W, --weight                  Test dataset weights  (default=off)",
+  "  -U, --weight2                 Test dataset weights 2  (default=off)",
   "  -C, --comp_ranking            Compare two rankings (*.gscore files)  \n                                  (default=off)",
   "\nWeight:",
   "  -E, --dweight_dir=directory   Dataset weight directory  (default=`NA')",
   args_info->databaselet_given = 0 ;
   args_info->dataset_given = 0 ;
   args_info->weight_given = 0 ;
+  args_info->weight2_given = 0 ;
   args_info->comp_ranking_given = 0 ;
   args_info->dweight_dir_given = 0 ;
   args_info->dweight_num_given = 0 ;
   args_info->databaselet_flag = 0;
   args_info->dataset_flag = 0;
   args_info->weight_flag = 0;
+  args_info->weight2_flag = 0;
   args_info->comp_ranking_flag = 0;
   args_info->dweight_dir_arg = gengetopt_strdup ("NA");
   args_info->dweight_dir_orig = NULL;
   args_info->databaselet_help = gengetopt_args_info_help[3] ;
   args_info->dataset_help = gengetopt_args_info_help[4] ;
   args_info->weight_help = gengetopt_args_info_help[5] ;
-  args_info->comp_ranking_help = gengetopt_args_info_help[6] ;
-  args_info->dweight_dir_help = gengetopt_args_info_help[8] ;
-  args_info->dweight_num_help = gengetopt_args_info_help[9] ;
-  args_info->dweight_map_help = gengetopt_args_info_help[10] ;
-  args_info->dweight_test_dir_help = gengetopt_args_info_help[11] ;
-  args_info->dweight_test_num_help = gengetopt_args_info_help[12] ;
-  args_info->gscore_dir1_help = gengetopt_args_info_help[14] ;
-  args_info->gscore_dir2_help = gengetopt_args_info_help[15] ;
-  args_info->gscore_num1_help = gengetopt_args_info_help[16] ;
-  args_info->order_stat_single_gene_query_help = gengetopt_args_info_help[18] ;
-  args_info->db_help = gengetopt_args_info_help[19] ;
-  args_info->dset_list_help = gengetopt_args_info_help[20] ;
-  args_info->input_help = gengetopt_args_info_help[21] ;
-  args_info->single_query_help = gengetopt_args_info_help[22] ;
-  args_info->dir_in_help = gengetopt_args_info_help[23] ;
-  args_info->dir_prep_in_help = gengetopt_args_info_help[24] ;
-  args_info->dir_gvar_in_help = gengetopt_args_info_help[25] ;
-  args_info->dir_sinfo_in_help = gengetopt_args_info_help[26] ;
-  args_info->is_nibble_help = gengetopt_args_info_help[27] ;
-  args_info->platform_dir_help = gengetopt_args_info_help[28] ;
-  args_info->gvar_cutoff_help = gengetopt_args_info_help[29] ;
-  args_info->multi_query_help = gengetopt_args_info_help[30] ;
-  args_info->output_file_help = gengetopt_args_info_help[31] ;
+  args_info->weight2_help = gengetopt_args_info_help[6] ;
+  args_info->comp_ranking_help = gengetopt_args_info_help[7] ;
+  args_info->dweight_dir_help = gengetopt_args_info_help[9] ;
+  args_info->dweight_num_help = gengetopt_args_info_help[10] ;
+  args_info->dweight_map_help = gengetopt_args_info_help[11] ;
+  args_info->dweight_test_dir_help = gengetopt_args_info_help[12] ;
+  args_info->dweight_test_num_help = gengetopt_args_info_help[13] ;
+  args_info->gscore_dir1_help = gengetopt_args_info_help[15] ;
+  args_info->gscore_dir2_help = gengetopt_args_info_help[16] ;
+  args_info->gscore_num1_help = gengetopt_args_info_help[17] ;
+  args_info->order_stat_single_gene_query_help = gengetopt_args_info_help[19] ;
+  args_info->db_help = gengetopt_args_info_help[20] ;
+  args_info->dset_list_help = gengetopt_args_info_help[21] ;
+  args_info->input_help = gengetopt_args_info_help[22] ;
+  args_info->single_query_help = gengetopt_args_info_help[23] ;
+  args_info->dir_in_help = gengetopt_args_info_help[24] ;
+  args_info->dir_prep_in_help = gengetopt_args_info_help[25] ;
+  args_info->dir_gvar_in_help = gengetopt_args_info_help[26] ;
+  args_info->dir_sinfo_in_help = gengetopt_args_info_help[27] ;
+  args_info->is_nibble_help = gengetopt_args_info_help[28] ;
+  args_info->platform_dir_help = gengetopt_args_info_help[29] ;
+  args_info->gvar_cutoff_help = gengetopt_args_info_help[30] ;
+  args_info->multi_query_help = gengetopt_args_info_help[31] ;
+  args_info->output_file_help = gengetopt_args_info_help[32] ;
   
 }
 
     write_into_file(outfile, "dataset", 0, 0 );
   if (args_info->weight_given)
     write_into_file(outfile, "weight", 0, 0 );
+  if (args_info->weight2_given)
+    write_into_file(outfile, "weight2", 0, 0 );
   if (args_info->comp_ranking_given)
     write_into_file(outfile, "comp_ranking", 0, 0 );
   if (args_info->dweight_dir_given)
         { "databaselet",	0, NULL, 'D' },
         { "dataset",	0, NULL, 'A' },
         { "weight",	0, NULL, 'W' },
+        { "weight2",	0, NULL, 'U' },
         { "comp_ranking",	0, NULL, 'C' },
         { "dweight_dir",	1, NULL, 'E' },
         { "dweight_num",	1, NULL, 'n' },
         { NULL,	0, NULL, 0 }
       };
 
-      c = getopt_long (argc, argv, "VDAWCE:n:M:F:G:H:h:I:Ox:X:i:q:d:p:r:s:NP:v:Q:o:", long_options, &option_index);
+      c = getopt_long (argc, argv, "VDAWUCE:n:M:F:G:H:h:I:Ox:X:i:q:d:p:r:s:NP:v:Q:o:", long_options, &option_index);
 
       if (c == -1) break;	/* Exit from `while (1)' loop.  */
 
             goto failure;
         
           break;
+        case 'U':	/* Test dataset weights 2.  */
+        
+        
+          if (update_arg((void *)&(args_info->weight2_flag), 0, &(args_info->weight2_given),
+              &(local_args_info.weight2_given), optarg, 0, 0, ARG_FLAG,
+              check_ambiguity, override, 1, 0, "weight2", 'U',
+              additional_error))
+            goto failure;
+        
+          break;
         case 'C':	/* Compare two rankings (*.gscore files).  */
         
         

File tools/SeekReader/cmdline.h

   const char *dataset_help; /**< @brief Check which datasets contain query of interest, based on .gpres file help description.  */
   int weight_flag;	/**< @brief Test dataset weights (default=off).  */
   const char *weight_help; /**< @brief Test dataset weights help description.  */
+  int weight2_flag;	/**< @brief Test dataset weights 2 (default=off).  */
+  const char *weight2_help; /**< @brief Test dataset weights 2 help description.  */
   int comp_ranking_flag;	/**< @brief Compare two rankings (*.gscore files) (default=off).  */
   const char *comp_ranking_help; /**< @brief Compare two rankings (*.gscore files) help description.  */
   char * dweight_dir_arg;	/**< @brief Dataset weight directory (default='NA').  */
   unsigned int databaselet_given ;	/**< @brief Whether databaselet was given.  */
   unsigned int dataset_given ;	/**< @brief Whether dataset was given.  */
   unsigned int weight_given ;	/**< @brief Whether weight was given.  */
+  unsigned int weight2_given ;	/**< @brief Whether weight2 was given.  */
   unsigned int comp_ranking_given ;	/**< @brief Whether comp_ranking was given.  */
   unsigned int dweight_dir_given ;	/**< @brief Whether dweight_dir was given.  */
   unsigned int dweight_num_given ;	/**< @brief Whether dweight_num was given.  */