def get_output_ids(ids_bcs_added_field, corrected_bc, num_errors, added_field, max_bc_errors=1.5, enum_val=1):
 bc_corrected_flag = None
 if (added_field is None):
  curr_added_field = ''
 else:
  curr_added_field = added_field
 if (corrected_bc is None):
  curr_bc = ''
 else:
  curr_bc = corrected_bc
 log_id = ''
 if (num_errors > max_bc_errors):
  sample_id = ('Unassigned_%d' % enum_val)
  bc_corrected_flag = 'not_corrected'
 else:
  try:
   base_sample_id = ids_bcs_added_field[(curr_bc, curr_added_field)]
   sample_id = ('%s_%d' % (base_sample_id, enum_val))
   if corrected_bc:
    log_id += ('%s' % corrected_bc)
   if (corrected_bc and added_field):
    log_id += ','
   if added_field:
    log_id += ('%s' % added_field)
   if log_id:
    log_id += ','
   log_id += ('%s' % base_sample_id)
   if (num_errors > 0):
    bc_corrected_flag = 'corrected'
  except KeyError:
   sample_id = ('Unassigned_%d' % enum_val)
 return (sample_id, log_id, bc_corrected_flag)

def get_output_ids ( ids_bcs_added_field , corrected_bc , num_errors , added_field , max_bc_errors = 1.5 , enum_val = 1 ) : bc_corrected_flag = None if ( added_field is None ) : curr_added_field = '' else : curr_added_field = added_field if ( corrected_bc is None ) : curr_bc = '' else : curr_bc = corrected_bc log_id = '' if ( num_errors > max_bc_errors ) : sample_id = ( 'Unassigned_%d' % enum_val ) bc_corrected_flag = 'not_corrected' else : try : base_sample_id = ids_bcs_added_field [ ( curr_bc , curr_added_field ) ] sample_id = ( '%s_%d' % ( base_sample_id , enum_val ) ) if corrected_bc : log_id += ( '%s' % corrected_bc ) if ( corrected_bc and added_field ) : log_id += ',' if added_field : log_id += ( '%s' % added_field ) if log_id : log_id += ',' log_id += ( '%s' % base_sample_id ) if ( num_errors > 0 ) : bc_corrected_flag = 'corrected' except KeyError : sample_id = ( 'Unassigned_%d' % enum_val ) return ( sample_id , log_id , bc_corrected_flag )
returns sampleid to write to output fasta/qual files ids_bcs_added_field: dict of : sampleid corrected_bc: corrected barcode sequence .