def get_technical_lengths(input_map, debug=False):
 if debug:
  print 'Making debug output'
 (body, header, comments) = parse_mapping_file(input_map)
 if debug:
  print 'HEADER:', header
 key_index = header.index('KEY_SEQ')
 bc_index = header.index('BARCODE')
 if ('LINKER' in header):
  linker_index = header.index('LINKER')
 else:
  linker_index = None
 primer_index = header.index('PRIMER')
 technical_lengths = {}
 for fields in body:
  curr_tech_len = ((len(fields[key_index]) + len(fields[bc_index])) + len(fields[primer_index]))
  if (linker_index is not None):
   curr_tech_len += len(fields[linker_index])
  technical_lengths[fields[0]] = curr_tech_len
 if debug:
  print 'Technical lengths:'
  print technical_lengths
 return technical_lengths

def get_technical_lengths ( input_map , debug = False ) : if debug : print 'Making debug output' ( body , header , comments ) = parse_mapping_file ( input_map ) if debug : print 'HEADER:' , header key_index = header . index ( 'KEY_SEQ' ) bc_index = header . index ( 'BARCODE' ) if ( 'LINKER' in header ) : linker_index = header . index ( 'LINKER' ) else : linker_index = None primer_index = header . index ( 'PRIMER' ) technical_lengths = { } for fields in body : curr_tech_len = ( ( len ( fields [ key_index ] ) + len ( fields [ bc_index ] ) ) + len ( fields [ primer_index ] ) ) if ( linker_index is not None ) : curr_tech_len += len ( fields [ linker_index ] ) technical_lengths [ fields [ 0 ] ] = curr_tech_len if debug : print 'Technical lengths:' print technical_lengths return technical_lengths
returns per-sample info on technical lengths .