From 9fd6f01ad819f6ebb8a5818afaac66ec9c39894c Mon Sep 17 00:00:00 2001 From: Steven Weaver Date: Tue, 26 Nov 2024 13:55:44 -0800 Subject: [PATCH 1/3] veg/datamonkey-js#752 -- adding new fel options --- app/fel/fel.js | 79 ++++++++++++++++++++++++++++---------------------- app/fel/fel.sh | 11 +++---- 2 files changed, 50 insertions(+), 40 deletions(-) diff --git a/app/fel/fel.js b/app/fel/fel.js index 259a9d4..8681cfb 100644 --- a/app/fel/fel.js +++ b/app/fel/fel.js @@ -5,7 +5,7 @@ var config = require("../../config.json"), fs = require("fs"), path = require("path"); -var fel = function(socket, stream, params) { +var fel = function (socket, stream, params) { var self = this; self.socket = socket; self.stream = stream; @@ -13,6 +13,11 @@ var fel = function(socket, stream, params) { // object specific attributes self.type = "fel"; + + // New attributes for multiple hits and site multihit + self.multiple_hits = self.params.analysis.multiple_hits || "None"; // e.g., [Double, Double+Triple, None] + self.site_multihit = self.params.analysis.site_multihit || "Estimate"; // e.g., [Estimate, Global] + self.qsub_script_name = "fel.sh"; self.qsub_script = __dirname + "/" + self.qsub_script_name; @@ -38,52 +43,56 @@ var fel = function(socket, stream, params) { self.tree_fn = self.fn + ".tre"; self.qsub_params = [ - "-l walltime=" + - config.fel_walltime + - ",nodes=1:ppn=" + + "-l walltime=" + + config.fel_walltime + + ",nodes=1:ppn=" + config.fel_procs, "-q", config.qsub_queue, "-v", "fn=" + - self.fn + - ",tree_fn=" + - self.tree_fn + - ",sfn=" + - self.status_fn + - ",pfn=" + - self.progress_fn + - ",rfn=" + - self.results_short_fn + - ",treemode=" + - self.treemode + - ",bootstrap=" + - self.bootstrap + - ",resample=" + - self.resample+ - ",genetic_code=" + - self.genetic_code + - ",analysis_type=" + - self.type + - ",rate_variation=" + - self.rate_variation + - ",ci=" + - self.ci + - ",cwd=" + - __dirname + - ",msaid=" + - self.msaid + - ",procs=" + - config.fel_procs, + self.fn + + ",tree_fn=" + + self.tree_fn + + ",sfn=" + + self.status_fn + + ",pfn=" + + self.progress_fn + + ",rfn=" + + self.results_short_fn + + ",treemode=" + + self.treemode + + ",bootstrap=" + + self.bootstrap + + ",resample=" + + self.resample + + ",genetic_code=" + + self.genetic_code + + ",analysis_type=" + + self.type + + ",rate_variation=" + + self.rate_variation + + ",ci=" + + self.ci + + ",cwd=" + + __dirname + + ",msaid=" + + self.msaid + + ",procs=" + + config.fel_procs + + ",multiple_hits=" + + self.multiple_hits + + ",site_multihit=" + + self.site_multihit, "-o", self.output_dir, "-e", self.output_dir, - self.qsub_script + self.qsub_script, ]; // Write tree to a file - fs.writeFile(self.tree_fn, self.nwk_tree, function(err) { + fs.writeFile(self.tree_fn, self.nwk_tree, function (err) { if (err) throw err; }); diff --git a/app/fel/fel.sh b/app/fel/fel.sh index c790260..1d6d139 100644 --- a/app/fel/fel.sh +++ b/app/fel/fel.sh @@ -17,6 +17,8 @@ RESAMPLE=$resample RESULTS_FN=$rfn GENETIC_CODE=$genetic_code RATE_VARIATION=$rate_variation +MULTIPLE_HITS=$multiple_hits +SITE_MULTIHIT=$site_multihit PROCS=$procs HYPHY=$CWD/../../.hyphy/HYPHYMPI @@ -30,12 +32,11 @@ trap 'echo "Error" > $STATUS_FILE; exit 1' ERR if [ $BOOTSTRAP = "true" ] then - echo "mpirun -np $PROCS $HYPHY LIBPATH=$HYPHY_PATH $FEL --alignment $FN --tree $TREE_FN --code $GENETIC_CODE --branches FG --srv $RATE_VARIATION --output $RESULTS_FILE --resample $RESAMPLE --ci $CI >> $PROGRESS_FILE" - mpirun -np $PROCS $HYPHY LIBPATH=$HYPHY_PATH ENV="TOLERATE_NUMERICAL_ERRORS=1;" $FEL --alignment $FN --tree $TREE_FN --code $GENETIC_CODE --branches FG --srv $RATE_VARIATION --output $RESULTS_FILE --resample $RESAMPLE --ci $CI >> $PROGRESS_FILE + echo "mpirun -np $PROCS $HYPHY LIBPATH=$HYPHY_PATH $FEL --alignment $FN --tree $TREE_FN --code $GENETIC_CODE --branches FG --srv $RATE_VARIATION --output $RESULTS_FILE --resample $RESAMPLE --ci $CI --multiple-hits $MULTIPLE_HITS --site-multihit $SITE_MULTIHIT >> $PROGRESS_FILE" + mpirun -np $PROCS $HYPHY LIBPATH=$HYPHY_PATH ENV="TOLERATE_NUMERICAL_ERRORS=1;" $FEL --alignment $FN --tree $TREE_FN --code $GENETIC_CODE --branches FG --srv $RATE_VARIATION --output $RESULTS_FILE --resample $RESAMPLE --ci $CI --multiple-hits $MULTIPLE_HITS --site-multihit $SITE_MULTIHIT >> $PROGRESS_FILE else - echo "mpirun -np $PROCS $HYPHY LIBPATH=$HYPHY_PATH $FEL --alignment $FN --tree $TREE_FN --code $GENETIC_CODE --branches FG --srv $RATE_VARIATION --output $RESULTS_FILE --ci $CI >> $PROGRESS_FILE" - mpirun -np $PROCS $HYPHY LIBPATH=$HYPHY_PATH ENV="TOLERATE_NUMERICAL_ERRORS=1;" $FEL --alignment $FN --tree $TREE_FN --code $GENETIC_CODE --branches FG --srv $RATE_VARIATION --output $RESULTS_FILE --ci $CI >> $PROGRESS_FILE + echo "mpirun -np $PROCS $HYPHY LIBPATH=$HYPHY_PATH $FEL --alignment $FN --tree $TREE_FN --code $GENETIC_CODE --branches FG --srv $RATE_VARIATION --output $RESULTS_FILE --ci $CI --multiple-hits $MULTIPLE_HITS --site-multihit $SITE_MULTIHIT >> $PROGRESS_FILE" + mpirun -np $PROCS $HYPHY LIBPATH=$HYPHY_PATH ENV="TOLERATE_NUMERICAL_ERRORS=1;" $FEL --alignment $FN --tree $TREE_FN --code $GENETIC_CODE --branches FG --srv $RATE_VARIATION --output $RESULTS_FILE --ci $CI --multiple-hits $MULTIPLE_HITS --site-multihit $SITE_MULTIHIT >> $PROGRESS_FILE fi echo "Completed" > $STATUS_FILE - From 21ee61c6f6733986b24dbe06b07ec23a9984d883 Mon Sep 17 00:00:00 2001 From: Steven Weaver Date: Wed, 27 Nov 2024 08:25:12 -0800 Subject: [PATCH 2/3] veg/datamonkey-js#752 -- adding new meme options --- app/meme/meme.js | 27 ++++++++++++++++++++------- app/meme/meme.sh | 17 +++++++---------- 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/app/meme/meme.js b/app/meme/meme.js index 50168c6..4b6b713 100644 --- a/app/meme/meme.js +++ b/app/meme/meme.js @@ -5,7 +5,7 @@ var config = require("../../config.json"), fs = require("fs"), path = require("path"); -var meme = function(socket, stream, params) { +var meme = function (socket, stream, params) { var self = this; self.socket = socket; self.stream = stream; @@ -26,6 +26,12 @@ var meme = function(socket, stream, params) { self.bootstrap = self.params.analysis.bootstrap; self.resample = self.params.analysis.resample; + self.multiple_hits = self.params.multiple_hits; + self.site_multihit = self.params.site_multihit; + self.rates = self.params.rates; + self.resample = self.params.resample; + self.impute_states = self.params.impute_states; + // parameter-derived attributes self.fn = __dirname + "/output/" + self.id; self.output_dir = path.dirname(self.fn); @@ -36,10 +42,7 @@ var meme = function(socket, stream, params) { self.tree_fn = self.fn + ".tre"; self.qsub_params = [ - "-l walltime=" + - config.meme_walltime + - ",nodes=1:ppn=" + - config.meme_procs, + "-l walltime=" + config.meme_walltime + ",nodes=1:ppn=" + config.meme_procs, "-q", config.qsub_queue, "-v", @@ -59,6 +62,16 @@ var meme = function(socket, stream, params) { self.bootstrap + ",resample=" + self.resample + + ",multiple_hits=" + + self.multiple_hits + + ",site_multihit=" + + self.site_multihit + + ",rates=" + + self.rates + + ",resample=" + + self.resample + + ",impute_states=" + + self.impute_states + ",genetic_code=" + self.genetic_code + ",analysis_type=" + @@ -73,11 +86,11 @@ var meme = function(socket, stream, params) { self.output_dir, "-e", self.output_dir, - self.qsub_script + self.qsub_script, ]; // Write tree to a file - fs.writeFile(self.tree_fn, self.nj, function(err) { + fs.writeFile(self.tree_fn, self.nj, function (err) { if (err) throw err; }); diff --git a/app/meme/meme.sh b/app/meme/meme.sh index 69fe491..32200a4 100755 --- a/app/meme/meme.sh +++ b/app/meme/meme.sh @@ -11,8 +11,11 @@ CWD=$cwd TREE_FN=$tree_fn STATUS_FILE=$sfn PROGRESS_FILE=$pfn -#BOOTSTRAP=$bootstrap -#RESAMPLE=$resample +MULTIPLE_HITS="$multiple_hits" +SITE_MULTIHIT="$site_multihit" +RATES="$rates" +RESAMPLE="$resample" +IMPUTE_STATES="$impute_states" RESULTS_FN=$fn.MEME.json GENETIC_CODE=$genetic_code PROCS=$procs @@ -24,13 +27,7 @@ export HYPHY_PATH=$HYPHY_PATH trap 'echo "Error" > $STATUS_FILE; exit 1' ERR -#if [ $BOOTSTRAP = "true" ] -#then -echo "mpirun -np $PROCS $HYPHY LIBPATH=$HYPHY_PATH meme --alignment $FN --tree $TREE_FN --code $GENETIC_CODE >> $PROGRESS_FILE" -mpirun -np $PROCS $HYPHY LIBPATH=$HYPHY_PATH ENV="TOLERATE_NUMERICAL_ERRORS=1;" meme --alignment $FN --tree $TREE_FN --code $GENETIC_CODE >> $PROGRESS_FILE -#else -# echo "mpirun -np $PROCS $HYPHY LIBPATH=$HYPHY_PATH meme --alignment $FN --tree $TREE_FN --code $GENETIC_CODE >> $PROGRESS_FILE" -# mpirun -np $PROCS $HYPHY LIBPATH=$HYPHY_PATH ENV="TOLERATE_NUMERICAL_ERRORS=1;" meme --alignment $FN --tree $TREE_FN --code $GENETIC_CODE >> $PROGRESS_FILE -#fi +echo "mpirun -np $PROCS $HYPHY LIBPATH=$HYPHY_PATH meme --alignment $FN --tree $TREE_FN --code $GENETIC_CODE --multiple-hits $MULTIPLE_HITS --site-multihit $SITE_MULTIHIT --rates $RATES --resample $RESAMPLE --impute-states $IMPUTE_STATES >> $PROGRESS_FILE" +mpirun -np $PROCS $HYPHY LIBPATH=$HYPHY_PATH ENV="TOLERATE_NUMERICAL_ERRORS=1;" meme --alignment $FN --tree $TREE_FN --code $GENETIC_CODE --multiple-hits $MULTIPLE_HITS --site-multihit $SITE_MULTIHIT --rates $RATES --resample $RESAMPLE --impute-states $IMPUTE_STATES >> $PROGRESS_FILE echo "Completed" > $STATUS_FILE From 7d4c671d3a0df9579e335808a80596af83dfd699 Mon Sep 17 00:00:00 2001 From: Steven Weaver Date: Wed, 27 Nov 2024 19:04:40 -0500 Subject: [PATCH 3/3] meme fix --- app/meme/meme.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/meme/meme.js b/app/meme/meme.js index 4b6b713..15ce6f4 100644 --- a/app/meme/meme.js +++ b/app/meme/meme.js @@ -26,11 +26,11 @@ var meme = function (socket, stream, params) { self.bootstrap = self.params.analysis.bootstrap; self.resample = self.params.analysis.resample; - self.multiple_hits = self.params.multiple_hits; - self.site_multihit = self.params.site_multihit; - self.rates = self.params.rates; - self.resample = self.params.resample; - self.impute_states = self.params.impute_states; + // New attributes for multiple hits and site multihit + self.multiple_hits = self.params.analysis.multiple_hits || "None"; // e.g., [Double, Double+Triple, None] + self.site_multihit = self.params.analysis.site_multihit || "Estimate"; // e.g., [Estimate, Global] + self.rates = self.params.analysis.rates || 2; + self.impute_states = self.params.analysis.impute_states || "No"; // parameter-derived attributes self.fn = __dirname + "/output/" + self.id;