Skip to content

Commit

Permalink
MPI export fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
spond committed May 30, 2024
1 parent 7009f2f commit f3cb549
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 7 deletions.
2 changes: 1 addition & 1 deletion res/TemplateBatchFiles/GARD.bf
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ if (fastRunMode) {
gard.queue = mpi.CreateQueue (
{
"LikelihoodFunctions" : {{"gard.exportedModel"}},
"Headers" : {{"libv3/all-terms.bf"}},
"Headers" : {{"libv3/all-terms.bf","libv3/tasks/estimators.bf"}},
"Variables" : {{"gard.globalParameterCount", "gard.numSites", "gard.alignment", "gard.variableSiteMap", "gard.dataType", "terms.gard.codon","OPTIMIZE_SUMMATION_ORDER_PARTITION", "OPTIMIZATION_PRECISION"}}
}
);
Expand Down
4 changes: 2 additions & 2 deletions res/TemplateBatchFiles/MSS-joint-fitter.bf
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,8 @@ function mss.MSS_generator (type) {
return model;
}

mss.tree_objects = {};
mss.fit_objects = {};
mss.tree_objects = {};
mss.fit_objects = {};
mss.lf_components = {
2*mss_selector.file_count,
1
Expand Down
2 changes: 1 addition & 1 deletion res/TemplateBatchFiles/SelectionAnalyses/BUSTED.bf
Original file line number Diff line number Diff line change
Expand Up @@ -1362,7 +1362,7 @@ while (!busted.converged) {
(busted.json [busted.json.evidence_ratios])[busted.constrained] = busted.EvidenceRatios ( (busted.json [busted.json.site_logl])[busted.unconstrained], (busted.json [busted.json.site_logl])[busted.constrained]);
(busted.json [busted.json.evidence_ratios ])[busted.optimized_null] = busted.EvidenceRatios ( (busted.json [busted.json.site_logl])[busted.unconstrained], (busted.json [busted.json.site_logl])[busted.optimized_null]);

if (busted.LRT[terms.LRT] < 0) {
if (busted.LRT[terms.LRT] < -0.01) {
parameters.RemoveConstraint (model.generic.GetGlobalParameter (busted.test.bsrel_model , terms.AddCategory (terms.parameters.omega_ratio,busted.rate_classes)));
console.log ("----\n## Negative test LRT (convergence problem). Refitting the alternative model using the null model as a start.\n----\n");
busted.restart_optimization = busted.null_results;
Expand Down
10 changes: 9 additions & 1 deletion res/TemplateBatchFiles/SelectionAnalyses/aBSREL.bf
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ absrel.json = {

selection.io.startTimer (absrel.json [terms.json.timers], "Overall", 0);

KeywordArgument ("blb", "[Advanced option] Bag of little bootstrap alignment resampling rate", 1.0);
absrel.blb = io.PromptUser ("[Advanced option] Bag of little bootstrap alignment resampling rate", 1.0, 0.01, 1, FALSE);

/*------------------------------------------------------------------------------
Key word arguments
Expand All @@ -110,9 +112,14 @@ KeywordArgument ("branches", "Branches to test", "All");
Continued Analysis Setup
*/


namespace absrel {
LoadFunctionLibrary ("modules/shared-load-file.bf");
load_file ("absrel");

load_file ({
utility.getGlobalValue("terms.prefix"): "absrel",
utility.getGlobalValue("terms.data.blb_subsample") : blb
});
}

KeywordArgument ("multiple-hits", "Include support for multiple nucleotide substitutions", "None");
Expand Down Expand Up @@ -147,6 +154,7 @@ if (absrel.do_srv) {
absrel.synonymous_rate_classes = io.PromptUser ("The number omega rate classes to include in the model", absrel.synonymous_rate_classes, 1, 10, TRUE);
}


selection.io.json_store_setting (absrel.json, "srv", absrel.do_srv);


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,12 @@ function load_file (prefix) {

settings = None;
multiple_files = FALSE;

blb = 1.0;

if (Type (prefix) == "AssociativeList") {
multiple_files = prefix [utility.getGlobalValue("terms.multiple_files")];
settings = prefix[utility.getGlobalValue("terms.settings")];
settings = prefix [utility.getGlobalValue("terms.settings")];
blb = prefix [utility.getGlobalValue("terms.data.blb_subsample")];
prefix = prefix [utility.getGlobalValue("terms.prefix")];
}

Expand Down Expand Up @@ -199,6 +200,10 @@ function load_file (prefix) {
} else {
datasets = prefix+".codon_data";
codon_data_info = alignments.PromptForGeneticCodeAndAlignment(datasets, prefix+".codon_filter");
if (blb < 1 && blb > 0) {
console.log (blb);
codon_data_info [utility.getGlobalValue("terms.data.blb_subsample")] = blb;
}
/** example output
{
"sequences": 13,
Expand Down
1 change: 1 addition & 0 deletions res/TemplateBatchFiles/libv3/all-terms.bf
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ namespace terms{
characters = "characters";
pattern_id = "pattern id";
filename_to_index = "filename-to-index";
blb_subsample = "blb-subsample"
}


Expand Down
13 changes: 13 additions & 0 deletions res/TemplateBatchFiles/libv3/tasks/alignments.bf
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,8 @@ function alignments.LoadCodonDataFile(dataset_name, datafilter_name, data_info)
}
io.CheckAssertion("`datafilter_name`.sites*3==`dataset_name`.sites", "The input alignment must have the number of sites that is divisible by 3 and must not contain stop codons");
}


data_info[terms.data.sites] = ^ "`datafilter_name`.sites";
data_info[terms.data.dataset] = dataset_name;
data_info[terms.data.datafilter] = datafilter_name;
Expand Down Expand Up @@ -563,6 +565,17 @@ lfunction alignments.DefineFiltersForPartitions(partitions, source_data, prefix,
diff = test.sites - 3 * ^ (this_filter[utility.getGlobalValue("terms.data.name")] + ".sites");

io.CheckAssertion("`&diff` == 0", "Partition " + this_filter[utility.getGlobalValue("terms.data.name")] + " is either has stop codons or is not in frame");

if (Type (data_info[^"terms.data.blb_subsample"]) == "Number") {
datafilter_name = (this_filter[utility.getGlobalValue("terms.data.name")]);
i = (^ "`datafilter_name`.sites") ^ (data_info[^"terms.data.blb_subsample"]) $ 1;
if (i > 1 && i < ^"`datafilter_name`.sites") {
console.log (">Subsampling/upsampling using bag of little bootstraps with sample size `i`.");
DataSetFilter test = Bootstrap (^datafilter_name, {"BLB_size": i, "BLB_sampler" : ""});
DataSetFilter ^datafilter_name = CreateFilter (test,3,"","", data_info[utility.getGlobalValue("terms.stop_codons")]);
}
}


this_filter[utility.getGlobalValue("terms.data.coverage")] = utility.DictToArray(utility.Map(utility.Filter( ^ (this_filter[utility.getGlobalValue("terms.data.name")] + ".site_map"), "_value_", "_value_%3==0"), "_value_", "_value_$3"));
filters + this_filter;
Expand Down
1 change: 1 addition & 0 deletions res/TemplateBatchFiles/libv3/tasks/mpi.bf
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ namespace mpi {
//#profile START;

LFCompute (^lf_id, LF_START_COMPUTE);


results = {};
task_ids = utility.Keys (tasks);
Expand Down
1 change: 1 addition & 0 deletions src/core/batchlan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4770,6 +4770,7 @@ bool _ElementaryCommand::ConstructDataSetFilter (_StringBuffer&source, _Execu
} else if (operation_type == kBootstrap) {
datafilter_command = new _ElementaryCommand(28);
} else {

throw _String ("Expected: DataSetFilter dataSetFilterid = CreateFilter (datasetid,unit,vertical partition,horizontal partition,alphabet exclusions); or Permute/Bootstrap (dataset/filter,<atom>,<column partition>)");
}

Expand Down

0 comments on commit f3cb549

Please sign in to comment.