input: from typing import List
  
  def calculate_rrna_percentage(htseq_counts: str, gtf_file: str) -> str:
      """ Calculate the percent of transcripts mapping to rRNA from an HTseq_counts file and a GTF file.
      The function will return the name of the output file containing the summary of rRNA and MT counts.
      >>> calculate_rrna_percentage('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')
      'C17_3_S20_Aligned.out.srt.bam_htseq_combined_counts_rRNAmtRNACounts.txt'
      """
output:     import re
      from collections import defaultdict
  
      def parse_gtf(gtf_file):
          rrna_genes = 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]
                          if 'gene_biotype "rRNA"' in gene_info:
                              gene_id = re.search(r'gene_id "([^"]+)"', gene_info).group(1)
                              rrna_genes.add(gene_id)
          return rrna_genes
  
      def parse_htseq_counts(htseq_counts, rrna_genes):
          rrna_counts = 0
          total_counts = 0
          with open(htseq_counts, 'r') as htseq:
              for line in htseq:
                  if not line.startswith('__'):
                      fields = line.strip().split('\t')
                      gene_id = fields[0]
                      count = int(fields[1])
                      total_counts += count
                      if gene_id in rrna_genes:
                          rrna_counts += count
          return rrna_counts, total_counts
  
      rrna_genes = parse_gtf(gtf_file)
      rrna_counts, total_counts = parse_htseq_counts(htseq_counts, rrna_genes)
      rrna_percentage = (rrna_counts / total_counts) * 100
  
      output_file = htseq_counts.replace('.txt', '_rRNAmtRNACounts.txt')
      with open(output_file, 'w') as out:
          out.write(f"Total counts: {total_counts}\n")
          out.write(f"rRNA counts: {rrna_counts}\n")
          out.write(f"rRNA percentage: {rrna_percentage:.2f}%\n")
  
      return output_file