def filter_sff_reads(sff_data, ids_to_keep=None, ids_to_remove=None):
 (header, reads) = sff_data
 if (ids_to_keep is not None):
  reads = [r for r in reads if (r['Name'] in ids_to_keep)]
 if (ids_to_remove is not None):
  reads = [r for r in reads if (r['Name'] not in ids_to_remove)]
 header['number_of_reads'] = len(reads)
 return (header, reads)

def filter_sff_reads ( sff_data , ids_to_keep = None , ids_to_remove = None ) : ( header , reads ) = sff_data if ( ids_to_keep is not None ) : reads = [ r for r in reads if ( r [ 'Name' ] in ids_to_keep ) ] if ( ids_to_remove is not None ) : reads = [ r for r in reads if ( r [ 'Name' ] not in ids_to_remove ) ] header [ 'number_of_reads' ] = len ( reads ) return ( header , reads )
retain reads where the id is in ids_to_keep but not in ids_to_remove .