def check_sampleid_duplicates(header, mapping_data, errors):
 sample_id_field = 'SampleID'
 correction = 1
 try:
  sample_id_ix = header.index(sample_id_field)
 except ValueError:
  return errors
 sample_ids = []
 missing_sample_ids = []
 for curr_data in range(len(mapping_data)):
  if (len(mapping_data[curr_data][sample_id_ix]) == 0):
   errors.append(('Missing SampleID. DCTB %d,%d' % ((curr_data + correction), sample_id_ix)))
   missing_sample_ids.append((curr_data + correction))
  sample_ids.append(mapping_data[curr_data][sample_id_ix])
 dups = duplicates_indices(sample_ids)
 for curr_dup in dups:
  for curr_loc in dups[curr_dup]:
   if ((curr_loc + correction) not in missing_sample_ids):
    errors.append(('Duplicate SampleID %s found. DCTB %d,%d' % (curr_dup, (curr_loc + correction), sample_id_ix)))
 return errors

def check_sampleid_duplicates ( header , mapping_data , errors ) : sample_id_field = 'SampleID' correction = 1 try : sample_id_ix = header . index ( sample_id_field ) except ValueError : return errors sample_ids = [ ] missing_sample_ids = [ ] for curr_data in range ( len ( mapping_data ) ) : if ( len ( mapping_data [ curr_data ] [ sample_id_ix ] ) == 0 ) : errors . append ( ( 'Missing SampleID. DCTB %d,%d' % ( ( curr_data + correction ) , sample_id_ix ) ) ) missing_sample_ids . append ( ( curr_data + correction ) ) sample_ids . append ( mapping_data [ curr_data ] [ sample_id_ix ] ) dups = duplicates_indices ( sample_ids ) for curr_dup in dups : for curr_loc in dups [ curr_dup ] : if ( ( curr_loc + correction ) not in missing_sample_ids ) : errors . append ( ( 'Duplicate SampleID %s found. DCTB %d,%d' % ( curr_dup , ( curr_loc + correction ) , sample_id_ix ) ) ) return errors
flags duplicate .