docs: def index_bgen(fn, legacy=False):
      """Indexes a BGEN file.
  
      Args:
          fn (str): The name of the BGEN file.
  
      """
      logger.info("Indexing {} (BGEN) using 'bgenix'{}".format(
          fn, " (legacy mode)" if legacy else "",
      ))
      command = ["bgenix", "-g", fn, "-index"]
      if legacy:
          command.append("-with-rowid")
      try:
          logger.info("Executing '{}'".format(" ".join(command)))
          subprocess.Popen(command).communicate()
      except FileNotFoundError:
          logger.error("Cannot find 'bgenix', impossible to index {}".format(fn))
          sys.exit(1)
      logger.info("Index generated")