code: def error(args):
      
      p = OptionParser(error.__doc__)
      opts, args = p.parse_args(args)
  
      if len(args) != 2:
          sys.exit(not p.print_help())
  
      version, backup_folder = args
      mkdir(backup_folder)
  
      fw = open("errors.log", "w")
  
      seen = set()
      for g in glob("../5-consensus/*.err"):
          if "partitioned" in g:
              continue
  
          fp = open(g)
          partID = op.basename(g).rsplit(".err", 1)[0]
          partID = int(partID.split("_")[-1])
  
          for row in fp:
              if row.startswith(working):
                  unitigID = row.split("(")[0].split()[-1]
                  continue
  
              if not failed.upper() in row.upper():
                  continue
  
              uu = (version, partID, unitigID)
              if uu in seen:
                  continue
              seen.add(uu)
  
              print("\t".join(str(x) for x in (partID, unitigID)), file=fw)
  
              s = [str(x) for x in uu]
              unitigfile = pull(s)
              cmd = "mv {0} {1}".format(unitigfile, backup_folder)
              sh(cmd)
  
          fp.close()
  
      logging.debug("A total of {0} unitigs saved to {1}.".\
                   format(len(seen), backup_folder))
docs: %prog error version backup_folder
  
      Find all errors in ../5-consensus/*.err and pull the error unitigs into
      backup/ folder.