code: def _candidates_from_reads(config, ref_reader, reads, region):
      """Returns a list of candidate positions.
  
      Args:
        config: learning.genomics.deepvariant.realigner.WindowSelectorOptions
          options determining the behavior of this window selector.
        ref_reader: GenomeReference. Indexed reference genome to query bases.
        reads: list[nucleus.protos.Read]. The reads we are processing into candidate
          positions.
        region: nucleus.protos.Range. The region we are processing.
  
      Returns:
        A list. The elements are reference positions within region.
  
      Raises:
        ValueError: if config.window_selector_model.model_type isn't a valid enum
        name in realigner_pb2.WindowSelectorModel.ModelType.
      """
      allele_counter_options = deepvariant_pb2.AlleleCounterOptions(
          read_requirements=reads_pb2.ReadRequirements(
              min_mapping_quality=config.min_mapq,
              min_base_quality=config.min_base_quality,
          ),
          keep_legacy_behavior=config.keep_legacy_behavior,
      )
      expanded_region = ranges.expand(
          region,
          config.region_expansion_in_bp,
          contig_map=ranges.contigs_dict(ref_reader.header.contigs),
      )
  
      allele_counter = allelecounter.AlleleCounter(
          ref_reader.c_reader,
          expanded_region,
          [],
          allele_counter_options,
      )
  
      for read in reads:
          allele_counter.add(read, "placeholder_sample_id")
  
      model_type = config.window_selector_model.model_type
      if model_type == realigner_pb2.WindowSelectorModel.VARIANT_READS:
          return _variant_reads_threshold_selector(
              allele_counter,
              config.window_selector_model.variant_reads_model,
              expanded_region,
          )
      elif (
          model_type
          == realigner_pb2.WindowSelectorModel.ALLELE_COUNT_LINEAR
      ):
          return _allele_count_linear_selector(
              allele_counter,
              config.window_selector_model.allele_count_linear_model,
              expanded_region,
          )
      else:
          raise ValueError(
              'Unknown enum option "{}" for '
              "WindowSelectorModel.model_type".format(
                  config.window_selector_model.model_type
              )
          )
  
file_path: deepvariant/deepvariant/realigner/window_selector.py
imports: from third_party.nucleus.protos import reads_pb2
  from third_party.nucleus.util import ranges
  from deepvariant.protos import deepvariant_pb2
  from deepvariant.protos import realigner_pb2
  from deepvariant.python import allelecounter
  from deepvariant.realigner.python import window_selector
label_desc: Use image node_id 1 for calling a global function with example usage: _candidates_from_reads(config, ref_reader, reads, region) and returns: _variant_reads_threshold_selector, _allele_count_linear_selector