docs: def recode_curesim_reads(
          curesim_fastq_fo,
          rnf_fastq_fo,
          fai_fo,
          genome_id,
          number_of_read_tuples=10**9,
          recode_random=False,
      ):
          """Recode CuReSim output FASTQ file to the RNF-compatible output FASTQ file.
  
  		Args:
  			curesim_fastq_fo (file object): File object of CuReSim FASTQ file.
  			fastq_rnf_fo (file object): File object of RNF FASTQ.
  			fai_fo (file object): File object for FAI file of the reference genome.
  			genome_id (int): RNF genome ID to be used.
  			number_of_read_tuples (int): Expected number of read tuples (to estimate number of digits in RNF).
  			recode_random (bool): Recode random reads.
  
  		Raises:
  			ValueError
  		"""
  
          curesim_pattern = re.compile('@(.*)_([0-9]+)_([0-9]+)_([0-9]+)_([0-9]+)_([0-9]+)_([0-9]+)_([0-9]+)')
          """
  			CuReSim read name format
  
  			@<#1>_<#2>_<#3>_<#4>_<#5>_<#6>_<#7>_<#8>
  
  			1: contig name
  			2: original position
  			3: strand (0=forward;1=reverse)
  			4: random read (0=non-random;1=random)
  			5: number of insertions
  			6: number of deletions
  			7: number of substitution
  			8: read number (unique within a genome)
  		"""
  
          max_seq_len = 0
  
          fai_index = rnftools.utils.FaIdx(fai_fo=fai_fo)
          read_tuple_id_width = len(format(number_of_read_tuples, 'x'))
  
          fq_creator = rnftools.rnfformat.FqCreator(
              fastq_fo=rnf_fastq_fo,
              read_tuple_id_width=read_tuple_id_width,
              genome_id_width=2,
              chr_id_width=fai_index.chr_id_width,
              coor_width=fai_index.coor_width,
              info_reads_in_tuple=True,
              info_simulator="curesim",
          )
  
          # parsing FQ file
          read_tuple_id = 0
  
          i = 0
          for line in curesim_fastq_fo:
              if i % 4 == 0:
                  m = curesim_pattern.search(line)
                  if m is None:
                      rnftools.utils.error(
                          "Read '{}' was not generated by CuReSim.".format(line[1:]), program="RNFtools",
                          subprogram="MIShmash", exception=ValueError
                      )
  
                  contig_name = m.group(1)
                  start_pos = int(m.group(2))
                  direction = "R" if int(m.group(3)) else "F"
                  random = bool(m.group(4))
                  ins_nb = int(m.group(5))
                  del_nb = int(m.group(6))
                  subst_nb = int(m.group(7))
                  rd_id = int(m.group(8))
  
                  end_pos = start_pos - 1 - ins_nb + del_nb
  
                  chr_id = 0
  
                  random = contig_name[:4] == "rand"
  
              # TODO: uncomment when the chromosome naming bug in curesim is corrected
              # chr_id = self.dict_chr_ids[contig_name] if self.dict_chr_ids!={} else "0"
  
              elif i % 4 == 1:
                  bases = line.strip()
                  end_pos += len(bases)
  
                  if recode_random:
                      left = 0
                      right = 0
                  else:
                      left = start_pos + 1
                      right = end_pos
  
                  segment = rnftools.rnfformat.Segment(
                      genome_id=genome_id,
                      chr_id=chr_id,
                      direction=direction,
                      left=left,
                      right=right,
                  )
  
              elif i % 4 == 2:
                  pass
  
              elif i % 4 == 3:
                  qualities = line.strip()
  
                  if random == recode_random:
                      fq_creator.add_read(
                          read_tuple_id=read_tuple_id,
                          bases=bases,
                          qualities=qualities,
                          segments=[segment],
                      )
  
                  read_tuple_id += 1
  
              i += 1
  
          fq_creator.flush_read_tuple()