def sam_list_paired(sam):
    """
	get a list of mapped reads
	require that both pairs are mapped in the sam file in order to remove the reads
	"""
    list = []
    pair = ['1', '2']
    prev = ''
    for file in sam:
        for line in file:
            if line.startswith('@') is False:
                line = line.strip().split()
                id, map = line[0], int(line[1])
                if map != 4 and map != 8:
                    read = id.rsplit('/')[0]
                    if read == prev:
                        list.append(read)
                    prev = read
    return set(list)
