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