/usr/share/hyphy/TemplateBatchFiles/MolecularClock.bf is in hyphy-common 2.2.7+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | #include "molclockBootstrap.bf";
RESTORE_GLOBALS = 1;
_DO_TREE_REBALANCE_ = 0;
VERBOSITY_LEVEL = -1;
function RestoreGlobalValues (lfIndex)
{
if (lfIndex==0)
{
for (i=0;i<SAVE_GLOBALS;i=i+1)
{
SetParameter (lf,i,globalSpoolMatrix[i]);
}
}
if (lfIndex==1)
{
for (i=0;i<SAVE_GLOBALS2;i=i+1)
{
SetParameter (lfConstrained,i,globalSpoolMatrix2[i]);
}
}
return 0;
}
fprintf(stdout,"\n ---- RUNNING MOLECULAR CLOCK ANALYSIS ---- \n");
ChoiceList (dataType,"Data type",1,SKIP_NONE,"Nucleotide/Protein","Nucleotide or amino-acid (protein).",
"Codon","Codon (several available genetic codes).");
if (dataType<0)
{
return;
}
if (dataType)
{
NICETY_LEVEL = 3;
#include "TemplateModels/chooseGeneticCode.def";
}
SetDialogPrompt ("Choose the data file:");
DataSet ds = ReadDataFile (PROMPT_FOR_FILE);
fprintf (stdout,"The following data was read:\n",ds,"\n");
if (dataType)
{
DataSetFilter filteredData = CreateFilter (ds,3,"","",GeneticCodeExclusions);
}
else
{
DataSetFilter filteredData = CreateFilter (ds,1);
}
SelectTemplateModel(filteredData);
#include "queryTree.bf";
global RelRatio;
RelRatio = 1.0;
relationString = ":=RelRatio*";
parameter2Constrain = 0;
if (Rows("LAST_MODEL_PARAMETER_LIST")>1)
{
ChoiceList (parameter2Constrain, "Parameter(s) to constrain:",1,SKIP_NONE,LAST_MODEL_PARAMETER_LIST);
if (parameter2Constrain<0)
{
return;
}
if (parameter2Constrain==0)
{
parameter2ConstrainString = "";
for (parameter2Constrain=Rows("LAST_MODEL_PARAMETER_LIST")-1; parameter2Constrain; parameter2Constrain = parameter2Constrain-1)
{
GetString (funnyString,LAST_MODEL_PARAMETER_LIST,parameter2Constrain);
parameter2ConstrainString = parameter2ConstrainString + funnyString + ",";
}
GetString (funnyString,LAST_MODEL_PARAMETER_LIST,0);
parameter2ConstrainString = parameter2ConstrainString + funnyString;
}
else
{
GetString (parameter2ConstrainString,LAST_MODEL_PARAMETER_LIST,parameter2Constrain-1);
}
}
else
{
GetString (parameter2ConstrainString,LAST_MODEL_PARAMETER_LIST,0);
}
timer = Time(0);
LikelihoodFunction lf = (filteredData,givenTree);
Optimize (res,lf);
separator = "*-----------------------------------------------------------*";
fprintf (stdout, "\n", separator, "\nRESULTS WITHOUT THE CLOCK:\n",lf);
fullModelLik = res[1][0];
fullVars = res[1][1];
/* now specify the constraint */
Tree clockTree = treeString;
ExecuteCommands ("MolecularClock (clockTree,"+parameter2ConstrainString+");");
LikelihoodFunction lfConstrained = (filteredData, clockTree);
USE_LAST_RESULTS = 1;
Optimize (res1,lfConstrained);
USE_LAST_RESULTS = 0;
SAVE_GLOBALS = res1[1][2];
if (SAVE_GLOBALS)
{
globalSpoolMatrix = {1,SAVE_GLOBALS};
for (i=0;i<SAVE_GLOBALS;i=i+1)
{
globalSpoolMatrix[i]=res1[0][i];
}
}
fprintf (stdout, "\n", separator,"\n\nRESULTS WITH THE CLOCK:\n",lfConstrained);
lnLikDiff = 2(fullModelLik-res1[1][0]);
degFDiff = fullVars - res1[1][1];
fprintf (stdout, "\n", separator,"\n\n-2(Ln Likelihood Ratio)=",lnLikDiff,"\n","Constrained parameters:",Format(degFDiff,0,0));
fprintf (stdout, "\nP-Value:",1-CChi2(lnLikDiff,degFDiff));
fprintf (stdout, "\nCPU time taken: ", Time(0)-timer, " seconds.\n");
|