/usr/share/hyphy/TemplateBatchFiles/doSPRSwap.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 | l = 0;
while (cladesInfo[l][1])
{
l = l+1;
}
if (verbFlag)
{
fprintf (stdout, "\n\n\tPerforming subtree pruning and regrafting on the best tree so far.\n\n");
}
nniDidBetter = 0;
for (l2 = 0; l2 < l; l2=l2+1)
{
dummy = splitCladesOnIBranch (filteredData.species,filteredData.species+l2);
l3s = 0;
l3f = 2;
if ((splitTreeInfo[0][1]==1)&&(splitTreeInfo[0][3]==1))
{
l3s = 2;
l3f = 4;
}
for (l3=l3s; l3<l3f; l3=l3+1)
{
l4 = 0;
while (splitTreeInfo[l4+1][2*l3+1])
{
/* check for degeneracies
if ((l3==1)&&(splitTreeInfo[0][1]==1)&&(splitTreeInfo[0][3]==1))
{
break;
}*/
if (l3<2)
{
dummy = doSPRSwap (2,3,l3,l4,filteredData.species);
}
else
{
dummy = doSPRSwap (0,1,l3,l4,filteredData.species);
}
thisTree = TreeMatrix2TreeString (2,0);
if (verbFlag)
{
fprintf (stdout, "\n\tSPR tree ",thisTree);
}
Tree Inferred_Tree = thisTree;
if (haveTreeConstraint)
{
if ((Inferred_Tree<=_topologyPattern) == 0)
{
if (verbFlag)
{
fprintf (stdout, " => Rejected by the topology constraint.");
}
l4 = l4+1;
continue;
}
else
{
if (verbFlag)
{
fprintf (stdout, " => Accepted by the topology constraint.");
}
}
}
if (starDecomposition)
{
LikelihoodFunction lf = (filteredData, Inferred_Tree);
}
else
{
LikelihoodFunction lf = (smallerFilter, Inferred_Tree);
}
Optimize (res,lf);
if (verbFlag)
{
fprintf (stdout, " => ", res[1][0]);
}
if (res[1][0]>bestValue)
{
nniDidBetter = 1;
bestValue = res[1][0];
bestTree = thisTree;
for (l4=2*taxonCounter-2;l4>=0;l4=l4-1)
{
bestTreeNodes[l4][0]= treeNodes[l4][2];
bestTreeNodes[l4][1]= treeNodes[l4][3];
treeNodes[l4][0] = treeNodes[l4][2];
treeNodes[l4][1] = treeNodes[l4][3];
}
for (l4=0; l4<taxonCounter-2; l4=l4+1)
{
bestCladesInfo[l4][0]= cladesInfo[l4][2];
bestCladesInfo[l4][1]= cladesInfo[l4][3];
cladesInfo[l4][0] = cladesInfo[l4][2];
cladesInfo[l4][1] = cladesInfo[l4][3];
}
if (verbFlag)
{
OpenWindow (TREEWINDOW, {{"Inferred_Tree"}});
fprintf (stdout, "\n\tRestarting SPR on the better tree.");
}
l = 0;
while (cladesInfo[l][1])
{
l = l+1;
}
l2 = -1;
l3 = l3f;
break;
}
l4 = l4+1;
}
}
}
if (nniDidBetter)
{
for (l=Rows(bestTreeNodes)-1;l>=0;l=l-1)
{
treeNodes[l][0]=bestTreeNodes[l][0];
treeNodes[l][1]=bestTreeNodes[l][1];
}
for (l=0; l<Rows(bestCladesInfo); l=l+1)
{
cladesInfo[l][0]=bestCladesInfo[l][0];
cladesInfo[l][1]=bestCladesInfo[l][1];
}
if (verbFlag)
{
fprintf (stdout,"\n\n\t Improved SPR ", Format(taxonCounter,0,0)," taxa tree is ", bestTree, " with log likelihood of ", bestValue);
}
}
|