class_docstr: Realign reads in regions to assembled haplotypes.
  
  This class helps us to realign reads in regions by:
  
  (1) Create smaller windows in which to operate over the region. These windows
  are created by finding evidence of genetic variation surrounded by stretches
  of reference-matching seqence.
  
  (2) Build a de-Bruijn assembly graph of the window. Edges are pruned if they
  don't meet the required weight threshold. Every remaining haplotype is listed
  by traversing the graph.
  
  (3) Realign reads using a Smith-Waterman algorithm to the best candidate
  haplotype and then realign that haplotype to the reference sequence to modify
  the read's alignment.
class_docstr_tok: ["Realign","reads","in","regions","to","assembled","haplotypes",".","This","class","helps","us","to","realign","reads","in","regions","by",":","(","1",")","Create","smaller","windows","in","which","to","operate","over","the","region",".","These","windows","are","created","by","finding","evidence","of","genetic","variation","surrounded","by","stretches","of","reference-matching","seqence",".","(","2",")","Build","a","de-Bruijn","assembly","graph","of","the","window",".","Edges","are","pruned","if","they","do","n't","meet","the","required","weight","threshold",".","Every","remaining","haplotype","is","listed","by","traversing","the","graph",".","(","3",")","Realign","reads","using","a","Smith-Waterman","algorithm","to","the","best","candidate","haplotype","and","then","realign","that","haplotype","to","the","reference","sequence","to","modify","the","read","'s","alignment","."]
docstr: Creates a new Realigner.
  
  Args:
    config: realigner_pb2.RealignerOptions protobuf.
    ref_reader: GenomeReferenceFai, indexed reference genome to query bases.
    shared_header: header info from the input bam file
docstr_tok: ["Creates","a","new","Realigner",".","Args",":","config",":","realigner_pb2.RealignerOptions","protobuf",".","ref_reader",":","GenomeReferenceFai",",","indexed","reference","genome","to","query","bases",".","shared_header",":","header","info","from","the","input","bam","file"]
code: def __init__(self, config, ref_reader, shared_header=None):
      """Creates a new Realigner.
  
      Args:
        config: realigner_pb2.RealignerOptions protobuf.
        ref_reader: GenomeReferenceFai, indexed reference genome to query bases.
        shared_header: header info from the input bam file
      """
      self.config = config
      self.ref_reader = ref_reader
      self.diagnostic_logger = DiagnosticLogger(self.config.diagnostics)
      self.shared_header = shared_header
  
imports: import csv
  import os
  import os.path
  from absl import flags
  from etils import epath
  from deepvariant.protos import realigner_pb2
  from deepvariant.realigner import window_selector
  from deepvariant.realigner.python import debruijn_graph
  from deepvariant.realigner.python import fast_pass_aligner
  from deepvariant.vendor import timer
  from google.protobuf import text_format
  from third_party.nucleus.io import sam
  from third_party.nucleus.protos import cigar_pb2
  from third_party.nucleus.protos import reads_pb2
  from third_party.nucleus.util import cigar
  from third_party.nucleus.util import ranges
  from third_party.nucleus.util import utils
  from third_party.nucleus.util.cigar import READ_ADVANCING_OPS
  from third_party.nucleus.util.cigar import REF_ADVANCING_OPS
label_desc: Use image node_id 1 to create a new Realigner object from inherited base classes: object with example: obj = Realigner(config, ref_reader, shared_header)