input: 
  def calculate_rrna_percentage(htseq_counts: str, gtf_file: str) -> str:
      """
      Calculate the percent of transcripts mapping to rRNA and write the output to a summary file.
      
      >>> 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:     
      rrna_counts = 0
      total_counts = 0
      
      with open(htseq_counts, 'r') as htseq_file:
          for line in htseq_file:
              if not line.startswith('__'):
                  total_counts += int(line.split()[1])
      
      with open(gtf_file, 'r') as gtf_file:
          for line in gtf_file:
              if 'rRNA' in line or 'Mt_rRNA' in line:
                  gene_id = line.split('\t')[8].split(';')[0].split('"')[1]
                  with open(htseq_counts, 'r') as htseq_file:
                      for htseq_line in htseq_file:
                          if gene_id in htseq_line:
                              rrna_counts += int(htseq_line.split()[1])
      
      rrna_percentage = (rrna_counts / total_counts) * 100
      
      output_file = htseq_counts.replace('.txt', '_rRNAmtRNACounts.txt')
      with open(output_file, 'w') as out_file:
          out_file.write(f"rRNA and mtRNA counts: {rrna_counts}\n")
          out_file.write(f"Total counts: {total_counts}\n")
          out_file.write(f"Percentage of rRNA and mtRNA: {rrna_percentage:.2f}%\n")
      
      return output_file
  