Package csb :: Package bio :: Package io :: Module fasta :: Class OutputBuilder

[frames] | no frames]

# Class OutputBuilder

source code

    object --+
             |
            OutputBuilder

Known Subclasses:
  - A3MOutputBuilder
  - , FASTAOutputBuilder
  - , PIROutputBuilder

Base sequence/alignment string format builder.

Note: File builders are not guaranteed to check the correctness of the product. It is assumed that the client of the builder knows what it is doing.

Nested Classes
| __metaclass__ Metaclass for defining Abstract Base Classes (ABCs).

Instance Methods

__init__(self, output, headers=True) x.__init__(...) initializes x; see help(type(x)) for signature | source code

add_alignment(self, alignment) Format and append an alignment to the product. | source code

add_comment(self, text, comment=`'``#``'`, length=120) Append a comment line to the product. | source code

add_many(self, sequences) Format and append a collection of AbstractSequences to the product. | source code

add_separator(self, separator=`'````'`) Append a sequence separator to the product. | source code

add_sequence(self, sequence) Format and append a new sequence to the product. | source code

write(self, text) Write a chunk of `text` to the output stream. | source code

writeline(self, text) Write a chunk of `text`, followed by a newline terminator. | source code

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

Static Methods

OutputBuilder

create(format, *a, **k) Create an output builder, which knows how to handle the specified sequence/alignment `format`. | source code

register(format, klass) Register a new output builder. | source code

Class Variables
| __abstractmethods__ = ``frozenset([``'``add_alignment``'``,` `'``add_sequenc``...``

Properties
bool | headers True if sequence headers will be written to the destination
stream | output Destination stream
Inherited from `object`: `__class__`

Method Details

### __init__(self, output, headers=True)
(Constructor)

source code

x.__init__(...) initializes x; see help(type(x)) for signature

Parameters:
  - `output` (file) - destination stream, where the product is written.
  - `headers` (bool) - if False, omit headers
Overrides: object.__init__
  (inherited documentation)

### add_alignment(self, alignment)

source code

Format and append an alignment to the product.

Parameters:
  - `alignment` (AbstractAlignment)

### add_comment(self, text, comment=`'``#``'`, length=120)

source code

Append a comment line to the product.

Parameters:
  - `text` (str) - comment text
  - `comment` (str) - comment prefix
  - `length` (int) - maximal comment length

### add_many(self, sequences)

source code

Format and append a collection of AbstractSequences to the product.

Parameters:
  - `sequences` (iterable of AbstractSequences)

### add_sequence(self, sequence)

source code

Format and append a new sequence to the product.

Parameters:
  - `sequence` (AbstractSequence)

### create(format, *a, **k)
Static Method

source code

Create an output builder, which knows how to handle the specified sequence/alignment `format`. Additional arguments are passed to the builder's constructor.

Parameters:
  - `format` (EnumItem) - AlignmentFormats member
Returns: OutputBuilder

### register(format, klass)
Static Method

source code

Register a new output builder.

Parameters:
  - `format` (EnumItem) - AlignmentFormats member
  - `klass` (type) - builder class (OutputBuilder sub-class)

Class Variable Details

### __abstractmethods__

Value:

      frozenset(['add_alignment', 'add_sequence'])

Property Details

### headers

True if sequence headers will be written to the destination

Get Method:
  unreachable.headers(self) - True if sequence headers will be written to the destination
Type:
  bool

### output

Destination stream

Get Method:
  unreachable.output(self) - Destination stream
Type:
  stream