input: Write a function to calculate the percent of transcripts mapping to rRNA. The function should accept two inputs: an HTseq_counts file and a GTF file. The function will extract all identifiers of genes/transcripts mapping to the rRNA and MT genes and store them in two arrays. It will then count reads matching the rRNA identifiers and write the output to a file named "HTseq_counts_file_rRNAmtRNACounts.txt". If the files do not exist, the function should print an error message and exit.
  assert calculate_rRNA_percent("/path/to/HTseq_counts/file", "/path/to/GTF/file")=="HTseq_counts_file_rRNAmtRNACounts.txt"
  assert calculate_rRNA_percent("nonexistent_file.txt", "/path/to/GTF/file")=="Error->\tFile: nonexistent_file.txt does not exist"
  assert calculate_rRNA_percent("/path/to/HTseq_counts/file", "nonexistent_file.gtf")=="Error->\tGTF File: nonexistent_file.gtf does not exist"
output: def calculate_rRNA_percent(HTseq_counts_file, GTF_file):
      import os
      if not os.path.exists(HTseq_counts_file):
          return f"Error->\tFile: {HTseq_counts_file} does not exist"
      if not os.path.exists(GTF_file):
          return f"Error->\tGTF File: {GTF_file} does not exist"
      
      rRNA_ids = []
      MT_ids = []
      
      with open(GTF_file, 'r') as gtf:
          for line in gtf:
              if 'rRNA' in line:
                  rRNA_ids.append(line.split('\t')[8].split(';')[0].split()[1].strip('"'))
              if 'MT' in line:
                  MT_ids.append(line.split('\t')[8].split(';')[0].split()[1].strip('"'))
      
      rRNA_counts = 0
      total_counts = 0
      
      with open(HTseq_counts_file, 'r') as htseq:
          for line in htseq:
              parts = line.strip().split('\t')
              if parts[0] in rRNA_ids:
                  rRNA_counts += int(parts[1])
              total_counts += int(parts[1])
      
      with open(f"{HTseq_counts_file}_rRNAmtRNACounts.txt", 'w') as outfile:
          outfile.write(f"rRNA Counts: {rRNA_counts}\n")
          outfile.write(f"Total Counts: {total_counts}\n")
          outfile.write(f"Percent rRNA: {100 * rRNA_counts / total_counts}%\n")
      
      return f"{HTseq_counts_file}_rRNAmtRNACounts.txt"