Package Bio :: Package SeqIO :: Module Interfaces :: Class SequentialSequenceWriter
[hide private]
[frames] | no frames]

Class SequentialSequenceWriter

source code

    object --+    
             |    
SequenceWriter --+
                 |
                SequentialSequenceWriter
Known Subclasses:

This class should be subclassed.

It is intended for sequential file formats with an (optional)
header, repeated records, and an (optional) footer.

In this case (as with interlaced file formats), the user may
simply call the write_file() method and be done.

However, they may also call the write_header(), followed
by multiple calls to write_record() and/or write_records()
followed finally by write_footer().

Users must call write_header() and write_footer() even when
the file format concerned doesn't have a header or footer.
This is to try and make life as easy as possible when
switching the output format.

Note that write_header() cannot require any assumptions about
the number of records.

Instance Methods [hide private]
 
__init__(self, handle)
Creates the writer object.
source code
 
write_header(self) source code
 
write_footer(self) source code
 
write_record(self, record)
Write a single record to the output file.
source code
 
write_records(self, records)
Write multiple record to the output file.
source code
 
write_file(self, records)
Use this to write an entire file containing the given records.
source code

Inherited from SequenceWriter: clean

Inherited from SequenceWriter (private): _get_seq_string

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, handle)
(Constructor)

source code 
Creates the writer object.

Use the method write_file() to actually record your sequence records.

Overrides: object.__init__
(inherited documentation)

write_record(self, record)

source code 
Write a single record to the output file.

record - a SeqRecord object

Once you have called write_header() you can call write_record()
and/or write_records() as many times as needed.  Then call
write_footer() and close().

write_records(self, records)

source code 
Write multiple record to the output file.

records - A list or iterator returning SeqRecord objects

Once you have called write_header() you can call write_record()
and/or write_records() as many times as needed.  Then call
write_footer() and close().

Returns the number of records written.

write_file(self, records)

source code 
Use this to write an entire file containing the given records.

records - A list or iterator returning SeqRecord objects

This method can only be called once.  Returns the number of records
written.

Overrides: SequenceWriter.write_file