input: 
  def calculate_percent_rrna(htseq_counts: str, gtf_file: str) -> str:
      """ Calculate the percent of transcripts mapping to rRNA from given HTseq_counts and GTF files.
      The script will produce a summary output file named "<HTseq_counts>_rRNAmtRNACounts.txt".
      
      >>> calculate_percent_rrna("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
      import os
  
      def extract_gene_type(gtf_line: str) -> str:
          return re.search(r'gene_biotype "([^"]+)"', gtf_line).group(1)
  
      def count_rrna_reads(htseq_counts: str, gtf_file: str) -> int:
          rrna_genes = set()
          with open(gtf_file, 'r') as gtf:
              for line in gtf:
                  if line.startswith('#'):
                      continue
                  if extract_gene_type(line) == 'rRNA':
                      gene_id = re.search(r'gene_id "([^"]+)"', line).group(1)
                      rrna_genes.add(gene_id)
  
          rrna_count = 0
          with open(htseq_counts, 'r') as htseq:
              for line in htseq:
                  gene_id, count = line.strip().split('\t')
                  if gene_id in rrna_genes:
                      rrna_count += int(count)
  
          return rrna_count
  
      rrna_count = count_rrna_reads(htseq_counts, gtf_file)
  
      total_count = 0
      with open(htseq_counts, 'r') as htseq:
          for line in htseq:
              if not line.startswith('__'):
                  total_count += int(line.strip().split('\t')[1])
  
      percent_rrna = (rrna_count / total_count) * 100
  
      output_file = f"{htseq_counts}_rRNAmtRNACounts.txt"
      with open(output_file, 'w') as out:
          out.write(f"Total rRNA reads: {rrna_count}\n")
          out.write(f"Total reads: {total_count}\n")
          out.write(f"Percent rRNA: {percent_rrna:.2f}%\n")
  
      return output_file