/usr/share/hyphy/TemplateBatchFiles/RelativeRate.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 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | VERBOSITY_LEVEL = -1;
ALLOW_SEQUENCE_MISMATCH = 1;
#include "relrateBootstrap.bf";
fprintf(stdout,"\n ---- RUNNING RELATIVE RATE 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;
SetDialogPrompt ("Please choose a codon data file:");
#include "TemplateModels/chooseGeneticCode.def";
}
else
{
SetDialogPrompt ("Please choose a nucleotide or amino-acid data file:");
}
fileCount = 0;
speciesCount = 0;
if ((OPTIMIZATION_PRECISION==0)||(OPTIMIZATION_PRECISION>0.001))
{
OPTIMIZATION_PRECISION = 0.001;
}
while (speciesCount < 3)
{
if (fileCount>=1)
{
SetDialogPrompt ("Please choose an additional data file:");
DataSet ds2 = ReadDataFile (PROMPT_FOR_FILE);
speciesCount = speciesCount + ds2.species;
DataSet ds = Combine (ds,ds2);
}
else
{
DataSet ds = ReadDataFile (PROMPT_FOR_FILE);
speciesCount = speciesCount + ds.species;
}
fileCount = fileCount+1;
}
firstSpec = 0;
secondSpec = 1;
thirdSpec = 2;
fprintf (stdout,"The following data were read:\n",ds,"\n");
if (speciesCount>3)
{
speciesNames = {1,3};
ChoiceList (twoSpec, "Choose 2 taxa to share rates:",2,SKIP_NONE,ds);
if (twoSpec[0]<0)
{
return ;
}
firstSpec = twoSpec[0];
secondSpec = twoSpec[1];
ChoiceList (thirdSpec, "Choose the outgroup:",1,twoSpec,ds);
}
else
{
ChoiceList (thirdSpec,"Choose the outgroup:",1,SKIP_NONE,ds);
if (thirdSpec == 1)
{
firstSpec = 0;
secondSpec = 2;
}
else
{
if (thirdSpec == 2)
{
firstSpec = 0;
secondSpec = 1;
}
else
{
firstSpec = 1;
secondSpec = 2;
thirdSpec = 0;
}
}
}
if (dataType)
{
DataSetFilter filteredData = CreateFilter (ds,3,"",(speciesIndex==firstSpec)||(speciesIndex==secondSpec)||(speciesIndex==thirdSpec),GeneticCodeExclusions);
}
else
{
DataSetFilter filteredData = CreateFilter (ds,1,"",(speciesIndex==firstSpec)||(speciesIndex==secondSpec)||(speciesIndex==thirdSpec));
}
SelectTemplateModel(filteredData);
if ((firstSpec<thirdSpec)&&(secondSpec<thirdSpec))
{
treeString = "(Ingroup1,Ingroup2,OutGroup)";
}
else
{
if ((firstSpec>thirdSpec)&&(secondSpec>thirdSpec))
{
treeString = "(OutGroup,Ingroup1,Ingroup2)";
}
else
{
treeString = "(Ingroup1,OutGroup,Ingroup2)";
}
}
relationString = ":=";
#include "selectModelParameters.bf";
Tree threeTaxaTree = treeString;
LikelihoodFunction lf = (filteredData,threeTaxaTree);
GetString (specName,ds,thirdSpec);
fprintf (stdout,"\nOutgroup = ",specName);
GetString (specName,ds,firstSpec);
fprintf (stdout,"\nIngroup1 = ",specName);
GetString (specName,ds,secondSpec);
fprintf (stdout,"\nIngroup2 = ",specName);
Optimize (res,lf);
fprintf (stdout, "\n_________________RESULTS_________________\n\nFull Model Results:\n",lf);
Tree constrained3TaxaTree = treeString;
/* now specify the constraint */
LikelihoodFunction lfConstrained = (filteredData,constrained3TaxaTree);
ReplicateConstraint (constraintString,constrained3TaxaTree.Ingroup1, constrained3TaxaTree.Ingroup2);
Optimize (res1,lfConstrained);
fprintf (stdout, "\n\nConstrained Model Results:\n",lfConstrained);
lnLikDiff = -2(res1[1][0]-res[1][0]);
degFDiff = res[1][1]-res1[1][1];
fprintf (stdout, "\n\n-2(Ln Likelihood Difference)=",lnLikDiff,"\n","Difference in number of parameters:",Format(degFDiff,0,0));
fprintf (stdout, "\nP-Value:",1-CChi2(lnLikDiff,degFDiff));
|