def check_map(infile, disable_primer_check, barcode_type='golay_12', added_demultiplex_field=None, has_barcodes=True):
 if (barcode_type == 'variable_length'):
  var_len_barcodes = True
 else:
  var_len_barcodes = False
 if (barcode_type == '0'):
  has_barcodes = False
 (hds, mapping_data, run_description, errors, warnings) = process_id_map(infile, has_barcodes=has_barcodes, disable_primer_check=disable_primer_check, added_demultiplex_field=added_demultiplex_field, variable_len_barcodes=var_len_barcodes)
 if errors:
  raise ValueError((('Errors were found with mapping file, ' + 'please run validate_mapping_file.py to ') + 'identify problems.'))
 id_map = {}
 for curr_data in mapping_data:
  id_map[curr_data[0]] = {}
 for header in range(len(hds)):
  for curr_data in mapping_data:
   id_map[curr_data[0]][hds[header]] = curr_data[header]
 barcode_to_sample_id = {}
 primer_seqs_lens = {}
 all_primers = {}
 for (sample_id, sample) in id_map.items():
  if added_demultiplex_field:
   barcode_to_sample_id[((sample['BarcodeSequence'].upper() + ',') + sample[added_demultiplex_field])] = sample_id
  else:
   barcode_to_sample_id[sample['BarcodeSequence'].upper()] = sample_id
  if (not disable_primer_check):
   raw_primers = sample['LinkerPrimerSequence'].upper().split(',')
   if (len(raw_primers[0].strip()) == 0):
    raise ValueError(('No primers detected, please use the ' + '-p parameter to disable primer detection.'))
   expanded_primers = expand_degeneracies(raw_primers)
   curr_bc_primers = {}
   for primer in expanded_primers:
    curr_bc_primers[primer] = len(primer)
    all_primers[primer] = len(primer)
   primer_seqs_lens[sample['BarcodeSequence']] = curr_bc_primers
 return (hds, id_map, barcode_to_sample_id, warnings, errors, primer_seqs_lens, all_primers)

def check_map ( infile , disable_primer_check , barcode_type = 'golay_12' , added_demultiplex_field = None , has_barcodes = True ) : if ( barcode_type == 'variable_length' ) : var_len_barcodes = True else : var_len_barcodes = False if ( barcode_type == '0' ) : has_barcodes = False ( hds , mapping_data , run_description , errors , warnings ) = process_id_map ( infile , has_barcodes = has_barcodes , disable_primer_check = disable_primer_check , added_demultiplex_field = added_demultiplex_field , variable_len_barcodes = var_len_barcodes ) if errors : raise ValueError ( ( ( 'Errors were found with mapping file, ' + 'please run validate_mapping_file.py to ' ) + 'identify problems.' ) ) id_map = { } for curr_data in mapping_data : id_map [ curr_data [ 0 ] ] = { } for header in range ( len ( hds ) ) : for curr_data in mapping_data : id_map [ curr_data [ 0 ] ] [ hds [ header ] ] = curr_data [ header ] barcode_to_sample_id = { } primer_seqs_lens = { } all_primers = { } for ( sample_id , sample ) in id_map . items ( ) : if added_demultiplex_field : barcode_to_sample_id [ ( ( sample [ 'BarcodeSequence' ] . upper ( ) + ',' ) + sample [ added_demultiplex_field ] ) ] = sample_id else : barcode_to_sample_id [ sample [ 'BarcodeSequence' ] . upper ( ) ] = sample_id if ( not disable_primer_check ) : raw_primers = sample [ 'LinkerPrimerSequence' ] . upper ( ) . split ( ',' ) if ( len ( raw_primers [ 0 ] . strip ( ) ) == 0 ) : raise ValueError ( ( 'No primers detected, please use the ' + '-p parameter to disable primer detection.' ) ) expanded_primers = expand_degeneracies ( raw_primers ) curr_bc_primers = { } for primer in expanded_primers : curr_bc_primers [ primer ] = len ( primer ) all_primers [ primer ] = len ( primer ) primer_seqs_lens [ sample [ 'BarcodeSequence' ] ] = curr_bc_primers return ( hds , id_map , barcode_to_sample_id , warnings , errors , primer_seqs_lens , all_primers )
gets header .