[med-svn] [Git][med-team/hyphy][upstream] New upstream version 2.5.23+dfsg

Nilesh Patra gitlab at salsa.debian.org
Wed Nov 18 20:14:27 GMT 2020



Nilesh Patra pushed to branch upstream at Debian Med / hyphy


Commits:
e5b51d8b by Nilesh Patra at 2020-11-18T20:06:37+00:00
New upstream version 2.5.23+dfsg
- - - - -


11 changed files:

- .github/workflows/coverage.yml
- res/TemplateBatchFiles/SelectionAnalyses/BUSTED.bf
- res/TemplateBatchFiles/SelectionAnalyses/PRIME.bf
- res/TemplateBatchFiles/SelectionAnalyses/RELAX.bf
- res/TemplateBatchFiles/SelectionAnalyses/SLAC.bf
- res/TemplateBatchFiles/SelectionAnalyses/contrast-fel.bf
- src/core/batchlanhelpers.cpp
- src/core/global_things.cpp
- src/core/likefunc.cpp
- src/core/trie.cpp
- src/mains/unix.cpp


Changes:

=====================================
.github/workflows/coverage.yml
=====================================
@@ -21,7 +21,7 @@ jobs:
       - name: Get HyPhy code
         uses: actions/checkout at v2
       - name: Install and activate miniconda
-        uses: goanpeca/setup-miniconda at v1
+        uses: conda-incubator/setup-miniconda at v2
         with:
           activate-environment: 'hyphy-test-env'
           environment-file: '.coveralls.env.yml'


=====================================
res/TemplateBatchFiles/SelectionAnalyses/BUSTED.bf
=====================================
@@ -166,6 +166,8 @@ busted.json[busted.json.background] =  busted.has_background;
 
 selection.io.startTimer (busted.json [terms.json.timers], "Preliminary model fitting", 1);
 
+namespace_tag = "busted";
+
 namespace busted {
     doGTR ("busted");
 }


=====================================
res/TemplateBatchFiles/SelectionAnalyses/PRIME.bf
=====================================
@@ -159,6 +159,7 @@ prime.pairwise_counts = genetic_code.ComputePairwiseDifferencesAndExpectedSites(
 selection.io.startTimer (prime.json [terms.json.timers], "Model fitting",1);
 
 if (Type (debug.checkpoint) != "String") {
+    namespace_tag = "prime";
     namespace prime {
         doGTR ("prime");
     }


=====================================
res/TemplateBatchFiles/SelectionAnalyses/RELAX.bf
=====================================
@@ -263,6 +263,8 @@ if (relax.do_srv) {
 
 selection.io.startTimer (relax.json [terms.json.timers], "Preliminary model fitting", 1);
 
+namespace_tag = "relax";
+
 namespace relax {
     doGTR ("relax");
 }


=====================================
res/TemplateBatchFiles/SelectionAnalyses/SLAC.bf
=====================================
@@ -145,6 +145,8 @@ utility.ForEachPair (slac.selected_branches, "_partition_", "_selection_",
 
 selection.io.startTimer (slac.json [terms.json.timers], "Model fitting",1 );
 
+namespace_tag = "slac";
+
 namespace slac {
     doGTR ("slac");
 }


=====================================
res/TemplateBatchFiles/SelectionAnalyses/contrast-fel.bf
=====================================
@@ -268,6 +268,8 @@ fel.table_output_options = {terms.table_options.header : TRUE, terms.table_optio
 
 selection.io.startTimer (fel.json [terms.json.timers], "Model fitting",1);
 
+namespace_tag = "fel";
+
 namespace fel {
     doGTR ("fel");
 }
@@ -394,12 +396,26 @@ fel.site_patterns = alignments.Extract_site_patterns ((fel.filter_specification[
 // alpha = alpha_scaler * branch_length
 // beta  = beta_scaler_test * branch_length or beta_nuisance_test * branch_length
 
-utility.ForEach (fel.case_respecting_node_names, "_node_",
-        '_node_class_ = (fel.selected_branches[fel.partition_index])[_node_];
-         _beta_scaler = fel.scaler_parameter_names[_node_class_];
-         fel.apply_proportional_site_constraint ("fel.site_tree", _node_, fel.alpha, fel.beta, fel.alpha.scaler, _beta_scaler, (( fel.final_partitioned_mg_results[terms.branch_length])[fel.partition_index])[_node_]);
-    ');
+fel.lengths_by_class = {};
 
+for (_node_; in; fel.case_respecting_node_names) {
+    _node_class_ = (fel.selected_branches[fel.partition_index])[_node_];
+    _beta_scaler = fel.scaler_parameter_names[_node_class_];
+    fel.lengths_by_class[_node_class_] += fel.apply_proportional_site_constraint ("fel.site_tree", _node_, fel.alpha, fel.beta, fel.alpha.scaler, _beta_scaler, (( fel.final_partitioned_mg_results[terms.branch_length])[fel.partition_index])[_node_]);
+}
+
+fel.ignorable = {};
+for (fel.t; in; fel.branches.testable) {
+    if ( fel.lengths_by_class[fel.t] == 0) {
+      fprintf(stdout, "\n-------\n", io.FormatLongStringToWidth(
+      ">[WARNING] The cumulative branch length in the _" + fel.t + "_ class is 0. 
+      Rates along these branches are not identifiable; testing will not be formally conducted (all p-values set to 1).", 72),
+      "\n-------\n");        
+      fel.ignorable [fel.scaler_parameter_names[fel.t]] = 1;
+    } else {
+      fel.ignorable [fel.scaler_parameter_names[fel.t]] = 0;
+    }
+}
 
 
 // create the likelihood function for this site
@@ -422,7 +438,7 @@ fel.queue = mpi.CreateQueue ({"LikelihoodFunctions": {{"fel.site_likelihood"}},
                                "Models" : {{"fel.site.mg_rev"}},
                                "Headers" : {{"libv3/all-terms.bf","libv3/tasks/ancestral.bf", "libv3/convenience/math.bf"}},
                                "Functions" : {{"fel.apply_proportional_site_constraint"}},
-                               "Variables" : {{"terms.fel.test_keys","fel.permutations", "fel.alpha","fel.beta","fel.alpha.scaler","terms.fel.permutation","fel.final_partitioned_mg_results","fel.srv","fel.site_tested_classes","fel.scaler_parameter_names","fel.branches.testable","fel.branches.has_background","fel.alpha.scaler","terms.fel.pairwise","fel.branch_class_counter","fel.report.test_count", "fel.p_value","fel.site.permutations"}}
+                               "Variables" : {{"terms.fel.test_keys","fel.permutations","fel.ignorable","fel.alpha","fel.beta","fel.alpha.scaler","terms.fel.permutation","fel.final_partitioned_mg_results","fel.srv","fel.site_tested_classes","fel.scaler_parameter_names","fel.branches.testable","fel.branches.has_background","fel.alpha.scaler","terms.fel.pairwise","fel.branch_class_counter","fel.report.test_count", "fel.p_value","fel.site.permutations"}}
                              });
 
 
@@ -642,6 +658,8 @@ function fel.apply_proportional_site_constraint (tree_name, node_name, alpha_par
         `node_name`.`alpha_parameter` := (`alpha_factor`) * fel.branch_length__;
         `node_name`.`beta_parameter`  := (`beta_factor`)  * fel.branch_length__;
     ");
+    
+    return fel.branch_length;
 }
 //----------------------------------------------------------------------------------------
 
@@ -685,17 +703,27 @@ lfunction fel.handle_a_site (lf, filter_data, partition_index, pattern_info, mod
         for (vi, vv; in; v) {
             values[pnames[vi]] = +vv;
         }
+        if (^"fel.srv"){
+         values[^"fel.alpha.scaler"] = Random (0.75, 1.25);
+        } 
         start.grid + values;
     }
     
-        
+    /*
+    GetString (p, ^lf, -1);
+    console.log (p);
+    console.log (values);
+    assert (0);
+    */
+    
     Optimize (results, ^lf, {
                 "OPTIMIZATION_METHOD" : "nedler-mead", 
                 "OPTIMIZATION_PRECISION" : 1e-5,
                 "OPTIMIZATION_START_GRID" : start.grid    
             }
            );
-    
+           
+               
     /**
         infer and report ancestral substitutions
     */
@@ -712,8 +740,6 @@ lfunction fel.handle_a_site (lf, filter_data, partition_index, pattern_info, mod
         ');
     }
     
-    
-            
     snapshot = estimators.TakeLFStateSnapshot (lf);
     alternative = estimators.ExtractMLEs (lf, model_mapping);
     alternative [utility.getGlobalValue("terms.fit.log_likelihood")] = results[1][0];
@@ -738,20 +764,17 @@ lfunction fel.handle_a_site (lf, filter_data, partition_index, pattern_info, mod
     ref_parameter = (^"fel.scaler_parameter_names")[(^"fel.branches.testable")["VALUEINDEXORDER"][0]];
 
     ^ref_parameter = sum /denominator;
+    
 
     if (testable == 1) {
         parameters.SetConstraint ((^"fel.scaler_parameter_names")[^"terms.tree_attributes.background"],ref_parameter, "");
     } else {
-        utility.ForEach (^"fel.branches.testable", "_gname_",
-        '
-            //console.log ("REF " + `&ref_parameter`);
+        for (_gname_; in; ^"fel.branches.testable") {
             _pname_ =  (^"fel.scaler_parameter_names")[_gname_];
-            if (_pname_ != `&ref_parameter`) {
-            	//console.log (_pname_ + "=>" + `&ref_parameter`);
-                parameters.SetConstraint (_pname_,`&ref_parameter`, "");
+            if (_pname_ != ref_parameter && (^"fel.ignorable")[_pname_] == 0) {
+                 parameters.SetConstraint (_pname_,ref_parameter, "");
             }
-        '
-        );
+        }
     }
 
     Optimize (results, ^lf, {"OPTIMIZATION_METHOD" : "nedler-mead"});
@@ -764,12 +787,17 @@ lfunction fel.handle_a_site (lf, filter_data, partition_index, pattern_info, mod
             for (v2 = v + 1; v2 < testable; v2+=1) {
                 v1n = (^"fel.branches.testable")[v];
                 v2n = (^"fel.branches.testable")[v2];
-
                 estimators.RestoreLFStateFromSnapshot (lf_id, snapshot);
-                parameters.SetConstraint ((^"fel.scaler_parameter_names")[v1n],(^"fel.scaler_parameter_names")[v2n], "");
-                Optimize (results, ^lf, {"OPTIMIZATION_METHOD" : "nedler-mead"});
-                pairwise[v1n + "|" + v2n] = estimators.ExtractMLEs (lf, model_mapping);
-                (pairwise[v1n + "|" + v2n])[utility.getGlobalValue("terms.fit.log_likelihood")] = results[1][0];
+              
+                if ((^"fel.ignorable")[(^"fel.scaler_parameter_names")[v1n]] || (^"fel.ignorable")[(^"fel.scaler_parameter_names")[v2n]]) {
+                    //console.log (v1n + "|" + v2n + " is ignorable");
+                    (pairwise[v1n + "|" + v2n]) = alternative;
+                } else {                
+                    parameters.SetConstraint ((^"fel.scaler_parameter_names")[v1n],(^"fel.scaler_parameter_names")[v2n], "");
+                    Optimize (results, ^lf, {"OPTIMIZATION_METHOD" : "nedler-mead"});
+                    pairwise[v1n + "|" + v2n] = estimators.ExtractMLEs (lf, model_mapping);
+                    (pairwise[v1n + "|" + v2n])[utility.getGlobalValue("terms.fit.log_likelihood")] = results[1][0];
+                }
            }
         }
     } else {


=====================================
src/core/batchlanhelpers.cpp
=====================================
@@ -68,14 +68,18 @@ _String const   _HYGenerateANameSpace () {
 //____________________________________________________________________________________
 
 void  _HYClearANameSpace (const _String& nm) {
+    /*BufferToConsole("Deleting key: ");
+    BufferToConsole(nm.get_str());
+    NLToConsole();
+    ObjectToConsole(&_HY_HBL_Namespaces);
+    NLToConsole();*/
     _HY_HBL_Namespaces.Delete(nm);
  }
 
 //____________________________________________________________________________________
 
 
-void    ReadModelList(void)
-{
+void    ReadModelList(void) {
     if (templateModelList.empty() == false) return;
 
     _String     modelListFile (GetStandardDirectory (HY_HBL_DIRECTORY_TEMPLATE_MODELS) & "models.lst"),


=====================================
src/core/global_things.cpp
=====================================
@@ -121,7 +121,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.22"),
+                     kHyPhyVersion  = _String ("2.5.23"),
     
                     kNoneToken = "None",
                     kNullToken = "null",


=====================================
src/core/likefunc.cpp
=====================================
@@ -256,8 +256,14 @@ void         BenchmarkThreads (_LikelihoodFunction* lf) {
     lf->SetThreadCount (1);
 #endif
     TimeDifference timer;
-    lf->SetIthIndependent (alterIndex,lf->GetIthIndependent(alterIndex));
-    lf->Compute           ();
+#ifdef  __HYPHYMPI__
+    if (hy_mpi_node_rank == 0)
+#endif
+
+    {
+        lf->SetIthIndependent (alterIndex,lf->GetIthIndependent(alterIndex));
+        lf->Compute           ();
+    }
 
 
 
@@ -276,6 +282,7 @@ hyFloat            tdiff = timer.TimeSinceStart();
             lf->SetThreadCount              (k);
             TimeDifference timer;
             lf->SetIthIndependent           (alterIndex,lf->GetIthIndependent(alterIndex));
+            
             lf->Compute                     ();
             tdiff = timer.TimeSinceStart();
             if (tdiff < minDiff) {
@@ -4063,15 +4070,8 @@ _Matrix*        _LikelihoodFunction::Optimize (_AssociativeList const * options)
     SetupLFCaches       ();
     SetupCategoryCaches ();
     computationalResults.Clear();
-    _variables_changed_during_last_compute = new _SimpleList ();
-    variables_changed_during_last_compute = new _AVLList (_variables_changed_during_last_compute);
     
-    for (unsigned long i=0UL; i<indexInd.lLength; i++) {
-        if (GetIthIndependentVar(i)->varFlags & HY_VARIABLE_CHANGED) {
-            variables_changed_during_last_compute->InsertNumber (GetIthIndependentVar(i)->get_index());
-        }
-    }
-
+    
 
 #ifdef __HYPHYMPI__
     if (hy_mpi_node_rank == 0) {
@@ -4101,13 +4101,13 @@ _Matrix*        _LikelihoodFunction::Optimize (_AssociativeList const * options)
 #endif
 
 
+    _variables_changed_during_last_compute = new _SimpleList ();
+    variables_changed_during_last_compute = new _AVLList (_variables_changed_during_last_compute);
+
 #ifdef __HYPHYMPI__
     if (hy_mpi_node_rank == 0) {
 #endif
-
     BenchmarkThreads (this);
-
-
 #ifdef __HYPHYMPI__
     }
 #endif
@@ -4133,7 +4133,7 @@ _Matrix*        _LikelihoodFunction::Optimize (_AssociativeList const * options)
     if (keepStartingPoint) {
         indexInd.Each ([this, &untag] (long v, unsigned long i) -> void {
             _Variable *iv = GetIthIndependentVar (i);
-            if (iv->HasBeenInitialized()) {
+            if (!iv->IsGlobal() && iv->HasBeenInitialized()) {
                 if (!iv->IsModified()) {
                     iv->MarkModified();
                     untag << i;
@@ -4178,6 +4178,13 @@ _Matrix*        _LikelihoodFunction::Optimize (_AssociativeList const * options)
             }
         }
     }
+    
+    for (unsigned long i=0UL; i<indexInd.lLength; i++) {
+        if (GetIthIndependentVar(i)->varFlags & HY_VARIABLE_CHANGED) {
+            variables_changed_during_last_compute->InsertNumber (GetIthIndependentVar(i)->get_index());
+        }
+    }
+
 
 #if !defined __UNIX__ || defined __HEADLESS__
     SetStatusBarValue (5,maxSoFar,(likeFuncEvalCallCount-evalsIn)/timer.TimeSinceStart());


=====================================
src/core/trie.cpp
=====================================
@@ -344,10 +344,11 @@ bool    _Trie::Delete (const _String& key){
                 emptySlots << history.list_data[k];
                 payload.list_data[history.list_data[k]] = 0L;
                 parents.list_data[history.list_data[k]] = -1L;
-                _SimpleList * parentList = ((_SimpleList**)list_data)[history.list_data[k-1]];
+                _SimpleList * parentList = ((_SimpleList**)list_data)[k ? history.list_data[k-1] : 0];
                 unsigned long parentNode = parentList->FindStepping (history.list_data[k],2, 1) - 1;
                 parentList->Delete (parentNode);
                 parentList->Delete (parentNode);
+                
                 DeleteObject (current_list);
                 ((_SimpleList**)list_data)[history.list_data[k]] = nil;
                 inserted_values--;
@@ -450,7 +451,9 @@ BaseRef     _Trie::toStr(unsigned long) {
            }
         } else {
             _String * this_string = RetrieveStringFromPath(traversal_history, &alph);
-            (*serialized) << '"' << this_string << "\":" << _String (GetValue (traversal_history.list_data[traversal_history.lLength-2]));
+            (*serialized) << '"';
+            (*serialized).AppendNewInstance(this_string);
+            (*serialized) << "\":" << _String (GetValue (traversal_history.list_data[traversal_history.lLength-2]));
             if (doComma) {
                 (*serialized) << ',';
             } else {


=====================================
src/mains/unix.cpp
=====================================
@@ -694,51 +694,6 @@ void    SetStatusLineUser   (_String const s) {
 #ifndef __UNITTEST__
 int main (int argc, char* argv[]) {
     
-    /*long    N       = 1000L;
-    long    repeats = 20L;
-    long    density = 0.25 * RAND_MAX;
-    
-    auto start = std::chrono::high_resolution_clock::now();
-    
-    srand(time(0));
-    
-    _Matrix::switchThreshold = atoi (argv[1]);
-    
-    printf ("%ld\n", _Matrix::switchThreshold);
-    
-    for (long i = 0; i < N; i++) {
-        _Matrix test (61,61,false,true);
-        test.ForEachCellNumeric([density] (hyFloat& e, long i, long r, long c) -> void {
-            if (r != c && rand() < density) {
-                e = genrand_real1 ();
-            } else {
-                e = 0.0;
-            }
-        });
-        for (long r = 0; r < 61; r++) {
-            double s = 0.;
-            for (long c = 0; c < 61; c++) {
-                s += test (r, c);
-            }
-            test.theData[r*61+r] = -s;
-        }
-        
-        test.AmISparse();
-        //ObjectToConsole(&test);
-        
-        //printf ("%d\n", test.is_dense());
-        for (long j = 0; j < repeats; j++) {
-            DeleteObject (test.Exponentiate());
-            //return 0;
-        }
-    }
-
-    auto end = std::chrono::high_resolution_clock::now();
-    std::chrono::duration<double> elapsed = end - start;
-    printf ("%15.12g s\n", elapsed.count());
-    
-    return 0;*/
-    
  
 #ifdef _COMPARATIVE_LF_DEBUG_DUMP
     FILE * comparative_lf_debug_matrix_content_file = doFileOpen (_COMPARATIVE_LF_DEBUG_DUMP, "w");



View it on GitLab: https://salsa.debian.org/med-team/hyphy/-/commit/e5b51d8b41be01b7403fe58fde204cf04555868d

-- 
View it on GitLab: https://salsa.debian.org/med-team/hyphy/-/commit/e5b51d8b41be01b7403fe58fde204cf04555868d
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/20201118/e7fe7575/attachment-0001.html>


More information about the debian-med-commit mailing list