Skip to content

Commit

Permalink
Merge pull request #733 from veg/beta
Browse files Browse the repository at this point in the history
2.3.9-rc
  • Loading branch information
stevenweaver authored Jan 11, 2018
2 parents a9fb747 + ec4877d commit dd2474f
Show file tree
Hide file tree
Showing 21 changed files with 524 additions and 24 deletions.
2 changes: 1 addition & 1 deletion res/TemplateBatchFiles/LEISR.bf
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ leisr.analysis_type = io.SelectAnOption ({{leisr.protein_type , "Infer relative

if (leisr.analysis_type == leisr.protein_type) {
leisr.baseline_model = io.SelectAnOption (models.protein.empirical_models, "Select a protein model:");
leisr.generators = models.protein.empirical.default_generators;
leisr.generators = models.protein.empirical.plusF_generators;
}
else {

Expand Down
15 changes: 11 additions & 4 deletions res/TemplateBatchFiles/SelectionAnalyses/MEME.bf
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ meme.final_partitioned_mg_results = estimators.FitMGREV (meme.filter_names, meme
}, meme.partitioned_mg_results);


//meme.final_partitioned_mg_results = meme.partitioned_mg_results;


io.ReportProgressMessageMD("MEME", "codon-refit", "* Log(L) = " + Format(meme.final_partitioned_mg_results[terms.fit.log_likelihood],8,2));
Expand Down Expand Up @@ -298,21 +299,20 @@ for (meme.partition_index = 0; meme.partition_index < meme.partition_count; meme
));

__make_filter ("meme.site_filter");

LikelihoodFunction meme.site_likelihood = (meme.site_filter, meme.site_tree_fel);

__make_filter ("meme.site_filter_bsrel");


estimators.ApplyExistingEstimates ("meme.site_likelihood", meme.site_model_mapping, meme.final_partitioned_mg_results,
terms.globals_only);



__make_filter ("meme.site_filter_bsrel");
LikelihoodFunction meme.site_likelihood_bsrel = (meme.site_filter_bsrel, meme.site_tree_bsrel);


estimators.ApplyExistingEstimates ("meme.site_likelihood_bsrel", meme.site_model_mapping, meme.final_partitioned_mg_results,
"globals only");
terms.globals_only);

meme.queue = mpi.CreateQueue ({terms.mpi.LikelihoodFunctions: {{"meme.site_likelihood","meme.site_likelihood_bsrel"}},
terms.mpi.Models : {{"meme.site.background_fel","meme.site.bsrel"}},
Expand Down Expand Up @@ -458,11 +458,15 @@ lfunction meme.handle_a_site (lf_fel, lf_bsrel, filter_data, partition_index, pa
bsrel_tree_id = (lfInfo["Trees"])[0];

utility.SetEnvVariable ("USE_LAST_RESULTS", TRUE);
utility.SetEnvVariable ("ASSUME_REVERSIBLE_MODELS", TRUE);
utility.SetEnvVariable ("VERBOSITY_LEVEL", 500);

^"meme.site_alpha" = 1;
^"meme.site_beta_plus" = 1;
^"meme.site_beta_nuisance" = 1;

console.log ("Optimizing FEL for pattern " + pattern_info);
io.SpoolLF (lf_fel, "/tmp/meme.debug", "FEL");
Optimize (results, ^lf_fel);

fel = estimators.ExtractMLEs (lf_fel, model_mapping);
Expand All @@ -477,6 +481,8 @@ lfunction meme.handle_a_site (lf_fel, lf_bsrel, filter_data, partition_index, pa
/* avoid 0/0 by making the denominator non-zero*/
}

console.log ("Optimizing MEME for pattern " + pattern_info);
io.SpoolLF (lf_bsrel, "/tmp/meme.debug", "MEME");
Optimize (results, ^lf_bsrel);

alternative = estimators.ExtractMLEs (lf_bsrel, model_mapping);
Expand Down Expand Up @@ -554,6 +560,7 @@ lfunction meme.handle_a_site (lf_fel, lf_bsrel, filter_data, partition_index, pa

//----------------------------------------------------------------------------------------
function meme.report.echo (meme.report.site, meme.report.partition, meme.report.row) {

meme.print_row = None;
if (meme.report.row [6] <= meme.pvalue) {
meme.print_row = meme.report.positive_site;
Expand Down
3 changes: 1 addition & 2 deletions res/TemplateBatchFiles/SelectionAnalyses/RELAX.bf
Original file line number Diff line number Diff line change
Expand Up @@ -641,8 +641,7 @@ lfunction relax.select_branches(partition_info) {

tree_for_analysis = (partition_info[0])[utility.getGlobalValue("terms.data.tree")];
utility.ForEach (tree_for_analysis[utility.getGlobalValue("terms.trees.model_map")], "_value_", "`&available_models`[_value_] += 1");
list_models = utility.Keys (available_models); // get keys
branch_counts = utility.Values (available_models);
list_models = utility.sortStrings(utility.Keys(available_models)); // get keys
option_count = Abs (available_models);

io.CheckAssertion("`&option_count` >= 2", "RELAX requires at least one designated set of branches in the tree.");
Expand Down
2 changes: 2 additions & 0 deletions res/TemplateBatchFiles/libv3/IOFunctions.bf
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,7 @@ lfunction io.ReadDelimitedFile (path, separator, has_header) {
fscanf (path, REWIND, "Lines", data);
} else {
fscanf (PROMPT_FOR_FILE, REWIND, "Lines", data);
path = utility.getGlobalValue("LAST_FILE_PATH");
}
result = {utility.getGlobalValue("terms.io.rows") : {}};
index = 0;
Expand All @@ -674,6 +675,7 @@ lfunction io.ReadDelimitedFile (path, separator, has_header) {
for (k = index; k < row_count; k+=1) {
result [utility.getGlobalValue("terms.io.rows")] + regexp.Split (data[k], separator);
}
result[utility.getGlobalValue("terms.json.file")] = path;
return result;
}

Expand Down
24 changes: 24 additions & 0 deletions res/TemplateBatchFiles/libv3/UtilityFunctions.bf
Original file line number Diff line number Diff line change
Expand Up @@ -935,4 +935,28 @@ lfunction utility.CatersianProduct (arguments) {
return product;
}

function _sortStringsAux (theKey, theValue)
{
for (_gb_idx2 = 0; _gb_idx2 < theValue; _gb_idx2=_gb_idx2+1)
{
_gb_sortedStrings [_gb_idx] = theKey;
_gb_idx = _gb_idx + 1;
}
return 0;
}

function utility.sortStrings (_theList)
{
_gb_dim = Rows (_theList)*Columns (_theList);
_toSort = {};
for (_gb_idx = 0; _gb_idx < _gb_dim; _gb_idx = _gb_idx + 1)
{
_toSort[_theList[_gb_idx]] = _toSort[_theList[_gb_idx]]+1;
}
_gb_sortedStrings = {_gb_dim,1};
_gb_idx = 0;
_toSort["_sortStringsAux"][""];
return _gb_sortedStrings;
}


Loading

0 comments on commit dd2474f

Please sign in to comment.