class_docstr: A GenomicsWriter that writes to a TFRecord file.
  
  Example usage:
    writer = TFRecordWriter('/tmp/my_output.tfrecord.gz')
    for record in records:
      writer.write(record)
  
  Note that TFRecord files do not need to be wrapped in a "with" block.
class_docstr_tok: ["A","GenomicsWriter","that","writes","to","a","TFRecord","file",".","Example","usage",":","writer","=","TFRecordWriter","(","'\/tmp\/my_output.tfrecord.gz","'",")","for","record","in","records",":","writer.write","(","record",")","Note","that","TFRecord","files","do","not","need","to","be","wrapped","in","a","``","with","''","block","."]
docstr: Initializer.
  
  Args:
    output_path: str. The output path to which the records are written.
    header: An optional header for the particular data type. This can be
      useful for file types that have logical headers where some operations
      depend on that header information (e.g. VCF using its headers to
      determine type information of annotation fields).
    compression_type:  Either 'ZLIB', 'GZIP', '' (uncompressed), or
      None.  If None, __init__ will guess the compression type based on
      the input_path's suffix.
  
  Raises:
    IOError:  if there was any problem opening output_path for writing.
docstr_tok: ["Initializer",".","Args",":","output_path",":","str",".","The","output","path","to","which","the","records","are","written",".","header",":","An","optional","header","for","the","particular","data","type",".","This","can","be","useful","for","file","types","that","have","logical","headers","where","some","operations","depend","on","that","header","information","(","e.g",".","VCF","using","its","headers","to","determine","type","information","of","annotation","fields",")",".","compression_type",":","Either","'ZLIB","'",",","'GZIP","'",",","``","(","uncompressed",")",",","or","None",".","If","None",",","__init__","will","guess","the","compression","type","based","on","the","input_path","'s","suffix",".","Raises",":","IOError",":","if","there","was","any","problem","opening","output_path","for","writing","."]
code: def __init__(self, output_path, header=None, compression_type=None):
      """Initializer.
  
      Args:
        output_path: str. The output path to which the records are written.
        header: An optional header for the particular data type. This can be
          useful for file types that have logical headers where some operations
          depend on that header information (e.g. VCF using its headers to
          determine type information of annotation fields).
        compression_type:  Either 'ZLIB', 'GZIP', '' (uncompressed), or
          None.  If None, __init__ will guess the compression type based on
          the input_path's suffix.
  
      Raises:
        IOError:  if there was any problem opening output_path for writing.
      """
      super(TFRecordWriter, self).__init__()
      self.header = header
  
      if compression_type is None:
          compression_type = (
              "GZIP" if output_path.endswith(".gz") else ""
          )
  
      self._writer = tfrecord_writer.TFRecordWriter.from_file(
          output_path, compression_type
      )
      if self._writer is None:
          raise IOError(
              errno.EIO, "Error opening %s for writing" % output_path
          )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import abc
  import errno
  from absl import logging
  from third_party.nucleus.io.python import tfrecord_writer
label_desc: Use image node_id 1 to create a new TFRecordWriter object from inherited base classes: GenomicsWriter with example: obj = TFRecordWriter(output_path, header, compression_type)