/tools/filters/lav_to_bed_code.py

https://bitbucket.org/cistrome/cistrome-harvard/ · Python · 19 lines · 18 code · 0 blank · 1 comment · 5 complexity · 1fee2235aaf699646284c1431982c364 MD5 · raw file

  1. #Set build, name, and info for each output BED file
  2. def exec_after_process(app, inp_data, out_data, param_dict, tool, stdout, stderr):
  3. new_stdout = ""
  4. filename_to_build = {}
  5. for line in stdout.split("\n"):
  6. if line.startswith("#FILE"):
  7. fields = line.split("\t")
  8. filename_to_build[fields[1]]=fields[2].strip()
  9. else:
  10. new_stdout = "%s%s" % ( new_stdout, line )
  11. for name,data in out_data.items():
  12. try:
  13. data.info = "%s\n%s" % ( new_stdout, stderr )
  14. data.dbkey = filename_to_build[data.file_name]
  15. data.name = "%s (%s)" % ( data.name, data.dbkey )
  16. app.model.context.add( data )
  17. app.model.context.flush()
  18. except:
  19. continue