input: Write a function to calculate the percentage of transcripts mapping to rRNA and MT (mitochondrial) reads from an HTseq_counts file and a GTF file. The function should take two arguments: the path to the HTseq_counts file and the path to the GTF file. The output should be a summary file named "HTseq_counts_file_rRNAmtRNACounts.txt" containing the percentage of reads mapped to rRNA and MT genes. If either file does not exist, the function should print an error message and exit.
  
  assert calculate_rRNA_MT_percentage("/path/to/HTseq_counts/file", "/path/to/GTF/file")==True
  assert calculate_rRNA_MT_percentage("/nonexistent/file", "/path/to/GTF/file") is None
  assert calculate_rRNA_MT_percentage("/path/to/HTseq_counts/file", "/nonexistent/file") is None
  assert calculate_rRNA_MT_percentage("/nonexistent/file", "/nonexistent/file") is None
output: 
  def calculate_rRNA_MT_percentage(htseq_counts_file, gtf_file):
      import os
      if not os.path.exists(htseq_counts_file) or not os.path.exists(gtf_file):
          print("Error: One or both of the files do not exist.")
          return None
      
      rRNA_genes = set()
      MT_genes = set()
      total_reads = 0
      rRNA_MT_reads = 0
      
      with open(gtf_file, 'r') as gtf:
          for line in gtf:
              if line.startswith('#'):
                  continue
              fields = line.strip().split('\t')
              if fields[2] == 'gene':
                  gene_info = fields[8].split(';')
                  gene_name = [x for x in gene_info if 'gene_name' in x]
                  if gene_name:
                      gene_name = gene_name[0].split('"')[1]
                      if 'rRNA' in gene_name:
                          rRNA_genes.add(gene_name)
                      if 'MT-' in gene_name:
                          MT_genes.add(gene_name)
      
      with open(htseq_counts_file, 'r') as htseq:
          for line in htseq:
              if line.startswith('__'):
                  continue
              gene_name, count = line.strip().split('\t')
              count = int(count)
              total_reads += count
              if gene_name in rRNA_genes or gene_name in MT_genes:
                  rRNA_MT_reads += count
      
      percentage = (rRNA_MT_reads / total_reads) * 100
      summary_file = f"{htseq_counts_file}_rRNAmtRNACounts.txt"
      with open(summary_file, 'w') as outfile:
          outfile.write(f"Percentage of reads mapped to rRNA and MT genes: {percentage:.2f}%\n")
      
      return True
  