def extract_barcodes_from_mapping(labels):
 barcodes = {}
 re = compile('(\\w+) ([a-zA-Z0-9.]+) orig_bc=(\\w*) new_bc=\\w* bc_diffs=\\d+')
 for label in labels:
  tmatch = search(re, label)
  flowgram_id = tmatch.group(2)
  barcode = tmatch.group(3)
  barcodes[flowgram_id] = barcode
 return barcodes

def extract_barcodes_from_mapping ( labels ) : barcodes = { } re = compile ( '(\\w+) ([a-zA-Z0-9.]+) orig_bc=(\\w*) new_bc=\\w* bc_diffs=\\d+' ) for label in labels : tmatch = search ( re , label ) flowgram_id = tmatch . group ( 2 ) barcode = tmatch . group ( 3 ) barcodes [ flowgram_id ] = barcode return barcodes
extract barcodes from split_libraries fasta headers .