code: def _get_merged_intervals(rm_interval_file, vrn_file, base_dir, data):
      
      a_intervals = get_analysis_intervals(data, vrn_file, base_dir)
      if a_intervals:
          final_intervals = shared.remove_lcr_regions(a_intervals, [data])
          if rm_interval_file:
              caller = _get_caller(data)
              sample = dd.get_sample_name(data)
              combo_intervals = os.path.join(base_dir, "%s-%s-%s-wrm.bed" %
                                             (utils.splitext_plus(os.path.basename(final_intervals))[0],
                                              sample, caller))
              if not utils.file_uptodate(combo_intervals, final_intervals):
                  with file_transaction(data, combo_intervals) as tx_out_file:
                      with utils.chdir(os.path.dirname(tx_out_file)):
                          # Copy files locally to avoid issues on shared filesystems
                          # where BEDtools has trouble accessing the same base
                          # files from multiple locations
                          a = os.path.basename(final_intervals)
                          b = os.path.basename(rm_interval_file)
                          try:
                              shutil.copyfile(final_intervals, a)
                          except IOError:
                              time.sleep(60)
                              shutil.copyfile(final_intervals, a)
                          try:
                              shutil.copyfile(rm_interval_file, b)
                          except IOError:
                              time.sleep(60)
                              shutil.copyfile(rm_interval_file, b)
                          cmd = ("bedtools intersect -nonamecheck -a {a} -b {b} > {tx_out_file}")
                          do.run(cmd.format(**locals()), "Intersect callable intervals for rtg vcfeval")
              final_intervals = combo_intervals
      else:
          assert rm_interval_file, "No intervals to subset analysis with for %s" % vrn_file
          final_intervals = shared.remove_lcr_regions(rm_interval_file, [data])
      return final_intervals
docs: Retrieve intervals to run validation on, merging reference and callable BED files.