Commits

Aaron Wong  committed 230b790

Add option to input dataset name / bin count file

  • Participants
  • Parent commits f357551

Comments (0)

Files changed (5)

File tools/BNServer/BNServer.cpp

 #include "BNServer.h"
 #include "dot.h"
 
+typedef CFullMatrix<size_t> CCountMatrix;
+
 static const char				c_szXDSL[]						= ".xdsl";
 static const char				c_szDSL[]						= ".dsl";
 static const char				c_szDOT[]						= ".dot";
 	{&CBNServer::ProcessInference, &CBNServer::ProcessData, &CBNServer::ProcessGraph,
 	&CBNServer::ProcessContexts, &CBNServer::ProcessTermFinder, &CBNServer::ProcessDiseases,
 	&CBNServer::ProcessGenes, &CBNServer::ProcessAssociation, &CBNServer::ProcessAssociations,
-	&CBNServer::ProcessInferenceOTF, &CBNServer::ProcessEdges};
+	&CBNServer::ProcessInferenceOTF, &CBNServer::ProcessEdges, &CBNServer::ProcessLearning};
 
 struct SPixie {
 	size_t	m_iNode;
 };
 
 int main( int iArgs, char** aszArgs ) {
+	static const size_t	c_iBuffer	= 1024;
+	char				acBuffer[ c_iBuffer ];
 	gengetopt_args_info			sArgs;
 	CServer						Server;
 	CBayesNetSmile				BNSmile;
 	ifstream					ifsm, ifsmGenes;
-	vector<string>				vecstrLine;
+	vector<string>				vecstrLine, vecstrDatasets;
 	size_t						i, j, k;
 	uint32_t					iSize;
 	ofstream					ofsm;
 	CDataMatrix					MatBackgrounds, MatParameters, MatWithinC, MatWithinD;
 	CDataMatrix					MatBetweenCC, MatBetweenDD, MatBetweenDC;
 	vector<vector<size_t> >		vecveciDiseases, vecveciContexts;
-	vector<size_t>				veciDiseases, veciContexts;
+	vector<size_t>				veciDiseases, veciContexts, veciBins;
 	CGenome						Genome;
 	const IOntology*			apOntologies[]	= {&GOBP, &GOMF, &GOCC, &KEGG, NULL };
 
 	iRet = cmdline_parser2( iArgs, aszArgs, &sArgs, 0, 1, 0 );
 	CDatabase Database(sArgs.is_nibble_flag);
+	CDatabase Answers(sArgs.is_nibble_flag);
 
 	if( sArgs.config_arg )
 		iRet = cmdline_parser_configfile( sArgs.config_arg, &sArgs, 0, 0, 1 ) && iRet;
 	if( !Database.Open( sArgs.database_arg ) ) {
 		cerr << "Could not open: " << sArgs.database_arg << endl;
 		return 1; }
+
+
+	if(sArgs.datasets_arg){
+		ifsm.clear( );
+		ifsm.open(sArgs.datasets_arg);
+		while(!ifsm.eof()){
+			ifsm.getline(acBuffer, c_iBuffer -1);
+			if(acBuffer[0]==0)
+				break;
+			acBuffer[c_iBuffer-1] = 0;
+
+            		vector<string> tok;
+            		CMeta::Tokenize(acBuffer, tok, " \t");
+			vecstrDatasets.push_back(tok[0]);
+			veciBins.push_back(atoi(tok[1].c_str()));
+		}
+		ifsm.close();
+	}
+
 // Open Bayes networks
 	if( sArgs.minimal_in_flag ) {
 		cerr << "Loading minimal Bayesian classifiers..." << endl;
 		veciDiseases.resize( setiContexts.size( ) );
 		copy( setiContexts.begin( ), setiContexts.end( ), veciDiseases.begin( ) );
 	}
+// Open global gold standard
+	if( sArgs.global_standard_given ) {
+	   if( !Answers.Open( sArgs.global_standard_arg) ) {
+		cerr << "Could not open: " << sArgs.global_standard_arg << endl;
+		return 1; }
+	}
+
+
 // Open gene backgrounds
 	cerr << "Loading gene backgrounds..." << endl;
 	if( sArgs.backgrounds_arg && !MatBackgrounds.Open( sArgs.backgrounds_arg ) ) {
 		apOntologies,
 		BNDefault,
 		Database,
+		Answers,
 		Genome,
 		sArgs.limit_arg,
 		MatBackgrounds,
 		sArgs.graphviz_arg,
 		vecBNs,
 		vecdPriors,
+		veciBins,
 		veciContexts,
 		veciDiseases,
 		vecveciContexts,
 	return ( iOffset - iStart );
 }
 
+
+size_t CBNServer::ProcessLearning( const vector<unsigned char>& vecbMessage, size_t iOffset ) {
+	size_t		i, j, k, iStart, iAnswer, iVal, iCount, iDatasets;
+	uint32_t	iGene, iGenes, iChunk, iSize, iGeneOffset, iGeneOne, iGeneTwo;
+	unsigned char	c;
+	float	logratio;
+	vector<unsigned char> vecbData;
+	vector<size_t> veciGenes;
+	vector<bool> vecfGenes, vecfUbik;
+	vector<CCountMatrix*> vecpMatCounts; 
+	CCountMatrix matRoot;
+	vector<CFullMatrix<float>*> vecpMatProbs, vecpMatRatios;
+
+	iStart = iOffset;
+	iDatasets = GetDatabase().GetDatasets();
+
+	// Initialize matrices
+	matRoot.Initialize( 2, 1 );
+	matRoot.Clear();
+	vecpMatCounts.resize(iDatasets);
+	vecpMatProbs.resize(iDatasets);
+	vecpMatRatios.resize(iDatasets);
+	for ( i = 0; i < GetDatabase().GetDatasets(); i++ ) {
+	    vecpMatCounts[i] = new CCountMatrix();
+	    vecpMatCounts[i]->Initialize( GetBins()[i], 2 );
+	    vecpMatCounts[i]->Clear();
+
+	    vecpMatProbs[i] = new CFullMatrix<float>();
+	    vecpMatProbs[i]->Initialize( GetBins()[i], 2 );
+	    vecpMatProbs[i]->Clear();
+
+	    vecpMatRatios[i] = new CFullMatrix<float>();
+	    vecpMatRatios[i]->Initialize( 1, GetBins()[i] );
+	    vecpMatRatios[i]->Clear();
+	}
+
+	// Load context gene membership
+	vecfGenes.resize(GetAnswers().GetGenes());
+
+	// Load gene id pairs
+	for ( j = 0; iOffset < vecbMessage.size(); j++, iOffset += sizeof(iGene) ) {
+	    iGene = *(uint32_t*)&vecbMessage[ iOffset ];
+	    veciGenes.push_back(iGene-1);
+	    vecfGenes[iGene-1] = true;
+	}
+
+	for ( i = 0; i < veciGenes.size(); i++ ) {
+	    iGeneOne = veciGenes[i];
+
+	    for ( j = 0; j < GetAnswers().GetGenes(); j++ ) {
+		iGeneTwo = j;
+		
+		if ( vecfGenes[iGeneTwo] && iGeneTwo < iGeneOne )
+		    continue;
+
+		vecbData.clear();
+		GetAnswers().Get(iGeneOne, iGeneTwo, vecbData);
+
+		iAnswer = vecbData[0];
+		if ( ( iAnswer &= 0xF ) == 0xF )  
+		    continue; // Missing value
+
+		if ( CMeta::SkipEdge( iAnswer, iGeneOne, iGeneTwo, vecfGenes, vecfUbik, true, true, false, true, false, false) )
+		    continue;
+
+		matRoot.Get( iAnswer, 0 )++;
+
+		vecbData.clear();
+		GetDatabase().Get(iGeneOne, iGeneTwo, vecbData);
+		for( k = 0; k < GetDatabase().GetDatasets(); ++k ) {
+		    c = vecbData[ ( k / 2 ) ];
+		    if( k % 2 )
+		        c >>= 4;
+		    if( ( c &= 0xF ) == 0xF ) // Skip missing data
+		        continue;
+		    vecpMatCounts[k]->Get( (size_t)c, iAnswer )++;
+		}
+	    }
+	}
+
+	// Convert counts to probabilities
+	uint32_t iTotal, iBinTotal = 0;
+	for ( i = 0; i < vecpMatCounts.size(); i++ ) {
+	    for ( j = 0; j < vecpMatCounts[i]->GetColumns(); j++ ) {
+		iTotal = 0;
+		for( iVal = 0; iVal < vecpMatCounts[i]->GetRows(); ++iVal ) {
+		   iTotal += vecpMatCounts[i]->Get( iVal, j ); 
+		}	
+		for( iVal = 0; iVal < vecpMatCounts[i]->GetRows(); ++iVal ) {
+		    iCount = vecpMatCounts[i]->Get( iVal, j );
+		    vecpMatProbs[i]->Set( iVal, j, ((float)(iCount+1))/(iTotal+vecpMatCounts[i]->GetRows())); 
+		}	
+	    } 
+	    for( iVal = 0; iVal < vecpMatProbs[i]->GetRows(); ++iVal ) {
+	    	logratio = log( vecpMatProbs[i]->Get( iVal, 0 ) / vecpMatProbs[i]->Get( iVal, 1 ) );
+	    	vecpMatRatios[i]->Set( 0, iVal, logratio ); 
+	    }	
+	    iBinTotal += vecpMatCounts[i]->GetRows();
+	}
+/*
+	for ( i = 0; i < 5; i++ ) {
+	    cerr << "d: " << i << endl;
+	    for ( j = 0; j < vecpMatProbs[i]->GetColumns(); j++ ) {
+		for( iVal = 0; iVal < vecpMatProbs[i]->GetRows(); ++iVal ) {
+		    cerr << ( iVal ? "\t" : "" ) << vecpMatProbs[i]->Get( iVal, j );
+		}	
+		cerr << endl;
+	    } 
+	    for( iVal = 0; iVal < vecpMatRatios[i]->GetColumns(); ++iVal ) {
+	        cerr << ( iVal ? "\t" : "" ) << vecpMatRatios[i]->Get( 0, iVal );
+	    }	
+	    cerr << endl;
+	}
+*/
+	// Send results back
+	iSize = (uint32_t)( (iBinTotal + 1 + iDatasets) * sizeof(float) ); // [# datasets][[# bin in d0][bin0]*]*
+	send( m_iSocket, (char*)&iSize, sizeof(iSize), 0 );
+
+	send( m_iSocket, (char*)&iDatasets, sizeof(iDatasets), 0 );
+	for ( i = 0; i < iDatasets; i++ ) {
+	    iTotal =  vecpMatRatios[i]->GetColumns();
+	    send( m_iSocket, (char*)&iTotal, sizeof(iTotal), 0 );
+	    send( m_iSocket, (char*)(vecpMatRatios[i]->Get(0)), sizeof(float)*iTotal, 0);
+	}
+
+	return ( iOffset - iStart );
+}
+
 float CBNServer::Evaluate( const vector<vector<float> >& binEffects, vector<unsigned char>& vecbDatum, size_t iOffset ) {
 
 	unsigned char	c;

File tools/BNServer/BNServer.ggo

 							string	typestr="filename"
 option	"is_nibble"		N	"Specify whether the database is nibble type"
 							flag	on
+option	"global_standard"	S	"Global gold standard dab file"
+							string	typestr="filename"
+option	"datasets"		I	"File dataset names and number of bins"
+							string	typestr="filename"
 
 section "Bayes nets"
 option	"networks"		n	"Bayes net directory"

File tools/BNServer/BNServer.h

 	const IOntology**				m_apOntologies;
 	const CBayesNetMinimal&			m_BNDefault;
 	const CDatabase&				m_Database;
+	const CDatabase&				m_Answers;
 	const CGenome&					m_Genome;
 	size_t							m_iLimit;
 	const CDataMatrix&				m_MatBackgrounds;
 	const vector<float>&			m_vecdPriors;
 	const vector<size_t>&			m_veciContexts;
 	const vector<size_t>&			m_veciDiseases;
+	const vector<size_t>&			m_veciBins;
 	const vector<vector<size_t> >&	m_vecveciContexts;
 	const vector<vector<size_t> >&	m_vecveciDiseases;
 
 		const IOntology**				apOntologies,
 		const CBayesNetMinimal&			BNDefault,
 		const CDatabase&				Database,
+		const CDatabase&				Answers,
 		const CGenome&					Genome,
 		size_t							iLimit,
 		const CDataMatrix&				MatBackgrounds,
 		const string&					strGraphviz,
 		const vector<CBayesNetMinimal>&	vecBNs,
 		const vector<float>&			vecdPriors,
+		const vector<size_t>&			veciBins,
 		const vector<size_t>&			veciContexts,
 		const vector<size_t>&			veciDiseases,
 		const vector<vector<size_t> >&	vecveciContexts,
 		m_apOntologies		(apOntologies),
 		m_BNDefault			(BNDefault),
 		m_Database			(Database),
+		m_Answers			(Answers),
 		m_Genome			(Genome),
 		m_iLimit			(iLimit),
 		m_MatBackgrounds	(MatBackgrounds),
 		m_strGraphviz		(strGraphviz),
 		m_vecBNs			(vecBNs),
 		m_vecdPriors		(vecdPriors),
+		m_veciBins		(veciBins),
 		m_veciContexts		(veciContexts),
 		m_veciDiseases		(veciDiseases),
 		m_vecveciContexts	(vecveciContexts),
 	size_t ProcessInference( const std::vector<unsigned char>&, size_t );
 	size_t ProcessCPT( const std::vector<unsigned char>&, size_t, vector<vector<float> >& );
 	size_t ProcessInferenceOTF( const std::vector<unsigned char>&, size_t );
+	size_t ProcessLearning( const std::vector<unsigned char>&, size_t );
 	size_t ProcessEdges( const std::vector<unsigned char>&, size_t );
 	size_t ProcessData( const std::vector<unsigned char>&, size_t );
 	size_t ProcessGraph( const std::vector<unsigned char>&, size_t );
 
 		return m_sData.m_Database; }
 
+	const CDatabase& GetAnswers( ) const {
+
+		return m_sData.m_Answers; }
+
 	const string& GetFiles( ) const {
 
 		return m_sData.m_strFiles; }
 
 		return m_sData.m_veciDiseases; }
 
+	const vector<size_t>& GetBins( ) const {
+
+		return m_sData.m_veciBins; }
+
+
 	const vector<vector<size_t> >& GetGeneSets( unsigned char bDiseases ) const {
 
 		return ( bDiseases ? m_sData.m_vecveciDiseases : m_sData.m_vecveciContexts ); }

File tools/BNServer/cmdline.c

 /*
-  File autogenerated by gengetopt version 2.22.5
+  File autogenerated by gengetopt version 2.22.6
   generated with the following command:
   /usr/bin/gengetopt -iBNServer.ggo --default-optional -C -N -e 
 
 
 const char *gengetopt_args_info_usage = "Usage: BNServer [OPTIONS]...";
 
+const char *gengetopt_args_info_versiontext = "";
+
 const char *gengetopt_args_info_description = "";
 
 const char *gengetopt_args_info_help[] = {
   "  -i, --input=filename          Context IDs and names",
   "  -c, --contexts=filename       Context/gene mapping",
   "  -s, --diseases=filename       Disease/gene mapping",
-  "  -N, --is_nibble               Specify whether the database is nibble type  \n                                  (default=on)",
+  "  -N, --is_nibble               Specify whether the database is nibble type\n                                  (default=on)",
+  "  -S, --global_standard=filename\n                                Global gold standard dab file",
+  "  -I, --datasets=filename       File dataset names and number of bins",
   "\nBayes nets:",
   "  -n, --networks=directory      Bayes net directory  (default=`.')",
   "  -b, --default=filename        Bayes net for no context",
   "  -x, --xdsl                    Use XDSL files instead of DSL  (default=on)",
-  "  -m, --minimal_in              Read stored contexts and minimal Bayes nets  \n                                  (default=off)",
+  "  -m, --minimal_in              Read stored contexts and minimal Bayes nets\n                                  (default=off)",
   "  -M, --minimal_out=filename    Store contexts and minimal Bayes nets",
   "\nP-values:",
   "  -P, --global=filename         Parameter file for global context p-values",
   "  -t, --timeout=INT             Server timeout  (default=`100')",
   "\nPrecalculation:",
   "  -l, --networklets             Generate mini-network icons  (default=off)",
-  "  -r, --assoc_diseases=filename Disease names to generate disease/process \n                                  associations",
-  "  -R, --assoc_context=INT       Context in which associations are computed  \n                                  (default=`0')",
+  "  -r, --assoc_diseases=filename Disease names to generate disease/process\n                                  associations",
+  "  -R, --assoc_context=INT       Context in which associations are computed\n                                  (default=`0')",
   "\nOptional:",
-  "  -L, --limit=INT               Maximum genes to process per set  \n                                  (default=`500')",
+  "  -L, --limit=INT               Maximum genes to process per set\n                                  (default=`500')",
   "  -f, --files=directory         File directory  (default=`.')",
   "  -z, --graphviz=filename       Graphviz executable path  (default=`fdp')",
-  "  -C, --config=filename         Command line config file  \n                                  (default=`BNServer.ini')",
+  "  -C, --config=filename         Command line config file\n                                  (default=`BNServer.ini')",
   "  -v, --verbosity=INT           Message verbosity  (default=`5')",
     0
 };
   args_info->contexts_given = 0 ;
   args_info->diseases_given = 0 ;
   args_info->is_nibble_given = 0 ;
+  args_info->global_standard_given = 0 ;
+  args_info->datasets_given = 0 ;
   args_info->networks_given = 0 ;
   args_info->default_given = 0 ;
   args_info->xdsl_given = 0 ;
   args_info->diseases_arg = NULL;
   args_info->diseases_orig = NULL;
   args_info->is_nibble_flag = 1;
+  args_info->global_standard_arg = NULL;
+  args_info->global_standard_orig = NULL;
+  args_info->datasets_arg = NULL;
+  args_info->datasets_orig = NULL;
   args_info->networks_arg = gengetopt_strdup (".");
   args_info->networks_orig = NULL;
   args_info->default_arg = NULL;
   args_info->contexts_help = gengetopt_args_info_help[5] ;
   args_info->diseases_help = gengetopt_args_info_help[6] ;
   args_info->is_nibble_help = gengetopt_args_info_help[7] ;
-  args_info->networks_help = gengetopt_args_info_help[9] ;
-  args_info->default_help = gengetopt_args_info_help[10] ;
-  args_info->xdsl_help = gengetopt_args_info_help[11] ;
-  args_info->minimal_in_help = gengetopt_args_info_help[12] ;
-  args_info->minimal_out_help = gengetopt_args_info_help[13] ;
-  args_info->global_help = gengetopt_args_info_help[15] ;
-  args_info->within_c_help = gengetopt_args_info_help[16] ;
-  args_info->within_d_help = gengetopt_args_info_help[17] ;
-  args_info->between_cc_help = gengetopt_args_info_help[18] ;
-  args_info->between_dd_help = gengetopt_args_info_help[19] ;
-  args_info->between_dc_help = gengetopt_args_info_help[20] ;
-  args_info->backgrounds_help = gengetopt_args_info_help[21] ;
-  args_info->go_onto_help = gengetopt_args_info_help[23] ;
-  args_info->go_anno_help = gengetopt_args_info_help[24] ;
-  args_info->kegg_help = gengetopt_args_info_help[25] ;
-  args_info->kegg_org_help = gengetopt_args_info_help[26] ;
-  args_info->port_help = gengetopt_args_info_help[28] ;
-  args_info->timeout_help = gengetopt_args_info_help[29] ;
-  args_info->networklets_help = gengetopt_args_info_help[31] ;
-  args_info->assoc_diseases_help = gengetopt_args_info_help[32] ;
-  args_info->assoc_context_help = gengetopt_args_info_help[33] ;
-  args_info->limit_help = gengetopt_args_info_help[35] ;
-  args_info->files_help = gengetopt_args_info_help[36] ;
-  args_info->graphviz_help = gengetopt_args_info_help[37] ;
-  args_info->config_help = gengetopt_args_info_help[38] ;
-  args_info->verbosity_help = gengetopt_args_info_help[39] ;
+  args_info->global_standard_help = gengetopt_args_info_help[8] ;
+  args_info->datasets_help = gengetopt_args_info_help[9] ;
+  args_info->networks_help = gengetopt_args_info_help[11] ;
+  args_info->default_help = gengetopt_args_info_help[12] ;
+  args_info->xdsl_help = gengetopt_args_info_help[13] ;
+  args_info->minimal_in_help = gengetopt_args_info_help[14] ;
+  args_info->minimal_out_help = gengetopt_args_info_help[15] ;
+  args_info->global_help = gengetopt_args_info_help[17] ;
+  args_info->within_c_help = gengetopt_args_info_help[18] ;
+  args_info->within_d_help = gengetopt_args_info_help[19] ;
+  args_info->between_cc_help = gengetopt_args_info_help[20] ;
+  args_info->between_dd_help = gengetopt_args_info_help[21] ;
+  args_info->between_dc_help = gengetopt_args_info_help[22] ;
+  args_info->backgrounds_help = gengetopt_args_info_help[23] ;
+  args_info->go_onto_help = gengetopt_args_info_help[25] ;
+  args_info->go_anno_help = gengetopt_args_info_help[26] ;
+  args_info->kegg_help = gengetopt_args_info_help[27] ;
+  args_info->kegg_org_help = gengetopt_args_info_help[28] ;
+  args_info->port_help = gengetopt_args_info_help[30] ;
+  args_info->timeout_help = gengetopt_args_info_help[31] ;
+  args_info->networklets_help = gengetopt_args_info_help[33] ;
+  args_info->assoc_diseases_help = gengetopt_args_info_help[34] ;
+  args_info->assoc_context_help = gengetopt_args_info_help[35] ;
+  args_info->limit_help = gengetopt_args_info_help[37] ;
+  args_info->files_help = gengetopt_args_info_help[38] ;
+  args_info->graphviz_help = gengetopt_args_info_help[39] ;
+  args_info->config_help = gengetopt_args_info_help[40] ;
+  args_info->verbosity_help = gengetopt_args_info_help[41] ;
   
 }
 
   printf ("%s %s\n",
      (strlen(CMDLINE_PARSER_PACKAGE_NAME) ? CMDLINE_PARSER_PACKAGE_NAME : CMDLINE_PARSER_PACKAGE),
      CMDLINE_PARSER_VERSION);
+
+  if (strlen(gengetopt_args_info_versiontext) > 0)
+    printf("\n%s\n", gengetopt_args_info_versiontext);
 }
 
 static void print_help_common(void) {
   free_string_field (&(args_info->contexts_orig));
   free_string_field (&(args_info->diseases_arg));
   free_string_field (&(args_info->diseases_orig));
+  free_string_field (&(args_info->global_standard_arg));
+  free_string_field (&(args_info->global_standard_orig));
+  free_string_field (&(args_info->datasets_arg));
+  free_string_field (&(args_info->datasets_orig));
   free_string_field (&(args_info->networks_arg));
   free_string_field (&(args_info->networks_orig));
   free_string_field (&(args_info->default_arg));
     write_into_file(outfile, "diseases", args_info->diseases_orig, 0);
   if (args_info->is_nibble_given)
     write_into_file(outfile, "is_nibble", 0, 0 );
+  if (args_info->global_standard_given)
+    write_into_file(outfile, "global_standard", args_info->global_standard_orig, 0);
+  if (args_info->datasets_given)
+    write_into_file(outfile, "datasets", args_info->datasets_orig, 0);
   if (args_info->networks_given)
     write_into_file(outfile, "networks", args_info->networks_orig, 0);
   if (args_info->default_given)
 int
 cmdline_parser_required2 (struct gengetopt_args_info *args_info, const char *prog_name, const char *additional_error)
 {
-  int error = 0;
+  int error_occurred = 0;
   FIX_UNUSED (additional_error);
 
   /* checks for required options */
   if (! args_info->contexts_given)
     {
       fprintf (stderr, "%s: '--contexts' ('-c') option required%s\n", prog_name, (additional_error ? additional_error : ""));
-      error = 1;
+      error_occurred = 1;
     }
   
   if (! args_info->global_given)
     {
       fprintf (stderr, "%s: '--global' ('-P') option required%s\n", prog_name, (additional_error ? additional_error : ""));
-      error = 1;
+      error_occurred = 1;
     }
   
   
   /* checks for dependences among options */
 
-  return error;
+  return error_occurred;
 }
 
 
 {
   int c;	/* Character of the parsed option.  */
 
-  int error = 0;
+  int error_occurred = 0;
   struct gengetopt_args_info local_args_info;
   
   int override;
         { "contexts",	1, NULL, 'c' },
         { "diseases",	1, NULL, 's' },
         { "is_nibble",	0, NULL, 'N' },
+        { "global_standard",	1, NULL, 'S' },
+        { "datasets",	1, NULL, 'I' },
         { "networks",	1, NULL, 'n' },
         { "default",	1, NULL, 'b' },
         { "xdsl",	0, NULL, 'x' },
         { 0,  0, 0, 0 }
       };
 
-      c = getopt_long (argc, argv, "hVd:i:c:s:Nn:b:xmM:P:w:W:e:E:B:a:g:G:k:K:p:t:lr:R:L:f:z:C:v:", long_options, &option_index);
+      c = getopt_long (argc, argv, "hVd:i:c:s:NS:I:n:b:xmM:P:w:W:e:E:B:a:g:G:k:K:p:t:lr:R:L:f:z:C:v:", long_options, &option_index);
 
       if (c == -1) break;	/* Exit from `while (1)' loop.  */
 
             goto failure;
         
           break;
+        case 'S':	/* Global gold standard dab file.  */
+        
+        
+          if (update_arg( (void *)&(args_info->global_standard_arg), 
+               &(args_info->global_standard_orig), &(args_info->global_standard_given),
+              &(local_args_info.global_standard_given), optarg, 0, 0, ARG_STRING,
+              check_ambiguity, override, 0, 0,
+              "global_standard", 'S',
+              additional_error))
+            goto failure;
+        
+          break;
+        case 'I':	/* File dataset names and number of bins.  */
+        
+        
+          if (update_arg( (void *)&(args_info->datasets_arg), 
+               &(args_info->datasets_orig), &(args_info->datasets_given),
+              &(local_args_info.datasets_given), optarg, 0, 0, ARG_STRING,
+              check_ambiguity, override, 0, 0,
+              "datasets", 'I',
+              additional_error))
+            goto failure;
+        
+          break;
         case 'n':	/* Bayes net directory.  */
         
         
 
   if (check_required)
     {
-      error += cmdline_parser_required2 (args_info, argv[0], additional_error);
+      error_occurred += cmdline_parser_required2 (args_info, argv[0], additional_error);
     }
 
   cmdline_parser_release (&local_args_info);
 
-  if ( error )
+  if ( error_occurred )
     return (EXIT_FAILURE);
 
   return 0;

File tools/BNServer/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.6
  *  http://www.gnu.org/software/gengetopt.
  *  DO NOT modify this file, since it can be overwritten
  *  @author GNU Gengetopt by Lorenzo Bettini */
   const char *diseases_help; /**< @brief Disease/gene mapping help description.  */
   int is_nibble_flag;	/**< @brief Specify whether the database is nibble type (default=on).  */
   const char *is_nibble_help; /**< @brief Specify whether the database is nibble type help description.  */
+  char * global_standard_arg;	/**< @brief Global gold standard dab file.  */
+  char * global_standard_orig;	/**< @brief Global gold standard dab file original value given at command line.  */
+  const char *global_standard_help; /**< @brief Global gold standard dab file help description.  */
+  char * datasets_arg;	/**< @brief File dataset names and number of bins.  */
+  char * datasets_orig;	/**< @brief File dataset names and number of bins original value given at command line.  */
+  const char *datasets_help; /**< @brief File dataset names and number of bins help description.  */
   char * networks_arg;	/**< @brief Bayes net directory (default='.').  */
   char * networks_orig;	/**< @brief Bayes net directory original value given at command line.  */
   const char *networks_help; /**< @brief Bayes net directory help description.  */
   unsigned int contexts_given ;	/**< @brief Whether contexts was given.  */
   unsigned int diseases_given ;	/**< @brief Whether diseases was given.  */
   unsigned int is_nibble_given ;	/**< @brief Whether is_nibble was given.  */
+  unsigned int global_standard_given ;	/**< @brief Whether global_standard was given.  */
+  unsigned int datasets_given ;	/**< @brief Whether datasets was given.  */
   unsigned int networks_given ;	/**< @brief Whether networks was given.  */
   unsigned int default_given ;	/**< @brief Whether default was given.  */
   unsigned int xdsl_given ;	/**< @brief Whether xdsl was given.  */
 extern const char *gengetopt_args_info_purpose;
 /** @brief the usage string of the program */
 extern const char *gengetopt_args_info_usage;
+/** @brief the description string of the program */
+extern const char *gengetopt_args_info_description;
 /** @brief all the lines making the help output */
 extern const char *gengetopt_args_info_help[];