GetString(dsfName,DataSetFilter,0);
GetString(dsName,DataSet,0);
GetString(treeName,Tree,0);

ModelMatrixDimension = 61;

nonSynRate 		= 1;
synRate		 	= 0;
ExecuteCommands ("MGM = "+dsfName+"_MG94xREV_3x4;vectorOfFrequencies="+dsfName+"_Freqs;");

factorNS = 0;

for (h=0; h<ModelMatrixDimension; h=h+1)
{
	factorNS = factorNS - MGM[h][h]*vectorOfFrequencies[h];
}

nonSynRate 		= 0;
synRate		 	= 1;
ExecuteCommands ("MGM = "+dsfName+"_MG94xREV_3x4;vectorOfFrequencies="+dsfName+"_Freqs;");
factorS = 0;

for (h=0; h<ModelMatrixDimension; h=h+1)
{
	factorS = factorS - MGM[h][h]*vectorOfFrequencies[h];
}

ExecuteCommands("branchNames = BranchName 	("+treeName+",-1);");
bCount 	    = Columns		(branchNames);

for (bc = 0; bc < bCount; bc = bc + 1)
{
	ExecuteCommands (treeName+"."+branchNames[bc]+
					 ".sSubs = factorS*"+treeName+"."+branchNames[bc]+".synRate/3");
	ExecuteCommands (treeName+"."+branchNames[bc]+
					 ".nSubs = factorNS*"+treeName+"."+branchNames[bc]+".nonSynRate/3");
}
