public class EmblFileFormer extends Object implements SeqFileFormer
EmblFileFormer
performs the detailed formatting of
EMBL entries for writing to a PrintStream
. 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.
Modifier | Constructor and Description |
---|---|
protected |
EmblFileFormer()
Deprecated.
Creates a new
EmblFileFormer using
System.out stream. |
protected |
EmblFileFormer(PrintStream stream)
Deprecated.
Creates a new
EmblFileFormer using the specified
stream. |
Modifier and Type | Method and 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.
|
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 a Location . |
StringBuffer |
formatLocation(StringBuffer sb,
Location loc,
StrandedFeature.Strand strand)
formatLocation creates an EMBL/Genbank style
representation of a Location . |
PrintStream |
getPrintStream()
Deprecated.
getPrintStream returns the
PrintStream 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 which
PrintStream 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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
formatLocation, formatLocation
protected EmblFileFormer()
EmblFileFormer
using
System.out
stream.protected EmblFileFormer(PrintStream stream)
EmblFileFormer
using the specified
stream.stream
- a PrintStream
.public PrintStream getPrintStream()
SeqFileFormer
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.getPrintStream
in interface SeqFileFormer
PrintStream
which will be written to.public void setPrintStream(PrintStream stream)
SeqFileFormer
setPrintStream
informs an instance which
PrintStream
to use.setPrintStream
in interface SeqFileFormer
stream
- a PrintStream
to write to.public void setName(String id) throws ParseException
SeqIOListener
setName
in interface SeqIOListener
id
- the String that should be returned by getName for the sequence
being parsedParseException
public void startSequence() throws ParseException
SeqIOListener
startSequence
in interface SeqIOListener
ParseException
public void endSequence() throws ParseException
SeqIOListener
endSequence
in interface SeqIOListener
ParseException
public void setURI(String uri) throws ParseException
SeqIOListener
setURI
in interface SeqIOListener
ParseException
public void addSymbols(Alphabet alpha, Symbol[] syms, int start, int length) throws IllegalAlphabetException
SeqIOListener
addSymbols
in interface SeqIOListener
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 arrayIllegalAlphabetException
- if we can't cope with this
alphabet.public void addSequenceProperty(Object key, Object value) throws ParseException
SeqIOListener
addSequenceProperty
in interface SeqIOListener
ParseException
public void startFeature(Feature.Template templ) throws ParseException
SeqIOListener
startFeature
in interface SeqIOListener
ParseException
public void endFeature() throws ParseException
SeqIOListener
endFeature
in interface SeqIOListener
ParseException
public void addFeatureProperty(Object key, Object value)
SeqIOListener
addFeatureProperty
in interface SeqIOListener
public String formatLocation(Feature theFeature)
theFeature
- The feature with the location to formatpublic String formatLocation(Location loc, StrandedFeature.Strand strand)
formatLocation
creates an EMBL/Genbank style
representation of a Location
. This is a
convenience method only. The version which has a
StringBuffer
parameter (and returns the
StringBuffer
) is preferred. If a compound location is
formatted using this method, it is returned as a join-type location
rather than an order-type.loc
- a Location
to format.strand
- a StrandedFeature.Strand
indicating the Location
's strand.StringBuffer
.public StringBuffer formatLocation(StringBuffer sb, Location loc, StrandedFeature.Strand strand)
formatLocation
creates an EMBL/Genbank style
representation of a Location
. 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.
sb
- a StringBuffer
loc
- a Location
to format.strand
- a StrandedFeature.Strand
indicating the Location
's strand.StringBuffer
.Copyright © 2014 BioJava. All rights reserved.