input: from typing import List
  
  def calculate_percent_rRNA(htseq_counts: str, gtf: str) -> str:
      """ Calculate the percent of transcripts mapping to rRNA and MT genes from given HTseq_counts file and GTF file.
      The script will extract all the identifiers of genes/transcripts mapping to the rRNA and MT genes, count reads matching these identifiers, 
      and write the output to a summary file named "HTseq_counts_file_rRNAmtRNACounts.txt".
      
      >>> calculate_percent_rRNA('/path/to/HTseq_counts_file', '/path/to/GTF_file')
      'Summary output file: /path/to/HTseq_counts_file_rRNAmtRNACounts.txt'
      """
output:     import re
      import os
  
      def extract_gene_ids(gtf_file, gene_types):
          gene_ids = set()
          with open(gtf_file, 'r') as gtf:
              for line in gtf:
                  if not line.startswith('#'):
                      fields = line.split('\t')
                      if fields[2] == 'gene':
                          attributes = fields[8]
                          for gene_type in gene_types:
                              if re.search(rf'gene_biotype "{gene_type}"', attributes):
                                  gene_id = re.search(r'gene_id "([^"]+)"', attributes).group(1)
                                  gene_ids.add(gene_id)
          return gene_ids
  
      def count_reads(htseq_counts_file, gene_ids):
          total_reads = 0
          rrna_mt_reads = 0
          with open(htseq_counts_file, 'r') as htseq:
              for line in htseq:
                  if not line.startswith('__'):
                      fields = line.split('\t')
                      gene_id = fields[0]
                      count = int(fields[1])
                      total_reads += count
                      if gene_id in gene_ids:
                          rrna_mt_reads += count
          return total_reads, rrna_mt_reads
  
      def write_summary(output_file, total_reads, rrna_mt_reads):
          with open(output_file, 'w') as summary:
              summary.write(f"Total reads: {total_reads}\n")
              summary.write(f"rRNA and MT reads: {rrna_mt_reads}\n")
              summary.write(f"Percent rRNA and MT reads: {rrna_mt_reads / total_reads * 100:.2f}%\n")
  
      gene_types = ['rRNA', 'Mt_rRNA', 'Mt_tRNA']
      gene_ids = extract_gene_ids(gtf, gene_types)
      total_reads, rrna_mt_reads = count_reads(htseq_counts, gene_ids)
      output_file = f"{htseq_counts}_rRNAmtRNACounts.txt"
      write_summary(output_file, total_reads, rrna_mt_reads)
      return f'Summary output file: {output_file}'