Commits

Anonymous committed fc80efa

Updated SpeciesConnector removing Gibbs sampling.

Comments (0)

Files changed (5)

tools/SpeciesConnector/SpeciesConnector.cpp

 
 static const char	c_acDab[]	= ".dab";
 
-struct SSorter {
-	const vector<size_t>&	m_veciSizes;
-
-	SSorter( const vector<size_t>& veciSizes ) : m_veciSizes(veciSizes) { }
-
-	bool operator()( size_t iOne, size_t iTwo ) const {
-
-		return ( m_veciSizes[ iOne ] > m_veciSizes[ iTwo ] ); }
-};
-
 float find_value( size_t iOne, size_t iTwo, const CDat& Dat ) {
 
 	return ( ( ( iOne == -1 ) || ( iTwo == -1 ) ) ? CMeta::GetNaN( ) : Dat.Get( iOne, iTwo ) ); }
 
-size_t sample ( vector<float> flag ){
-	size_t						i;
-	float						UnifSamp;
-		
-	UnifSamp = ( float )rand( ) / RAND_MAX; 
-	for( i = 0; i < flag.size( ); ++i ){
-		if( UnifSamp <= flag[ i ] )
-			break;}
-
-	return i;}
-
 int main( int iArgs, char** aszArgs ) {
-	size_t						NGibbs, burn;
 	gengetopt_args_info			sArgs;
 	CDataPair					DatOne, DatTwo;
 	size_t						i, j, k, iDatOne, iDatTwo, iGeneOne, iGeneTwo, count1, count2;
 	size_t						iCountJoint, iValueOne, iValueTwo;
-	vector<size_t>				veciGenesOne, veciGenesTwo, veciDefaults, veciSizes;
+	vector<size_t>				veciGenesOne, veciGenesTwo, veciSizes;
 	vector<vector<size_t> >		vecveciJoint;
-	vector<string>				vecstrTInputs, vecstrInputs, vecstrxInputs, vecstrlInputs, vecstrlxInputs, vecstrGenes;
+	vector<string>				vecstrTInputs, vecstrInputs, vecstrxInputs, vecstrlInputs, vecstrlxInputs, vecstrGenes, vecstrAllGenes;
 	float						dValueOne, dValueTwo;
 	map<string, size_t>			mapZeros;
 	CBayesNetSmile				BNIn;
 		cerr << "Number of inputs should be even." <<  endl;
 		return 1;}
 	
-	NGibbs = burn = sArgs.gibbs_arg;
-
 	vecstrTInputs.resize( sArgs.inputs_num );
 	copy( sArgs.inputs, sArgs.inputs + sArgs.inputs_num, vecstrTInputs.begin( ) );
 
 				vecIndInputs[ i ] = j;
 				break;}}}
 
-	{	vector<size_t>	veciIndices, veciSizes;
-
-		veciSizes.resize( vecstrInputs.size( ) );
-		veciIndices.resize( vecstrInputs.size( ) );
-		for( i = 0; i < vecstrInputs.size( ); ++i ) {
-			CDat		Dat;
-			ifstream	ifsm;
-
-			veciIndices[ i ] = i;
-			ifsm.open( vecstrInputs[ i ].c_str( ) );
-			Dat.OpenGenes( ifsm, true );
-			veciSizes[ i ] = Dat.GetGenes( ); }
-		sort( veciIndices.begin( ), veciIndices.end( ), SSorter( veciSizes ) );
-		CMeta::Permute( vecstrInputs, veciIndices ); }
-	
 	{	CDataset	Data;
 
 		Data.OpenGenes( vecstrInputs );
 
-		vecstrGenes.resize( Data.GetGenes( ) );
-		copy( Data.GetGeneNames( ).begin( ), Data.GetGeneNames( ).end( ), vecstrGenes.begin( ) );}
+		vecstrAllGenes.resize( Data.GetGenes( ) );
+		copy( Data.GetGeneNames( ).begin( ), Data.GetGeneNames( ).end( ), vecstrAllGenes.begin( ) );}
 
+	if( sArgs.genex_arg ) {
+
+		CGenome				Genome;		
+		CGenes				GenesEx( Genome );
+
+		if( !GenesEx.Open( sArgs.genex_arg ) ) {
+			cerr << "Could not open: " << sArgs.genex_arg << endl;
+			return 1; } 
+
+		vecstrGenes.resize( vecstrAllGenes.size( ) - GenesEx.GetGenes( ) );
+
+		size_t		GenesExCount = 0;
+		for( i = 0; i < vecstrAllGenes.size( ); ++i ){
+			if( !GenesEx.IsGene( vecstrAllGenes[ i ] ) ){
+				vecstrGenes[ GenesExCount ] = vecstrAllGenes[ i ];
+				GenesExCount++;}}}
+	else{
+		vecstrGenes.resize( vecstrAllGenes.size( ) );
+		for( i = 0; i < vecstrAllGenes.size( ); ++i )
+			vecstrGenes[ i ] = vecstrAllGenes[ i ];}
+	
 	veciSizes.resize( vecstrInputs.size( ) );
 	for( i = 0; i < veciSizes.size( ); ++i ) {
 		DatOne.OpenQuants( vecstrInputs[ i ].c_str( ) );
 	vecvecSpDat.resize( sArgs.inputs_num/2 );
 	for( i = 0; i < vecPrior.size(  ); ++i ){
 		if( !BNIn.Open( vecstrxInputs[ vecIndInputs[ i ] ].c_str( ) ) ) {
-			cerr << "Couldn't open: " << endl;
+			cerr << "Couldn't open: " << vecstrxInputs[ vecIndInputs[ i ] ] << endl;
 			return 1;}
 		BNIn.GetCPT( 0, MatCPT );
 		vecPrior[ i ].resize( MatCPT.GetRows( ) );
 					cerr << "Could not open: " << vecstrInputs[ iDatOne ] << endl;
 					return 1; }
 
-			if( sArgs.genex_arg && !DatOne.FilterGenes( sArgs.genex_arg, CDat::EFilterExclude ) ){
-				cerr << "Couldn't open: " << sArgs.genex_arg << endl;
-				return 1; }
-
 			veciGenesOne.resize( vecstrGenes.size( ) );
 			for( i = 0; i < vecstrGenes.size( ); ++i )
 				veciGenesOne[ i ] = DatOne.GetGene( vecstrGenes[ i ] );
 						cerr << "Could not open: " << vecstrInputs[ iDatTwo ] << endl;
 						return 1; }
 
-				if( sArgs.genex_arg && !DatTwo.FilterGenes( sArgs.genex_arg, CDat::EFilterExclude ) ){
-					cerr << "Couldn't open: " << sArgs.genex_arg << endl;
-					return 1; }
-
 				veciGenesTwo.resize( vecstrGenes.size( ) );
 				for( i = 0; i < veciGenesTwo.size( ); ++i )
 					veciGenesTwo[ i ] = DatTwo.GetGene( vecstrGenes[ i ] );
 					for( j = ( i + 1 ); j < vecstrGenes.size( ); ++j ) {
 						dValueTwo = find_value( iGeneTwo, veciGenesTwo[ j ], DatTwo );
 						dValueOne = find_value( iGeneOne, veciGenesOne[ j ], DatOne );
-						if( ( !CMeta::IsNaN( dValueTwo = find_value( iGeneTwo, veciGenesTwo[ j ], DatTwo ) ) ) && 
-							( !CMeta::IsNaN( dValueOne = find_value( iGeneOne, veciGenesOne[ j ], DatOne ) ) ) ){
+						if( ( !CMeta::IsNaN( dValueTwo ) ) && ( !CMeta::IsNaN( dValueOne ) ) ){
 								iValueTwo = DatTwo.Quantize( dValueTwo );
 								iValueOne = DatOne.Quantize( dValueOne );
 								iCountJoint++;
+								vecveciJoint[ iValueOne ][ iValueTwo ]++;}
+						if( ( CMeta::IsNaN( dValueTwo ) ) && ( !CMeta::IsNaN( dValueOne ) ) ){
+								iValueTwo = 0;
+								iValueOne = DatOne.Quantize( dValueOne );
+								iCountJoint++;
+								vecveciJoint[ iValueOne ][ iValueTwo ]++;}
+						if( ( !CMeta::IsNaN( dValueTwo ) ) && ( CMeta::IsNaN( dValueOne ) ) ){
+								iValueTwo = DatTwo.Quantize( dValueTwo );
+								iValueOne = 0;
+								iCountJoint++;
+								vecveciJoint[ iValueOne ][ iValueTwo ]++;}
+						if( ( CMeta::IsNaN( dValueTwo ) ) && ( CMeta::IsNaN( dValueOne ) ) ){
+								iValueTwo = 0;
+								iValueOne = 0;
+								iCountJoint++;
 								vecveciJoint[ iValueOne ][ iValueTwo ]++;}}}
 
-				size_t				Flag716 = 0;
-				for( i = 0; i < vecveciJoint.size( ); ++i )
-					for( j = 0; j < vecveciJoint[ i ].size( ); ++j )
-						Flag716 += vecveciJoint[ i ][ j ];
-
-				if( Flag716 < 10 ){
-					cerr << "Total number of common edges between the answer files of " << vecstrlInputs[ iDatOne ].c_str( ) << " and " 
-						<< vecstrlInputs[ iDatTwo ].c_str( ) << " should be much greater than 10" << endl;
-					return 1;}
-
-				Flag716 = Flag716/10;
-
-				for( i = 0; i < vecveciJoint.size( ); ++i ){
-					for( j = 0; j < vecveciJoint[ i ].size( ); ++j ){
-						vecveciJoint[ i ][ j ] += Flag716;
-						iCountJoint += Flag716;}}
-
 				vector<vector<float> >		vecveciTJoint;
 				vecveciTJoint.resize( vecveciJoint.size( ) );
 				for( i = 0; i < vecveciTJoint.size( ); ++i ){
 						vec4OSpGSp[ iDatOne ][ iDatTwo ][ i ][ j ] = vecveciTJoint[ i ][ j ] / veciValueOnep[ i ];
 						vec4OSpGSp[ iDatTwo ][ iDatOne ][ i ][ j ] = vecveciTJoint[ j ][ i ] / veciValueTwop[ i ];}}}}
 
-	// Gibbs Magic
-	vector<float>				vecMax;
-	vecMax.resize( sArgs.inputs_num/2 );
-	for( i = 0; i < vecMax.size( ); ++i ){
-		float Max = 0;
-		for( j = 0; j < vecDataGSpZero[ i ].size(  ); ++j ){
-			float		temp1;
-			float		temp2;
-			temp1 = *max_element( vecDataGSpZero[ i ][ j ].begin( ), vecDataGSpZero[ i ][ j ].end( ) );
-			temp2 = *max_element( vecDataGSpOne[ i ][ j ].begin( ), vecDataGSpOne[ i ][ j ].end( ) );
-			Max += ( temp1 >= temp2 ) ? log ( temp1 ) : log( temp2 );}
-				
-		for( j = 0; j < sArgs.inputs_num/2; ++j ){
-			if( j != i ){
-				vector<float>	temp3;
-				temp3.resize( vec4OSpGSp[ i ][ j ].size( ) );
-				for( k = 0; k < vec4OSpGSp[ i ][ j ].size( ) ; ++k )
-					temp3[ k ] = *max_element( vec4OSpGSp[ i ][ j ][ k ].begin( ), vec4OSpGSp[ i ][ j ][ k ].end( ) );
-				Max += log ( *max_element( temp3.begin( ), temp3.end( ) ) );}}
-		vecMax[ i ] = Max;}
-
-	// Initialization
-	vector<size_t>					vecTSamples;
-	vecTSamples.resize( sArgs.inputs_num/2 );
-	for( i = 0; i < vecTSamples.size( ); ++i  ){
-		vector<float>			temp4;
-		temp4.resize( vecPrior[ i ].size( ) );
-		temp4[ 0 ] = vecPrior[ i ][ 0 ];
-		for( j = 1; j < vecPrior[ i ].size( ); ++j )
-			temp4[ j ] = temp4[ j - 1 ] + vecPrior[ i ][ j ];
-
-		vecTSamples[ i ] = sample( temp4 );}
-	
-	// Sampling
-	CDat		DatOut00, DatOut01, DatOut10; 
-	DatOut00.Open( vecstrlInputs );
-	DatOut01.Open( vecstrlInputs );
-	DatOut10.Open( vecstrlInputs );
-	
-	for( i = 0; i < NGibbs; ++i ){ 
-		vector<vector<size_t> >		vecvecDSp;
-		vecvecDSp.resize( sArgs.inputs_num/2 );
-		for( j = 0; j < sArgs.inputs_num/2; ++j ){
-//			const vector<float>&	vecdCur	= ( vecTSamples[j] ? vecDataGSpOne : vecDataGSpZero );
-
-			vecvecDSp[ j ].resize( vecDataGSpZero[ j ].size(  ) );
-			if( !vecTSamples[ j ] ){
-				for( k = 0; k < vecDataGSpZero[ j ].size( ); ++k ){
-					vector<float>		temp5;
-					size_t				l;
-					temp5.resize( vecDataGSpZero[ j ][ k ].size( ) );
-					temp5[ 0 ] = vecDataGSpZero[ j ][ k ][ 0 ];
-					for( l = 1; l < vecDataGSpZero[ j ][ k ].size( ); ++l )
-						temp5[ l ] = temp5[ l - 1 ] + vecDataGSpZero[ j ][ k ][ l ];
-					vecvecDSp[ j ][ k ] = sample( temp5 );}}
-			else{
-				for( k = 0; k < vecDataGSpOne[ j ].size(  ); ++k ){
-					vector<float>		temp5;
-					size_t				l;
-					temp5.resize( vecDataGSpOne[ j ][ k ].size( ) );
-					temp5[ 0 ] = vecDataGSpOne[ j ][ k ][ 0 ];
-					for( l = 1; l < vecDataGSpOne[ j ][ k ].size( ); ++l )
-						temp5[ l ] = temp5[ l - 1 ] + vecDataGSpOne[ j ][ k ][ l ];
-					vecvecDSp[ j ][ k ] = sample( temp5 );}}
-
-			vector<float>			temp6;
-			temp6.resize( vecPrior[ j ].size( ) );
-			temp6[ 0 ] = vecPrior[ j ][ 0 ];
-			for( k = 1; k < vecPrior[ j ].size( ); ++k )
-				temp6[ k ] = temp6[ k - 1 ] + vecPrior[ j ][ k ];
-			
-			float		sum;
-			do{ 
-				vecTSamples[ j ] = sample( temp6 );
-				sum = 0;
-				for( k = 0; k < vecvecDSp[ j ].size( ); ++k ){
-// same fix here for multi vectors
-					if( !vecTSamples[ j ] )
-						sum += log ( vecDataGSpZero[ j ][ k ][ vecvecDSp[ j ][ k ] ] );
-					else
-						sum += log ( vecDataGSpOne[ j ][ k ][ vecvecDSp[ j ][ k ] ] );}
-
-				for( k = 0; k < sArgs.inputs_num/2; ++k )
-					if( k != j )
-						sum += log ( vec4OSpGSp[ j ][ k ][ vecTSamples[ j ] ][ vecTSamples[ k ] ] );
-			} while ( log ( (float)rand( ) / RAND_MAX ) > ( sum - vecMax[ j ] ) );
-		}
-		 
-		if( i >= ( NGibbs - burn ) ){
-			for( j = 0; j < sArgs.inputs_num/2; ++j ){
-				for( k = j+1; k < sArgs.inputs_num/2; ++k ){
-					if( !vecTSamples[ j ] && !vecTSamples[ k ] ){
-						if( CMeta::IsNaN( DatOut00.Get( j, k ) ) )
-							DatOut00.Set( j, k, 1 );
-						else
-							DatOut00.Set( j, k, ++DatOut00.Get( j, k ) );}
-					if( !vecTSamples[ j ] && vecTSamples[ k ] ){
-						if( CMeta::IsNaN( DatOut01.Get( j, k ) ) )
-							DatOut01.Set( j, k, 1 );
-						else 
-							DatOut01.Set( j, k, ++DatOut01.Get( j, k ) );}
-					if( vecTSamples[ j ] && !vecTSamples[ k ] ){
-						if( CMeta::IsNaN( DatOut10.Get( j, k ) ) )
-							DatOut10.Set( j, k, 1 );
-						else
-							DatOut10.Set( j, k, ++DatOut10.Get( j, k ) );}}}}	
-	}	
-
 	_mkdir( sArgs.directory_arg );
-
-	vector<vector<vector<vector<float> > > >		vec4FSpGSp;
-	vec4FSpGSp.resize( sArgs.inputs_num/2 );
-	
-	for( iDatOne = 0; iDatOne < vecstrInputs.size( ); ++iDatOne ) {
-			vec4FSpGSp[ iDatOne ].resize( sArgs.inputs_num/2 );
-			for( iDatTwo = ( iDatOne + 1 ); iDatTwo < vecstrInputs.size( ); ++iDatTwo ) {
-				vec4FSpGSp[ iDatOne ][ iDatTwo ].resize( veciSizes[ iDatOne ] );
-				for( i = 0; i < veciSizes[ iDatOne ]; ++i )
-					vec4FSpGSp[ iDatOne ][ iDatTwo ][ i ].resize( veciSizes[ iDatTwo ] );}}
-
-	for( j = 0; j < sArgs.inputs_num/2; ++j ){
-		for( k = j+1; k < sArgs.inputs_num/2; ++k ){
-			double			DJValue;
-			if( !CMeta::IsNaN( DatOut00.Get( j, k ) ) ){
-				DJValue = DatOut00.Get( j, k );
-				DatOut00.Set( j, k, ( (float) DJValue / burn ) );
-				vec4FSpGSp[ j ][ k ][ 0 ][ 0 ] = DatOut00.Get( j, k );}
-			if( !CMeta::IsNaN( DatOut01.Get( j, k ) ) ){
-				DJValue = DatOut01.Get( j, k );
-				DatOut01.Set( j, k, ( (float) DJValue / burn ) );
-				vec4FSpGSp[ j ][ k ][ 0 ][ 1 ] = DatOut01.Get( j, k );}
-			if( !CMeta::IsNaN( DatOut10.Get( j, k ) ) ){
-				DJValue = DatOut10.Get( j, k );
-				DatOut10.Set( j, k, ( (float) DJValue / burn ) );
-				vec4FSpGSp[ j ][ k ][ 1 ][ 0 ] = DatOut10.Get( j, k );}
-
-			float		First3Sum = vec4FSpGSp[ j ][ k ][ 0 ][ 0 ] + vec4FSpGSp[ j ][ k ][ 0 ][ 1 ] + vec4FSpGSp[ j ][ k ][ 1 ][ 0 ];
-
-			vec4FSpGSp[ j ][ k ][ 1 ][ 1 ] = ( First3Sum == 1 ) ? 0.0f : ( 1.0f - First3Sum );}}
-	
-	DatOut00.Save( ( ( string ) sArgs.directory_arg + "/Learned00.dab" ).c_str( ) );
-	DatOut01.Save( ( ( string ) sArgs.directory_arg + "/Learned01.dab" ).c_str( ) );
-	DatOut10.Save( ( ( string ) sArgs.directory_arg + "/Learned10.dab" ).c_str( ) );
-	
-    for( iDatOne = 0; iDatOne < vecstrInputs.size( ); ++iDatOne ) {
-        vec4FSpGSp[ iDatOne ].resize( sArgs.inputs_num/2 );
-        for( iDatTwo = 0; iDatTwo < iDatOne; ++iDatTwo ) {
-            vec4FSpGSp[ iDatOne ][ iDatTwo ].resize( veciSizes[ iDatOne ] );
-            for( i = 0; i < veciSizes[ iDatOne ]; ++i )
-                vec4FSpGSp[ iDatOne ][ iDatTwo ][ i ].resize( veciSizes[ iDatTwo ] );}}
-
-    for( iDatOne = 0; iDatOne < vec4FSpGSp.size( ); ++iDatOne ) {
-        for( iDatTwo = ( iDatOne + 1 ); iDatTwo < vec4FSpGSp[ iDatOne ].size( ); ++iDatTwo ) {
-            vector<vector<float> >			vecvecFTJoint;
-            float							MaxFJoint = 0;
-            size_t							ZeroFCount = 0;
-            vecvecFTJoint.resize( vec4FSpGSp[ iDatOne ][ iDatTwo ].size( ) );
-            for( j = 0; j < vec4FSpGSp[ iDatOne ][ iDatTwo ].size( ); ++j ){
-                vecvecFTJoint[ j ].resize( vec4FSpGSp[ iDatOne ][ iDatTwo ][ j ].size( ) );
-                fill( vecvecFTJoint[ j ].begin( ), vecvecFTJoint[ j ].end( ), 0.0f );
-                for( k = 0; k < vec4FSpGSp[ iDatOne ][ iDatTwo ][ j ].size( ); ++k ){
-                    vecvecFTJoint[ j ][ k ] = vec4FSpGSp[ iDatOne ][ iDatTwo ][ j ][ k ];
-                    if( !vecvecFTJoint[ j ][ k ] )
-                        ZeroFCount++;
-                    if( vecvecFTJoint[ j ][ k ] > MaxFJoint )
-                        MaxFJoint = vecvecFTJoint[ j ][ k ];}}
-
-            if( ZeroFCount ){
-                float							BiasF;
-                size_t							BiasFFlag = 0;
-
-                BiasF = ( float ) MaxFJoint / ZeroFCount / veciSizes[ iDatTwo ] / veciSizes[ iDatOne ] / 100;
-
-                for( i = 0; i < vecvecFTJoint.size( ); ++i )
-                    for( j = 0; j < vecvecFTJoint[ i ].size( ); ++j )
-                        if( !vecvecFTJoint[ i ][ j ] )
-                            vecvecFTJoint[ i ][ j ] = BiasF;
-
-                for( i = 0; i < vecvecFTJoint.size( ); ++i ){
-                    for( j = 0; j < vecvecFTJoint[ i ].size( ); ++j ){
-                        if( !( vecvecFTJoint[ i ][ j ] - MaxFJoint ) ){
-                            vecvecFTJoint[ i ][ j ] -= ( BiasF * ZeroFCount );
-                            BiasFFlag = 1;
-                            break;}}
-                    if( BiasFFlag )
-                        break;}}
-        
-            vector<float>		vecFValueOnep;
-            vector<float>		vecFValueTwop;
-
-            vecFValueOnep.resize( veciSizes[ iDatOne ] );
-            vecFValueTwop.resize( veciSizes[ iDatTwo ] );
-            fill( vecFValueOnep.begin( ), vecFValueOnep.end( ), 0.0f );
-            fill( vecFValueTwop.begin( ), vecFValueTwop.end( ), 0.0f );
-
-            for( i = 0; i < vecvecFTJoint.size( ); ++i ){
-                for( j = 0; j < vecvecFTJoint[ i ].size( ); ++j ){
-                    vecFValueOnep[ i ] += vecvecFTJoint[ i ][ j ];
-                    vecFValueTwop[ j ] += vecvecFTJoint[ i ][ j ];}} 
-
-            for( i = 0; i < vecvecFTJoint.size( ); ++i ){
-                for( j = 0; j < vecvecFTJoint[ i ].size(  ); ++j ){
-                    vec4FSpGSp[ iDatOne ][ iDatTwo ][ i ][ j ] = vecvecFTJoint[ i ][ j ] / vecFValueOnep[ i ];
-                    vec4FSpGSp[ iDatTwo ][ iDatOne ][ i ][ j ] = vecvecFTJoint[ j ][ i ] / vecFValueTwop[ i ];}}}}
     
     vector<vector<string> >		vecvecstrInputs;
     size_t						countstrInputs;
 				float		sumOneT = 0, sumZeroT = 0, FinalT = 0;
                 for( k = 0; k < vecvecstrInputs.size( ); ++k ){
                     if( k != i ){
-                        sumOne += log( exp( log( vec4FSpGSp[ i ][ k ][ 1 ][ 0 ] ) + vecDataIntZero[ k ] ) + exp( log( vec4FSpGSp[ i ][ k ][ 1 ][ 1 ] ) + vecDataIntOne[ k ] ) );
-                        sumZero += log( exp( log( vec4FSpGSp[ i ][ k ][ 0 ][ 0 ] ) + vecDataIntZero[ k ] ) + exp( log( vec4FSpGSp[ i ][ k ][ 0 ][ 1 ] ) + vecDataIntOne[ k ] ) );}}
+                        sumOne += log( exp( log( vec4OSpGSp[ i ][ k ][ 1 ][ 0 ] ) + vecDataIntZero[ k ] ) + exp( log( vec4OSpGSp[ i ][ k ][ 1 ][ 1 ] ) + vecDataIntOne[ k ] ) );
+                        sumZero += log( exp( log( vec4OSpGSp[ i ][ k ][ 0 ][ 0 ] ) + vecDataIntZero[ k ] ) + exp( log( vec4OSpGSp[ i ][ k ][ 0 ][ 1 ] ) + vecDataIntOne[ k ] ) );}}
                 sumOneT = sumOne + log( vecPrior[ i ][ 1 ] );
 				sumOne += ( vecDataIntOne[ i ] + log( vecPrior[ i ][ 1 ] ) );
 				sumOneB =  vecDataIntOne[ i ] + log( vecPrior[ i ][ 1 ] );
 	delete DatOutCSH[ i ];
 	delete DatOutB[ i ];}	
 	
-	return 0;}
+	return 0;}

tools/SpeciesConnector/SpeciesConnector.ggo

-package	"SpeciesConnector"
-version	"1.0"
-purpose	"Cross species connection calculator."
-
-section "Main"
-option	"ndirectory" n	"Input directory"
-						string	typestr="directory"	default="."
-option	"directory"	d	"Output directory"
-						string	typestr="directory"	default="."
-option	"gibbs"		g	"Gibbs run"
-						int	default="100000"
-
-section "Network Features"
-option	"zero"		z	"Zero missing values"
-						flag	off
-option	"zeros"		Z	"Read zeroed node IDs/outputs from the given file"
-						string	typestr="filename"
-
-section "Optional"
-option	"genex"		G	"Gene exclusion file"
-						string	typestr="filename"
-option	"subsample"	s	"Maximum pairs to subsample"
-						int	default="100000"
-option	"memmap"	m	"Memory map input/output"
-						flag	off
-option	"random"	r	"Seed random generator"
-						int	default="0"
-option	"verbosity"	v	"Message verbosity"
+package	"SpeciesConnector"
+version	"1.0"
+purpose	"Cross species connection calculator."
+
+section "Main"
+option	"ndirectory" n	"Input directory"
+						string	typestr="directory"	default="."
+option	"directory"	d	"Output directory"
+						string	typestr="directory"	default="."
+
+section "Network Features"
+option	"zeros"		Z	"Read zeroed node IDs/outputs from the given file"
+						string	typestr="filename"
+
+section "Optional"
+option	"genex"		G	"Gene exclusion file"
+						string	typestr="filename"
+option	"memmap"	m	"Memory map input/output"
+						flag	off
+option	"random"	r	"Seed random generator"
+						int	default="0"
+option	"verbosity"	v	"Message verbosity"
 						int	default="5"

tools/SpeciesConnector/cmdline.c

 /*
   File autogenerated by gengetopt version 2.22
   generated with the following command:
-  ..\..\..\..\extlib\proj\vs2008\release\gengetopt.exe -u --default-optional -N -e --output-dir=c:\Users\Pinaki Sarder\Documents\Visual Studio 2008\Projects\sleipnir\trunk\tools\SpeciesConnector\ -i ..\..\..\tools\SpeciesConnector\SpeciesConnector.ggo 
+  /shared/users/psarder/sleipnir/trunk/../extlib/gengetopt-2.22/bin/gengetopt -iSpeciesConnector.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:
   "\nMain:",
   "  -n, --ndirectory=directory  Input directory  (default=`.')",
   "  -d, --directory=directory   Output directory  (default=`.')",
-  "  -g, --gibbs=INT             Gibbs run  (default=`100000')",
   "\nNetwork Features:",
-  "  -z, --zero                  Zero missing values  (default=off)",
   "  -Z, --zeros=filename        Read zeroed node IDs/outputs from the given file",
   "\nOptional:",
   "  -G, --genex=filename        Gene exclusion file",
-  "  -s, --subsample=INT         Maximum pairs to subsample  (default=`100000')",
   "  -m, --memmap                Memory map input/output  (default=off)",
   "  -r, --random=INT            Seed random generator  (default=`0')",
   "  -v, --verbosity=INT         Message verbosity  (default=`5')",
   args_info->version_given = 0 ;
   args_info->ndirectory_given = 0 ;
   args_info->directory_given = 0 ;
-  args_info->gibbs_given = 0 ;
-  args_info->zero_given = 0 ;
   args_info->zeros_given = 0 ;
   args_info->genex_given = 0 ;
-  args_info->subsample_given = 0 ;
   args_info->memmap_given = 0 ;
   args_info->random_given = 0 ;
   args_info->verbosity_given = 0 ;
   args_info->ndirectory_orig = NULL;
   args_info->directory_arg = gengetopt_strdup (".");
   args_info->directory_orig = NULL;
-  args_info->gibbs_arg = 100000;
-  args_info->gibbs_orig = NULL;
-  args_info->zero_flag = 0;
   args_info->zeros_arg = NULL;
   args_info->zeros_orig = NULL;
   args_info->genex_arg = NULL;
   args_info->genex_orig = NULL;
-  args_info->subsample_arg = 100000;
-  args_info->subsample_orig = NULL;
   args_info->memmap_flag = 0;
   args_info->random_arg = 0;
   args_info->random_orig = NULL;
   args_info->version_help = gengetopt_args_info_help[1] ;
   args_info->ndirectory_help = gengetopt_args_info_help[3] ;
   args_info->directory_help = gengetopt_args_info_help[4] ;
-  args_info->gibbs_help = gengetopt_args_info_help[5] ;
-  args_info->zero_help = gengetopt_args_info_help[7] ;
-  args_info->zeros_help = gengetopt_args_info_help[8] ;
-  args_info->genex_help = gengetopt_args_info_help[10] ;
-  args_info->subsample_help = gengetopt_args_info_help[11] ;
-  args_info->memmap_help = gengetopt_args_info_help[12] ;
-  args_info->random_help = gengetopt_args_info_help[13] ;
-  args_info->verbosity_help = gengetopt_args_info_help[14] ;
+  args_info->zeros_help = gengetopt_args_info_help[6] ;
+  args_info->genex_help = gengetopt_args_info_help[8] ;
+  args_info->memmap_help = gengetopt_args_info_help[9] ;
+  args_info->random_help = gengetopt_args_info_help[10] ;
+  args_info->verbosity_help = gengetopt_args_info_help[11] ;
   
 }
 
   free_string_field (&(args_info->ndirectory_orig));
   free_string_field (&(args_info->directory_arg));
   free_string_field (&(args_info->directory_orig));
-  free_string_field (&(args_info->gibbs_orig));
   free_string_field (&(args_info->zeros_arg));
   free_string_field (&(args_info->zeros_orig));
   free_string_field (&(args_info->genex_arg));
   free_string_field (&(args_info->genex_orig));
-  free_string_field (&(args_info->subsample_orig));
   free_string_field (&(args_info->random_orig));
   free_string_field (&(args_info->verbosity_orig));
   
     write_into_file(outfile, "ndirectory", args_info->ndirectory_orig, 0);
   if (args_info->directory_given)
     write_into_file(outfile, "directory", args_info->directory_orig, 0);
-  if (args_info->gibbs_given)
-    write_into_file(outfile, "gibbs", args_info->gibbs_orig, 0);
-  if (args_info->zero_given)
-    write_into_file(outfile, "zero", 0, 0 );
   if (args_info->zeros_given)
     write_into_file(outfile, "zeros", args_info->zeros_orig, 0);
   if (args_info->genex_given)
     write_into_file(outfile, "genex", args_info->genex_orig, 0);
-  if (args_info->subsample_given)
-    write_into_file(outfile, "subsample", args_info->subsample_orig, 0);
   if (args_info->memmap_given)
     write_into_file(outfile, "memmap", 0, 0 );
   if (args_info->random_given)
         { "version",	0, NULL, 'V' },
         { "ndirectory",	1, NULL, 'n' },
         { "directory",	1, NULL, 'd' },
-        { "gibbs",	1, NULL, 'g' },
-        { "zero",	0, NULL, 'z' },
         { "zeros",	1, NULL, 'Z' },
         { "genex",	1, NULL, 'G' },
-        { "subsample",	1, NULL, 's' },
         { "memmap",	0, NULL, 'm' },
         { "random",	1, NULL, 'r' },
         { "verbosity",	1, NULL, 'v' },
         { NULL,	0, NULL, 0 }
       };
 
-      c = getopt_long (argc, argv, "hVn:d:g:zZ:G:s:mr:v:", long_options, &option_index);
+      c = getopt_long (argc, argv, "hVn:d:Z:G:mr:v:", long_options, &option_index);
 
       if (c == -1) break;	/* Exit from `while (1)' loop.  */
 
             goto failure;
         
           break;
-        case 'g':	/* Gibbs run.  */
-        
-        
-          if (update_arg( (void *)&(args_info->gibbs_arg), 
-               &(args_info->gibbs_orig), &(args_info->gibbs_given),
-              &(local_args_info.gibbs_given), optarg, 0, "100000", ARG_INT,
-              check_ambiguity, override, 0, 0,
-              "gibbs", 'g',
-              additional_error))
-            goto failure;
-        
-          break;
-        case 'z':	/* Zero missing values.  */
-        
-        
-          if (update_arg((void *)&(args_info->zero_flag), 0, &(args_info->zero_given),
-              &(local_args_info.zero_given), optarg, 0, 0, ARG_FLAG,
-              check_ambiguity, override, 1, 0, "zero", 'z',
-              additional_error))
-            goto failure;
-        
-          break;
         case 'Z':	/* Read zeroed node IDs/outputs from the given file.  */
         
         
             goto failure;
         
           break;
-        case 's':	/* Maximum pairs to subsample.  */
-        
-        
-          if (update_arg( (void *)&(args_info->subsample_arg), 
-               &(args_info->subsample_orig), &(args_info->subsample_given),
-              &(local_args_info.subsample_given), optarg, 0, "100000", ARG_INT,
-              check_ambiguity, override, 0, 0,
-              "subsample", 's',
-              additional_error))
-            goto failure;
-        
-          break;
         case 'm':	/* Memory map input/output.  */
         
         

tools/SpeciesConnector/cmdline.h

   char * directory_arg;	/**< @brief Output directory (default='.').  */
   char * directory_orig;	/**< @brief Output directory original value given at command line.  */
   const char *directory_help; /**< @brief Output directory help description.  */
-  int gibbs_arg;	/**< @brief Gibbs run (default='100000').  */
-  char * gibbs_orig;	/**< @brief Gibbs run original value given at command line.  */
-  const char *gibbs_help; /**< @brief Gibbs run help description.  */
-  int zero_flag;	/**< @brief Zero missing values (default=off).  */
-  const char *zero_help; /**< @brief Zero missing values help description.  */
   char * zeros_arg;	/**< @brief Read zeroed node IDs/outputs from the given file.  */
   char * zeros_orig;	/**< @brief Read zeroed node IDs/outputs from the given file original value given at command line.  */
   const char *zeros_help; /**< @brief Read zeroed node IDs/outputs from the given file help description.  */
   char * genex_arg;	/**< @brief Gene exclusion file.  */
   char * genex_orig;	/**< @brief Gene exclusion file original value given at command line.  */
   const char *genex_help; /**< @brief Gene exclusion file help description.  */
-  int subsample_arg;	/**< @brief Maximum pairs to subsample (default='100000').  */
-  char * subsample_orig;	/**< @brief Maximum pairs to subsample original value given at command line.  */
-  const char *subsample_help; /**< @brief Maximum pairs to subsample help description.  */
   int memmap_flag;	/**< @brief Memory map input/output (default=off).  */
   const char *memmap_help; /**< @brief Memory map input/output help description.  */
   int random_arg;	/**< @brief Seed random generator (default='0').  */
   unsigned int version_given ;	/**< @brief Whether version was given.  */
   unsigned int ndirectory_given ;	/**< @brief Whether ndirectory was given.  */
   unsigned int directory_given ;	/**< @brief Whether directory was given.  */
-  unsigned int gibbs_given ;	/**< @brief Whether gibbs was given.  */
-  unsigned int zero_given ;	/**< @brief Whether zero was given.  */
   unsigned int zeros_given ;	/**< @brief Whether zeros was given.  */
   unsigned int genex_given ;	/**< @brief Whether genex was given.  */
-  unsigned int subsample_given ;	/**< @brief Whether subsample was given.  */
   unsigned int memmap_given ;	/**< @brief Whether memmap was given.  */
   unsigned int random_given ;	/**< @brief Whether random was given.  */
   unsigned int verbosity_given ;	/**< @brief Whether verbosity was given.  */

tools/SpeciesConnector/stdafx.h

 #include "meta.h"
 using namespace Sleipnir;
 
-#endif // STDAFX_H
+#endif // STDAFX_H