Ejemplo n.º 1
0
def realigner_config(flags_obj):
    """Creates a RealignerOptions proto based on input and default settings.

  Args:
    flags_obj: configuration FLAGS.

  Returns:
    realigner_pb2.RealignerOptions protobuf.

  Raises:
    ValueError: If we observe invalid flag values.
  """
    ws_config = window_selector_config(flags_obj)

    dbg_config = realigner_pb2.DeBruijnGraphOptions(
        min_k=flags_obj.dbg_min_k,
        max_k=flags_obj.dbg_max_k,
        step_k=flags_obj.dbg_step_k,
        min_mapq=flags_obj.dbg_min_mapq,
        min_base_quality=flags_obj.dbg_min_base_quality,
        min_edge_weight=flags_obj.dbg_min_edge_weight,
        max_num_paths=flags_obj.dbg_max_num_paths)

    aln_config = realigner_pb2.AlignerOptions(
        match=flags_obj.aln_match,
        mismatch=flags_obj.aln_mismatch,
        gap_open=flags_obj.aln_gap_open,
        gap_extend=flags_obj.aln_gap_extend,
        k=flags_obj.aln_k,
        error_rate=flags_obj.aln_error_rate,
        max_num_of_mismatches=flags_obj.max_num_mismatches,
        realignment_similarity_threshold=flags_obj.
        realignment_similarity_threshold,
        kmer_size=flags_obj.kmer_size,
        force_alignment=False)

    diagnostics = realigner_pb2.Diagnostics(
        enabled=bool(flags_obj.realigner_diagnostics),
        output_root=flags_obj.realigner_diagnostics,
        emit_realigned_reads=flags_obj.emit_realigned_reads)

    # The normalize_reads flag could came from the `flags_obj` arg, passed in
    # from make_examples_options.py. It is already part of AlleleCounterOptions in
    # MakeExamplesOptions. Here, we need to set it in RealignerOptions as well
    # because an if statement in fast_pass_aligner.cc needs it to decide whether
    # to run a specific logic.
    # This is not ideal. If there's a way to improve this, please do.
    normalize_reads = False
    if 'normalize_reads' in flags_obj:
        normalize_reads = flags_obj.normalize_reads
    return realigner_pb2.RealignerOptions(
        ws_config=ws_config,
        dbg_config=dbg_config,
        aln_config=aln_config,
        diagnostics=diagnostics,
        split_skip_reads=flags_obj.split_skip_reads,
        normalize_reads=normalize_reads)
Ejemplo n.º 2
0
def realigner_config(flags_obj):
  """Creates a RealignerOptions proto based on input and default settings.

  Args:
    flags_obj: configuration FLAGS.

  Returns:
    realigner_pb2.RealignerOptions protobuf.

  Raises:
    ValueError: If we observe invalid flag values.
  """
  ws_config = window_selector_config(flags_obj)

  dbg_config = realigner_pb2.DeBruijnGraphOptions(
      min_k=flags_obj.dbg_min_k,
      max_k=flags_obj.dbg_max_k,
      step_k=flags_obj.dbg_step_k,
      min_mapq=flags_obj.dbg_min_mapq,
      min_base_quality=flags_obj.dbg_min_base_quality,
      min_edge_weight=flags_obj.dbg_min_edge_weight,
      max_num_paths=flags_obj.dbg_max_num_paths)

  aln_config = realigner_pb2.AlignerOptions(
      match=flags_obj.aln_match,
      mismatch=flags_obj.aln_mismatch,
      gap_open=flags_obj.aln_gap_open,
      gap_extend=flags_obj.aln_gap_extend,
      k=flags_obj.aln_k,
      error_rate=flags_obj.aln_error_rate,
      max_num_of_mismatches=flags_obj.max_num_mismatches,
      realignment_similarity_threshold=flags_obj.
      realignment_similarity_threshold,
      kmer_size=flags_obj.kmer_size)

  diagnostics = realigner_pb2.Diagnostics(
      enabled=bool(flags_obj.realigner_diagnostics),
      output_root=flags_obj.realigner_diagnostics,
      emit_realigned_reads=flags_obj.emit_realigned_reads)

  return realigner_pb2.RealignerOptions(
      ws_config=ws_config,
      dbg_config=dbg_config,
      aln_config=aln_config,
      diagnostics=diagnostics)