def extract_read_to_sample_mapping(labels):
 sample_id_mapping = {}
 re = compile('(\\S+) (\\S+)')
 for label in labels:
  tmatch = search(re, label)
  sample_id = tmatch.group(1)
  flowgram_id = tmatch.group(2)
  sample_id_mapping[flowgram_id] = sample_id
 return sample_id_mapping

def extract_read_to_sample_mapping ( labels ) : sample_id_mapping = { } re = compile ( '(\\S+) (\\S+)' ) for label in labels : tmatch = search ( re , label ) sample_id = tmatch . group ( 1 ) flowgram_id = tmatch . group ( 2 ) sample_id_mapping [ flowgram_id ] = sample_id return sample_id_mapping
extract a mapping from reads to sample_ids from split_libraries .