Skip to content

Commit

Permalink
Merge pull request #1247 from veg/develop
Browse files Browse the repository at this point in the history
2.5.22 rc
  • Loading branch information
spond authored Nov 13, 2020
2 parents 01301fd + 13d9aa4 commit 3ae1dbe
Show file tree
Hide file tree
Showing 36 changed files with 796 additions and 171 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ makeLink(HYPHYMP hyphy hyphy)

#-------------------------------------------------------------------------------
# TESTS
#---------------------------------------------geany----------------------------------
#-------------------------------------------------------------------------------

add_test (NAME UNIT-TESTS COMMAND bash run_unit_tests.sh)
add_test (CODON HYPHYMP tests/hbltests/SimpleOptimizations/SmallCodon.bf)
Expand All @@ -579,6 +579,7 @@ add_test (NAME SLAC COMMAND HYPHYMP tests/hbltests/libv3/SLAC.wbf)
add_test (NAME SLAC-PARTITIONED COMMAND HYPHYMP tests/hbltests/libv3/SLAC-partitioned.wbf)
add_test (NAME FEL COMMAND HYPHYMP tests/hbltests/libv3/FEL.wbf)
add_test (MEME HYPHYMP tests/hbltests/libv3/MEME.wbf)
#add_test (MEME_MPI mpirun -np 4 HYPHYMPI tests/hbltests/libv3/MEME.wbf)
add_test (MEME-PARTITIONED HYPHYMP tests/hbltests/libv3/MEME-partitioned.wbf)
add_test (BUSTED HYPHYMP tests/hbltests/libv3/BUSTED.wbf)
add_test (BUSTED-SRV HYPHYMP tests/hbltests/libv3/BUSTED-SRV.wbf)
Expand Down
41 changes: 37 additions & 4 deletions res/TemplateBatchFiles/SelectionAnalyses/BUSTED.bf
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,38 @@ namespace busted {
}


busted.run_full_mg94 = TRUE;

if (Type (busted.save_intermediate_fits) == "AssociativeList") {
if (None != busted.save_intermediate_fits[^"terms.data.value"]) {
if (utility.Has (busted.save_intermediate_fits[^"terms.data.value"], "Full-MG94", "AssociativeList")) {
busted.final_partitioned_mg_results = (busted.save_intermediate_fits[^"terms.data.value"])["Full-MG94"];
busted.run_full_mg94 = FALSE;
}
}
}

io.ReportProgressMessageMD ("BUSTED", "codon-refit", "Improving branch lengths, nucleotide substitution biases, and global dN/dS ratios under a full codon model");

busted.final_partitioned_mg_results = estimators.FitMGREV (busted.filter_names, busted.trees, busted.codon_data_info [terms.code], {
terms.run_options.model_type: terms.local,
terms.run_options.partitioned_omega: busted.selected_branches,
}, busted.partitioned_mg_results);
if (busted.run_full_mg94) {
busted.final_partitioned_mg_results = estimators.FitMGREV (busted.filter_names, busted.trees, busted.codon_data_info [terms.code], {
terms.run_options.model_type: terms.local,
terms.run_options.partitioned_omega: busted.selected_branches,
terms.run_options.apply_user_constraints: busted.zero_branch_length_constrain,
terms.run_options.optimization_settings: {
"OPTIMIZATION_METHOD" : "coordinate-wise"
}
}, busted.partitioned_mg_results);

if (Type (busted.save_intermediate_fits) == "AssociativeList") {
(busted.save_intermediate_fits[^"terms.data.value"])["Full-MG94"] = busted.final_partitioned_mg_results;
Export (lfe, ^busted.final_partitioned_mg_results[^"terms.likelihood_function"]);
(busted.save_intermediate_fits[^"terms.data.value"])["Full-MG94-LF"] = lfe;
io.SpoolJSON (busted.save_intermediate_fits[^"terms.data.value"],busted.save_intermediate_fits[^"terms.data.file"]);
}
}




io.ReportProgressMessageMD("BUSTED", "codon-refit", "* " + selection.io.report_fit (busted.final_partitioned_mg_results, 0, busted.codon_data_info[terms.data.sample_size]));
Expand Down Expand Up @@ -317,6 +343,7 @@ if (busted.has_background) {
busted.model_object_map = { "busted.test" : busted.test.bsrel_model };
}


if (busted.do_srv) {

if (busted.do_bs_srv) {
Expand Down Expand Up @@ -395,6 +422,12 @@ io.ReportProgressMessageMD ("BUSTED", "main", "Performing the full (dN/dS > 1 al

busted.nm.precision = -0.00025*busted.final_partitioned_mg_results[terms.fit.log_likelihood];

if (busted.do_srv_hmm) {
busted.hmm_lambda = selection.io.extract_global_MLE (busted.full_model, terms.rate_variation.hmm_lambda);
//parameters.SetConstraint (((busted.test.bsrel_model[terms.parameters])[terms.global])[terms.rate_variation.hmm_lambda],"1e-6", "");
}


parameters.DeclareGlobalWithRanges ("busted.bl.scaler", 1, 0, 1000);
busted.grid_search.results = estimators.FitLF (busted.filter_names, busted.trees, busted.model_map, busted.final_partitioned_mg_results, busted.model_object_map, {
"retain-lf-object": TRUE,
Expand Down
41 changes: 32 additions & 9 deletions res/TemplateBatchFiles/SelectionAnalyses/FEL.bf
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ utility.ForEachPair (fel.selected_branches, "_partition_", "_selection_",

selection.io.startTimer (fel.json [terms.json.timers], "Model fitting",1);

namespace_tag = "fel";

namespace fel {
doGTR ("fel");
Expand All @@ -158,16 +159,38 @@ namespace fel {

io.ReportProgressMessageMD ("fel", "codon-refit", "Improving branch lengths, nucleotide substitution biases, and global dN/dS ratios under a full codon model");


fel.final_partitioned_mg_results = estimators.FitMGREV (fel.filter_names, fel.trees, fel.codon_data_info [terms.code], {
terms.run_options.model_type: terms.local,
terms.run_options.partitioned_omega: fel.selected_branches,
terms.run_options.retain_lf_object: TRUE,
terms.run_options.optimization_settings: {
"OPTIMIZATION_METHOD" : "coordinate-wise"
fel.run_full_mg94 = TRUE;

if (Type (fel.save_intermediate_fits) == "AssociativeList") {
if (None != fel.save_intermediate_fits[^"terms.data.value"]) {
if (utility.Has (fel.save_intermediate_fits[^"terms.data.value"], "Full-MG94", "AssociativeList")) {
fel.final_partitioned_mg_results = (fel.save_intermediate_fits[^"terms.data.value"])["Full-MG94"];
if (utility.Has (fel.save_intermediate_fits[^"terms.data.value"], "Full-MG94-LF", "String")) {
ExecuteCommands ((fel.save_intermediate_fits[^"terms.data.value"])["Full-MG94-LF"]);
fel.run_full_mg94 = FALSE;
}
}
}
}, fel.partitioned_mg_results);

}

if (fel.run_full_mg94) {

fel.final_partitioned_mg_results = estimators.FitMGREV (fel.filter_names, fel.trees, fel.codon_data_info [terms.code], {
terms.run_options.model_type: terms.local,
terms.run_options.partitioned_omega: fel.selected_branches,
terms.run_options.retain_lf_object: TRUE,
terms.run_options.apply_user_constraints: fel.zero_branch_length_constrain,
terms.run_options.optimization_settings: {
"OPTIMIZATION_METHOD" : "coordinate-wise"
}
}, fel.partitioned_mg_results);
if (Type (fel.save_intermediate_fits) == "AssociativeList") {
(fel.save_intermediate_fits[^"terms.data.value"])["Full-MG94"] = fel.final_partitioned_mg_results;
Export (lfe, ^fel.final_partitioned_mg_results[^"terms.likelihood_function"]);
(fel.save_intermediate_fits[^"terms.data.value"])["Full-MG94-LF"] = lfe;
io.SpoolJSON (fel.save_intermediate_fits[^"terms.data.value"],fel.save_intermediate_fits[^"terms.data.file"]);
}
}



Expand Down
4 changes: 2 additions & 2 deletions res/TemplateBatchFiles/SelectionAnalyses/FUBAR.bf
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ lfunction fubar.scalers.SetBranchLength (model, value, parameter) {

//------------------------------------------------------------------------------

lfunction fubar.scalers.Constrain (tree_name, node_name, model_description) {
lfunction fubar.scalers.Constrain (tree_name, node_name, model_description, ignore) {
parameters.SetProprtionalConstraint (tree_name + "." + node_name + "." + (model_description [utility.getGlobalValue ("terms.local")])[utility.getGlobalValue ("terms.parameters.synonymous_rate")],
(model_description[utility.getGlobalValue ("terms.global")])[utility.getGlobalValue ("terms.fubar.branch_length_scaler.alpha")]);

Expand All @@ -780,7 +780,7 @@ lfunction fubar.scalers.Constrain (tree_name, node_name, model_description) {

//------------------------------------------------------------------------------

lfunction fubar.scalers.Unconstrain (tree_name, node_name, model_description) {
lfunction fubar.scalers.Unconstrain (tree_name, node_name, model_description, ignore) {
parameters.RemoveConstraint (tree_name + "." + node_name + "." + (model_description [utility.getGlobalValue ("terms.local")])[utility.getGlobalValue ("terms.parameters.synonymous_rate")]);
parameters.RemoveConstraint (tree_name + "." + node_name + "." + (model_description [utility.getGlobalValue ("terms.local")])[utility.getGlobalValue ("terms.parameters.nonsynonymous_rate")]);
}
Expand Down
60 changes: 53 additions & 7 deletions res/TemplateBatchFiles/SelectionAnalyses/MEME.bf
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ meme.pairwise_counts = genetic_code.ComputePairwiseDifferencesAndExpectedSites(m

selection.io.startTimer (meme.json [terms.json.timers], "Model fitting",1);

namespace_tag = "meme";

namespace meme {
doGTR ("meme");
}
Expand All @@ -159,6 +161,7 @@ namespace meme {

estimators.fixSubsetOfEstimates(meme.partitioned_mg_results, meme.partitioned_mg_results[terms.global]);


meme.final_partitioned_mg_results_bl = estimators.FitMGREV (meme.filter_names, meme.trees, meme.codon_data_info [terms.code], {
terms.run_options.model_type: terms.local,
terms.run_options.partitioned_omega: meme.selected_branches,
Expand All @@ -177,16 +180,41 @@ utility.ForEach (meme.global_dnds, "_value_", 'io.ReportProgressMessageMD ("MEME

io.ReportProgressMessageMD ("MEME", "codon-refit", "Improving branch lengths, nucleotide substitution biases, and global dN/dS ratios under a full codon model");

meme.final_partitioned_mg_results = estimators.FitMGREV (meme.filter_names, meme.trees, meme.codon_data_info [terms.code], {
terms.run_options.model_type: terms.local,
terms.run_options.partitioned_omega: meme.selected_branches,
terms.run_options.retain_lf_object: TRUE,
terms.run_options.optimization_settings: {
"OPTIMIZATION_METHOD" : "coordinate-wise"

meme.run_full_mg94 = TRUE;

if (Type (meme.save_intermediate_fits) == "AssociativeList") {
if (None != meme.save_intermediate_fits[^"terms.data.value"]) {
if (utility.Has (meme.save_intermediate_fits[^"terms.data.value"], "Full-MG94", "AssociativeList")) {
meme.final_partitioned_mg_results = (meme.save_intermediate_fits[^"terms.data.value"])["Full-MG94"];
if (utility.Has (meme.save_intermediate_fits[^"terms.data.value"], "Full-MG94-LF", "String")) {
ExecuteCommands ((meme.save_intermediate_fits[^"terms.data.value"])["Full-MG94-LF"]);
meme.run_full_mg94 = FALSE;
}
}
}
}, meme.partitioned_mg_results);
}


if (meme.run_full_mg94) {
meme.final_partitioned_mg_results = estimators.FitMGREV (meme.filter_names, meme.trees, meme.codon_data_info [terms.code], {
terms.run_options.model_type: terms.local,
terms.run_options.partitioned_omega: meme.selected_branches,
terms.run_options.retain_lf_object: TRUE,
terms.run_options.apply_user_constraints: meme.zero_branch_length_constrain,
terms.run_options.optimization_settings: {
"OPTIMIZATION_METHOD" : "coordinate-wise"
}
}, meme.partitioned_mg_results);

if (Type (meme.save_intermediate_fits) == "AssociativeList") {
(meme.save_intermediate_fits[^"terms.data.value"])["Full-MG94"] = meme.final_partitioned_mg_results;
Export (lfe, ^meme.final_partitioned_mg_results[^"terms.likelihood_function"]);
(meme.save_intermediate_fits[^"terms.data.value"])["Full-MG94-LF"] = lfe;
io.SpoolJSON (meme.save_intermediate_fits[^"terms.data.value"],meme.save_intermediate_fits[^"terms.data.file"]);
}
}

//meme.final_partitioned_mg_results = meme.partitioned_mg_results;


Expand Down Expand Up @@ -535,41 +563,59 @@ lfunction meme.handle_a_site (lf_fel, lf_bsrel, filter_data, partition_index, pa

initial_guess_grid = {
"0" : {

"meme.site_alpha" : ^"meme.site_alpha",
"meme.site_beta_nuisance" : ^"meme.site_beta_nuisance",
"meme.site_beta_plus": ^"meme.site_beta_plus",
"meme.site_omega_minus": ^"meme.site_omega_minus",
"meme.site_mixture_weight": ^"meme.site_mixture_weight"

},
"1" : {
"meme.site_alpha" : ^"meme.site_alpha",
"meme.site_beta_nuisance" : ^"meme.site_beta_nuisance",
"meme.site_beta_plus": ^"meme.site_beta_plus" * 2,
"meme.site_omega_minus": 0.5,
"meme.site_mixture_weight": 0.5
},
"2" : {
"meme.site_alpha" : ^"meme.site_alpha",
"meme.site_beta_nuisance" : ^"meme.site_beta_nuisance",
"meme.site_beta_plus": ^"meme.site_beta_plus" * 4,
"meme.site_omega_minus": 0.25,
"meme.site_mixture_weight": 0.25
},
"3" : {
"meme.site_alpha" : ^"meme.site_alpha",
"meme.site_beta_nuisance" : ^"meme.site_beta_nuisance",
"meme.site_beta_plus": ^"meme.site_beta_plus",
"meme.site_omega_minus": 0.5,
"meme.site_mixture_weight": 0.5
},
"4" : {
"meme.site_alpha" : ^"meme.site_alpha",
"meme.site_beta_nuisance" : ^"meme.site_beta_nuisance",
"meme.site_beta_plus": ^"meme.site_beta_plus",
"meme.site_omega_minus": 0.75,
"meme.site_mixture_weight": 0.8
},
"5" : {
"meme.site_alpha" : ^"meme.site_alpha",
"meme.site_beta_nuisance" : ^"meme.site_beta_nuisance",
"meme.site_beta_plus": ^"meme.site_beta_plus" * 8,
"meme.site_omega_minus": 0.5,
"meme.site_mixture_weight": 0.8
},
"6" : {
"meme.site_alpha" : ^"meme.site_alpha",
"meme.site_beta_nuisance" : ^"meme.site_beta_nuisance",
"meme.site_beta_plus": ^"meme.site_beta_plus",
"meme.site_omega_minus": 0,
"meme.site_mixture_weight": 0.01
},
"7" : {
"meme.site_alpha" : ^"meme.site_alpha",
"meme.site_beta_nuisance" : ^"meme.site_beta_nuisance",
"meme.site_beta_plus": ^"meme.site_beta_plus",
"meme.site_omega_minus": ^"meme.site_omega_minus",
"meme.site_mixture_weight": 1.0
Expand Down
Loading

1 comment on commit 3ae1dbe

@kjlevitz
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Benchmark.js Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: 3ae1dbe Previous: 13d9aa4 Ratio
SLAC-partitioned.wbf Infinity secs/op (±0.000000%) 14.616250347135944 secs/op (±5.057844%) Infinity
BGM.wbf Infinity secs/op (±0.000000%) 3.842518232749015 secs/op (±4.317378%) Infinity

This comment was automatically generated by workflow using github-action-benchmark.

CC: @klevitz

Please sign in to comment.