require that both pairs are mapped in the sam file in order to remove the reads

def filter_paired(list):
	"""
	require that both pairs are mapped in the sam file in order to remove the reads
	"""
	pairs = {}
	filtered = []
	for id in list:
		read = id.rsplit('/')[0]
		if read not in pairs:
			pairs[read] = []
		pairs[read].append(id)
	for read in pairs:
		ids = pairs[read]
		if len(ids) == 2:
			filtered.extend(ids)
	return set(filtered)