@Override
	public double[] computeValue(char refBase, FastaWindow window,
			AlignmentColumn col) {

		int startPos = Math.max(window.indexOfLeftEdge(), col.getCurrentPosition()-WINDOW_SIZE);
		int endPos = Math.min(window.indexOfRightEdge(), col.getCurrentPosition()+WINDOW_SIZE);
		counts[0] = 0.0;
		counts[1] = 0.0;
		counts[2] = 0.0;
		counts[3] = 0.0;
		
		for(int i=startPos; i<endPos; i++) {
			char base = window.getBaseAt(i);
			switch(base) {
			case 'A' : counts[0]++; break;
			case 'C' : counts[1]++; break;
			case 'T' : counts[2]++; break;
			case 'G' : counts[3]++; break;
			}
		}
		
		
		double tot = counts[0] + counts[1] + counts[2] + counts[3];
		if (tot > 0) {
			counts[0] /= tot;
			counts[1] /= tot;
			counts[2] /= tot;
			counts[3] /= tot;
		}
		val[0] = (counts[0]-expA)*(counts[0]-expA)
					+ (counts[1]-expC)*(counts[1]-expC)
					+ (counts[2]-expT)*(counts[2]-expT)
					+ (counts[3]-expG)*(counts[3]-expG);
		
		
		return val;
	}