def filter_hmm_hit_list(hmm_hit_list, e_value_cutoff="1e-25", hmm_coverage=0.3, max_align_overlap=0.5):
	"""
	Filters HMM gits by E-Value, Coverage and Overlap between hits.

	:param hmm_hit_list: List of HMM hit objects.
	:param e_value_cutoff: The E-Value cutoff for hits.
	:param hmm_coverage: The HMM coverage cutoff for hits.
	:param max_align_overlap: The maximum overlap percentage between overlapping HMM hits.
	:return: List of filtered HMM hit objects.
	"""
	hmm_hit_list = [hit for hit in hmm_hit_list if hit.e_value < float(e_value_cutoff)]  # Filters hits by E-value.

	i = 0
	while i < (len(hmm_hit_list) - 1):
		hit_one = hmm_hit_list[i]  # Current Row in hit table.
		hit_two = hmm_hit_list[i + 1]  # Row below.
		if hit_one.target_protein == hit_two.target_protein:
			overlap_between_hits = hit_one.ali_to - hit_two.ali_from
			if overlap_between_hits > 0:
				# If the overlap is greater than 50% of either alignment.
				if ((float(overlap_between_hits) / float(hit_one.ali_length)) > max_align_overlap) or (
							(float(overlap_between_hits) / float(hit_two.ali_length)) > max_align_overlap):

					if hit_one.e_value < hit_two.e_value:
						hmm_hit_list.remove(hit_two)
					else:
						hmm_hit_list.remove(hit_one)
					i -= 1  # Resets list index.
		i += 1

	hmm_hit_list = [hit for hit in hmm_hit_list if hit.hmm_coverage > hmm_coverage]  # Filters by Query Coverage.
	return hmm_hit_list