input: def percent_rrna_mapped(htseq_counts_file: str, gtf_file: str) -> str:
      """Calculates the percentage of transcripts mapping to rRNA and MT genes from an HTseq_counts file and a GTF file.
      The script processes the files and generates a summary output file detailing the counts and percentages of rRNA and MT transcripts.
      >>> percent_rrna_mapped("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_mt_genes = set()
      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_id = [x for x in gene_info if 'gene_id' in x][0].split('"')[1]
                  gene_type = [x for x in gene_info if 'gene_biotype' in x][0].split('"')[1]
                  if gene_type in ['rRNA', 'Mt_rRNA', 'Mt_tRNA']:
                      rrna_mt_genes.add(gene_id)
      
      total_counts = 0
      rrna_mt_counts = 0
      with open(htseq_counts_file, 'r') as htseq:
          for line in htseq:
              if line.startswith('__'):
                  continue
              gene_id, count = line.strip().split('\t')
              count = int(count)
              total_counts += count
              if gene_id in rrna_mt_genes:
                  rrna_mt_counts += count
      
      rrna_mt_percent = (rrna_mt_counts / total_counts) * 100
      
      output_file = htseq_counts_file.replace('.txt', '_rRNAmtRNACounts.txt')
      with open(output_file, 'w') as out:
          out.write(f"Total counts: {total_counts}\n")
          out.write(f"rRNA and MT counts: {rrna_mt_counts}\n")
          out.write(f"Percentage of rRNA and MT transcripts: {rrna_mt_percent:.2f}%\n")
      
      return output_file
  