docs: def run_remove_heterozygous_haploid(in_prefix, in_type, out_prefix, base_dir,
                                      options):
      """Runs step8 (remove heterozygous haploid).
  
      :param in_prefix: the prefix of the input files.
      :param in_type: the type of the input files.
      :param out_prefix: the output prefix.
      :param base_dir: the output directory.
      :param options: the options needed.
  
      :type in_prefix: str
      :type in_type: str
      :type out_prefix: str
      :type base_dir: str
      :type options: list
  
      :returns: a tuple containing the prefix of the output files (the input
                prefix for the next script) and the type of the output files
                (``bfile``).
  
      This function calls the
      :py:mod:`pyGenClean.HeteroHap.remove_heterozygous_haploid` module. The
      required file type for this module is ``bfile``, hence the need to use the
      :py:func:`check_input_files` to check if the file input file type is the
      good one, or to create it if needed.
  
      """
      # Creating the output directory
      os.mkdir(out_prefix)
  
      # We know we need bfile
      required_type = "bfile"
      check_input_files(in_prefix, in_type, required_type)
  
      # We need to inject the name of the input file and the name of the output
      # prefix
      script_prefix = os.path.join(out_prefix, "without_hh_genotypes")
      options += ["--{}".format(required_type), in_prefix,
                  "--out", script_prefix]
  
      # We run the script
      try:
          remove_heterozygous_haploid.main(options)
      except remove_heterozygous_haploid.ProgramError as e:
          msg = "remove_heterozygous_haploid: {}".format(e)
          raise ProgramError(msg)
  
      # We get the number of genotypes that were set to missing
      nb_hh_missing = None
      with open(script_prefix + ".log", "r") as i_file:
          nb_hh_missing = re.search(
              r"(\d+) heterozygous haploid genotypes; set to missing",
              i_file.read(),
          )
      if nb_hh_missing:
          nb_hh_missing = int(nb_hh_missing.group(1))
      else:
          nb_hh_missing = 0
  
      # We write a LaTeX summary
      latex_file = os.path.join(script_prefix + ".summary.tex")
      try:
          with open(latex_file, "w") as o_file:
              print >>o_file, latex_template.subsection(
                  remove_heterozygous_haploid.pretty_name
              )
              text = (
                  "After Plink's heterozygous haploid analysis, a total of "
                  "{:,d} genotype{} were set to missing.".format(
                      nb_hh_missing,
                      "s" if nb_hh_missing > 1 else "",
                  )
              )
              print >>o_file, latex_template.wrap_lines(text)
  
      except IOError:
          msg = "{}: cannot write LaTeX summary".format(latex_file)
          raise ProgramError(msg)
  
      # Writing the summary results
      with open(os.path.join(base_dir, "results_summary.txt"), "a") as o_file:
          print >>o_file, "# {}".format(script_prefix)
          print >>o_file, ("Number of heterozygous haploid genotypes set to "
                           "missing\t{:,d}".format(nb_hh_missing))
          print >>o_file, "---"
  
      # We know this step produces an new data set (bfile), so we return it
      return _StepResult(
          next_file=os.path.join(out_prefix, "without_hh_genotypes"),
          next_file_type="bfile",
          latex_summary=latex_file,
          description=remove_heterozygous_haploid.desc,
          long_description=remove_heterozygous_haploid.long_desc,
          graph_path=None,
      )