input: 
  def calculate_rRNA_percentage(htseq_counts_file: str, gtf_file: str) -> str:
      """ Calculates the percentage of transcripts mapping to rRNA and MT genes from given HTseq_counts file 
      and GTF file. It produces a summary output file named '<htseq_counts_file>_rRNAmtRNACounts.txt' with details 
      on the counts and percentages of rRNA and MT transcripts.
      >>> 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.txt_rRNAmtRNACounts.txt'
      """
  
output:     
      rRNA_counts = 0
      MT_counts = 0
      total_counts = 0
  
      with open(htseq_counts_file, 'r') as f:
          for line in f:
              if line.startswith('__'):
                  continue
              gene_id, count = line.strip().split('\t')
              total_counts += int(count)
  
      with open(gtf_file, 'r') as f:
          for line in f:
              if line.startswith('#'):
                  continue
              fields = line.strip().split('\t')
              if fields[2] == 'gene':
                  gene_info = fields[8]
                  if 'gene_biotype "rRNA"' in gene_info:
                      gene_id = gene_info.split('gene_id "')[1].split('";')[0]
                      with open(htseq_counts_file, 'r') as htseq:
                          for htseq_line in htseq:
                              if htseq_line.startswith(gene_id):
                                  rRNA_counts += int(htseq_line.strip().split('\t')[1])
                  elif 'gene_biotype "Mt_rRNA"' in gene_info or 'gene_biotype "Mt_tRNA"' in gene_info:
                      gene_id = gene_info.split('gene_id "')[1].split('";')[0]
                      with open(htseq_counts_file, 'r') as htseq:
                          for htseq_line in htseq:
                              if htseq_line.startswith(gene_id):
                                  MT_counts += int(htseq_line.strip().split('\t')[1])
  
      rRNA_percentage = (rRNA_counts / total_counts) * 100
      MT_percentage = (MT_counts / total_counts) * 100
  
      output_file = f"{htseq_counts_file}_rRNAmtRNACounts.txt"
      with open(output_file, 'w') as f:
          f.write(f"Total counts: {total_counts}\n")
          f.write(f"rRNA counts: {rRNA_counts} ({rRNA_percentage:.2f}%)\n")
          f.write(f"MT counts: {MT_counts} ({MT_percentage:.2f}%)\n")
  
      return output_file
  