docs: def encode_chr(chromosome):
      """Encodes chromosomes.
  
      :param chromosome: the chromosome to encode.
  
      :type chromosome: str
  
      :returns: the encoded chromosome as :py:class:`int`.
  
      It changes ``X``, ``Y``, ``XY`` and ``MT`` to ``23``, ``24``, ``25`` and
      ``26``, respectively. It changes everything else as :py:class:`int`.
  
      If :py:class:`ValueError` is raised, then :py:class:`ProgramError` is
      also raised. If a chromosome as a value below 1 or above 26, a
      :py:class:`ProgramError` is raised.
  
      .. testsetup::
  
          from pyGenClean.SexCheck.gender_plot import encode_chr
  
      .. doctest::
  
          >>> [encode_chr(str(i)) for i in range(0, 11)]
          [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
          >>> [encode_chr(str(i)) for i in range(11, 21)]
          [11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
          >>> [encode_chr(str(i)) for i in range(21, 27)]
          [21, 22, 23, 24, 25, 26]
          >>> [encode_chr(i) for i in ["X", "Y", "XY", "MT"]]
          [23, 24, 25, 26]
          >>> encode_chr("27")
          Traceback (most recent call last):
              ...
          ProgramError: 27: invalid chromosome
          >>> encode_chr("XX")
          Traceback (most recent call last):
              ...
          ProgramError: XX: invalid chromosome
  
      """
      if chromosome == "X":
          return 23
      if chromosome == "Y":
          return 24
      if chromosome == "XY":
          return 25
      if chromosome == "MT":
          return 26
      try:
          new_chromosome = int(chromosome)
          if new_chromosome < 0 or new_chromosome > 26:
              msg = "{}: invalid chromosome".format(chromosome)
              raise ProgramError(msg)
          return new_chromosome
      except ValueError:
          msg = "{}: invalid chromosome".format(chromosome)
          raise ProgramError(msg)