Package Bio :: Module bgzf :: Class BgzfWriter
[hide private]
[frames] | no frames]

Class BgzfWriter

source code

object --+
         |
        BgzfWriter

Define a BGZFWriter object.
Instance Methods [hide private]
 
__init__(self, filename=None, mode='w', fileobj=None, compresslevel=6)
Initilize the class.
source code
 
_write_block(self, block)
Write provided data to file as a single BGZF compressed block (PRIVATE).
source code
 
write(self, data)
Write method for the class.
source code
 
flush(self)
Flush data explicitally.
source code
 
close(self)
Flush data, write 28 bytes BGZF EOF marker, and close BGZF file.
source code
 
tell(self)
Return a BGZF 64-bit virtual offset.
source code
 
seekable(self)
Return True indicating the BGZF supports random access.
source code
 
isatty(self)
Return True if connected to a TTY device.
source code
 
fileno(self)
Return integer file descriptor.
source code
 
__enter__(self)
Open a file operable with WITH statement.
source code
 
__exit__(self, type, value, traceback)
Close a file with WITH statement.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, filename=None, mode='w', fileobj=None, compresslevel=6)
(Constructor)

source code 
Initilize the class.
Overrides: object.__init__

close(self)

source code 

Flush data, write 28 bytes BGZF EOF marker, and close BGZF file.

samtools will look for a magic EOF marker, just a 28 byte empty BGZF block, and if it is missing warns the BAM file may be truncated. In addition to samtools writing this block, so too does bgzip - so this implementation does too.