org.biojava.bio.seq.io
Interface SequenceFormat

All Known Implementing Classes:
EmblFormat, GenbankFormat, FastaFormat

public interface SequenceFormat

Defines what a sequence format does.

Sequence formats are responsible for both reading and writing a sequence in a format, presumably in such a way as the written record can be read back in by the same formatter.

Where possible, the methods are parameterised so that they don't need any knowledge of the specific implementation of Sequence they are reading or writing. E.g. it should be possible to parameterise readSequence to read from a GENBANK stream and construct ensembl corba objects, just by specifying an ensembl SequenceFactory.

Author:
Matthew Pocock

Method Summary
 Sequence readSequence(StreamReader.Context context, SymbolParser resParser, SequenceFactory sf)
          Read in a single sequence.
 void writeSequence(Sequence seq, java.io.PrintStream os)
          Write out a sequence to the specified printstream
 

Method Detail

readSequence

public Sequence readSequence(StreamReader.Context context,
                             SymbolParser resParser,
                             SequenceFactory sf)
                      throws BioException,
                             IllegalSymbolException,
                             java.io.IOException
Read in a single sequence.

The format is responsible for converting characters in a stream into a complete sequence. It should read from the stream contained in context, parse the symbol characters using resParser and generate a sequence from the resulting symbol list using sf. Any non-sequence information within the format should be read in either as features, or as annotation.

Parameters:
context - the context to parse from
resParser - the parser to parse chars to Symbol objects
sf - the sequence factory for generating a full sequence
Returns:
the resulting sequence

writeSequence

public void writeSequence(Sequence seq,
                          java.io.PrintStream os)
                   throws java.io.IOException
Write out a sequence to the specified printstream
Parameters:
seq - the sequence to write out
os - the printstream to write to