input: 
  def calculate_rRNA_percent(htseq_counts: str, gtf_file: str) -> str:
      """
      Calculate the percentage of transcripts that map to rRNA and MT genes from an HTseq_counts file and a GTF file.
      The script will generate an output file named "HTseq_counts_file_rRNAmtRNACounts.txt" containing the summary of the counts.
      >>> calculate_rRNA_percent('C17_3_S20_Aligned.out.srt.bam_htseq_combined_counts.txt', 'Mus_musculus.GRCm38.84.gtf')
      'C17_3_S20_Aligned.out.srt.bam_htseq_combined_counts_rRNAmtRNACounts.txt'
      """
  
output:     import re
      from collections import defaultdict
  
      # Read the GTF file to identify rRNA and MT genes
      gene_type_dict = defaultdict(set)
      with open(gtf_file, 'r') as gtf:
          for line in gtf:
              if not line.startswith('#'):
                  fields = line.strip().split('\t')
                  if fields[2] == 'gene':
                      gene_info = fields[8]
                      gene_id = re.search(r'gene_id "([^"]+)"', gene_info).group(1)
                      gene_type = re.search(r'gene_type "([^"]+)"', gene_info).group(1)
                      if gene_type in ['rRNA', 'Mt_rRNA', 'Mt_tRNA']:
                          gene_type_dict[gene_type].add(gene_id)
  
      # Read the HTseq_counts file and count the reads mapping to rRNA and MT genes
      rRNA_count = 0
      mtRNA_count = 0
      total_count = 0
      with open(htseq_counts, 'r') as htseq:
          for line in htseq:
              if not line.startswith('__'):
                  gene_id, count = line.strip().split('\t')
                  count = int(count)
                  total_count += count
                  if gene_id in gene_type_dict['rRNA']:
                      rRNA_count += count
                  elif gene_id in gene_type_dict['Mt_rRNA'] or gene_id in gene_type_dict['Mt_tRNA']:
                      mtRNA_count += count
  
      # Calculate the percentage
      rRNA_percent = (rRNA_count / total_count) * 100
      mtRNA_percent = (mtRNA_count / total_count) * 100
  
      # Write the summary to the output file
      output_file = htseq_counts.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: {mtRNA_count} ({mtRNA_percent:.2f}%)\n")
  
      return output_file