Commits

Casey Greene committed 7a05f25

Update Counter and DChecker to work with ubiquitous gene lists

Comments (0)

Files changed (8)

tools/Counter/Counter.cpp

 class CRegularize;
 
 static const char	c_acDab[]	= ".dab";
+static const char	c_acDat[]	= ".dat";
 static const char	c_acQDab[]	= ".qdab";
 static const char	c_acQuant[]	= ".quant";
 static const char	c_acTxt[]	= ".txt";
 typedef CFullMatrix<size_t>	CCountMatrix;
 
 struct SLearn {
-    CCountMatrix*		m_pMatCounts;
-    const CGenes*		m_pGenes;
-    const CDataPair*	m_pAnswers;
-    const CDatFilter*	m_pDat;
-    size_t			m_iZero;
-    CRegularize*		m_pRegularize;
-    size_t			m_iDat;
+    CCountMatrix*	    m_pMatCounts;
+    const CGenes*	    m_pGenes;
+    const CGenes*           m_pUbikGenes;
+    const CDataPair*	    m_pAnswers;
+    const CDatFilter*	    m_pDat;
+    size_t	            m_iZero;
+    CRegularize*	    m_pRegularize;
+    size_t		    m_iDat;
     bool                    m_bInPos;
     bool                    m_bInNeg;
     bool                    m_bBridgePos;
 struct SEvaluate {
     const CBayesNetMinimal*	m_pBN;
     const CDataPair*		m_pDat;
-    const CGenes*			m_pGenes;
-    CDat*					m_pYes;
-    CDat*					m_pNo;
-    size_t					m_iZero;
-    size_t					m_iNode;
+    const CGenes*		m_pGenes;
+    CDat*			m_pYes;
+    CDat*			m_pNo;
+    size_t			m_iZero;
+    size_t			m_iNode;
     const vector<size_t>*	m_pveciGenes;
-    bool					m_fFirst;
-    string					m_strName;
+    bool			m_fFirst;
+    string			m_strName;
 };
 
 struct SEvaluate2 {
-    size_t								m_iBegin;
-    size_t								m_iEnd;
-    const CBayesNetMinimal*				m_pBN;
+    size_t				m_iBegin;
+    size_t				m_iEnd;
+    const CBayesNetMinimal*		m_pBN;
     const vector<CBayesNetMinimal*>*	m_pvecpBNs;
-    const CDataPair*					m_pDat;
-    CDat*								m_pYes;
-    CDat*								m_pNo;
-    size_t								m_iZero;
-    const vector<size_t>*				m_pveciGenes;
-    string								m_strName;
-    const vector<size_t>*				m_pveciBNs;
-    size_t								m_iNode;
-    pthread_spinlock_t					m_sLock;
+    const CDataPair*			m_pDat;
+    CDat*				m_pYes;
+    CDat*				m_pNo;
+    size_t				m_iZero;
+    const vector<size_t>*		m_pveciGenes;
+    string				m_strName;
+    const vector<size_t>*		m_pveciBNs;
+    size_t				m_iNode;
+    pthread_spinlock_t			m_sLock;
 };
 
 class CRegularize {
 void* evaluate2( void* );
 void* finalize( void* );
 int main_count( const gengetopt_args_info&, const map<string, size_t>&, const CGenes&, const CGenes&,
-                const CGenes&, const CGenes& );
+                const CGenes&, const CGenes&, const CGenes& );
 int main_xdsls( const gengetopt_args_info&, const map<string, size_t>&, const map<string, size_t>&,
                 const vector<string>& );
 int main_inference( const gengetopt_args_info&, const map<string, size_t>&, const map<string, size_t>& );
     int					iRet;
     size_t				i;
     CGenome				Genome;
-    CGenes				GenesIn( Genome ), GenesEx( Genome ), GenesEd( Genome ), GenesTm( Genome );
+    CGenes				GenesIn( Genome ), GenesEx( Genome ), GenesEd( Genome ), GenesTm( Genome ), GenesUbik( Genome);
 
 #ifdef WIN32
     pthread_win32_process_attach_np( );
             return 1;
         }
     }
+    if( sArgs.ubiqg_arg ) {
+        if( !GenesUbik.Open( sArgs.ubiqg_arg ) ) {
+            cerr << "Could not open: " << sArgs.ubiqg_arg << endl;
+            return 1;
+        }
+    }
 
     if( sArgs.answers_arg )
-        iRet = main_count( sArgs, mapstriZeros, GenesIn, GenesEx, GenesTm, GenesEd );
+        iRet = main_count( sArgs, mapstriZeros, GenesIn, GenesEx, GenesTm, GenesEd, GenesUbik );
     else if( sArgs.counts_arg )
         iRet = main_xdsls( sArgs, mapstriZeros, mapstriDatasets, vecstrContexts );
     else if( sArgs.networks_arg )
 }
 
 int main_count( const gengetopt_args_info& sArgs, const map<string, size_t>& mapstriZeros,
-                const CGenes& GenesIn, const CGenes& GenesEx, const CGenes& GenesTm, const CGenes& GenesEd ) {
-    size_t			    		i, j, k, m, iTerm, iThread;
-    vector<vector<CCountMatrix*>* >		vecpvecpMats;
-    vector<CCountMatrix*>			vecpMatRoots;
-    vector<CGenes*>				vecpGenes;
+                const CGenes& GenesIn, const CGenes& GenesEx, const CGenes& GenesTm, const CGenes& GenesEd, const CGenes& GenesUbik ) {
+    size_t				i, j, k, m, iTerm, iThread;
+    vector<vector<CCountMatrix*>* >	vecpvecpMats;
+    vector<CCountMatrix*>		vecpMatRoots;
+    vector<CGenes*>			vecpGenes;
     CDataPair				Answers, Dat;
     CDatFilter				Filter, FilterIn, FilterEx, FilterTm, FilterEd;
     CDatFilter*				pFilter;
-    string	    				strFile;
+    string	    			strFile;
     vector<pthread_t>	    		vecpthdThreads;
-    vector<SLearn>				vecsData;
+    vector<SLearn>			vecsData;
     map<string, size_t>::const_iterator	iterZero;
-    CGenome			    		Genome;
-    vector<string>				vecstrNames;
+    CGenome			    	Genome;
+    vector<string>			vecstrNames;
     CRegularize			        Regularize;
     if( !Answers.Open( sArgs.answers_arg, false, !!sArgs.memmap_flag ) ) {
         cerr << "Could not open: " << sArgs.answers_arg << endl;
             vecsData[ i ].m_pDat = NULL;
             vecsData[ i ].m_iDat = -1;
             vecsData[ i ].m_pGenes = vecpGenes[ i ];
+	    vecsData[ i ].m_pUbikGenes = &GenesUbik;
             vecsData[ i ].m_pAnswers = &Answers;
             vecsData[ i ].m_iZero = -1;
             vecsData[ i ].m_pRegularize = &Regularize;
         for( i = 0; i < iThread; ++i )
             pthread_join( vecpthdThreads[ iTerm + i ], NULL );
     }
-
     FOR_EACH_DIRECTORY_FILE((string)sArgs.directory_arg, strFile)
     string					strName;
     vector<CCountMatrix*>*	pvecpMatCounts;
-
+    
     if( CMeta::IsExtension( strFile, c_acDab ) ) {
         i = strFile.rfind( '.' );
         strName = (string) sArgs.directory_arg + "/" + strFile.substr( 0, i ) + c_acDab;
     } else if( CMeta::IsExtension( strFile, c_acQDab ) ) {
         i = strFile.rfind( '.' );
         strName = (string) sArgs.directory_arg + "/" + strFile.substr( 0, i ) + c_acQDab;
+    } else if( CMeta::IsExtension( strFile, c_acDat ) ) {
+	i = strFile.rfind( '.' );
+	strName = (string) sArgs.directory_arg + "/" + strFile.substr( 0, i ) + c_acDat;
     } else {
         continue;
     }
             vecsData[ i ].m_pDat = pFilter;
             vecsData[ i ].m_iDat = vecstrNames.size( ) - 1;
             vecsData[ i ].m_pGenes = vecpGenes[ i ];
+	    vecsData[ i ].m_pUbikGenes = &GenesUbik;
             vecsData[ i ].m_pAnswers = &Answers;
             vecsData[ i ].m_iZero = ( ( iterZero = mapstriZeros.find( strName ) ) == mapstriZeros.end( ) ) ? -1 : iterZero->second;
             vecsData[ i ].m_pRegularize = &Regularize;
 void* learn( void* pData ) {
     SLearn*		psData;
     size_t		i, j, iAnswer, iVal, iOne, iTwo;
-    vector<bool>	vecfGenes;
+    vector<bool>	vecfGenes, vecfUbik;
     vector<size_t>	veciGenes;
 
     psData = (SLearn*)pData;
+    if (psData->m_pUbikGenes->GetGenes( )) {
+	vecfUbik.resize( psData->m_pAnswers->GetGenes( ) );
+	for( i = 0; i < vecfUbik.size( ); ++i) {
+	    vecfUbik[ i ] = psData->m_pUbikGenes->IsGene( psData->m_pAnswers->GetGene( i ) );
+	}
+    }
     vecfGenes.resize( psData->m_pAnswers->GetGenes( ) );
     for( i = 0; i < vecfGenes.size( ); ++i )
         vecfGenes[ i ] = psData->m_pGenes->IsGene( psData->m_pAnswers->GetGene( i ) );
         if( psData->m_pDat )
             iOne = veciGenes[ i ];
         for( j = ( i + 1 ); j < psData->m_pAnswers->GetGenes( ); ++j ) {
-            if( iAnswer = psData->m_pAnswers->Quantize( psData->m_pAnswers->Get( i, j ) ) == -1 ) {
+	    iAnswer = psData->m_pAnswers->Quantize( psData->m_pAnswers->Get( i, j ) );
+            if( iAnswer == -1 ) {
                 continue;
             }
-            bool bOut = !( vecfGenes[ i ] || vecfGenes[ j ] );
-            if( bOut ) {
-                if ( iAnswer && !psData->m_bOutPos) {
-                    continue;
-                }
-                else if ( !iAnswer && !psData->m_bOutNeg ) {
-                    continue;
-                }
-            }
-            bool bIn = vecfGenes[ i ] && vecfGenes[ j ];
-            if( bIn ) {
+            bool fIn = vecfGenes[ i ] && vecfGenes[ j ];
+            if( fIn ) {
                 if ( iAnswer && !psData->m_bInPos ) {
                     continue;
                 }
                     continue;
                 }
             }
-            bool bBridge = !( bOut || bIn );
-            if( bBridge ) {
-                if ( iAnswer && !psData->m_bBridgePos ) {
+	    bool fBridge;
+	    if ( vecfUbik.size( ) ) {
+		fBridge = ( vecfUbik[ i ] && vecfGenes[ j ] ) || ( vecfGenes[ i ] && vecfUbik[ j ] );
+	    }
+	    else {
+		fBridge = ( vecfGenes[ i ] ^ vecfGenes[ j ] );
+	    }
+	    if( fBridge ) {
+		if ( iAnswer && !psData->m_bBridgePos ) {
+		    continue;
+		}
+		else if ( !iAnswer && !psData->m_bBridgeNeg ) {
+		    continue;
+		}
+	    }
+            bool fOut = !( fIn || fBridge );
+            if( fOut ) {
+                if ( iAnswer && !psData->m_bOutPos) {
                     continue;
                 }
-                else if ( !iAnswer && !psData->m_bBridgeNeg ) {
+                else if ( !iAnswer && !psData->m_bOutNeg ) {
                     continue;
                 }
             }

tools/Counter/Counter.ggo

 							string	typestr="filename"
 option	"genex"			G	"Gene exclusion file"
 							string	typestr="filename"
+option  "ubiqg"                 P       "Ubiquitous gene file (-j and -J refer to connections to ubiq instead of all bridging pairs)"
+                                                        string  typestr="filename"
 option	"genet"			c	"Term inclusion file"
 							string	typestr="filename"
 option	"genee"			C	"Edge inclusion file"
 							flag	off
 
 section "Bayesian Regularization"
-option	"pseudocounts"	p	"Effective number of pseudocounts to use"
+option	"pseudocounts"	        p	"Effective number of pseudocounts to use"
 							float default="-1"
 option	"alphas"		a	"File containing equivalent sample sizes (alphas) for each node"
 							string	typestr="filename"
-option	"regularize"	r	"Automatically regularize based on similarity"
+option	"regularize"	        r	"Automatically regularize based on similarity"
 							flag	off
 option	"reggroups"		R	"Automatically regularize based on given groups"
 							string	typestr="filename"
 							flag	on
 option	"memmap"		m	"Memory map input files"
 							flag	off
-option  "memmapout" M "Memory map output files (only for inference mode)"
-              flag  off
+option  "memmapout"             M       "Memory map output files (only for inference mode)"
+                                                        flag  off
 option	"threads"		t	"Maximum number of threads to spawn"
 							int	default="-1"
 option	"verbosity"		v	"Message verbosity"

tools/Counter/cmdline.c

 /*
-  File autogenerated by gengetopt version 2.22.4
+  File autogenerated by gengetopt version 2.22.5
   generated with the following command:
   /usr/bin/gengetopt -iCounter.ggo --default-optional -u -N -e 
 
   "\nLearning/Evaluation:",
   "  -g, --genes=filename          Gene inclusion file",
   "  -G, --genex=filename          Gene exclusion file",
+  "  -P, --ubiqg=filename          Ubiquitous gene file (-j and -J refer to \n                                  connections to ubiq instead of all bridging \n                                  pairs)",
   "  -c, --genet=filename          Term inclusion file",
   "  -C, --genee=filename          Edge inclusion file",
   "  -q, --ctxtpos                 Use positive edges between context genes  \n                                  (default=on)",
   args_info->contexts_given = 0 ;
   args_info->genes_given = 0 ;
   args_info->genex_given = 0 ;
+  args_info->ubiqg_given = 0 ;
   args_info->genet_given = 0 ;
   args_info->genee_given = 0 ;
   args_info->ctxtpos_given = 0 ;
   args_info->genes_orig = NULL;
   args_info->genex_arg = NULL;
   args_info->genex_orig = NULL;
+  args_info->ubiqg_arg = NULL;
+  args_info->ubiqg_orig = NULL;
   args_info->genet_arg = NULL;
   args_info->genet_orig = NULL;
   args_info->genee_arg = NULL;
   args_info->contexts_help = gengetopt_args_info_help[11] ;
   args_info->genes_help = gengetopt_args_info_help[13] ;
   args_info->genex_help = gengetopt_args_info_help[14] ;
-  args_info->genet_help = gengetopt_args_info_help[15] ;
-  args_info->genee_help = gengetopt_args_info_help[16] ;
-  args_info->ctxtpos_help = gengetopt_args_info_help[17] ;
-  args_info->ctxtneg_help = gengetopt_args_info_help[18] ;
-  args_info->bridgepos_help = gengetopt_args_info_help[19] ;
-  args_info->bridgeneg_help = gengetopt_args_info_help[20] ;
-  args_info->outpos_help = gengetopt_args_info_help[21] ;
-  args_info->outneg_help = gengetopt_args_info_help[22] ;
-  args_info->default_help = gengetopt_args_info_help[24] ;
-  args_info->zeros_help = gengetopt_args_info_help[25] ;
-  args_info->genewise_help = gengetopt_args_info_help[26] ;
-  args_info->pseudocounts_help = gengetopt_args_info_help[28] ;
-  args_info->alphas_help = gengetopt_args_info_help[29] ;
-  args_info->regularize_help = gengetopt_args_info_help[30] ;
-  args_info->reggroups_help = gengetopt_args_info_help[31] ;
-  args_info->temporary_help = gengetopt_args_info_help[33] ;
-  args_info->smile_help = gengetopt_args_info_help[34] ;
-  args_info->xdsl_help = gengetopt_args_info_help[35] ;
-  args_info->memmap_help = gengetopt_args_info_help[36] ;
-  args_info->memmapout_help = gengetopt_args_info_help[37] ;
-  args_info->threads_help = gengetopt_args_info_help[38] ;
-  args_info->verbosity_help = gengetopt_args_info_help[39] ;
+  args_info->ubiqg_help = gengetopt_args_info_help[15] ;
+  args_info->genet_help = gengetopt_args_info_help[16] ;
+  args_info->genee_help = gengetopt_args_info_help[17] ;
+  args_info->ctxtpos_help = gengetopt_args_info_help[18] ;
+  args_info->ctxtneg_help = gengetopt_args_info_help[19] ;
+  args_info->bridgepos_help = gengetopt_args_info_help[20] ;
+  args_info->bridgeneg_help = gengetopt_args_info_help[21] ;
+  args_info->outpos_help = gengetopt_args_info_help[22] ;
+  args_info->outneg_help = gengetopt_args_info_help[23] ;
+  args_info->default_help = gengetopt_args_info_help[25] ;
+  args_info->zeros_help = gengetopt_args_info_help[26] ;
+  args_info->genewise_help = gengetopt_args_info_help[27] ;
+  args_info->pseudocounts_help = gengetopt_args_info_help[29] ;
+  args_info->alphas_help = gengetopt_args_info_help[30] ;
+  args_info->regularize_help = gengetopt_args_info_help[31] ;
+  args_info->reggroups_help = gengetopt_args_info_help[32] ;
+  args_info->temporary_help = gengetopt_args_info_help[34] ;
+  args_info->smile_help = gengetopt_args_info_help[35] ;
+  args_info->xdsl_help = gengetopt_args_info_help[36] ;
+  args_info->memmap_help = gengetopt_args_info_help[37] ;
+  args_info->memmapout_help = gengetopt_args_info_help[38] ;
+  args_info->threads_help = gengetopt_args_info_help[39] ;
+  args_info->verbosity_help = gengetopt_args_info_help[40] ;
   
 }
 
   free_string_field (&(args_info->genes_orig));
   free_string_field (&(args_info->genex_arg));
   free_string_field (&(args_info->genex_orig));
+  free_string_field (&(args_info->ubiqg_arg));
+  free_string_field (&(args_info->ubiqg_orig));
   free_string_field (&(args_info->genet_arg));
   free_string_field (&(args_info->genet_orig));
   free_string_field (&(args_info->genee_arg));
     write_into_file(outfile, "genes", args_info->genes_orig, 0);
   if (args_info->genex_given)
     write_into_file(outfile, "genex", args_info->genex_orig, 0);
+  if (args_info->ubiqg_given)
+    write_into_file(outfile, "ubiqg", args_info->ubiqg_orig, 0);
   if (args_info->genet_given)
     write_into_file(outfile, "genet", args_info->genet_orig, 0);
   if (args_info->genee_given)
         { "contexts",	1, NULL, 'X' },
         { "genes",	1, NULL, 'g' },
         { "genex",	1, NULL, 'G' },
+        { "ubiqg",	1, NULL, 'P' },
         { "genet",	1, NULL, 'c' },
         { "genee",	1, NULL, 'C' },
         { "ctxtpos",	0, NULL, 'q' },
         { 0,  0, 0, 0 }
       };
 
-      c = getopt_long (argc, argv, "hVw:k:n:o:d:s:e:X:g:G:c:C:qQjJuUb:Z:Sp:a:rR:y:lxmMt:v:", long_options, &option_index);
+      c = getopt_long (argc, argv, "hVw:k:n:o:d:s:e:X:g:G:P:c:C:qQjJuUb:Z:Sp:a:rR:y:lxmMt:v:", long_options, &option_index);
 
       if (c == -1) break;	/* Exit from `while (1)' loop.  */
 
             goto failure;
         
           break;
+        case 'P':	/* Ubiquitous gene file (-j and -J refer to connections to ubiq instead of all bridging pairs).  */
+        
+        
+          if (update_arg( (void *)&(args_info->ubiqg_arg), 
+               &(args_info->ubiqg_orig), &(args_info->ubiqg_given),
+              &(local_args_info.ubiqg_given), optarg, 0, 0, ARG_STRING,
+              check_ambiguity, override, 0, 0,
+              "ubiqg", 'P',
+              additional_error))
+            goto failure;
+        
+          break;
         case 'c':	/* Term inclusion file.  */
         
         

tools/Counter/cmdline.h

 /** @file cmdline.h
  *  @brief The header file for the command line option parser
- *  generated by GNU Gengetopt version 2.22.4
+ *  generated by GNU Gengetopt version 2.22.5
  *  http://www.gnu.org/software/gengetopt.
  *  DO NOT modify this file, since it can be overwritten
  *  @author GNU Gengetopt by Lorenzo Bettini */
   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.  */
+  char * ubiqg_arg;	/**< @brief Ubiquitous gene file (-j and -J refer to connections to ubiq instead of all bridging pairs).  */
+  char * ubiqg_orig;	/**< @brief Ubiquitous gene file (-j and -J refer to connections to ubiq instead of all bridging pairs) original value given at command line.  */
+  const char *ubiqg_help; /**< @brief Ubiquitous gene file (-j and -J refer to connections to ubiq instead of all bridging pairs) help description.  */
   char * genet_arg;	/**< @brief Term inclusion file.  */
   char * genet_orig;	/**< @brief Term inclusion file original value given at command line.  */
   const char *genet_help; /**< @brief Term inclusion file help description.  */
   unsigned int contexts_given ;	/**< @brief Whether contexts was given.  */
   unsigned int genes_given ;	/**< @brief Whether genes was given.  */
   unsigned int genex_given ;	/**< @brief Whether genex was given.  */
+  unsigned int ubiqg_given ;	/**< @brief Whether ubiqg was given.  */
   unsigned int genet_given ;	/**< @brief Whether genet was given.  */
   unsigned int genee_given ;	/**< @brief Whether genee was given.  */
   unsigned int ctxtpos_given ;	/**< @brief Whether ctxtpos was given.  */

tools/DChecker/DChecker.cpp

     ETFPN		    eTFPN;
     int			    iMax;
     float		    dAnswer, dValue;
-    vector<bool>    	    vecfHere;
+    vector<bool>    	    vecfHere, vecfUbik;
     vector<float>	    vecdScores, vecdSSE, vecdBinValue;
     vector<size_t>	    veciPositives, veciNegatives, veciGenesTerm;
     ofstream		    ofsm;
     map<float,size_t>	    mapValues;
     bool		    fMapAnswers;
     CGenome		    Genome;
-    CGenes		    GenesTm( Genome );
+    CGenes		    GenesTm( Genome ), GenesUbik( Genome );
 
     if( cmdline_parser( iArgs, aszArgs, &sArgs ) ) {
         cmdline_parser_print_help( );
     }
     CMeta Meta( sArgs.verbosity_arg );
 
-    fMapAnswers = !!sArgs.memmap_flag && !( sArgs.genep_arg || sArgs.genes_arg || sArgs.genet_arg || sArgs.genex_arg || sArgs.genee_arg );
+    fMapAnswers = !!sArgs.memmap_flag && !( sArgs.genes_arg || sArgs.genet_arg || sArgs.genex_arg || sArgs.genee_arg );
     if( !Answers.Open( sArgs.answers_arg, fMapAnswers ) ) {
         cerr << "Couldn't open: " << sArgs.answers_arg << endl;
         return 1;
         cerr << "Couldn't open: " << sArgs.genes_arg << endl;
         return 1;
     }
-    if( sArgs.genep_arg && !Answers.FilterGenes( sArgs.genep_arg, CDat::EFilterIncludePos ) ) {
-        cerr << "Couldn't open: " << sArgs.genep_arg << endl;
-        return 1;
-    }
     if( sArgs.genee_arg && !Answers.FilterGenes( sArgs.genee_arg, CDat::EFilterEdge ) ) {
         cerr << "Couldn't open: " << sArgs.genee_arg << endl;
         return 1;
             MatResults.Clear( );
             MatGenes.Clear( );
 
-            if( sArgs.inputs_num ) {
+            if( sArgs.genep_arg ) {
                 CGenes		Genes( Genome );
-                ifstream	ifsm;
-
-                ifsm.open( sArgs.inputs[ iGenes ] );
-                if( !Genes.Open( ifsm ) ) {
-                    cerr << "Couldn't open: " << sArgs.inputs[ iGenes ] << endl;
+                if( !Genes.Open( sArgs.genep_arg ) ) {
+                    cerr << "Couldn't open: " << sArgs.genep_arg << endl;
                     return 1;
                 }
                 vecfHere.resize( Answers.GetGenes( ) );
-                for( i = 0; i < vecfHere.size( ); ++i )
+                for( i = 0; i < vecfHere.size( ); ++i ) {
                     vecfHere[ i ] = Genes.IsGene( Answers.GetGene( i ) );
-                cerr << "Processing " << sArgs.inputs[ iGenes ] << "..." << endl;
-                ifsm.close( );
+		}
             }
+	    if( sArgs.ubiqg_arg ) {
+		if( !GenesUbik.Open( sArgs.ubiqg_arg ) ) {
+		    cerr << "Could not open: " << sArgs.ubiqg_arg << endl;
+		    return 1;
+		}
+		vecfUbik.resize( Answers.GetGenes( ) );
+		for( i = 0; i < vecfUbik.size( ); ++i ) {
+		    vecfUbik[ i ] = GenesUbik.IsGene( Answers.GetGene( i ) );
+		}
+	    }
 
             if( mapValues.size( ) ) {
                 for( i = 0; i < Answers.GetGenes( ); ++i ) {
                                 CMeta::IsNaN( dValue = Data.Get( iOne, iTwo ) ) ||
                                 CMeta::IsNaN( dAnswer = Answers.Get( i, j ) ) )
                             continue;
-                        if( !( vecfHere.empty( ) ||
-                                ( dAnswer && vecfHere[ i ] && vecfHere[ j ] ) ||
-                                ( !dAnswer && ( vecfHere[ i ] || vecfHere[ j ] ) ) ) )
-                            continue;
+ 			if( vecfHere.size( ) ) {
+			    bool fIn = vecfHere[ i ] && vecfHere[j];
+                            if( fIn ) {
+                                if ( dAnswer && !sArgs.ctxtpos_flag ) {
+                                    continue;
+                                }
+                                else if ( !dAnswer && !sArgs.ctxtneg_flag ) {
+                                    continue;
+                                }
+                            }
+			    bool fBridge;
+			    if ( vecfUbik.size( ) ) {
+				fBridge = ( vecfUbik[ i ] && vecfHere[ j ] ) || ( vecfHere[ i ] && vecfUbik[ j ] );
+			    }
+			    else {
+				fBridge = ( vecfHere[ i ] ^ vecfHere[ j ] );
+			    }
+                            if( fBridge ) {
+                                if ( dAnswer && !sArgs.bridgepos_flag ) {
+                                    continue;
+                                }
+                                else if ( !dAnswer && !sArgs.bridgeneg_flag ) {
+                                    continue;
+                                }
+                            }
+			    bool fOut = !( fIn || fBridge);
+                            if( fOut ) {
+                                if ( dAnswer && !sArgs.outpos_flag) {
+                                    continue;
+                                }
+                                else if ( !dAnswer && !sArgs.outneg_flag ) {
+                                    continue;
+                                }
+                            }
+                        }
                         if( sArgs.invert_flag )
                             dValue = 1 - dValue;
                         for( k = 0; k <= mapValues[ dValue ]; ++k ) {
                                 CMeta::IsNaN( dAnswer = Answers.Get( i, j ) ) ||
                                 CMeta::IsNaN( dValue = Data.Get( iOne, iTwo ) ) )
                             continue;
-/* flags for positives/negatives/bridging only work in this situation, no plans
- * for using in the other situations
- */
-                        if( !( vecfHere.empty( ) ) ) {
-                            bool bOut = !( vecfHere[ i ] || vecfHere[ j ] );
-                            if( bOut ) {
+			if( vecfHere.size( ) ) {
+			    bool fIn = vecfHere[ i ] && vecfHere[j];
+                            if( fIn ) {
+                                if ( dAnswer && !sArgs.ctxtpos_flag ) {
+                                    continue;
+                                }
+                                else if ( !dAnswer && !sArgs.ctxtneg_flag ) {
+                                    continue;
+                                }
+                            }
+			    bool fBridge;
+			    if ( vecfUbik.size( ) ) {
+				fBridge = ( vecfUbik[ i ] && vecfHere[ j ] ) || ( vecfHere[ i ] && vecfUbik[ j ] );
+			    }
+			    else {
+				fBridge = ( vecfHere[ i ] ^ vecfHere[ j ] );
+			    }
+                            if( fBridge ) {
+                                if ( dAnswer && !sArgs.bridgepos_flag ) {
+                                    continue;
+                                }
+                                else if ( !dAnswer && !sArgs.bridgeneg_flag ) {
+                                    continue;
+                                }
+                            }
+			    bool fOut = !( fIn || fBridge);
+                            if( fOut ) {
                                 if ( dAnswer && !sArgs.outpos_flag) {
                                     continue;
                                 }
                                     continue;
                                 }
                             }
-                            bool bIn = vecfHere[ i ] && vecfHere[ j ];
-                            if( bIn ) {
-                                if ( dAnswer && !sArgs.ctxtpos_flag ) {
-                                    continue;
-                                }
-                                else if ( !dAnswer && !sArgs.ctxtneg_flag ) {
-                                    continue;
-                                }
-                            }
-                            bool bBridge = !( bOut || bIn );
-                            if( bBridge ) {
-                                if ( dAnswer && !sArgs.bridgepos_flag ) {
-                                    continue;
-                                }
-                                else if ( !dAnswer && !sArgs.bridgeneg_flag ) {
-                                    continue;
-                                }
-                            }
                         }
-
+			
                         MatGenes.Set( i, 0, true );
                         MatGenes.Set( j, 0, true );
                         if( dAnswer )
                                 veciNegatives[ i ]++;
                         }
                     }
-
                     MatResults.Set( 0, ETFPN_TP, iPositives );
                     MatResults.Set( 0, ETFPN_FP, iNegatives );
                     MatResults.Set( 0, ETFPN_TN, 0 );
                                 CMeta::IsNaN( dAnswer = Answers.Get( i, j ) ) ||
                                 CMeta::IsNaN( dValue = Data.Get( iOne, iTwo ) ) )
                             continue;
-                        if( !( vecfHere.empty( ) ||
-                                ( dAnswer && vecfHere[ i ] && vecfHere[ j ] ) ||
-                                ( !dAnswer && ( vecfHere[ i ] || vecfHere[ j ] ) ) ) )
-                            continue;
+			if( vecfHere.size( ) ) {
+			    cout << "Here" << endl;
+			    bool fIn = vecfHere[ i ] && vecfHere[j];
+                            if( fIn ) {
+                                if ( dAnswer && !sArgs.ctxtpos_flag ) {
+                                    continue;
+                                }
+                                else if ( !dAnswer && !sArgs.ctxtneg_flag ) {
+                                    continue;
+                                }
+                            }
+			    bool fBridge;
+			    if ( vecfUbik.size( ) ) {
+				fBridge = ( vecfUbik[ i ] && vecfHere[ j ] ) || ( vecfHere[ i ] && vecfUbik[ j ] );
+			    }
+			    else {
+				fBridge = ( vecfHere[ i ] ^ vecfHere[ j ] );
+			    }
+                            if( fBridge ) {
+                                if ( dAnswer && !sArgs.bridgepos_flag ) {
+                                    continue;
+                                }
+                                else if ( !dAnswer && !sArgs.bridgeneg_flag ) {
+                                    continue;
+                                }
+                            }
+			    bool fOut = !( fIn || fBridge );
+                            if( fOut ) {
+                                if ( dAnswer && !sArgs.outpos_flag) {
+                                    continue;
+                                }
+                                else if ( !dAnswer && !sArgs.outneg_flag ) {
+                                    continue;
+                                }
+                            }
+                        }
                         if( sArgs.invert_flag )
                             dValue = 1 - dValue;
 
                 }
             for( iPositives = iNegatives = i = 0; i < Answers.GetGenes( ); ++i )
                 for( j = ( i + 1 ); j < Answers.GetGenes( ); ++j ) {
-                    if( CMeta::IsNaN( dAnswer = Answers.Get( i, j ) ) ||
-                            !( vecfHere.empty( ) ||
-                               ( dAnswer && vecfHere[ i ] && vecfHere[ j ] ) ||
-                               ( !dAnswer && ( vecfHere[ i ] || vecfHere[ j ] ) ) ) )
+                    if( CMeta::IsNaN( dAnswer = Answers.Get( i, j ) ) ) {
                         continue;
+		    }
+ 		    if( vecfHere.size( ) ) {
+			bool fIn = vecfHere[ i ] && vecfHere[j];
+                        if( fIn ) {
+                            if ( dAnswer && !sArgs.ctxtpos_flag ) {
+                                continue;
+                            }
+                            else if ( !dAnswer && !sArgs.ctxtneg_flag ) {
+                                continue;
+                            }
+                        }
+			bool fBridge;
+		        if ( vecfUbik.size( ) ) {
+	    		fBridge = ( vecfUbik[ i ] && vecfHere[ j ] ) || ( vecfHere[ i ] && vecfUbik[ j ] );
+			}
+			else {
+			   fBridge = ( vecfHere[ i ] ^ vecfHere[ j ] );
+			}
+                        if( fBridge ) {
+                            if ( dAnswer && !sArgs.bridgepos_flag ) {
+                                continue;
+                            }
+                            else if ( !dAnswer && !sArgs.bridgeneg_flag ) {
+                                continue;
+                            }
+                        }
+		        bool fOut = !( fIn || fBridge );
+                        if( fOut ) {
+                            if ( dAnswer && !sArgs.outpos_flag) {
+                                continue;
+                            }
+                            else if ( !dAnswer && !sArgs.outneg_flag ) {
+                                continue;
+                            }
+                        }
+                    }
                     if( dAnswer )
                         iPositives++;
-                    else
+                    else {
                         iNegatives++;
+		    }
                 }
 
             veciRec.resize( MatResults.GetRows( ) );

tools/DChecker/DChecker.ggo

 							string	typestr="filename"
 option	"genex"			G	"Gene exclusion file"
 							string	typestr="filename"
+option  "ubiqg"                 P       "Ubiquitous gene file (-j and -J refer to connections to ubiq instead of all bridging pairs)"
+                                                        string  typestr="filename"
 option	"genet"			c	"Term inclusion file"
 							string	typestr="filename"
 option	"genee"			C	"Edge inclusion file"

tools/DChecker/cmdline.c

 /*
-  File autogenerated by gengetopt version 2.22.4
+  File autogenerated by gengetopt version 2.22.5
   generated with the following command:
   /usr/bin/gengetopt -iDChecker.ggo --default-optional -u -N -e 
 
   "\nLearning/Evaluation:",
   "  -g, --genes=filename       Gene inclusion file",
   "  -G, --genex=filename       Gene exclusion file",
+  "  -P, --ubiqg=filename       Ubiquitous gene file (-j and -J refer to \n                               connections to ubiq instead of all bridging \n                               pairs)",
   "  -c, --genet=filename       Term inclusion file",
   "  -C, --genee=filename       Edge inclusion file",
   "  -l, --genep=filename       Gene inclusion file for positives",
   args_info->delta_given = 0 ;
   args_info->genes_given = 0 ;
   args_info->genex_given = 0 ;
+  args_info->ubiqg_given = 0 ;
   args_info->genet_given = 0 ;
   args_info->genee_given = 0 ;
   args_info->genep_given = 0 ;
   args_info->genes_orig = NULL;
   args_info->genex_arg = NULL;
   args_info->genex_orig = NULL;
+  args_info->ubiqg_arg = NULL;
+  args_info->ubiqg_orig = NULL;
   args_info->genet_arg = NULL;
   args_info->genet_orig = NULL;
   args_info->genee_arg = NULL;
   args_info->delta_help = gengetopt_args_info_help[14] ;
   args_info->genes_help = gengetopt_args_info_help[16] ;
   args_info->genex_help = gengetopt_args_info_help[17] ;
-  args_info->genet_help = gengetopt_args_info_help[18] ;
-  args_info->genee_help = gengetopt_args_info_help[19] ;
-  args_info->genep_help = gengetopt_args_info_help[20] ;
-  args_info->ctxtpos_help = gengetopt_args_info_help[21] ;
-  args_info->ctxtneg_help = gengetopt_args_info_help[22] ;
-  args_info->bridgepos_help = gengetopt_args_info_help[23] ;
-  args_info->bridgeneg_help = gengetopt_args_info_help[24] ;
-  args_info->outpos_help = gengetopt_args_info_help[25] ;
-  args_info->outneg_help = gengetopt_args_info_help[26] ;
-  args_info->normalize_help = gengetopt_args_info_help[28] ;
-  args_info->invert_help = gengetopt_args_info_help[29] ;
-  args_info->sse_help = gengetopt_args_info_help[31] ;
-  args_info->memmap_help = gengetopt_args_info_help[32] ;
-  args_info->verbosity_help = gengetopt_args_info_help[33] ;
+  args_info->ubiqg_help = gengetopt_args_info_help[18] ;
+  args_info->genet_help = gengetopt_args_info_help[19] ;
+  args_info->genee_help = gengetopt_args_info_help[20] ;
+  args_info->genep_help = gengetopt_args_info_help[21] ;
+  args_info->ctxtpos_help = gengetopt_args_info_help[22] ;
+  args_info->ctxtneg_help = gengetopt_args_info_help[23] ;
+  args_info->bridgepos_help = gengetopt_args_info_help[24] ;
+  args_info->bridgeneg_help = gengetopt_args_info_help[25] ;
+  args_info->outpos_help = gengetopt_args_info_help[26] ;
+  args_info->outneg_help = gengetopt_args_info_help[27] ;
+  args_info->normalize_help = gengetopt_args_info_help[29] ;
+  args_info->invert_help = gengetopt_args_info_help[30] ;
+  args_info->sse_help = gengetopt_args_info_help[32] ;
+  args_info->memmap_help = gengetopt_args_info_help[33] ;
+  args_info->verbosity_help = gengetopt_args_info_help[34] ;
   
 }
 
   free_string_field (&(args_info->genes_orig));
   free_string_field (&(args_info->genex_arg));
   free_string_field (&(args_info->genex_orig));
+  free_string_field (&(args_info->ubiqg_arg));
+  free_string_field (&(args_info->ubiqg_orig));
   free_string_field (&(args_info->genet_arg));
   free_string_field (&(args_info->genet_orig));
   free_string_field (&(args_info->genee_arg));
     write_into_file(outfile, "genes", args_info->genes_orig, 0);
   if (args_info->genex_given)
     write_into_file(outfile, "genex", args_info->genex_orig, 0);
+  if (args_info->ubiqg_given)
+    write_into_file(outfile, "ubiqg", args_info->ubiqg_orig, 0);
   if (args_info->genet_given)
     write_into_file(outfile, "genet", args_info->genet_orig, 0);
   if (args_info->genee_given)
         { "delta",	1, NULL, 'e' },
         { "genes",	1, NULL, 'g' },
         { "genex",	1, NULL, 'G' },
+        { "ubiqg",	1, NULL, 'P' },
         { "genet",	1, NULL, 'c' },
         { "genee",	1, NULL, 'C' },
         { "genep",	1, NULL, 'l' },
         { 0,  0, 0, 0 }
       };
 
-      c = getopt_long (argc, argv, "hVi:w:d:a:R:b:fm:M:e:g:G:c:C:l:qQjJuUntspv:", long_options, &option_index);
+      c = getopt_long (argc, argv, "hVi:w:d:a:R:b:fm:M:e:g:G:P:c:C:l:qQjJuUntspv:", long_options, &option_index);
 
       if (c == -1) break;	/* Exit from `while (1)' loop.  */
 
             goto failure;
         
           break;
+        case 'P':	/* Ubiquitous gene file (-j and -J refer to connections to ubiq instead of all bridging pairs).  */
+        
+        
+          if (update_arg( (void *)&(args_info->ubiqg_arg), 
+               &(args_info->ubiqg_orig), &(args_info->ubiqg_given),
+              &(local_args_info.ubiqg_given), optarg, 0, 0, ARG_STRING,
+              check_ambiguity, override, 0, 0,
+              "ubiqg", 'P',
+              additional_error))
+            goto failure;
+        
+          break;
         case 'c':	/* Term inclusion file.  */
         
         

tools/DChecker/cmdline.h

 /** @file cmdline.h
  *  @brief The header file for the command line option parser
- *  generated by GNU Gengetopt version 2.22.4
+ *  generated by GNU Gengetopt version 2.22.5
  *  http://www.gnu.org/software/gengetopt.
  *  DO NOT modify this file, since it can be overwritten
  *  @author GNU Gengetopt by Lorenzo Bettini */
   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.  */
+  char * ubiqg_arg;	/**< @brief Ubiquitous gene file (-j and -J refer to connections to ubiq instead of all bridging pairs).  */
+  char * ubiqg_orig;	/**< @brief Ubiquitous gene file (-j and -J refer to connections to ubiq instead of all bridging pairs) original value given at command line.  */
+  const char *ubiqg_help; /**< @brief Ubiquitous gene file (-j and -J refer to connections to ubiq instead of all bridging pairs) help description.  */
   char * genet_arg;	/**< @brief Term inclusion file.  */
   char * genet_orig;	/**< @brief Term inclusion file original value given at command line.  */
   const char *genet_help; /**< @brief Term inclusion file help description.  */
   unsigned int delta_given ;	/**< @brief Whether delta was given.  */
   unsigned int genes_given ;	/**< @brief Whether genes was given.  */
   unsigned int genex_given ;	/**< @brief Whether genex was given.  */
+  unsigned int ubiqg_given ;	/**< @brief Whether ubiqg was given.  */
   unsigned int genet_given ;	/**< @brief Whether genet was given.  */
   unsigned int genee_given ;	/**< @brief Whether genee was given.  */
   unsigned int genep_given ;	/**< @brief Whether genep was given.  */
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.