/* This file defines the transition matrix for the Hasegawa et al.,1985 (HKY85)
   The file should be used as follows:
   
   1) Read Data File and create datafilter filteredData
   2) #include this file (or use SelectTemplateModel(filteredData);)
   3) Define the tree
   4) Proceed with the likelihood function using 'vectorOfFrequencies' as the vector to pass to the constructor.
   
   This model has the following signature:
    #Short:HKY85#
   	#Desc:Hasegawa et al.,1985. Local or global parameters. Possible Gamma Variation.#
   	#Dimension:4#
    #DataType:nucleotide#
   	#FileName:HKY85.mdl#
   
   08/18/1999  by Sergei L. Kosakovsky Pond
   Modified on 03/06/2000 to comply with the new Model syntax.
*/

#include "modelParameters.mdl";

if (modelType >= 1)
{
	global R = 1;
	
	if (modelType == 2)
	{
		#include "defineGamma.mdl";
	}
	if (modelType == 3)
	{
		#include "defineHM.mdl";
	}
}

function PopulateModelMatrix (ModelMatrixName&, EFV)
{
	if (modelType == 0) {
		ModelMatrixName = {{*,a,b,a}{a,*,a,b}{b,a,*,a}{a,b,a,*}};
	}
	else
	{
		if (modelType<2) {
			ModelMatrixName = {{*,R*a,a,R*a}{R*a,*,R*a,a}{a,R*a,*,R*a}{R*a,a,R*a,*}};
		}
		else {
			ModelMatrixName = {{*,R*a*c,a*c,R*a*c}{R*a*c,*,R*a*c,a*c}{a*c,R*a*c,*,R*a*c}{R*a*c,a*c,R*a*c,*}};
		}
	}
	return 1;
}

HKY85 = 0;

HarvestFrequencies (vectorOfFrequencies, filteredData,1,1,0);

MULTIPLY_BY_FREQS = PopulateModelMatrix ("HKY85",vectorOfFrequencies);

Model HKY85Model = (HKY85, vectorOfFrequencies, MULTIPLY_BY_FREQS);

FREQUENCY_SENSITIVE = 1;
