def parse_illumina_line(l, barcode_length, rev_comp_barcode, barcode_in_sequence=False):
 fields = l.strip().split(':')
 y_position_subfields = fields[4].split('#')
 y_position = int(y_position_subfields[0])
 sequence = fields[5]
 qual_string = fields[6]
 if barcode_in_sequence:
  barcode = sequence[:barcode_length]
  sequence = sequence[barcode_length:]
  qual_string = qual_string[barcode_length:]
 else:
  barcode = y_position_subfields[1][:barcode_length]
 if rev_comp_barcode:
  barcode = str(DNA(barcode).rc())
 result = {'Full description': ':'.join(fields[:5]), 'Machine Name': fields[0], 'Channel Number': int(fields[1]), 'Tile Number': int(fields[2]), 'X Position': int(fields[3]), 'Y Position': y_position, 'Barcode': barcode, 'Full Y Position Field': fields[4], 'Sequence': sequence, 'Quality Score': qual_string}
 return result

def parse_illumina_line ( l , barcode_length , rev_comp_barcode , barcode_in_sequence = False ) : fields = l . strip ( ) . split ( ':' ) y_position_subfields = fields [ 4 ] . split ( '#' ) y_position = int ( y_position_subfields [ 0 ] ) sequence = fields [ 5 ] qual_string = fields [ 6 ] if barcode_in_sequence : barcode = sequence [ : barcode_length ] sequence = sequence [ barcode_length : ] qual_string = qual_string [ barcode_length : ] else : barcode = y_position_subfields [ 1 ] [ : barcode_length ] if rev_comp_barcode : barcode = str ( DNA ( barcode ) . rc ( ) ) result = { 'Full description' : ':' . join ( fields [ : 5 ] ) , 'Machine Name' : fields [ 0 ] , 'Channel Number' : int ( fields [ 1 ] ) , 'Tile Number' : int ( fields [ 2 ] ) , 'X Position' : int ( fields [ 3 ] ) , 'Y Position' : y_position , 'Barcode' : barcode , 'Full Y Position Field' : fields [ 4 ] , 'Sequence' : sequence , 'Quality Score' : qual_string } return result
parses a single line of illumina data .