code: def shared_variantcall(call_fn, name, align_bams, ref_file, items,
                         assoc_files, region=None, out_file=None):
      
      config = items[0]["config"]
      if out_file is None:
          if vcfutils.is_paired_analysis(align_bams, items):
              out_file = "%s-paired-variants.vcf.gz" % config["metdata"]["batch"]
          else:
              out_file = "%s-variants.vcf.gz" % os.path.splitext(align_bams[0])[0]
      if not file_exists(out_file):
          logger.debug("Genotyping with {name}: {region} {fname}".format(
                name=name, region=region, fname=os.path.basename(align_bams[0])))
          variant_regions = bedutils.population_variant_regions(items, merged=True)
          target_regions = subset_variant_regions(variant_regions, region, out_file, items=items)
          if (variant_regions is not None and isinstance(target_regions, six.string_types)
                and not os.path.isfile(target_regions)):
              vcfutils.write_empty_vcf(out_file, config)
          else:
              with file_transaction(config, out_file) as tx_out_file:
                  call_fn(align_bams, ref_file, items, target_regions,
                          tx_out_file)
      if out_file.endswith(".gz"):
          out_file = vcfutils.bgzip_and_index(out_file, config)
      return out_file
docs: Provide base functionality for prepping and indexing for variant calling.