Package org.biojava.bio.seq.io
Class EmblFileFormer
- java.lang.Object
-
- org.biojava.bio.seq.io.EmblFileFormer
-
- All Implemented Interfaces:
SeqFileFormer
,SeqIOListener
public class EmblFileFormer extends Object implements SeqFileFormer
Deprecated.Use org.biojavax.bio.seq.io framework insteadEmblFileFormer
performs the detailed formatting of EMBL entries for writing to aPrintStream
. Currently the formatting of the header is not correct. This really needs to be addressed in the parser which is merging fields which should remain separate.The event generator used to feed events to this class should enforce ordering of those events. This class will stream data directly to the
.PrintStream
This implementation requires that all the symbols be added in one block as is does not buffer the tokenized symbols between calls.
- Since:
- 1.2
- Author:
- Keith James, Len Trigg (Taxon output), Lorna Morris
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
EmblFileFormer()
Deprecated.Creates a newEmblFileFormer
usingSystem.out
stream.protected
EmblFileFormer(PrintStream stream)
Deprecated.Creates a newEmblFileFormer
using the specified stream.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addFeatureProperty(Object key, Object value)
Deprecated.Notify the listener of a feature property.void
addSequenceProperty(Object key, Object value)
Deprecated.Notify the listener of a sequence-wide property.void
addSymbols(Alphabet alpha, Symbol[] syms, int start, int length)
Deprecated.Notify the listener of symbol data.void
endFeature()
Deprecated.Mark the end of data associated with one specific feature.void
endSequence()
Deprecated.Notify the listener that processing of the sequence is complete.StringBuffer
formatLocation(StringBuffer sb, Location loc, StrandedFeature.Strand strand)
formatLocation
creates an EMBL/Genbank style representation of aLocation
.String
formatLocation(Feature theFeature)
Formats the location of a feature.String
formatLocation(Location loc, StrandedFeature.Strand strand)
formatLocation
creates an EMBL/Genbank style representation of aLocation
.PrintStream
getPrintStream()
Deprecated.getPrintStream
returns thePrintStream
to which an instance will write the formatted data.void
setName(String id)
Deprecated.Notify the listener that the current sequence is generally known by a particular name.void
setPrintStream(PrintStream stream)
Deprecated.setPrintStream
informs an instance whichPrintStream
to use.void
setURI(String uri)
Deprecated.Notify the listener of a URI identifying the current sequence.void
startFeature(Feature.Template templ)
Deprecated.Notify the listener that a new feature object is starting.void
startSequence()
Deprecated.Start the processing of a sequence.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.biojava.bio.seq.io.SeqFileFormer
formatLocation, formatLocation
-
-
-
-
Constructor Detail
-
EmblFileFormer
protected EmblFileFormer()
Deprecated.Creates a newEmblFileFormer
usingSystem.out
stream.
-
EmblFileFormer
protected EmblFileFormer(PrintStream stream)
Deprecated.Creates a newEmblFileFormer
using the specified stream.- Parameters:
stream
- aPrintStream
.
-
-
Method Detail
-
getPrintStream
public PrintStream getPrintStream()
Deprecated.Description copied from interface:SeqFileFormer
getPrintStream
returns thePrintStream
to which an instance will write the formatted data. If this has not been set, an implementation should default to System.out.- Specified by:
getPrintStream
in interfaceSeqFileFormer
- Returns:
- the
PrintStream
which will be written to.
-
setPrintStream
public void setPrintStream(PrintStream stream)
Deprecated.Description copied from interface:SeqFileFormer
setPrintStream
informs an instance whichPrintStream
to use.- Specified by:
setPrintStream
in interfaceSeqFileFormer
- Parameters:
stream
- aPrintStream
to write to.
-
setName
public void setName(String id) throws ParseException
Deprecated.Description copied from interface:SeqIOListener
Notify the listener that the current sequence is generally known by a particular name.- Specified by:
setName
in interfaceSeqIOListener
- Parameters:
id
- the String that should be returned by getName for the sequence being parsed- Throws:
ParseException
-
startSequence
public void startSequence() throws ParseException
Deprecated.Description copied from interface:SeqIOListener
Start the processing of a sequence. This method exists primarily to enforce the life-cycles of SeqIOListener objects.- Specified by:
startSequence
in interfaceSeqIOListener
- Throws:
ParseException
-
endSequence
public void endSequence() throws ParseException
Deprecated.Description copied from interface:SeqIOListener
Notify the listener that processing of the sequence is complete.- Specified by:
endSequence
in interfaceSeqIOListener
- Throws:
ParseException
-
setURI
public void setURI(String uri) throws ParseException
Deprecated.Description copied from interface:SeqIOListener
Notify the listener of a URI identifying the current sequence.- Specified by:
setURI
in interfaceSeqIOListener
- Throws:
ParseException
-
addSymbols
public void addSymbols(Alphabet alpha, Symbol[] syms, int start, int length) throws IllegalAlphabetException
Deprecated.Description copied from interface:SeqIOListener
Notify the listener of symbol data. All symbols passed to this method are guarenteed to be contained within the specified alphabet. Generally all calls to a given Listener should have the same alphabet -- if not, the listener implementation is likely to throw an exception- Specified by:
addSymbols
in interfaceSeqIOListener
- Parameters:
alpha
- The alphabet of the symbol datasyms
- An array containing symbolsstart
- The start offset of valid data within the arraylength
- The number of valid symbols in the array- Throws:
IllegalAlphabetException
- if we can't cope with this alphabet.
-
addSequenceProperty
public void addSequenceProperty(Object key, Object value) throws ParseException
Deprecated.Description copied from interface:SeqIOListener
Notify the listener of a sequence-wide property. This might be stored as an entry in the sequence's annotation bundle.- Specified by:
addSequenceProperty
in interfaceSeqIOListener
- Throws:
ParseException
-
startFeature
public void startFeature(Feature.Template templ) throws ParseException
Deprecated.Description copied from interface:SeqIOListener
Notify the listener that a new feature object is starting. Every call to startFeature should have a corresponding call to endFeature. If the listener is concerned with a hierarchy of features, it should maintain a stack of `open' features.- Specified by:
startFeature
in interfaceSeqIOListener
- Throws:
ParseException
-
endFeature
public void endFeature() throws ParseException
Deprecated.Description copied from interface:SeqIOListener
Mark the end of data associated with one specific feature.- Specified by:
endFeature
in interfaceSeqIOListener
- Throws:
ParseException
-
addFeatureProperty
public void addFeatureProperty(Object key, Object value)
Deprecated.Description copied from interface:SeqIOListener
Notify the listener of a feature property.- Specified by:
addFeatureProperty
in interfaceSeqIOListener
-
formatLocation
public 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
-
formatLocation
public String formatLocation(Location loc, StrandedFeature.Strand strand)
formatLocation
creates an EMBL/Genbank style representation of aLocation
. This is a convenience method only. The version which has aStringBuffer
parameter (and returns theStringBuffer
) is preferred. If a compound location is formatted using this method, it is returned as a join-type location rather than an order-type.- Parameters:
loc
- aLocation
to format.strand
- aStrandedFeature.Strand
indicating theLocation
's strand.- Returns:
- a
StringBuffer
.
-
formatLocation
public StringBuffer formatLocation(StringBuffer sb, Location loc, StrandedFeature.Strand strand)
formatLocation
creates an EMBL/Genbank style representation of aLocation
. Supported location forms:123 <123 or >123 (123.567) (123.567)..789 123..(567.789) (123.345)..(567.789) 123..456 <123..567 or 123..>567 or <123..>567 123^567 AL123465:(123..567)
If a compound location is formatted using this method, it is returned as a join-type location rather than an order-type. To preserve the join/order distinction; and to format locations like AL123465:(123..567), use the formatLocation(Feature) method.- Parameters:
sb
- aStringBuffer
loc
- aLocation
to format.strand
- aStrandedFeature.Strand
indicating theLocation
's strand.- Returns:
- a
StringBuffer
.
-
-