code: def _safe_run_theta(input_file, out_dir, output_ext, args, data):
      
      out_file = os.path.join(out_dir, _split_theta_ext(input_file) + output_ext)
      skip_file = out_file + ".skipped"
      if utils.file_exists(skip_file):
          return None
      if not utils.file_exists(out_file):
          with file_transaction(data, out_dir) as tx_out_dir:
              utils.safe_makedir(tx_out_dir)
              cmd = _get_cmd("RunTHetA.py") + args + \
                    [input_file, "--NUM_PROCESSES", dd.get_cores(data),
                     "--FORCE", "-d", tx_out_dir]
              try:
                  do.run(cmd, "Run THetA to calculate purity", log_error=False)
              except subprocess.CalledProcessError as msg:
                  if ("Number of intervals must be greater than 1" in str(msg) or
                        "This sample isn't a good candidate for THetA analysis" in str(msg)):
                      with open(os.path.join(tx_out_dir, os.path.basename(skip_file)), "w") as out_handle:
                          out_handle.write("Expected TheTA failure, skipping")
                      return None
                  else:
                      raise
      return out_file
docs: Run THetA, catching and continuing on any errors.