input: 
  def calculate_rRNA_percent(htseq_counts_file: str, gtf_file: str) -> str:
      """ Calculate the percentage of transcripts mapping to rRNA and MT genes.
      This function takes an HTseq_counts file and a GTF file as inputs, extracts gene identifiers for rRNA and MT genes,
      counts the reads matching these identifiers, and writes the results to a summary output file.
      
      >>> calculate_rRNA_percent("C17_3_S20_Aligned.out.srt.bam_htseq_combined_counts.txt", "/Users/malwina/Documents/CTR-Data/genomes/Mus_musculus/mm10/Mus_musculus.GRCm38.84.gtf")
      "Summary output file: ../../.._rRNAmtRNACounts.txt"
      """
  
output:     rRNA_genes = set()
      MT_genes = set()
  
      with open(gtf_file, 'r') as gtf:
          for line in gtf:
              if line.startswith('#'):
                  continue
              fields = line.strip().split('\t')
              if fields[2] == 'gene':
                  attributes = fields[8].split(';')
                  gene_id = None
                  gene_type = None
                  for attr in attributes:
                      if 'gene_id' in attr:
                          gene_id = attr.split()[1].strip('"')
                      if 'gene_type' in attr:
                          gene_type = attr.split()[1].strip('"')
                  if gene_type == 'rRNA':
                      rRNA_genes.add(gene_id)
                  elif gene_type == 'Mt_rRNA' or gene_type == 'Mt_tRNA':
                      MT_genes.add(gene_id)
  
      rRNA_count = 0
      MT_count = 0
      total_count = 0
  
      with open(htseq_counts_file, 'r') as htseq:
          for line in htseq:
              if line.startswith('__'):
                  continue
              gene_id, count = line.strip().split('\t')
              count = int(count)
              total_count += count
              if gene_id in rRNA_genes:
                  rRNA_count += count
              elif gene_id in MT_genes:
                  MT_count += count
  
      rRNA_percent = (rRNA_count / total_count) * 100
      MT_percent = (MT_count / total_count) * 100
  
      output_file = htseq_counts_file.replace('.txt', '_rRNAmtRNACounts.txt')
      with open(output_file, 'w') as out:
          out.write(f"Total reads: {total_count}\n")
          out.write(f"rRNA reads: {rRNA_count} ({rRNA_percent:.2f}%)\n")
          out.write(f"MT reads: {MT_count} ({MT_percent:.2f}%)\n")
  
      return f"Summary output file: {output_file}"