Commits

Qian Zhu committed 27cadb6

Fixed bug in DBCombiner with regard to splitting/joining option

Comments (0)

Files changed (13)

 	return true;
 }
 
-
-
-/* mainly used by SeekMinder */
+/* mainly used by SeekMiner */
 bool CDatabaselet::Get(size_t iOne, vector<unsigned char>& vecbData){
 	size_t iSize;
 	size_t i, j;
 				vecbData[ j * m_iDatasets + (2 * i) + 1 ] = bValue;
 			}
 		}
-
 	}
 	free(abImage);
 	return true;
 }
 
-
-
 bool CDatabaselet::Get( size_t iOne, size_t iTwo,
 		vector<unsigned char>& vecbData, unsigned char *charImage){
 	size_t offset = GetOffset(iOne, iTwo) - m_iHeader;
 
 	size_t bb = 0;
 	size_t sofar = 0;
+	fprintf(stderr, "Number of times: %d\n", numTimes); 
 	for(bb=0; bb<numTimes; sofar+=sizes[bb], bb++){
+		fprintf(stderr, "bb sizes[bb] sofar: %d %d %d\n", bb, sizes[bb], sofar); 
 
 		fprintf(stderr, "Started allocated memory %lu\n", bb);
 		/* load all Databaselets into memory, for efficiency */
 			size_t iGeneOne, iGeneTwo;
 			size_t offset1, offset2, offset3;
 
+			fprintf(stderr, "GetSizeGene() %d\n", DBS.GetSizeGene());
+			fprintf(stderr, "GetSizePair() %d\n", DBS.GetSizePair());
+			fprintf(stderr, "first->m_iGenes %d\n", first->m_iGenes);
 			if(first->m_useNibble==false){
 				for(iGeneOne = 0; iGeneOne < sizes[bb]; ++iGeneOne){
 					offset1 = DBS.GetSizeGene() * iGeneOne;
 							vector<unsigned char> vc;
 							CDatabaselet *current = vecDatabaselet[iDatum];
 							//size_t offset_c = current->GetSizeGene() * iGeneOne + current->GetSizePair() * iGeneTwo;
-							current->Get( offset1 + offset2, vc, charImages[iDatum]);
+							//current->Get( offset1 + offset2, vc, charImages[iDatum]);
 							//current->Get( iGeneOne, iGeneTwo, vc, charImages[iDatum]);
+							current->Get(current->GetSizeGene() * iGeneOne + current->GetSizePair() * iGeneTwo, vc, charImages[iDatum]);
 							offset3 = offset1 + offset2 + totalSum;
 							for(j=0; j<vc.size(); j++){
 								abImage[offset3 + j] = vc[j];
 						for( iDatum = 0; iDatum  < vecDatabaselet.size(); iDatum ++ ){
 							vector<unsigned char> vc;
 							CDatabaselet *current = vecDatabaselet[iDatum];
-							current->Get( offset1 + offset2, vc, charImages[iDatum]);
+							current->Get(current->GetSizeGene()*iGeneOne + current->GetSizePair()*iGeneTwo, vc, charImages[iDatum]);
+							//current->Get( offset1 + offset2, vc, charImages[iDatum]);
 							//current->Get( iGeneOne, iGeneTwo, vc, charImages[iDatum]);
 							offset3 = totalSum;
 							for(j=0; j<vc.size(); j++){
 	return true;
 }
 
+//For SeekMiner
 bool CDatabase::Open(const string &strDBDirectory,
 		const vector<string> &vecstrGenes, const size_t &iDatasets, const size_t &iNumDBs){
 	return CDatabase::Open(strDBDirectory.c_str(), vecstrGenes, iDatasets, iNumDBs);
 }
 
-
-bool CDatabase::Open(const char *db_dir,
-		const vector<string> &vecstrGenes, const size_t &iDatasets, const size_t &iNumDBs){
+//For SeekMiner
+bool CDatabase::Open(const char *db_dir, const vector<string> &vecstrGenes, 
+	const size_t &iDatasets, const size_t &iNumDBs){
 	size_t i, j, k;
 	Clear();
 	m_vecpDBs.resize(iNumDBs);
 	char acNumber[ 16 ];
 
-	for( i = 0; i < m_vecpDBs.size( ); ++i ) {
+	for( i = 0; i < m_vecpDBs.size( ); ++i )
 		m_vecpDBs[ i ] = new CDatabaselet( m_useNibble );
-	}
 
 	string strDBDirectory = db_dir;
 
 
 		return ( m_vecpDBs.empty( ) ? 0 : m_vecpDBs[ 0 ]->GetDatasets( ) ); }
 
-
+	//Used by SeekMiner and SeekServer
 	bool Open(const string &, const vector<string> &, const size_t &, const size_t &);
 	bool Open(const char *, const vector<string> &, const size_t &, const size_t &);
 
 	if (pMeasure->IsRank())
 		PCL.RankTransform();
 
+	g_CatSleipnir().info("Number of Experiments: %d", PCL.GetExperiments());
+
 	if ((iLimit != -1) && (PCL.GetGenes() > iLimit))
 		Dat.Open(PCL, pMeasure->Clone(), true);
 	else {
 	if (pMeasure->IsRank())
 		PCL.RankTransform();
 
+	g_CatSleipnir().info("Number of Experiments: %d", PCL.GetExperiments());
+
 	if ((iLimit != -1) && (PCL.GetGenes() > iLimit))
 		Dat.Open(PCL, pMeasure->Clone(), true);
 	else {

src/seekdataset.cpp

 	DeleteQuery();
 
 	if(iDBSize==0 || dbMap==NULL) return true;
-
 	//must require initializequeryBlock be executed first
 
 	queryMap = new CSeekIntIntMap(iNumGenes);

src/seekreader.cpp

 		return false;
 	}
 
-	size_t m;
-	size_t d;
+	size_t m, d;
 
 	for(i=0; i<allQ.size(); i++){
 		m = allQ[i];
-		for(d=0; d<DB.size(); d++){
+		for(d=0; d<DB.size(); d++){ //number of CDatabase collections
 			vector<unsigned char> Qi;
 			if(!DB[d]->GetGene(m, Qi)){
 				cerr << "Gene does not exist" << endl;
 
 	vc.clear();
 	vc.resize(iDatasets);
-
 	vp.clear();
 	vp.resize(vp_src.size());
-	for(i=0; i<vp.size(); i++){
+
+	for(i=0; i<vp.size(); i++)
 		vp[i].Copy(vp_src[i]);
-	}
+
 	int ret; //system call returns
 
 	fprintf(stderr, "Start reading average and presence files\n");
 				ret = fread((char*)(&val),1,sizeof(val),f);
 				tType first = id;
 				tType second = id2;
-				//mat looks like a full matrix
+				//mat is a full matrix
 				mat.Add(first, second, rbp_score[val]);
 				mat.Add(second, first, rbp_score[val]);
 			}
 
 		fprintf(stderr, "Begin normalization using row sum\n");
 		float rv;
+		#pragma omp parallel for \
+		shared(m, mat, allRGenes, vecSqrtSum) \
+		private(ii, i, j, rv) schedule(dynamic)
 		for(ii=0; ii<m.GetNumSet(); ii++){
 			i = (size_t) allRGenes[ii];
 			vector<CPair<float> >::iterator row_it;

tools/SeekIterative/SeekIterative.cpp

 bool get_score(vector<float> &gene_score, 
 	CSparseFlatMatrix<float> &mat,
 	CSeekIntIntMap *geneMap, vector<float> &q_weight){
-
 	vector<float> gene_count;
 	int numGenes = geneMap->GetSize();
 	CSeekTools::InitVector(gene_score, numGenes, (float)CMeta::GetNaN());
 		utype qq = allGenes[qi];
 		if(q_weight[qq]==0) 
 			continue;
-			
 		const vector<CPair<float> > &vc = mat.GetRow(qq);
 		for(kk=0; kk<vc.size(); kk++){
 			float fl = vc[kk].v;
 
 bool cv_weight(vector<utype> &query, CSparseFlatMatrix<float> &mat,
 	CSeekIntIntMap *geneMap, float rbp_p, float &tot_w){
-
 	//leave one in cross-validation
 	utype i, j;
 	int numGenes = geneMap->GetSize();
 		weight_fast(is_query, gene_score, geneMap, w);
 		tot_w += w;
 	}
-	tot_w /= query.size();	
+	tot_w /= query.size();
 	return true;	
 }
 
 	fprintf(stderr, "Reading queries\n");
 	if(!CSeekTools::ReadMultipleQueries(sArgs.query_arg, vecstrAllQuery))
 		return -1;
+	fprintf(stderr, "Finished reading queries\n");
 
 	vector<vector<utype> > qu;
 	qu.resize(vecstrAllQuery.size());
 	if(sArgs.combined_flag==1){
 		string dab_base = sArgs.dab_basename_arg;
 		string file1 = dab_dir + "/" + dab_base + ".dab";
-		float cutoff_par = sArgs.cutoff_arg;
-		string genome = sArgs.genome_arg;
-		vector<string> s1, s2;
-		CSeekTools::ReadListTwoColumns(genome.c_str(), s1, s2);
-
-		CGenome g;
-		g.Open(s1);
-		for(i=0; i<s2.size(); i++){
-			CGene &g1 = g.GetGene(g.FindGene(s1[i]));
-			g.AddSynonym(g1, s2[i]);
-		}
 
 		vector<vector<float> > q_weight;
 		vector<vector<vector<float> > > nq_weight;
 		}
 
 		fprintf(stderr, "Finished with search\n");
+		if(sArgs.print_distr_flag==0 && sArgs.generate_dot_flag==0){
+			return 0;
+		}
+
+		float cutoff_par = sArgs.cutoff_arg;
+		string genome = sArgs.genome_arg;
+		vector<string> s1, s2;
+		CSeekTools::ReadListTwoColumns(genome.c_str(), s1, s2);
+
+		CGenome g;
+		g.Open(s1);
+		for(i=0; i<s2.size(); i++){
+			CGene &g1 = g.GetGene(g.FindGene(s1[i]));
+			g.AddSynonym(g1, s2[i]);
+		}
+
 		//Visualize
 		for(j=0; j<vecstrAllQuery.size(); j++){
 			//fprintf(stderr, "Query %d\n", j);
 			CSeekTools::InitVector(freq[j], vecstrGenes.size(), (int) 0);
 			CSeekTools::InitVector(dweight[j], dab_list.size(), (float) 0);
 		}
-	
 		for(i=0; i<dab_list.size(); i++){
 			fprintf(stderr, "Reading %d: %s\n", i, dab_list[i].c_str());
 			CSeekIntIntMap d1(vecstrGenes.size());
 			CSparseFlatMatrix<float> sm (0);
 
 			if(sArgs.default_type_arg==0) //utype
-				CSeekWriter::ReadSeekSparseMatrix<utype>(dabfile.c_str(), sm, d1, max_rank, rbp_p, vecstrGenes);
+				CSeekWriter::ReadSeekSparseMatrix<utype>(dabfile.c_str(), sm, d1, 
+				max_rank, rbp_p, vecstrGenes);
 			else
-				CSeekWriter::ReadSeekSparseMatrix<unsigned short>(dabfile.c_str(), sm, d1, max_rank, rbp_p, vecstrGenes);
+				CSeekWriter::ReadSeekSparseMatrix<unsigned short>(dabfile.c_str(), 
+				sm, d1, max_rank, rbp_p, vecstrGenes);
 			
-			const vector<utype> &allGenes = d1.GetAllReverse();			
+			const vector<utype> &allGenes = d1.GetAllReverse();
+
+			#pragma omp parallel for \
+			shared(qu, sm, d1, dweight, final_score, count, freq, score_cutoff) \
+			private(j, k) firstprivate(bDatasetCutoff) schedule(dynamic)
 			for(j=0; j<vecstrAllQuery.size(); j++){
 				float dw = 1.0;
-				cv_weight(qu[j], sm, &d1, 0.99, dw);
+				cv_weight(qu[j], sm, &d1, rbp_p, dw);
 				if(bDatasetCutoff){
-					if(score_cutoff[i]>dw){
+					if(score_cutoff[i]>dw)
 						dw = 0;
-					}
 					//fprintf(stderr, "%.3e %.3e\n", score_cutoff[i], dw);
 				}
 				//fprintf(stderr, "%.3e\n", dw);

tools/SeekPrep/SeekPrep.cpp

 				CSeekWriter::ReadSeekSparseMatrix<tType>(dabfile.c_str(), sm, d1, 
 					MAX_RANK, rbp_p, vecstrGenes);
 				//NEW
-				CSeekWriter::RemoveDominant<tType>(sm, d1, vecstrGenes);
-				CSeekWriter::RemoveDominant<tType>(sm, d1, vecstrGenes);
+				//CSeekWriter::RemoveDominant<tType>(sm, d1, vecstrGenes);
+				//CSeekWriter::RemoveDominant<tType>(sm, d1, vecstrGenes);
 			}else if(norm_mode==Z_NORM){
 				CSeekWriter::ReadSeekSparseMatrix<tType>(dabfile.c_str(), sm, d1,
 					vecstrGenes, (int) (0.10*vecstrGenes.size()), exp);

tools/SeekReader/SeekReader.cpp

 		fprintf(stderr, "Done!\n");
 	}
 
+	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
+			vector<float> v1, v2;
+			sprintf(x, "%s/%d.gscore", sArgs.gscore_dir1_arg, i);
+			CSeekTools::ReadArray(x, v1);
+			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());
+			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;
+			CSeekTools::InitVector(presence, v1.size(), (char) 0);
+			for(j=0; j<500; j++){
+				presence[cp1[j].i]++;
+				presence[cp2[j].i]++;
+			}
+			int count = 0;
+			for(j=0; j<v1.size(); j++){
+				if(presence[j]==2){
+					count++;
+				}
+			}
+			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))

tools/SeekReader/SeekReader.ggo

 								flag	off
 option	"weight"			W	"Test dataset weights"
 								flag	off
+option	"comp_ranking"		C	"Compare two rankings (*.gscore files)"
+								flag	off
 
 section "Weight"
 option	"dweight_dir"		E	"Dataset weight directory"
 option	"dweight_test_num"	G	"Test number of .dweight files"
 								int	default="1000"
 
+section "Compare Rankings"
+option	"gscore_dir1"		H	"Gene score directory 1"
+								string typestr="directory" default="NA"	
+option	"gscore_dir2"		h	"Gene score directory 2"	
+								string typestr="directory" default="NA"	
+option	"gscore_num1"		I	"Number of .gscore files"
+								int default="1000"
+
+
 section "Main"
 option	"order_stat_single_gene_query"		O	"Order statistics mode (single-gene query)"
 								flag	off

tools/SeekReader/cmdline.c

 const char *gengetopt_args_info_description = "";
 
 const char *gengetopt_args_info_help[] = {
-  "  -h, --help                    Print help and exit",
+  "      --help                    Print help and exit",
   "  -V, --version                 Print version and exit",
   "\nDiagnosis:",
   "  -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)",
+  "  -C, --comp_ranking            Compare two rankings (*.gscore files)  \n                                  (default=off)",
   "\nWeight:",
   "  -E, --dweight_dir=directory   Dataset weight directory  (default=`NA')",
   "  -n, --dweight_num=INT         Number of .dweight files  (default=`1000')",
   "  -M, --dweight_map=filename    Dataset mapping file  (default=`NA')",
   "  -F, --dweight_test_dir=directory\n                                Test dataset weight directory  (default=`NA')",
   "  -G, --dweight_test_num=INT    Test number of .dweight files  (default=`1000')",
+  "\nCompare Rankings:",
+  "  -H, --gscore_dir1=directory   Gene score directory 1  (default=`NA')",
+  "  -h, --gscore_dir2=directory   Gene score directory 2  (default=`NA')",
+  "  -I, --gscore_num1=INT         Number of .gscore files  (default=`1000')",
   "\nMain:",
   "  -O, --order_stat_single_gene_query\n                                Order statistics mode (single-gene query)  \n                                  (default=off)",
   "  -x, --db=filename             Input dataset-platform definition",
   args_info->databaselet_given = 0 ;
   args_info->dataset_given = 0 ;
   args_info->weight_given = 0 ;
+  args_info->comp_ranking_given = 0 ;
   args_info->dweight_dir_given = 0 ;
   args_info->dweight_num_given = 0 ;
   args_info->dweight_map_given = 0 ;
   args_info->dweight_test_dir_given = 0 ;
   args_info->dweight_test_num_given = 0 ;
+  args_info->gscore_dir1_given = 0 ;
+  args_info->gscore_dir2_given = 0 ;
+  args_info->gscore_num1_given = 0 ;
   args_info->order_stat_single_gene_query_given = 0 ;
   args_info->db_given = 0 ;
   args_info->dset_list_given = 0 ;
   args_info->databaselet_flag = 0;
   args_info->dataset_flag = 0;
   args_info->weight_flag = 0;
+  args_info->comp_ranking_flag = 0;
   args_info->dweight_dir_arg = gengetopt_strdup ("NA");
   args_info->dweight_dir_orig = NULL;
   args_info->dweight_num_arg = 1000;
   args_info->dweight_test_dir_orig = NULL;
   args_info->dweight_test_num_arg = 1000;
   args_info->dweight_test_num_orig = NULL;
+  args_info->gscore_dir1_arg = gengetopt_strdup ("NA");
+  args_info->gscore_dir1_orig = NULL;
+  args_info->gscore_dir2_arg = gengetopt_strdup ("NA");
+  args_info->gscore_dir2_orig = NULL;
+  args_info->gscore_num1_arg = 1000;
+  args_info->gscore_num1_orig = NULL;
   args_info->order_stat_single_gene_query_flag = 0;
   args_info->db_arg = NULL;
   args_info->db_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->dweight_dir_help = gengetopt_args_info_help[7] ;
-  args_info->dweight_num_help = gengetopt_args_info_help[8] ;
-  args_info->dweight_map_help = gengetopt_args_info_help[9] ;
-  args_info->dweight_test_dir_help = gengetopt_args_info_help[10] ;
-  args_info->dweight_test_num_help = gengetopt_args_info_help[11] ;
-  args_info->order_stat_single_gene_query_help = gengetopt_args_info_help[13] ;
-  args_info->db_help = gengetopt_args_info_help[14] ;
-  args_info->dset_list_help = gengetopt_args_info_help[15] ;
-  args_info->input_help = gengetopt_args_info_help[16] ;
-  args_info->single_query_help = gengetopt_args_info_help[17] ;
-  args_info->dir_in_help = gengetopt_args_info_help[18] ;
-  args_info->dir_prep_in_help = gengetopt_args_info_help[19] ;
-  args_info->dir_gvar_in_help = gengetopt_args_info_help[20] ;
-  args_info->dir_sinfo_in_help = gengetopt_args_info_help[21] ;
-  args_info->is_nibble_help = gengetopt_args_info_help[22] ;
-  args_info->platform_dir_help = gengetopt_args_info_help[23] ;
-  args_info->gvar_cutoff_help = gengetopt_args_info_help[24] ;
-  args_info->multi_query_help = gengetopt_args_info_help[25] ;
-  args_info->output_file_help = gengetopt_args_info_help[26] ;
+  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] ;
   
 }
 
   free_string_field (&(args_info->dweight_test_dir_arg));
   free_string_field (&(args_info->dweight_test_dir_orig));
   free_string_field (&(args_info->dweight_test_num_orig));
+  free_string_field (&(args_info->gscore_dir1_arg));
+  free_string_field (&(args_info->gscore_dir1_orig));
+  free_string_field (&(args_info->gscore_dir2_arg));
+  free_string_field (&(args_info->gscore_dir2_orig));
+  free_string_field (&(args_info->gscore_num1_orig));
   free_string_field (&(args_info->db_arg));
   free_string_field (&(args_info->db_orig));
   free_string_field (&(args_info->dset_list_arg));
     write_into_file(outfile, "dataset", 0, 0 );
   if (args_info->weight_given)
     write_into_file(outfile, "weight", 0, 0 );
+  if (args_info->comp_ranking_given)
+    write_into_file(outfile, "comp_ranking", 0, 0 );
   if (args_info->dweight_dir_given)
     write_into_file(outfile, "dweight_dir", args_info->dweight_dir_orig, 0);
   if (args_info->dweight_num_given)
     write_into_file(outfile, "dweight_test_dir", args_info->dweight_test_dir_orig, 0);
   if (args_info->dweight_test_num_given)
     write_into_file(outfile, "dweight_test_num", args_info->dweight_test_num_orig, 0);
+  if (args_info->gscore_dir1_given)
+    write_into_file(outfile, "gscore_dir1", args_info->gscore_dir1_orig, 0);
+  if (args_info->gscore_dir2_given)
+    write_into_file(outfile, "gscore_dir2", args_info->gscore_dir2_orig, 0);
+  if (args_info->gscore_num1_given)
+    write_into_file(outfile, "gscore_num1", args_info->gscore_num1_orig, 0);
   if (args_info->order_stat_single_gene_query_given)
     write_into_file(outfile, "order_stat_single_gene_query", 0, 0 );
   if (args_info->db_given)
       int option_index = 0;
 
       static struct option long_options[] = {
-        { "help",	0, NULL, 'h' },
+        { "help",	0, NULL, 0 },
         { "version",	0, NULL, 'V' },
         { "databaselet",	0, NULL, 'D' },
         { "dataset",	0, NULL, 'A' },
         { "weight",	0, NULL, 'W' },
+        { "comp_ranking",	0, NULL, 'C' },
         { "dweight_dir",	1, NULL, 'E' },
         { "dweight_num",	1, NULL, 'n' },
         { "dweight_map",	1, NULL, 'M' },
         { "dweight_test_dir",	1, NULL, 'F' },
         { "dweight_test_num",	1, NULL, 'G' },
+        { "gscore_dir1",	1, NULL, 'H' },
+        { "gscore_dir2",	1, NULL, 'h' },
+        { "gscore_num1",	1, NULL, 'I' },
         { "order_stat_single_gene_query",	0, NULL, 'O' },
         { "db",	1, NULL, 'x' },
         { "dset_list",	1, NULL, 'X' },
         { NULL,	0, NULL, 0 }
       };
 
-      c = getopt_long (argc, argv, "hVDAWE:n:M:F:G:Ox:X:i:q:d:p:r:s:NP:v:Q:o:", long_options, &option_index);
+      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);
 
       if (c == -1) break;	/* Exit from `while (1)' loop.  */
 
       switch (c)
         {
-        case 'h':	/* Print help and exit.  */
-          cmdline_parser_print_help ();
-          cmdline_parser_free (&local_args_info);
-          exit (EXIT_SUCCESS);
-
         case 'V':	/* Print version and exit.  */
         
         
             goto failure;
         
           break;
+        case 'C':	/* Compare two rankings (*.gscore files).  */
+        
+        
+          if (update_arg((void *)&(args_info->comp_ranking_flag), 0, &(args_info->comp_ranking_given),
+              &(local_args_info.comp_ranking_given), optarg, 0, 0, ARG_FLAG,
+              check_ambiguity, override, 1, 0, "comp_ranking", 'C',
+              additional_error))
+            goto failure;
+        
+          break;
         case 'E':	/* Dataset weight directory.  */
         
         
             goto failure;
         
           break;
+        case 'H':	/* Gene score directory 1.  */
+        
+        
+          if (update_arg( (void *)&(args_info->gscore_dir1_arg), 
+               &(args_info->gscore_dir1_orig), &(args_info->gscore_dir1_given),
+              &(local_args_info.gscore_dir1_given), optarg, 0, "NA", ARG_STRING,
+              check_ambiguity, override, 0, 0,
+              "gscore_dir1", 'H',
+              additional_error))
+            goto failure;
+        
+          break;
+        case 'h':	/* Gene score directory 2.  */
+        
+        
+          if (update_arg( (void *)&(args_info->gscore_dir2_arg), 
+               &(args_info->gscore_dir2_orig), &(args_info->gscore_dir2_given),
+              &(local_args_info.gscore_dir2_given), optarg, 0, "NA", ARG_STRING,
+              check_ambiguity, override, 0, 0,
+              "gscore_dir2", 'h',
+              additional_error))
+            goto failure;
+        
+          break;
+        case 'I':	/* Number of .gscore files.  */
+        
+        
+          if (update_arg( (void *)&(args_info->gscore_num1_arg), 
+               &(args_info->gscore_num1_orig), &(args_info->gscore_num1_given),
+              &(local_args_info.gscore_num1_given), optarg, 0, "1000", ARG_INT,
+              check_ambiguity, override, 0, 0,
+              "gscore_num1", 'I',
+              additional_error))
+            goto failure;
+        
+          break;
         case 'O':	/* Order statistics mode (single-gene query).  */
         
         
           break;
 
         case 0:	/* Long option with no short option */
+          if (strcmp (long_options[option_index].name, "help") == 0) {
+            cmdline_parser_print_help ();
+            cmdline_parser_free (&local_args_info);
+            exit (EXIT_SUCCESS);
+          }
+
         case '?':	/* Invalid option.  */
           /* `getopt_long' already printed an error message.  */
           goto failure;

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 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').  */
   char * dweight_dir_orig;	/**< @brief Dataset weight directory original value given at command line.  */
   const char *dweight_dir_help; /**< @brief Dataset weight directory help description.  */
   int dweight_test_num_arg;	/**< @brief Test number of .dweight files (default='1000').  */
   char * dweight_test_num_orig;	/**< @brief Test number of .dweight files original value given at command line.  */
   const char *dweight_test_num_help; /**< @brief Test number of .dweight files help description.  */
+  char * gscore_dir1_arg;	/**< @brief Gene score directory 1 (default='NA').  */
+  char * gscore_dir1_orig;	/**< @brief Gene score directory 1 original value given at command line.  */
+  const char *gscore_dir1_help; /**< @brief Gene score directory 1 help description.  */
+  char * gscore_dir2_arg;	/**< @brief Gene score directory 2 (default='NA').  */
+  char * gscore_dir2_orig;	/**< @brief Gene score directory 2 original value given at command line.  */
+  const char *gscore_dir2_help; /**< @brief Gene score directory 2 help description.  */
+  int gscore_num1_arg;	/**< @brief Number of .gscore files (default='1000').  */
+  char * gscore_num1_orig;	/**< @brief Number of .gscore files original value given at command line.  */
+  const char *gscore_num1_help; /**< @brief Number of .gscore files help description.  */
   int order_stat_single_gene_query_flag;	/**< @brief Order statistics mode (single-gene query) (default=off).  */
   const char *order_stat_single_gene_query_help; /**< @brief Order statistics mode (single-gene query) help description.  */
   char * db_arg;	/**< @brief Input dataset-platform definition.  */
   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 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.  */
   unsigned int dweight_map_given ;	/**< @brief Whether dweight_map was given.  */
   unsigned int dweight_test_dir_given ;	/**< @brief Whether dweight_test_dir was given.  */
   unsigned int dweight_test_num_given ;	/**< @brief Whether dweight_test_num was given.  */
+  unsigned int gscore_dir1_given ;	/**< @brief Whether gscore_dir1 was given.  */
+  unsigned int gscore_dir2_given ;	/**< @brief Whether gscore_dir2 was given.  */
+  unsigned int gscore_num1_given ;	/**< @brief Whether gscore_num1 was given.  */
   unsigned int order_stat_single_gene_query_given ;	/**< @brief Whether order_stat_single_gene_query was given.  */
   unsigned int db_given ;	/**< @brief Whether db was given.  */
   unsigned int dset_list_given ;	/**< @brief Whether dset_list was given.  */

tools/SeekReader/stdafx.h

 #include "seekbasic.h"
 #include "seekmap.h"
 #include "seekreader.h"
+#include "sparsematrix.h"
 #include "meta.h"
 using namespace Sleipnir;
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.