code: def add_genes(in_file, data, max_distance=10000, work_dir=None):
      
      gene_file = regions.get_sv_bed(data, "exons", out_dir=os.path.dirname(in_file))
      if gene_file and utils.file_exists(in_file):
          out_file = "%s-annotated.bed" % utils.splitext_plus(in_file)[0]
          if work_dir:
              out_file = os.path.join(work_dir, os.path.basename(out_file))
          if not utils.file_uptodate(out_file, in_file):
              fai_file = ref.fasta_idx(dd.get_ref_file(data))
              with file_transaction(data, out_file) as tx_out_file:
                  _add_genes_to_bed(in_file, gene_file, fai_file, tx_out_file, data, max_distance)
          return out_file
      else:
          return in_file
docs: Add gene annotations to a BED file from pre-prepared RNA-seq data.
  
      max_distance -- only keep annotations within this distance of event