Commits

Anonymous committed 52db7f6

Add absolute weighting to Combiner
Add Linux build for Clinician
Fix Hubber hubbiness calculation for sparse networks

  • Participants
  • Parent commits a32a87b

Comments (0)

Files changed (8)

 fi
 
 
-                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ac_config_files="$ac_config_files Makefile src/Makefile tools/Makefile tools/Answerer/Makefile tools/Cliquer/Makefile tools/Clusterer/Makefile tools/Clusters2Dab/Makefile tools/COALESCE/Makefile tools/Combiner/Makefile tools/DChecker/Makefile tools/Dat2Dab/Makefile tools/Dat2Graph/Makefile tools/Data2Bnt/Makefile tools/Data2Features/Makefile tools/Data2Sql/Makefile tools/DataDumper/Makefile tools/Distancer/Makefile tools/Explainer/Makefile tools/Filterer/Makefile tools/Funcaeologist/Makefile tools/Funcifier/Makefile tools/Funcographer/Makefile tools/Hubber/Makefile tools/KNNImputer/Makefile tools/Mat2Txt/Makefile tools/MCluster/Makefile tools/Matcher/Makefile tools/MIer/Makefile tools/Normalizer/Makefile tools/Orthologer/Makefile tools/Overlapper/Makefile tools/PCLPlotter/Makefile tools/Randomizer/Makefile tools/Seqs2Ngrams/Makefile tools/SMRF/Makefile tools/SVDer/Makefile tools/Synthesizer/Makefile tools/Txt2Bin/Makefile tools/BNConverter/Makefile tools/BNCreator/Makefile tools/BNEvaluator/Makefile tools/BNFunc/Makefile tools/BNTester/Makefile tools/BNTruster/Makefile tools/BNs2Txt/Makefile tools/BNUnraveler/Makefile tools/BNWeaver/Makefile tools/Contexter/Makefile tools/Counter/Makefile tools/Data2DB/Makefile tools/DSLConverter/Makefile tools/Dab2Dad/Makefile tools/Edges2Posteriors/Makefile tools/MEFIT/Makefile tools/Data2Svm/Makefile tools/SVMer/Makefile tools/OntoShell/Makefile tools/BNServer/Makefile"
+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              ac_config_files="$ac_config_files Makefile src/Makefile tools/Makefile tools/Answerer/Makefile tools/Cliquer/Makefile tools/Clinician/Makefile tools/Clusterer/Makefile tools/Clusters2Dab/Makefile tools/COALESCE/Makefile tools/Combiner/Makefile tools/DChecker/Makefile tools/Dat2Dab/Makefile tools/Dat2Graph/Makefile tools/Data2Bnt/Makefile tools/Data2Features/Makefile tools/Data2Sql/Makefile tools/DataDumper/Makefile tools/Distancer/Makefile tools/Explainer/Makefile tools/Filterer/Makefile tools/Funcaeologist/Makefile tools/Funcifier/Makefile tools/Funcographer/Makefile tools/Hubber/Makefile tools/KNNImputer/Makefile tools/Mat2Txt/Makefile tools/MCluster/Makefile tools/Matcher/Makefile tools/MIer/Makefile tools/Normalizer/Makefile tools/Orthologer/Makefile tools/Overlapper/Makefile tools/PCLPlotter/Makefile tools/Randomizer/Makefile tools/Seqs2Ngrams/Makefile tools/SMRF/Makefile tools/SVDer/Makefile tools/Synthesizer/Makefile tools/Txt2Bin/Makefile tools/BNConverter/Makefile tools/BNCreator/Makefile tools/BNEvaluator/Makefile tools/BNFunc/Makefile tools/BNTester/Makefile tools/BNTruster/Makefile tools/BNs2Txt/Makefile tools/BNUnraveler/Makefile tools/BNWeaver/Makefile tools/Contexter/Makefile tools/Counter/Makefile tools/Data2DB/Makefile tools/DSLConverter/Makefile tools/Dab2Dad/Makefile tools/Edges2Posteriors/Makefile tools/MEFIT/Makefile tools/Data2Svm/Makefile tools/SVMer/Makefile tools/OntoShell/Makefile tools/BNServer/Makefile"
 
 
 
   "tools/Makefile" ) CONFIG_FILES="$CONFIG_FILES tools/Makefile" ;;
   "tools/Answerer/Makefile" ) CONFIG_FILES="$CONFIG_FILES tools/Answerer/Makefile" ;;
   "tools/Cliquer/Makefile" ) CONFIG_FILES="$CONFIG_FILES tools/Cliquer/Makefile" ;;
+  "tools/Clinician/Makefile" ) CONFIG_FILES="$CONFIG_FILES tools/Clinician/Makefile" ;;
   "tools/Clusterer/Makefile" ) CONFIG_FILES="$CONFIG_FILES tools/Clusterer/Makefile" ;;
   "tools/Clusters2Dab/Makefile" ) CONFIG_FILES="$CONFIG_FILES tools/Clusters2Dab/Makefile" ;;
   "tools/COALESCE/Makefile" ) CONFIG_FILES="$CONFIG_FILES tools/COALESCE/Makefile" ;;

File configure.ac

                  tools/Makefile \
 		 tools/Answerer/Makefile \
 		 tools/Cliquer/Makefile \
+		 tools/Clinician/Makefile \
 		 tools/Clusterer/Makefile \
 		 tools/Clusters2Dab/Makefile \
 		 tools/COALESCE/Makefile \

File tools/Combiner/Combiner.cpp

 	CHalfMatrix<float>		MatCounts;
 	size_t					i, j, k, iOne, iTwo, iA, iB;
 	vector<vector<size_t> >	vecveciGenes;
-	float					d, dWeight, dWeights;
+	float					d, dWeight1, dWeight2;
 	vector<string>			vecstrFiles, vecstrTerms;
 	CPCL					PCLWeights( false );
 	CGenome					Genome;
 		MatCounts.Initialize( DatOut.GetGenes( ) );
 		MatCounts.Clear( ); }
 	vecsetiGenes.resize( DatOut.GetGenes( ) );
-	for( dWeights = 0,i = 0; i < sArgs.inputs_num; ++i ) {
+	for( i = 0; i < sArgs.inputs_num; ++i ) {
 		if( !DatCur.Open( sArgs.inputs[ i ], !!sArgs.memmap_flag && !sArgs.normalize_flag && !GenesIn.GetGenes( ) ) ) {
 			cerr << "Couldn't open: " << sArgs.inputs[ i ] << endl;
 			return 1; }
 			if( ( j = PCLWeights.GetGene( CMeta::Deextension( CMeta::Basename( sArgs.inputs[ i ] ) ) ) ) == -1 ) {
 				cerr << "Ignoring unweighted graph: " << sArgs.inputs[ i ] << endl;
 				continue; }
-			dWeight = PCLWeights.Get( j, 0 ); }
+			dWeight1 = PCLWeights.Get( j, 0 );
+			dWeight2 = sArgs.reweight_flag ? 1 : dWeight1; }
 		else
-			dWeight = 1;
+			dWeight1 = dWeight2 = 1;
 		cerr << "Opened: " << sArgs.inputs[ i ] << endl;
 		if( sArgs.normalize_flag )
 			DatCur.Normalize( CDat::ENormalizeZScore );
 							continue;
 						switch( eMethod ) {
 							case EMethodGMean:
-								DatOut.Get( iOne, iTwo ) *= pow( d, dWeight );
-								MatCounts.Get( iOne, iTwo ) += dWeight;
+								DatOut.Get( iOne, iTwo ) *= pow( d, dWeight1 );
+								MatCounts.Get( iOne, iTwo ) += dWeight2;
 								break;
 
 							case EMethodHMean:
-								DatOut.Get( iOne, iTwo ) += dWeight / d;
-								MatCounts.Get( iOne, iTwo ) += dWeight;
+								DatOut.Get( iOne, iTwo ) += dWeight1 / d;
+								MatCounts.Get( iOne, iTwo ) += dWeight2;
 								break;
 
 							case EMethodMax:
 								break;
 
 							default:
-								DatOut.Get( iOne, iTwo ) += dWeight * d;
-								MatCounts.Get( iOne, iTwo ) += dWeight; } } } } }
+								DatOut.Get( iOne, iTwo ) += dWeight1 * d;
+								MatCounts.Get( iOne, iTwo ) += dWeight2; } } } } }
 	for( i = 0; i < DatOut.GetGenes( ); ++i )
 		for( j = ( i + 1 ); j < DatOut.GetGenes( ); ++j )
 			switch( eMethod ) {

File tools/Combiner/Combiner.ggo

 						string	typestr="filename"
 
 section "Optional"
+option	"reweight"	W	"Treat weights as absolute"
+						flag	off
 option	"skip"		k	"Columns to skip in input PCLs"
 						int	default="2"
 option	"memmap"	p	"Memory map input files"

File tools/Combiner/cmdline.c

   "  -g, --genes=filename       Process only genes from the given set",
   "  -e, --terms=filename       Produce DAT/DABs averaging within the provided \n                               terms",
   "\nOptional:",
+  "  -W, --reweight             Treat weights as absolute  (default=off)",
   "  -k, --skip=INT             Columns to skip in input PCLs  (default=`2')",
   "  -p, --memmap               Memory map input files  (default=off)",
   "  -n, --normalize            Normalize inputs before combining  (default=off)",
   args_info->intersection_given = 0 ;
   args_info->genes_given = 0 ;
   args_info->terms_given = 0 ;
+  args_info->reweight_given = 0 ;
   args_info->skip_given = 0 ;
   args_info->memmap_given = 0 ;
   args_info->normalize_given = 0 ;
   args_info->genes_orig = NULL;
   args_info->terms_arg = NULL;
   args_info->terms_orig = NULL;
+  args_info->reweight_flag = 0;
   args_info->skip_arg = 2;
   args_info->skip_orig = NULL;
   args_info->memmap_flag = 0;
   args_info->intersection_help = gengetopt_args_info_help[9] ;
   args_info->genes_help = gengetopt_args_info_help[11] ;
   args_info->terms_help = gengetopt_args_info_help[12] ;
-  args_info->skip_help = gengetopt_args_info_help[14] ;
-  args_info->memmap_help = gengetopt_args_info_help[15] ;
-  args_info->normalize_help = gengetopt_args_info_help[16] ;
-  args_info->subset_help = gengetopt_args_info_help[17] ;
-  args_info->verbosity_help = gengetopt_args_info_help[18] ;
+  args_info->reweight_help = gengetopt_args_info_help[14] ;
+  args_info->skip_help = gengetopt_args_info_help[15] ;
+  args_info->memmap_help = gengetopt_args_info_help[16] ;
+  args_info->normalize_help = gengetopt_args_info_help[17] ;
+  args_info->subset_help = gengetopt_args_info_help[18] ;
+  args_info->verbosity_help = gengetopt_args_info_help[19] ;
   
 }
 
     write_into_file(outfile, "genes", args_info->genes_orig, 0);
   if (args_info->terms_given)
     write_into_file(outfile, "terms", args_info->terms_orig, 0);
+  if (args_info->reweight_given)
+    write_into_file(outfile, "reweight", 0, 0 );
   if (args_info->skip_given)
     write_into_file(outfile, "skip", args_info->skip_orig, 0);
   if (args_info->memmap_given)
         { "intersection",	1, NULL, 'r' },
         { "genes",	1, NULL, 'g' },
         { "terms",	1, NULL, 'e' },
+        { "reweight",	0, NULL, 'W' },
         { "skip",	1, NULL, 'k' },
         { "memmap",	0, NULL, 'p' },
         { "normalize",	0, NULL, 'n' },
         { NULL,	0, NULL, 0 }
       };
 
-      c = getopt_long (argc, argv, "hVt:m:o:w:j:r:g:e:k:pns:v:", long_options, &option_index);
+      c = getopt_long (argc, argv, "hVt:m:o:w:j:r:g:e:Wk:pns:v:", long_options, &option_index);
 
       if (c == -1) break;	/* Exit from `while (1)' loop.  */
 
             goto failure;
         
           break;
+        case 'W':	/* Treat weights as absolute.  */
+        
+        
+          if (update_arg((void *)&(args_info->reweight_flag), 0, &(args_info->reweight_given),
+              &(local_args_info.reweight_given), optarg, 0, 0, ARG_FLAG,
+              check_ambiguity, override, 1, 0, "reweight", 'W',
+              additional_error))
+            goto failure;
+        
+          break;
         case 'k':	/* Columns to skip in input PCLs.  */
         
         

File tools/Combiner/cmdline.h

   char * terms_arg;	/**< @brief Produce DAT/DABs averaging within the provided terms.  */
   char * terms_orig;	/**< @brief Produce DAT/DABs averaging within the provided terms original value given at command line.  */
   const char *terms_help; /**< @brief Produce DAT/DABs averaging within the provided terms help description.  */
+  int reweight_flag;	/**< @brief Treat weights as absolute (default=off).  */
+  const char *reweight_help; /**< @brief Treat weights as absolute help description.  */
   int skip_arg;	/**< @brief Columns to skip in input PCLs (default='2').  */
   char * skip_orig;	/**< @brief Columns to skip in input PCLs original value given at command line.  */
   const char *skip_help; /**< @brief Columns to skip in input PCLs help description.  */
   unsigned int intersection_given ;	/**< @brief Whether intersection was given.  */
   unsigned int genes_given ;	/**< @brief Whether genes was given.  */
   unsigned int terms_given ;	/**< @brief Whether terms was given.  */
+  unsigned int reweight_given ;	/**< @brief Whether reweight was given.  */
   unsigned int skip_given ;	/**< @brief Whether skip was given.  */
   unsigned int memmap_given ;	/**< @brief Whether memmap was given.  */
   unsigned int normalize_given ;	/**< @brief Whether normalize was given.  */

File tools/Hubber/Hubber.cpp

 	for( iRet = i = 0; i < vecdHub.size( ); ++i ) {
 		if( veciHub[ i ] > iRet )
 			iRet = veciHub[ i ];
-		vecdHub[ i ] /= veciHub[ i ] ? veciHub[ i ] : 1; }
+		vecdHub[ i ] = veciHub[ i ] ? ( vecdHub[ i ] / veciHub[ i ] ) : CMeta::GetNaN( ); }
 
 	return iRet; }
 
 
 	sDatum.m_dHubbiness = sDatum.m_dHubbinessStd = 0;
 	for( iCount = i = 0; i < Dat.GetGenes( ); ++i )
-		if( !vecfOutside[ i ] ) {
+		if( !vecfOutside[ i ] && !CMeta::IsNaN( d = vecdHub[ i ] ) ) {
 			iCount++;
-			d = vecdHub[ i ];
 			sDatum.m_dHubbiness += d;
 			sDatum.m_dHubbinessStd += d * d; }
 	i = pGenes ? iCount : iGenes;

File tools/Makefile.am

   TOOLS_SUBDIRS = \
           Answerer \
 	  Cliquer \
+	  Clinician \
 	  Clusterer \
 	  Clusters2Dab \
 	  COALESCE \