def write_log_file(output_log_fp, errors, warnings):
 out_f = open(output_log_fp, 'w')
 if ((not errors) and (not warnings)):
  out_f.write('No errors or warnings found in mapping file.')
  return
 out_f.write(((((('# Errors and warnings are written as a tab separated ' + 'columns, with the first column showing the error or warning, and the ') + 'second column contains the location of the error or warning, written ') + 'as row,column, where 0,0 is the top left header item (SampleID).  ') + 'Problems not specific to a particular data cell will be listed as ') + "having 'no location'.\n"))
 out_f.write('Errors -----------------------------\n')
 for error in errors:
  if (error.split(' DCTB ')[1] == '-1,-1'):
   curr_err = (error.split(' DCTB ')[0] + ' DCTB no location')
  else:
   curr_err = error
  out_f.write((curr_err + '\n'))
 out_f.write('Warnings ---------------------------\n')
 for warning in warnings:
  if (warning.split(' DCTB ')[1] == '-1,-1'):
   curr_warning = (warning.split(' DCTB ')[0] + ' DCTB no location')
  else:
   curr_warning = warning
  out_f.write((curr_warning + '\n'))

def write_log_file ( output_log_fp , errors , warnings ) : out_f = open ( output_log_fp , 'w' ) if ( ( not errors ) and ( not warnings ) ) : out_f . write ( 'No errors or warnings found in mapping file.' ) return out_f . write ( ( ( ( ( ( '# Errors and warnings are written as a tab separated ' + 'columns, with the first column showing the error or warning, and the ' ) + 'second column contains the location of the error or warning, written ' ) + 'as row,column, where 0,0 is the top left header item (SampleID).  ' ) + 'Problems not specific to a particular data cell will be listed as ' ) + "having 'no location'.\n" ) ) out_f . write ( 'Errors -----------------------------\n' ) for error in errors : if ( error . split ( ' DCTB ' ) [ 1 ] == '-1,-1' ) : curr_err = ( error . split ( ' DCTB ' ) [ 0 ] + ' DCTB no location' ) else : curr_err = error out_f . write ( ( curr_err + '\n' ) ) out_f . write ( 'Warnings ---------------------------\n' ) for warning in warnings : if ( warning . split ( ' DCTB ' ) [ 1 ] == '-1,-1' ) : curr_warning = ( warning . split ( ' DCTB ' ) [ 0 ] + ' DCTB no location' ) else : curr_warning = warning out_f . write ( ( curr_warning + '\n' ) )
writes log file log_data: dictionary of details about reverse primer removal log_f: open filepath to write log details .