def get_demultiplex_data(ids_bcs_added_field, fasta_label, fasta_seq, bc_lens, all_bcs, barcode_type='golay_12', max_bc_errors=1.5, disable_bc_correction=False, added_demultiplex_field=None):
 for bc_len in bc_lens:
  curr_bc = fasta_seq[0:bc_len]
  (corrected_bc, num_errors, added_field) = get_curr_bc_added_field(curr_bc, ids_bcs_added_field, fasta_label, all_bcs, barcode_type, disable_bc_correction, added_demultiplex_field)
  if added_field:
   if ((corrected_bc, added_field) in ids_bcs_added_field.keys()):
    break
  elif (corrected_bc is not None):
   break
 return (curr_bc, corrected_bc, num_errors, added_field)

def get_demultiplex_data ( ids_bcs_added_field , fasta_label , fasta_seq , bc_lens , all_bcs , barcode_type = 'golay_12' , max_bc_errors = 1.5 , disable_bc_correction = False , added_demultiplex_field = None ) : for bc_len in bc_lens : curr_bc = fasta_seq [ 0 : bc_len ] ( corrected_bc , num_errors , added_field ) = get_curr_bc_added_field ( curr_bc , ids_bcs_added_field , fasta_label , all_bcs , barcode_type , disable_bc_correction , added_demultiplex_field ) if added_field : if ( ( corrected_bc , added_field ) in ids_bcs_added_field . keys ( ) ) : break elif ( corrected_bc is not None ) : break return ( curr_bc , corrected_bc , num_errors , added_field )
attempts to find bc in a given sequence and added demultiplex field ids_bcs_added_field: dict of : sampleid fasta_label: full fasta label .