def process_mapping_file(map_f, barcode_len, barcode_type, BARCODE_COLUMN, REVERSE_PRIMER_COLUMN):
 (_, _, bc_to_sid, _, _, bc_to_fwd_primers, _) = check_map(map_f, False)
 map_f.seek(0)
 metadata_map = parse_mapping_file_to_dict(map_f)[0]
 bc_to_rev_primers = {}
 for (sid, md) in metadata_map.items():
  if (REVERSE_PRIMER_COLUMN in md):
   bc_to_rev_primers[md[BARCODE_COLUMN]] = expand_degeneracies(md[REVERSE_PRIMER_COLUMN].upper().split(','))
  else:
   raise Exception(('The %s column does not exist in the mapping file. %s is required.' % (REVERSE_PRIMER_COLUMN, REVERSE_PRIMER_COLUMN)))
 check_barcodes(bc_to_sid, barcode_len, barcode_type)
 return (bc_to_sid, bc_to_fwd_primers, bc_to_rev_primers)

def process_mapping_file ( map_f , barcode_len , barcode_type , BARCODE_COLUMN , REVERSE_PRIMER_COLUMN ) : ( _ , _ , bc_to_sid , _ , _ , bc_to_fwd_primers , _ ) = check_map ( map_f , False ) map_f . seek ( 0 ) metadata_map = parse_mapping_file_to_dict ( map_f ) [ 0 ] bc_to_rev_primers = { } for ( sid , md ) in metadata_map . items ( ) : if ( REVERSE_PRIMER_COLUMN in md ) : bc_to_rev_primers [ md [ BARCODE_COLUMN ] ] = expand_degeneracies ( md [ REVERSE_PRIMER_COLUMN ] . upper ( ) . split ( ',' ) ) else : raise Exception ( ( 'The %s column does not exist in the mapping file. %s is required.' % ( REVERSE_PRIMER_COLUMN , REVERSE_PRIMER_COLUMN ) ) ) check_barcodes ( bc_to_sid , barcode_len , barcode_type ) return ( bc_to_sid , bc_to_fwd_primers , bc_to_rev_primers )
ensures that sample ids and barcodes are unique .