Package org.biojava.bio.seq.io
Class SequenceBuilderBase
java.lang.Object
org.biojava.bio.seq.io.SequenceBuilderBase
- All Implemented Interfaces:
SeqIOListener,SequenceBuilder
- Direct Known Subclasses:
SequenceDBSequenceBuilder,SimpleAssemblyBuilder,SimpleSequenceBuilder,SmartSequenceBuilder
Basic SequenceBuilder implementation which accumulates all
notified information. Subclass this to implement specific
Sequence implementations.
More functionality is offered by the
SimpleRichSequenceBuilder.- Version:
- 1.2 [newio proposal]
- Author:
- Thomas Down, David Huen (modified SimpleSequence to make this)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Annotationstatic Objectprotected Stringprotected Sequenceprotected String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFeatureProperty(Object key, Object value) Add an annotation-bundle entry to the feature.protected voidaddProperty(Annotation ann, Object key, Object value) voidaddSequenceProperty(Object key, Object value) Add an annotation-bundle entry to the sequence.abstract voidaddSymbols(Alphabet alpha, Symbol[] syms, int pos, int len) Notify the listener of symbol data.voidMark the end of data associated with one specific feature.voidNotify the listener that processing of the sequence is complete.Return the Sequence object which has been constructed by this builder.voidNotify the listener that the current sequence is generally known by a particular name.voidNotify the listener of a URI identifying the current sequence.voidstartFeature(Feature.Template templ) Notify the listener that a new feature object is starting.voidStart the processing of a sequence.
-
Field Details
-
ERROR_FEATURES_PROPERTY
-
name
-
uri
-
annotation
-
seq
-
-
Constructor Details
-
SequenceBuilderBase
public SequenceBuilderBase()
-
-
Method Details
-
startSequence
Description copied from interface:SeqIOListenerStart the processing of a sequence. This method exists primarily to enforce the life-cycles of SeqIOListener objects.- Specified by:
startSequencein interfaceSeqIOListener
-
endSequence
Description copied from interface:SeqIOListenerNotify the listener that processing of the sequence is complete.- Specified by:
endSequencein interfaceSeqIOListener
-
setName
Description copied from interface:SeqIOListenerNotify the listener that the current sequence is generally known by a particular name.- Specified by:
setNamein interfaceSeqIOListener- Parameters:
name- the String that should be returned by getName for the sequence being parsed
-
setURI
Description copied from interface:SeqIOListenerNotify the listener of a URI identifying the current sequence.- Specified by:
setURIin interfaceSeqIOListener
-
addSymbols
public abstract void addSymbols(Alphabet alpha, Symbol[] syms, int pos, int len) throws IllegalAlphabetException Description copied from interface:SeqIOListenerNotify 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:
addSymbolsin interfaceSeqIOListener- Parameters:
alpha- The alphabet of the symbol datasyms- An array containing symbolspos- The start offset of valid data within the arraylen- The number of valid symbols in the array- Throws:
IllegalAlphabetException- if we can't cope with this alphabet.
-
addSequenceProperty
Add an annotation-bundle entry to the sequence. If the annotation key isn't currently defined, the value is added directly. Otherwise:- If the current value implements the Collection interface, the new value is added to that collection.
- Otherwise, the current value is replaced by a List object containing the old value then the new value in that order.
- Specified by:
addSequencePropertyin interfaceSeqIOListener
-
startFeature
Description copied from interface:SeqIOListenerNotify 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:
startFeaturein interfaceSeqIOListener
-
addFeatureProperty
Add an annotation-bundle entry to the feature. If the annotation key isn't currently defined, the value is added directly. Otherwise:- If the current value implements the Collection interface, the new value is added to that collection.
- Otherwise, the current value is replaced by a List object containing the old value then the new value in that order.
- Specified by:
addFeaturePropertyin interfaceSeqIOListener- Throws:
ParseException
-
endFeature
Description copied from interface:SeqIOListenerMark the end of data associated with one specific feature.- Specified by:
endFeaturein interfaceSeqIOListener
-
makeSequence
Description copied from interface:SequenceBuilderReturn the Sequence object which has been constructed by this builder. This method is only expected to succeed after the endSequence() notifier has been called.- Specified by:
makeSequencein interfaceSequenceBuilder- Throws:
BioException
-
addProperty
-