def decode_barcode_8(nt_barcode):
 if (len(nt_barcode) != 8):
  raise ValueError('barcode must be 8 nt long.')
 if set(list(nt_barcode)).difference(CUR_ENC_FO.keys()):
  raise ValueError('Only A,T,C,G valid chars.')
 decoded = nt_to_cw(CUR_ENC_FO, nt_barcode)
 (num_errors, sym) = calc_syndrome(decoded, 16)
 if (num_errors == 1):
  nt_barcode = unpack_bitstr(CUR_REV_ENC_SI, ''.join(map(str, decoded)))
 elif (num_errors > 1):
  nt_barcode = None
 return (nt_barcode, (num_errors / 2.0))

def decode_barcode_8 ( nt_barcode ) : if ( len ( nt_barcode ) != 8 ) : raise ValueError ( 'barcode must be 8 nt long.' ) if set ( list ( nt_barcode ) ) . difference ( CUR_ENC_FO . keys ( ) ) : raise ValueError ( 'Only A,T,C,G valid chars.' ) decoded = nt_to_cw ( CUR_ENC_FO , nt_barcode ) ( num_errors , sym ) = calc_syndrome ( decoded , 16 ) if ( num_errors == 1 ) : nt_barcode = unpack_bitstr ( CUR_REV_ENC_SI , '' . join ( map ( str , decoded ) ) ) elif ( num_errors > 1 ) : nt_barcode = None return ( nt_barcode , ( num_errors / 2.0 ) )
decode length 8 barcode .