[med-svn] [Git][med-team/hyphy][master] 4 commits: New upstream version 2.5.41+dfsg

Andreas Tille (@tille) gitlab at salsa.debian.org
Wed Aug 24 13:15:12 BST 2022



Andreas Tille pushed to branch master at Debian Med / hyphy


Commits:
84ba2718 by Andreas Tille at 2022-08-24T14:07:43+02:00
New upstream version 2.5.41+dfsg
- - - - -
e3d3f390 by Andreas Tille at 2022-08-24T14:07:43+02:00
routine-update: New upstream version

- - - - -
112db933 by Andreas Tille at 2022-08-24T14:07:50+02:00
Update upstream source from tag 'upstream/2.5.41+dfsg'

Update to upstream version '2.5.41+dfsg'
with Debian dir 6d39ba61eaab851e6b3e4ef227c6552a3f78e7a3
- - - - -
fd446338 by Andreas Tille at 2022-08-24T14:11:20+02:00
routine-update: Ready to upload to unstable

- - - - -


9 changed files:

- CMakeLists.txt
- debian/changelog
- res/TemplateBatchFiles/SelectionAnalyses/MEME.bf
- res/TemplateBatchFiles/SelectionAnalyses/RELAX.bf
- res/TemplateBatchFiles/libv3/all-terms.bf
- res/TemplateBatchFiles/libv3/tasks/estimators.bf
- src/core/global_things.cpp
- src/core/likefunc.cpp
- src/core/tree.cpp


Changes:

=====================================
CMakeLists.txt
=====================================
@@ -289,6 +289,11 @@ endif(NOT DEFINED DEFAULT_WARNING_FLAGS)
 #-------------------------------------------------------------------------------
 find_package(OpenMP)
 
+# emulate missing OpenMP for testing
+
+#set (OPENMP_FOUND FALSE)
+#set (OpenMP_CXX_FLAGS "")
+
 #-------------------------------------------------------------------------------
 # default installation prefix
 #-------------------------------------------------------------------------------


=====================================
debian/changelog
=====================================
@@ -1,3 +1,9 @@
+hyphy (2.5.41+dfsg-1) unstable; urgency=medium
+
+  * New upstream version
+
+ -- Andreas Tille <tille at debian.org>  Wed, 24 Aug 2022 14:08:01 +0200
+
 hyphy (2.5.40+dfsg-1) unstable; urgency=medium
 
   * New upstream version 2.5.40+dfsg


=====================================
res/TemplateBatchFiles/SelectionAnalyses/MEME.bf
=====================================
@@ -791,6 +791,7 @@ lfunction meme.handle_a_site (lf_fel, lf_bsrel, filter_data, partition_index, pa
                     utility.getGlobalValue("terms.empirical_bayes_factor") : branch_ebf,
                     utility.getGlobalValue("terms.branch_selection_attributes") : branch_substitution_information, //TODO: keep this attr?
                     utility.getGlobalValue("terms.Null"): Null,
+                    utility.getGlobalValue("terms.substitutions") : compressed_substitution_info,
                     utility.getGlobalValue("terms.simulated"): null_LRT
                 };
             } 


=====================================
res/TemplateBatchFiles/SelectionAnalyses/RELAX.bf
=====================================
@@ -31,7 +31,8 @@ LoadFunctionLibrary("libv3/models/rate_variation.bf");
 utility.SetEnvVariable ("NORMALIZE_SEQUENCE_NAMES", TRUE);
 utility.SetEnvVariable ("ASSUME_REVERSIBLE_MODELS", TRUE);
 utility.SetEnvVariable ("USE_MEMORY_SAVING_DATA_STRUCTURES", 1e8);
-u
+
+//relax.OPTIMIZATION_LOGS = 1;
 
 /*------------------------------------------------------------------------------*/
 
@@ -386,7 +387,7 @@ if (relax.multi_hit == "None") {
             relax.rate_class_arguments = {{relax.synonymous_rate_classes__,relax.rate_classes__}};
         } else {
     
-            lfunction relax.model.with.GDD (type, code, rates) {        
+            lfunction relax.model.MH.with.GDD (type, code, rates) {        
                 def = relax.model.BS_REL_MH (type, code, rates);
                 options = {utility.getGlobalValue("terms.rate_variation.bins") : utility.getGlobalValue("relax.synonymous_rate_classes"),
                            utility.getGlobalValue("terms._namespace") : "relax._shared_srv"};
@@ -398,7 +399,7 @@ if (relax.multi_hit == "None") {
                 return def;
             }
         
-            relax.model_generator = "relax.model.with.GDD";
+            relax.model_generator = "relax.model.MH.with.GDD";
             relax.rate_class_arguments = relax.rate_classes;
         }
     } else {
@@ -463,7 +464,6 @@ if (relax.model_set == "All") { // run all the models
         selection.io.startTimer (relax.json [terms.json.timers], "General descriptive model fitting", 2);
 
         
-        
 
         if (Type (relax.ge_guess) != "Matrix") {
         
@@ -507,7 +507,8 @@ if (relax.model_set == "All") { // run all the models
                                                 } ,
                                      
                                             terms.search_grid : relax.initial_grid,
-                                            terms.search_restarts : relax.N.initial_guesses
+                                            terms.search_restarts : relax.N.initial_guesses,
+                                            terms.run_options.optimization_log : relax.optimization_log_file (".GE-1-log.json")
                                         }
             );
             
@@ -520,7 +521,8 @@ if (relax.model_set == "All") { // run all the models
                                         relax.model_object_map,
                                         {
                                             terms.run_options.apply_user_constraints: "relax.init.k",
-                                            terms.run_options.retain_lf_object : TRUE
+                                            terms.run_options.retain_lf_object : TRUE,
+                                            terms.run_options.optimization_log :  relax.optimization_log_file(".GE-2-log.json")
 
                                         });
                                         
@@ -534,7 +536,8 @@ if (relax.model_set == "All") { // run all the models
                                             relax.model_object_map,
                                             {
                                                 terms.run_options.apply_user_constraints: "relax.init.k",
-                                                terms.run_options.retain_lf_object : TRUE
+                                                terms.run_options.retain_lf_object : TRUE,
+                                                terms.run_options.run_options.optimization_log :  relax.optimization_log_file(".GE-log.json")
 
                                             });
        }
@@ -621,7 +624,7 @@ if (relax.model_set == "All") { // run all the models
 
 /* now fit the two main models for RELAX */
 
-if (relax.analysis_run_mode == relax.kGroupMode) {
+if (relax.analysis_run_mode != relax.kGroupMode) {
 	io.ReportProgressMessageMD ("RELAX", "alt", "Fitting the alternative model to test K != 1");
 } else {
 	io.ReportProgressMessageMD ("RELAX", "alt", "Fitting the alternative model with individual K parameters for " + relax.numbers_of_tested_groups + " branch groups");
@@ -938,13 +941,17 @@ function relax.FitMainTestPair () {
                                  
                                         terms.search_grid : relax.initial_grid,
                                         terms.search_restarts : relax.N.initial_guesses
+                        
                                     }
         );
         
     }
     
+    //fprintf ("/Users/sergei/Desktop/gd.json", CLEAR_FILE, relax.general_descriptive.fit); 
+    //fscanf ("/Users/sergei/Desktop/gd.json", "Raw", relax.general_descriptive.fit);
+    relax.general_descriptive.fit = Eval (relax.general_descriptive.fit);
 
-	relax.alternative_model.fit =  estimators.FitLF (relax.filter_names, relax.trees, { "0" : relax.model_map}, relax.general_descriptive.fit, relax.model_object_map, {terms.run_options.retain_lf_object: TRUE});
+	relax.alternative_model.fit =  estimators.FitLF (relax.filter_names, relax.trees, { "0" : relax.model_map}, relax.general_descriptive.fit, relax.model_object_map, {terms.run_options.retain_lf_object: TRUE, terms.run_options.optimization_log :  relax.optimization_log_file ( "MainALT-log.json")});
 	io.ReportProgressMessageMD("RELAX", "alt", "* " + selection.io.report_fit (relax.alternative_model.fit, 9, relax.codon_data_info[terms.data.sample_size]));
 
     KeywordArgument ("save-fit", "Save RELAX alternative model fit to this file (default is not to save)", "/dev/null");
@@ -997,7 +1004,9 @@ function relax.FitMainTestPair () {
 			relax.alternative_model.fit.take2 =  estimators.FitLF (relax.filter_names, relax.trees, { "0" : relax.model_map},
 																   relax.alternative_model.fit ,
 																   relax.model_object_map,
-																   {terms.run_options.retain_lf_object: TRUE}
+																   {
+																    terms.run_options.retain_lf_object: TRUE,
+																    terms.run_options.optimization_log :  relax.optimization_log_file("MainALT-redo-log.json")}
 																   );
 
 
@@ -1121,7 +1130,7 @@ function relax.FitMainTestPair () {
 
 
 	if (relax.LRT[terms.p_value] <= relax.p_threshold) {
-		if ( relax.numbers_of_tested_groups == 2) {
+		if ( relax.numbers_of_tested_groups == 2 && relax.analysis_run_mode != relax.kGroupMode) {
 			if (relax.fitted.K > 1) {
 				console.log (">Evidence for *intensification of selection* among **test** branches _relative_ to the **reference** branches at P<="+ relax.p_threshold);
 			} else {
@@ -1132,7 +1141,7 @@ function relax.FitMainTestPair () {
 	
 		}
 	} else {
-		if ( relax.numbers_of_tested_groups == 2) {
+		if ( relax.numbers_of_tested_groups == 2 && relax.analysis_run_mode != relax.kGroupMode) {
 			console.log (">No significant evidence for relaxation (or intensification) of selection among **test** branches _relative_ to the **reference** branches at P<="+ relax.p_threshold);
 		} else {
 			console.log (">>No significant evidence for differences of selective pressures among the test groups at P<="+ relax.p_threshold);
@@ -1712,6 +1721,14 @@ lfunction relax._renormalize (v, distro, mean) {
     
 }
 
+//------------------------------------------------------------------------------
+function relax.optimization_log_file (extension) {
+    if (relax.OPTIMIZATION_LOGS) {
+        return relax.codon_data_info [terms.json.json] + extension;
+    }   
+    return None;
+}
+
 //------------------------------------------------------------------------------
 
 //------------------------------------------------------------------------------


=====================================
res/TemplateBatchFiles/libv3/all-terms.bf
=====================================
@@ -493,6 +493,8 @@ namespace terms{
         apply_user_constraints            = "apply-user-constraints";
         optimization_settings             = "optimization-settings";
         keep_filters                      = "use-filters";
+        optimization_log                  = "optimization_log";
+
     }
 
 


=====================================
res/TemplateBatchFiles/libv3/tasks/estimators.bf
=====================================
@@ -172,8 +172,6 @@ function estimators.SetGlobals2(key2, value) {
     }
 
     
- 
-    
 
     estimators.ApplyExistingEstimates.set_globals[key3] = {
         terms.id: key3,
@@ -182,11 +180,11 @@ function estimators.SetGlobals2(key2, value) {
 
     __init_value = (initial_values[terms.global])[key3];
     
+    
     if (Type(__init_value) != "AssociativeList") {
         __init_value = (initial_values[terms.global])[key2];
     }
 
-    
     if (Type(__init_value) == "AssociativeList") {
         if (__init_value[terms.fix]) {
             estimators.ApplyExistingEstimates.df_correction += parameters.IsIndependent(value);
@@ -493,7 +491,6 @@ function estimators.ApplyExistingEstimatesToTree (_tree_name, model_descriptions
 
     SetParameter (DEFER_CONSTRAINT_APPLICATION, 1, 0);
 
-
     estimators.ApplyExistingEstimatesToTree.constraint_count = 0;
 
 
@@ -795,6 +792,11 @@ lfunction estimators.FitLF(data_filter, tree, model_map, initial_values, model_o
 
     
     
+    optimization_log = utility.Has (run_options, utility.getGlobalValue("terms.run_options.optimization_log"),"String");
+    if (optimization_log) {
+        utility.ToggleEnvVariable("PRODUCE_OPTIMIZATION_LOG", 1);
+    }
+    
     if (Type (can_do_restarts) == "AssociativeList") {
         io.ReportProgressBar("", "Working on crude initial optimizations");
         bestlog    = -1e100;
@@ -827,6 +829,14 @@ lfunction estimators.FitLF(data_filter, tree, model_map, initial_values, model_o
     }
 
 
+    if (optimization_log) {
+        utility.ToggleEnvVariable("PRODUCE_OPTIMIZATION_LOG", None);
+        utility.ToggleEnvVariable("USE_JSON_FOR_MATRIX", TRUE);
+
+        fprintf (run_options[utility.getGlobalValue("terms.run_options.optimization_log")], CLEAR_FILE, ^((&likelihoodFunction) + ".trace"));
+        utility.ToggleEnvVariable("USE_JSON_FOR_MATRIX", None);
+     }
+
 
     if (Type(initial_values) == "AssociativeList") {
         utility.ToggleEnvVariable("USE_LAST_RESULTS", None);


=====================================
src/core/global_things.cpp
=====================================
@@ -122,7 +122,7 @@ namespace hy_global {
                      kErrorStringDatasetRefIndexError ("Dataset index reference out of range"),
                      kErrorStringMatrixExportError    ("Export matrix called with a non-polynomial matrix argument"),
                      kErrorStringNullOperand          ("Attempting to operate on an undefined value; this is probably the result of an earlier 'soft' error condition"),
-                     kHyPhyVersion  = _String ("2.5.40"),
+                     kHyPhyVersion  = _String ("2.5.41"),
     
                     kNoneToken = "None",
                     kNullToken = "null",


=====================================
src/core/likefunc.cpp
=====================================
@@ -5464,6 +5464,13 @@ long    _LikelihoodFunction::Bracket (long index, hyFloat& left, hyFloat& middle
                           BufferToConsole (buf);
                         }
                     }
+                    if (isnan (left)) {
+                        left = lowerBound;
+                    }
+                    if (isnan (right)) {
+                        right = middle + rightStep;
+                    }
+
                     return -2;
                 } else {
                     middle=lowerBound+2.*leftStep;
@@ -5511,6 +5518,12 @@ long    _LikelihoodFunction::Bracket (long index, hyFloat& left, hyFloat& middle
                           BufferToConsole (buf);
                         }
                     }
+                    if (isnan (left)) {
+                        left = middle - leftStep;
+                    }
+                    if (isnan (right)) {
+                        right = upperBound;
+                    }
                     return -2;
                 } else {
                     middle=MAX(upperBound-2.0*rightStep,lowerBound+leftStep);
@@ -6944,13 +6957,14 @@ void    _LikelihoodFunction::LocateTheBump (long index,hyFloat gPrecision, hyFlo
                right = -INFINITY,
                middle           = bestVal,
                leftValue        = NAN,
-               middleValue       = maxSoFar,
-               rightValue      = NAN,
+               middleValue      = maxSoFar,
+               rightValue       = NAN,
                bp               = 2.*gPrecision,
                brentPrec        = bracketSetting>0.?bracketSetting:gPrecision,
                originalValue         = index >= 0 ? GetIthIndependent(index) : 0.;
 
     DetermineLocalUpdatePolicy           ();
+    
 
     /*if (optimizatonHistory && ((_AssociativeList*)this->optimizatonHistory->GetByKey("Phases"))->Length() == 2171) {
         verbosity_level = 1000;
@@ -7140,7 +7154,21 @@ void    _LikelihoodFunction::LocateTheBump (long index,hyFloat gPrecision, hyFlo
     }
 
     if (index >= 0) {
-      LoggerSingleVariable (index, maxSoFar, bp, brentPrec, outcome != -1 ? right-left : -1., GetIthIndependent(index)-originalValue, bracket_step_count, likeFuncEvalCallCount-inCount-bracket_step_count, matrix_exp_count - inECount);
+        if (isnan (left) || isnan (right)) {
+            char buf [256];
+            snprintf (buf, 256, "\n\t[_LikelihoodFunction::LocateTheBump (index %ld) NAN left or right]", index);
+            _TerminateAndDump (_String (buf) & "\n" &  "\nParameter name " & *GetIthIndependentName(index));
+        }
+        
+        LoggerSingleVariable (index,
+                            maxSoFar,
+                            bp,
+                            brentPrec,
+                            outcome != -1 ? right-left : -1.,
+                            GetIthIndependent(index)-originalValue,
+                            bracket_step_count,
+                            likeFuncEvalCallCount-inCount-bracket_step_count,
+                            matrix_exp_count - inECount);
     }
 
     oneDFCount += likeFuncEvalCallCount-inCount-bracket_step_count;


=====================================
src/core/tree.cpp
=====================================
@@ -2745,7 +2745,6 @@ void        _TheTree::ExponentiateMatrices  (_List& expNodes, long tc, long catI
     
     _List * computedExponentials = hasExpForm? new _List (matrixQueue.lLength) : nil;
     
-#ifdef _OPENMP
     _SimpleList parallel, serial;
     isExplicitForm.Each ([&parallel,&serial](long mx_count, unsigned long id) -> void {
         if (mx_count < 0) serial << id; else parallel << id;
@@ -2755,7 +2754,6 @@ void        _TheTree::ExponentiateMatrices  (_List& expNodes, long tc, long catI
     unsigned long cs = cBase<20 ? 10 : (cBase < 60 ? 5 : 2);
 
     //printf ("_TheTree::ExponentiateMatrices %d total, %d no update, (block update %d)\n", parallel.lLength, serial.lLength, nt);
-#endif
 
     if (parallel.lLength) {
 #ifdef _OPENMP



View it on GitLab: https://salsa.debian.org/med-team/hyphy/-/compare/a69cab1e90d3708841e7523967204296be7bc1fa...fd4463385d6079b9f28fea4532ac725ca6655bbb

-- 
View it on GitLab: https://salsa.debian.org/med-team/hyphy/-/compare/a69cab1e90d3708841e7523967204296be7bc1fa...fd4463385d6079b9f28fea4532ac725ca6655bbb
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20220824/af1e24a4/attachment-0001.htm>


More information about the debian-med-commit mailing list