@Override
	public int overlap(DnaSequence seq1, DnaSequence seq2) {
		// Initialize
		bestScore = Integer.MAX_VALUE;
		bestOffset = 0;
		rotator = new SequenceRotator(seq1);

		// Rotating right
		int lenRight = seq2.length() - minOverlap + 1;
		int lenLeft = seq1.length() - minOverlap + 1;
		int len = Math.max(lenRight, lenLeft);

		// Nothing to overlap?
		if (len <= 0) {
			bestScore = Math.min(seq1.length(), seq2.length());
			bestOffset = 0;
		}

		// Calculate best possible overlap
		for (int off = 0; off < len; off++) {
			int score = Integer.MAX_VALUE;

			// Compare to right rotation
			if (off < lenRight) score = overlapScore(seq1, seq2, off);
			if (score < bestScore) {
				bestScore = score;
				bestOffset = off;
				if (score == 0) return score; // Can't get lower than zero
			}

			// Compare to left rotation
			if (off < lenLeft) score = overlapScore(seq1, seq2, -off);
			if (score < bestScore) {
				bestScore = score;
				bestOffset = -off;
				if (score == 0) return score; // Can't get lower than zero
			}
		}

		return bestScore;
	}