code: def batch_for_variantcall(samples):
      
      sample_order = [dd.get_sample_name(utils.to_single_data(x)) for x in samples]
      to_process, extras = _dup_samples_by_variantcaller(samples, require_bam=False)
      batch_groups = collections.defaultdict(list)
      to_process = [utils.to_single_data(x) for x in to_process]
      for data in cwlutils.samples_to_records(to_process):
          vc = get_variantcaller(data, require_bam=False)
          batches = dd.get_batches(data) or dd.get_sample_name(data)
          if not isinstance(batches, (list, tuple)):
              batches = [batches]
          for b in batches:
              batch_groups[(b, vc)].append(utils.deepish_copy(data))
      batches = []
      for cur_group in batch_groups.values():
          joint_calling = any([is_joint(d) for d in cur_group])
          if joint_calling:
              for d in cur_group:
                  batches.append([d])
          else:
              batches.append(cur_group)
      def by_original_order(xs):
          return (min([sample_order.index(dd.get_sample_name(x)) for x in xs]),
                  min([dd.get_variantcaller_order(x) for x in xs]))
      return sorted(batches + extras, key=by_original_order)
docs: Prepare a set of samples for parallel variant calling.
  
      CWL input target that groups samples into batches and variant callers
      for parallel processing.
  
      If doing joint calling, with `tools_on: [gvcf]`, split the sample into
      individuals instead of combining into a batch.