function InitializeDistances (dummy)
{
	HarvestFrequencies (_dNucFreq,filteredData,1,1,0);
	
	_d_fA = _dNucFreq[0];
	_d_fC = _dNucFreq[1];
	_d_fG = _dNucFreq[2];
	_d_fT = _dNucFreq[3];
	
	_d_SS = _d_fA^2+_d_fC^2+_d_fG^2+_d_fT^2;
	
	summingVector = {4,1}["1"];

	return 0;
}

function ComputeDistanceFormula (s1,s2)
{
	GetDataInfo (siteDifferenceCount, filteredData, s1, s2, DISTANCE_AMBIG_OPTION);
	
	totalSitesCompared = (Transpose(summingVector)*(siteDifferenceCount*summingVector))[0];
	if (totalSitesCompared)
	{
		_d_c =  (siteDifferenceCount[0][1]+siteDifferenceCount[1][0])^2/(2*_d_fA*_d_fC)+
				(siteDifferenceCount[0][2]+siteDifferenceCount[2][0])^2/(2*_d_fA*_d_fG)+
				(siteDifferenceCount[0][3]+siteDifferenceCount[3][0])^2/(2*_d_fA*_d_fT)+
				(siteDifferenceCount[1][2]+siteDifferenceCount[2][1])^2/(2*_d_fC*_d_fG)+
				(siteDifferenceCount[1][3]+siteDifferenceCount[3][1])^2/(2*_d_fC*_d_fT)+
				(siteDifferenceCount[2][3]+siteDifferenceCount[3][2])^2/(2*_d_fG*_d_fT);
				
		_dDifferenceCounts = 1-(siteDifferenceCount[0][0]+siteDifferenceCount[1][1]+
								siteDifferenceCount[2][2]+siteDifferenceCount[3][3])/totalSitesCompared;

		_d_c = .5*(1-_d_SS+_dDifferenceCounts^2/_d_c);
		_d1	 = 1-_dDifferenceCounts/_d_c;
		if (_d1 > 0)
		{		
			return -_d_c*Log(_d1);
		}
	}
	else
	{
		return 0;
	}
	return 1000;
}
