class_docstr: Writes diagnostic information about the assembler.
class_docstr_tok: ["Writes","diagnostic","information","about","the","assembler","."]
docstr: Logs, if enabled, the realigned reads for region.
docstr_tok: ["Logs",",","if","enabled",",","the","realigned","reads","for","region","."]
code: def log_realigned_reads(self, region, reads, shared_header=None):
      """Logs, if enabled, the realigned reads for region."""
      if (
          self.enabled
          and self.config.emit_realigned_reads
          and shared_header is not None
      ):
          path = self._file_for_region(
              region, self.realigned_reads_filename
          )
          with sam.SamWriter(path, header=shared_header) as writer:
              # For realigned reads, sorting by just looking at starting position is
              # enough.
              for read in sorted(
                  reads,
                  key=lambda read: read.alignment.position.position,
              ):
                  writer.write(read)
  
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 7 for calling the DiagnosticLogger obj's underlying member method code with example usage: obj.log_realigned_reads(region, reads, shared_header) without return types