code: def n_samples_from_flags(add_flags=True, flags_obj=None):
      """Collects sample-related options into a list of samples."""
  
      n_reads = flags_obj.reads.split(";")
  
      num_samples = len(n_reads)
      flags_organized = {}
      for flag_name in [
          "reads",
          "sample_names",
          "downsample_fractions",
          "pileup_image_heights",
      ]:
          if flags_obj[flag_name].value != "DEFAULT":
              flags_organized[flag_name] = flags_obj[
                  flag_name
              ].value.split(";")
              if len(flags_organized[flag_name]) != num_samples:
                  raise ValueError(
                      f"--{flag_name} has {len(flags_organized[flag_name])} "
                      "samples, but it should be matching the number of "
                      f"samples in --reads, which was {num_samples}."
                  )
          else:
              flags_organized[flag_name] = [""] * num_samples
  
      n_sample_options = []
      for i in range(num_samples):
          sample_name = make_examples_core.assign_sample_name(
              sample_name_flag=flags_organized["sample_names"][i],
              reads_filenames=flags_organized["reads"][i],
          )
  
          n_sample_options.append(
              deepvariant_pb2.SampleOptions(
                  role=str(i),
                  name=sample_name,
                  variant_caller_options=make_examples_core.make_vc_options(
                      sample_name=sample_name, flags_obj=flags_obj
                  ),
                  order=range(num_samples),
                  pileup_height=100,
              )
          )
  
      if add_flags:
          for i in range(num_samples):
              n_sample_options[i].reads_filenames.extend(
                  flags_organized["reads"][i].split(",")
              )
              if flags_organized["downsample_fractions"][i]:
                  n_sample_options[i].downsample_fraction = float(
                      flags_organized["downsample_fractions"][i]
                  )
              if flags_organized["pileup_image_heights"][i]:
                  n_sample_options[i].pileup_height = int(
                      flags_organized["pileup_image_heights"][i]
                  )
  
      # Ordering here determines the default order of samples, and when a sample
      # above has a custom .order, then this is the list those indices refer to.
      samples_in_order = n_sample_options
      sample_role_to_train = "0"
      return samples_in_order, sample_role_to_train
  
file_path: deepvariant/deepvariant/multisample_make_examples.py
imports: import os
  from absl import app
  from absl import flags
  from deepvariant import logging_level
  from deepvariant import make_examples_core
  from deepvariant import make_examples_options
  from deepvariant.protos import deepvariant_pb2
  from third_party.nucleus.io.python import hts_verbose
  from third_party.nucleus.util import errors
  from third_party.nucleus.util import proto_utils
label_desc: Use image node_id 1 for calling a global function with example usage: n_samples_from_flags(add_flags, flags_obj) and returns: samples_in_order,  sample_role_to_train