class_docstr: Class for writing to native SAM/BAM/CRAM files.
  
  Most users will want SamWriter, which will write to either native SAM/BAM/CRAM
  files or TFRecords files, based on the output filename's extensions.
class_docstr_tok: ["Class","for","writing","to","native","SAM\/BAM\/CRAM","files",".","Most","users","will","want","SamWriter",",","which","will","write","to","either","native","SAM\/BAM\/CRAM","files","or","TFRecords","files",",","based","on","the","output","filename","'s","extensions","."]
docstr: Initializer for NativeSamWriter.
  
  Args:
    output_path: str. A path where we'll write our SAM/BAM/CRAM file.
    ref_path: str. Path to the reference file. Required for CRAM file.
    embed_ref: bool. Whether to embed the reference sequences in CRAM file.
      Default is False.
    header: A nucleus.SamHeader proto.  The header is used both for writing
      the header, and to control the sorting applied to the rest of the file.
docstr_tok: ["Initializer","for","NativeSamWriter",".","Args",":","output_path",":","str",".","A","path","where","we","'ll","write","our","SAM\/BAM\/CRAM","file",".","ref_path",":","str",".","Path","to","the","reference","file",".","Required","for","CRAM","file",".","embed_ref",":","bool",".","Whether","to","embed","the","reference","sequences","in","CRAM","file",".","Default","is","False",".","header",":","A","nucleus.SamHeader","proto",".","The","header","is","used","both","for","writing","the","header",",","and","to","control","the","sorting","applied","to","the","rest","of","the","file","."]
code: def __init__(
      self, output_path, header, ref_path=None, embed_ref=False
  ):
      """Initializer for NativeSamWriter.
  
      Args:
        output_path: str. A path where we'll write our SAM/BAM/CRAM file.
        ref_path: str. Path to the reference file. Required for CRAM file.
        embed_ref: bool. Whether to embed the reference sequences in CRAM file.
          Default is False.
        header: A nucleus.SamHeader proto.  The header is used both for writing
          the header, and to control the sorting applied to the rest of the file.
      """
      super(NativeSamWriter, self).__init__()
      self._writer = sam_writer.SamWriter.to_file(
          output_path,
          ref_path.encode("utf8") if ref_path is not None else "",
          embed_ref,
          header,
      )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from third_party.nucleus.io import genomics_reader
  from third_party.nucleus.io import genomics_writer
  from third_party.nucleus.io.python import sam_reader
  from third_party.nucleus.io.python import sam_writer
  from third_party.nucleus.protos import reads_pb2
  from third_party.nucleus.util import ranges
  from third_party.nucleus.util import utils
label_desc: Use image node_id 1 to create a new NativeSamWriter object from inherited base classes: genomics_writer with example: obj = NativeSamWriter(output_path, header, ref_path, embed_ref)