Allow reading and writing of patterns to files.
This just defines a simple persistance class for patterns, making
it easy to write them to a file and read 'em back.
Methods
|
|
__init__
read
write
write_seq
|
|
__init__
|
__init__ ( self, alphabet=None )
Intialize the reader and writer class.
Arguments:
Attributes:
o separator - A character to use in separating items in a signature
when it is written to a file and read back. This character should
not be in the possible alphabet of the sequences, or there will
be trouble.
|
|
read
|
read ( self, input_handle )
Read patterns from the specified handle.
Exceptions
|
|
ValueError("Pattern %s not matching alphabet %s" %( cur_pattern, self._alphabet ) )
|
|
|
write
|
write (
self,
pattern_list,
output_handle,
)
Write a list of patterns to the given handle.
|
|
write_seq
|
write_seq (
self,
seq_pattern_list,
output_handle,
)
Convenience function to write Seq objects to a file.
This can take Seqs and MutableSeqs, and write them to a file
as strings.
Exceptions
|
|
ValueError( "Unexpected pattern type %r" % seq_pattern )
|
|
|