org.biojava.bio.seq.io
Interface SeqFileFormer

All Superinterfaces:
SeqIOListener
All Known Implementing Classes:
EmblFileFormer, GenbankFileFormer, SwissprotFileFormer

public interface SeqFileFormer
extends SeqIOListener

Objects implementing the SeqFileFormer interface are responsible for the detailed formatting of sequence data prior to writing to a PrintStream. Some file formats, such as Fasta, are very simple and don't require a SeqFileFormer.

Since:
1.2
Author:
Keith James

Method Summary
 java.lang.String formatLocation(Feature theFeature)
          Formats the location of a feature.
 java.lang.StringBuffer formatLocation(java.lang.StringBuffer sb, Location loc, StrandedFeature.Strand strand)
          formatLocation creates a String representation of a Location.
 java.io.PrintStream getPrintStream()
          getPrintStream returns the PrintStream to which an instance will write the formatted data.
 void setPrintStream(java.io.PrintStream stream)
          setPrintStream informs an instance which PrintStream to use.
 
Methods inherited from interface org.biojava.bio.seq.io.SeqIOListener
addFeatureProperty, addSequenceProperty, addSymbols, endFeature, endSequence, setName, setURI, startFeature, startSequence
 

Method Detail

getPrintStream

public java.io.PrintStream getPrintStream()
getPrintStream returns the PrintStream to which an instance will write the formatted data. If this has not been set, an implementation should default to System.out.

Returns:
the PrintStream which will be written to.

setPrintStream

public void setPrintStream(java.io.PrintStream stream)
setPrintStream informs an instance which PrintStream to use.

Parameters:
stream - a PrintStream to write to.

formatLocation

public java.lang.StringBuffer formatLocation(java.lang.StringBuffer sb,
                                             Location loc,
                                             StrandedFeature.Strand strand)
formatLocation creates a String representation of a Location. The strand may not be relevant for all formats (e.g. it is relevant for Genbank and EMBL, but not for SwissProt). In such cases the implementation may accept a strand of 'unknown', '0' or '.'. A StringBuffer is used to allow avoidance of expensive String manipulations on (potentially very large numbers of) locations.

Parameters:
sb - a StringBuffer to append the location to.
loc - a Location to format.
strand - a StrandedFeature.Strand indicating any relevant strandedness.
Returns:
a StringBuffer with the location appended.

formatLocation

public java.lang.String formatLocation(Feature theFeature)
Formats the location of a feature. This version is required when formatting remote locations, since the location field of a remote feature is the projection of that feature on the sequence. When a distinction is made between 'order' and 'join' this method will likely be extended for that also.

Parameters:
theFeature - The feature with the location to format
Returns:
String The formatted location