code: def run_cortex(align_bams, items, ref_file, assoc_files, region=None,
                 out_file=None):
      
      raise NotImplementedError("Cortex currently out of date and needs reworking.")
      if len(align_bams) == 1:
          align_bam = align_bams[0]
          config = items[0]["config"]
      else:
          raise NotImplementedError("Need to add multisample calling for cortex_var")
      if out_file is None:
          out_file = "%s-cortex.vcf" % os.path.splitext(align_bam)[0]
      if region is not None:
          work_dir = safe_makedir(os.path.join(os.path.dirname(out_file),
                                               region.replace(".", "_")))
      else:
          work_dir = os.path.dirname(out_file)
      if not file_exists(out_file):
          bam.index(align_bam, config)
          variant_regions = config["algorithm"].get("variant_regions", None)
          if not variant_regions:
              raise ValueError("Only support regional variant calling with cortex_var: set variant_regions")
          target_regions = subset_variant_regions(variant_regions, region, out_file)
          if os.path.isfile(target_regions):
              with open(target_regions) as in_handle:
                  regional_vcfs = [_run_cortex_on_region(x.strip().split("\t")[:3], align_bam,
                                                         ref_file, work_dir, out_file, config)
                                   for x in in_handle]
  
              combine_file = "{0}-raw{1}".format(*os.path.splitext(out_file))
              _combine_variants(regional_vcfs, combine_file, ref_file, config)
              _select_final_variants(combine_file, out_file, config)
          else:
              vcfutils.write_empty_vcf(out_file)
      return out_file
docs: Top level entry to regional de-novo based variant calling with cortex_var.