Package org.biojavax.bio.seq.io
Class UniProtXMLFormat
- java.lang.Object
-
- org.biojavax.bio.seq.io.RichSequenceFormat.BasicFormat
-
- org.biojavax.bio.seq.io.UniProtXMLFormat
-
- All Implemented Interfaces:
SequenceFormat,RichSequenceFormat
public class UniProtXMLFormat extends RichSequenceFormat.BasicFormat
Format reader for UniProtXML files. This version of UniProtXML format will generate and write RichSequence objects. Loosely Based on code from the old, deprecated, org.biojava.bio.seq.io.GenbankXmlFormat object. Understands http://www.ebi.uniprot.org/support/docs/uniprot.xsd- Since:
- 1.5
- Author:
- Alan Li (code based on his work), Richard Holland
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classUniProtXMLFormat.TermsImplements some UniProtXML-specific terms.-
Nested classes/interfaces inherited from interface org.biojavax.bio.seq.io.RichSequenceFormat
RichSequenceFormat.BasicFormat, RichSequenceFormat.HeaderlessFormat
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.StringACCESSION_TAGprotected static java.lang.StringAUTHOR_LIST_TAGprotected static java.lang.StringCITATION_TAGprotected static java.lang.StringCOMMENT_ABS_MAX_TAGprotected static java.lang.StringCOMMENT_ABSORPTION_TAGprotected static java.lang.StringCOMMENT_ERROR_ATTRprotected static java.lang.StringCOMMENT_EVENT_TAGprotected static java.lang.StringCOMMENT_EXPERIMENTS_TAGprotected static java.lang.StringCOMMENT_INTERACT_INTACT_ATTRprotected static java.lang.StringCOMMENT_INTERACT_LABEL_TAGprotected static java.lang.StringCOMMENT_INTERACTANT_TAGprotected static java.lang.StringCOMMENT_ISOFORM_TAGprotected static java.lang.StringCOMMENT_KIN_KM_TAGprotected static java.lang.StringCOMMENT_KIN_VMAX_TAGprotected static java.lang.StringCOMMENT_KINETICS_TAGprotected static java.lang.StringCOMMENT_LINK_TAGprotected static java.lang.StringCOMMENT_LINK_URI_ATTRprotected static java.lang.StringCOMMENT_LOCTYPE_ATTRprotected static java.lang.StringCOMMENT_MASS_ATTRprotected static java.lang.StringCOMMENT_METHOD_ATTRprotected static java.lang.StringCOMMENT_ORGANISMS_TAGprotected static java.lang.StringCOMMENT_PH_TAGprotected static java.lang.StringCOMMENT_REDOX_TAGprotected static java.lang.StringCOMMENT_TAGprotected static java.lang.StringCOMMENT_TEMPERATURE_TAGprotected static java.lang.StringCOMPONENT_TAGprotected static java.lang.StringCONSORTIUM_TAGprotected static java.lang.StringCOPYRIGHT_TAGprotected static java.lang.StringDBXREF_TAGprotected static java.lang.StringDOMAIN_TAGprotected static java.lang.StringEDITOR_LIST_TAGprotected static java.lang.StringENTRY_CREATED_ATTRprotected static java.lang.StringENTRY_GROUP_TAGprotected static java.lang.StringENTRY_NAMESPACE_ATTRprotected static java.lang.StringENTRY_TAGprotected static java.lang.StringENTRY_UPDATED_ATTRprotected static java.lang.StringENTRY_VERSION_ATTRprotected static java.lang.StringEVIDENCE_ATTRprotected static java.lang.StringEVIDENCE_ATTRIBUTE_ATTRprotected static java.lang.StringEVIDENCE_CATEGORY_ATTRprotected static java.lang.StringEVIDENCE_DATE_ATTRprotected static java.lang.StringEVIDENCE_TAGprotected static java.lang.StringFEATURE_DESC_ATTRprotected static java.lang.StringFEATURE_ORIGINAL_TAGprotected static java.lang.StringFEATURE_TAGprotected static java.lang.StringFEATURE_VARIATION_TAGprotected static java.lang.StringGENE_TAGprotected static java.lang.StringGENELOCATION_NAME_TAGprotected static java.lang.StringGENELOCATION_TAGprotected static java.lang.StringID_ATTRprotected static java.lang.StringID_TAGprotected static java.lang.StringKEY_ATTRprotected static java.lang.StringKEYWORD_TAGprotected static java.lang.StringLINEAGE_TAGprotected static java.lang.StringLOCATION_BEGIN_TAGprotected static java.lang.StringLOCATION_END_TAGprotected static java.lang.StringLOCATION_POSITION_ATTRprotected static java.lang.StringLOCATION_POSITION_TAGprotected static java.lang.StringLOCATION_SEQ_ATTRprotected static java.lang.StringLOCATION_TAGprotected static java.lang.StringLOCATOR_TAGprotected static java.lang.StringNAME_ATTRprotected static java.lang.StringNAME_TAGprotected static java.lang.StringNOTE_TAGprotected static java.lang.StringORGANISM_TAGprotected static java.lang.StringPERSON_TAGprotected static java.lang.StringPROPERTY_TAGprotected static java.lang.StringPROTEIN_EXISTS_TAGprotected static java.lang.StringPROTEIN_TAGprotected static java.lang.StringPROTEIN_TYPE_ATTRprotected static java.lang.StringRC_LINE_TAGprotected static java.lang.StringRC_PLASMID_TAGprotected static java.lang.StringRC_SPECIES_TAGprotected static java.lang.StringRC_STRAIN_TAGprotected static java.lang.StringRC_TISSUE_TAGprotected static java.lang.StringRC_TRANSP_TAGprotected static java.lang.StringREF_ATTRprotected static java.lang.StringREFERENCE_TAGprotected static java.lang.StringRP_LINE_TAGprotected static java.util.regex.Patternrppatprotected static java.lang.StringSEQUENCE_CHECKSUM_ATTRprotected static java.lang.StringSEQUENCE_LENGTH_ATTRprotected static java.lang.StringSEQUENCE_MASS_ATTRprotected static java.lang.StringSEQUENCE_MODIFIED_ATTRprotected static java.lang.StringSEQUENCE_TAGprotected static java.lang.StringSEQUENCE_VERSION_ATTRprotected static java.lang.StringSTATUS_ATTRprotected static java.lang.StringTAXON_TAGprotected static java.lang.StringTEXT_TAGprotected static java.lang.StringTITLE_TAGprotected static java.lang.StringTYPE_ATTRstatic java.lang.StringUNIPROTXML_FORMATThe name of this formatprotected static java.lang.StringVALUE_ATTRprotected static java.util.regex.PatternxmlSchema
-
Constructor Summary
Constructors Constructor Description UniProtXMLFormat()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbeginWriting()Informs the writer that we want to start writing.booleancanRead(java.io.BufferedInputStream stream)Check to see if a given stream is in our format.booleancanRead(java.io.File file)Check to see if a given file is in our format.voidfinishWriting()Informs the writer that are done writing.java.lang.StringgetDefaultFormat()getDefaultFormatreturns the String identifier for the default sub-format written by aSequenceFormatimplementation.SymbolTokenizationguessSymbolTokenization(java.io.BufferedInputStream stream)On the assumption that the stream is readable by this format (not checked), attempt to guess which symbol tokenization we should use to read it.SymbolTokenizationguessSymbolTokenization(java.io.File file)On the assumption that the file is readable by this format (not checked), attempt to guess which symbol tokenization we should use to read it.booleanreadRichSequence(java.io.BufferedReader reader, SymbolTokenization symParser, RichSeqIOListener rlistener, Namespace ns)Reads a sequence from the given buffered reader using the given tokenizer to parse sequence symbols.booleanreadSequence(java.io.BufferedReader reader, SymbolTokenization symParser, SeqIOListener listener)Read a sequence and pass data on to a SeqIOListener.voidwriteSequence(Sequence seq, java.io.PrintStream os)writeSequencewrites a sequence to the specified PrintStream, using the default format.voidwriteSequence(Sequence seq, java.lang.String format, java.io.PrintStream os)writeSequencewrites a sequence to the specifiedPrintStream, using the specified format.voidwriteSequence(Sequence seq, Namespace ns)Writes a sequence out to the outputstream given by beginWriting() using the default format of the implementing class.-
Methods inherited from class org.biojavax.bio.seq.io.RichSequenceFormat.BasicFormat
getElideComments, getElideFeatures, getElideReferences, getElideSymbols, getLineWidth, getPrintStream, setElideComments, setElideFeatures, setElideReferences, setElideSymbols, setLineWidth, setPrintStream
-
-
-
-
Field Detail
-
UNIPROTXML_FORMAT
public static final java.lang.String UNIPROTXML_FORMAT
The name of this format- See Also:
- Constant Field Values
-
ENTRY_GROUP_TAG
protected static final java.lang.String ENTRY_GROUP_TAG
- See Also:
- Constant Field Values
-
ENTRY_TAG
protected static final java.lang.String ENTRY_TAG
- See Also:
- Constant Field Values
-
ENTRY_VERSION_ATTR
protected static final java.lang.String ENTRY_VERSION_ATTR
- See Also:
- Constant Field Values
-
ENTRY_NAMESPACE_ATTR
protected static final java.lang.String ENTRY_NAMESPACE_ATTR
- See Also:
- Constant Field Values
-
ENTRY_CREATED_ATTR
protected static final java.lang.String ENTRY_CREATED_ATTR
- See Also:
- Constant Field Values
-
ENTRY_UPDATED_ATTR
protected static final java.lang.String ENTRY_UPDATED_ATTR
- See Also:
- Constant Field Values
-
COPYRIGHT_TAG
protected static final java.lang.String COPYRIGHT_TAG
- See Also:
- Constant Field Values
-
ACCESSION_TAG
protected static final java.lang.String ACCESSION_TAG
- See Also:
- Constant Field Values
-
NAME_TAG
protected static final java.lang.String NAME_TAG
- See Also:
- Constant Field Values
-
TEXT_TAG
protected static final java.lang.String TEXT_TAG
- See Also:
- Constant Field Values
-
REF_ATTR
protected static final java.lang.String REF_ATTR
- See Also:
- Constant Field Values
-
TYPE_ATTR
protected static final java.lang.String TYPE_ATTR
- See Also:
- Constant Field Values
-
KEY_ATTR
protected static final java.lang.String KEY_ATTR
- See Also:
- Constant Field Values
-
ID_ATTR
protected static final java.lang.String ID_ATTR
- See Also:
- Constant Field Values
-
EVIDENCE_ATTR
protected static final java.lang.String EVIDENCE_ATTR
- See Also:
- Constant Field Values
-
VALUE_ATTR
protected static final java.lang.String VALUE_ATTR
- See Also:
- Constant Field Values
-
STATUS_ATTR
protected static final java.lang.String STATUS_ATTR
- See Also:
- Constant Field Values
-
NAME_ATTR
protected static final java.lang.String NAME_ATTR
- See Also:
- Constant Field Values
-
PROTEIN_TAG
protected static final java.lang.String PROTEIN_TAG
- See Also:
- Constant Field Values
-
PROTEIN_TYPE_ATTR
protected static final java.lang.String PROTEIN_TYPE_ATTR
- See Also:
- Constant Field Values
-
DOMAIN_TAG
protected static final java.lang.String DOMAIN_TAG
- See Also:
- Constant Field Values
-
COMPONENT_TAG
protected static final java.lang.String COMPONENT_TAG
- See Also:
- Constant Field Values
-
GENE_TAG
protected static final java.lang.String GENE_TAG
- See Also:
- Constant Field Values
-
ORGANISM_TAG
protected static final java.lang.String ORGANISM_TAG
- See Also:
- Constant Field Values
-
DBXREF_TAG
protected static final java.lang.String DBXREF_TAG
- See Also:
- Constant Field Values
-
PROPERTY_TAG
protected static final java.lang.String PROPERTY_TAG
- See Also:
- Constant Field Values
-
LINEAGE_TAG
protected static final java.lang.String LINEAGE_TAG
- See Also:
- Constant Field Values
-
TAXON_TAG
protected static final java.lang.String TAXON_TAG
- See Also:
- Constant Field Values
-
GENELOCATION_TAG
protected static final java.lang.String GENELOCATION_TAG
- See Also:
- Constant Field Values
-
GENELOCATION_NAME_TAG
protected static final java.lang.String GENELOCATION_NAME_TAG
- See Also:
- Constant Field Values
-
REFERENCE_TAG
protected static final java.lang.String REFERENCE_TAG
- See Also:
- Constant Field Values
-
CITATION_TAG
protected static final java.lang.String CITATION_TAG
- See Also:
- Constant Field Values
-
TITLE_TAG
protected static final java.lang.String TITLE_TAG
- See Also:
- Constant Field Values
-
EDITOR_LIST_TAG
protected static final java.lang.String EDITOR_LIST_TAG
- See Also:
- Constant Field Values
-
AUTHOR_LIST_TAG
protected static final java.lang.String AUTHOR_LIST_TAG
- See Also:
- Constant Field Values
-
PERSON_TAG
protected static final java.lang.String PERSON_TAG
- See Also:
- Constant Field Values
-
CONSORTIUM_TAG
protected static final java.lang.String CONSORTIUM_TAG
- See Also:
- Constant Field Values
-
LOCATOR_TAG
protected static final java.lang.String LOCATOR_TAG
- See Also:
- Constant Field Values
-
RP_LINE_TAG
protected static final java.lang.String RP_LINE_TAG
- See Also:
- Constant Field Values
-
RC_LINE_TAG
protected static final java.lang.String RC_LINE_TAG
- See Also:
- Constant Field Values
-
RC_SPECIES_TAG
protected static final java.lang.String RC_SPECIES_TAG
- See Also:
- Constant Field Values
-
RC_TISSUE_TAG
protected static final java.lang.String RC_TISSUE_TAG
- See Also:
- Constant Field Values
-
RC_TRANSP_TAG
protected static final java.lang.String RC_TRANSP_TAG
- See Also:
- Constant Field Values
-
RC_STRAIN_TAG
protected static final java.lang.String RC_STRAIN_TAG
- See Also:
- Constant Field Values
-
RC_PLASMID_TAG
protected static final java.lang.String RC_PLASMID_TAG
- See Also:
- Constant Field Values
-
COMMENT_TAG
protected static final java.lang.String COMMENT_TAG
- See Also:
- Constant Field Values
-
COMMENT_MASS_ATTR
protected static final java.lang.String COMMENT_MASS_ATTR
- See Also:
- Constant Field Values
-
COMMENT_ERROR_ATTR
protected static final java.lang.String COMMENT_ERROR_ATTR
- See Also:
- Constant Field Values
-
COMMENT_METHOD_ATTR
protected static final java.lang.String COMMENT_METHOD_ATTR
- See Also:
- Constant Field Values
-
COMMENT_LOCTYPE_ATTR
protected static final java.lang.String COMMENT_LOCTYPE_ATTR
- See Also:
- Constant Field Values
-
COMMENT_ABSORPTION_TAG
protected static final java.lang.String COMMENT_ABSORPTION_TAG
- See Also:
- Constant Field Values
-
COMMENT_ABS_MAX_TAG
protected static final java.lang.String COMMENT_ABS_MAX_TAG
- See Also:
- Constant Field Values
-
COMMENT_KINETICS_TAG
protected static final java.lang.String COMMENT_KINETICS_TAG
- See Also:
- Constant Field Values
-
COMMENT_KIN_KM_TAG
protected static final java.lang.String COMMENT_KIN_KM_TAG
- See Also:
- Constant Field Values
-
COMMENT_KIN_VMAX_TAG
protected static final java.lang.String COMMENT_KIN_VMAX_TAG
- See Also:
- Constant Field Values
-
COMMENT_PH_TAG
protected static final java.lang.String COMMENT_PH_TAG
- See Also:
- Constant Field Values
-
COMMENT_REDOX_TAG
protected static final java.lang.String COMMENT_REDOX_TAG
- See Also:
- Constant Field Values
-
COMMENT_TEMPERATURE_TAG
protected static final java.lang.String COMMENT_TEMPERATURE_TAG
- See Also:
- Constant Field Values
-
COMMENT_LINK_TAG
protected static final java.lang.String COMMENT_LINK_TAG
- See Also:
- Constant Field Values
-
COMMENT_LINK_URI_ATTR
protected static final java.lang.String COMMENT_LINK_URI_ATTR
- See Also:
- Constant Field Values
-
COMMENT_EVENT_TAG
protected static final java.lang.String COMMENT_EVENT_TAG
- See Also:
- Constant Field Values
-
COMMENT_ISOFORM_TAG
protected static final java.lang.String COMMENT_ISOFORM_TAG
- See Also:
- Constant Field Values
-
COMMENT_INTERACTANT_TAG
protected static final java.lang.String COMMENT_INTERACTANT_TAG
- See Also:
- Constant Field Values
-
COMMENT_INTERACT_INTACT_ATTR
protected static final java.lang.String COMMENT_INTERACT_INTACT_ATTR
- See Also:
- Constant Field Values
-
COMMENT_INTERACT_LABEL_TAG
protected static final java.lang.String COMMENT_INTERACT_LABEL_TAG
- See Also:
- Constant Field Values
-
COMMENT_ORGANISMS_TAG
protected static final java.lang.String COMMENT_ORGANISMS_TAG
- See Also:
- Constant Field Values
-
COMMENT_EXPERIMENTS_TAG
protected static final java.lang.String COMMENT_EXPERIMENTS_TAG
- See Also:
- Constant Field Values
-
NOTE_TAG
protected static final java.lang.String NOTE_TAG
- See Also:
- Constant Field Values
-
KEYWORD_TAG
protected static final java.lang.String KEYWORD_TAG
- See Also:
- Constant Field Values
-
PROTEIN_EXISTS_TAG
protected static final java.lang.String PROTEIN_EXISTS_TAG
- See Also:
- Constant Field Values
-
ID_TAG
protected static final java.lang.String ID_TAG
- See Also:
- Constant Field Values
-
FEATURE_TAG
protected static final java.lang.String FEATURE_TAG
- See Also:
- Constant Field Values
-
FEATURE_DESC_ATTR
protected static final java.lang.String FEATURE_DESC_ATTR
- See Also:
- Constant Field Values
-
FEATURE_ORIGINAL_TAG
protected static final java.lang.String FEATURE_ORIGINAL_TAG
- See Also:
- Constant Field Values
-
FEATURE_VARIATION_TAG
protected static final java.lang.String FEATURE_VARIATION_TAG
- See Also:
- Constant Field Values
-
EVIDENCE_TAG
protected static final java.lang.String EVIDENCE_TAG
- See Also:
- Constant Field Values
-
EVIDENCE_CATEGORY_ATTR
protected static final java.lang.String EVIDENCE_CATEGORY_ATTR
- See Also:
- Constant Field Values
-
EVIDENCE_ATTRIBUTE_ATTR
protected static final java.lang.String EVIDENCE_ATTRIBUTE_ATTR
- See Also:
- Constant Field Values
-
EVIDENCE_DATE_ATTR
protected static final java.lang.String EVIDENCE_DATE_ATTR
- See Also:
- Constant Field Values
-
LOCATION_TAG
protected static final java.lang.String LOCATION_TAG
- See Also:
- Constant Field Values
-
LOCATION_SEQ_ATTR
protected static final java.lang.String LOCATION_SEQ_ATTR
- See Also:
- Constant Field Values
-
LOCATION_BEGIN_TAG
protected static final java.lang.String LOCATION_BEGIN_TAG
- See Also:
- Constant Field Values
-
LOCATION_END_TAG
protected static final java.lang.String LOCATION_END_TAG
- See Also:
- Constant Field Values
-
LOCATION_POSITION_ATTR
protected static final java.lang.String LOCATION_POSITION_ATTR
- See Also:
- Constant Field Values
-
LOCATION_POSITION_TAG
protected static final java.lang.String LOCATION_POSITION_TAG
- See Also:
- Constant Field Values
-
SEQUENCE_TAG
protected static final java.lang.String SEQUENCE_TAG
- See Also:
- Constant Field Values
-
SEQUENCE_VERSION_ATTR
protected static final java.lang.String SEQUENCE_VERSION_ATTR
- See Also:
- Constant Field Values
-
SEQUENCE_LENGTH_ATTR
protected static final java.lang.String SEQUENCE_LENGTH_ATTR
- See Also:
- Constant Field Values
-
SEQUENCE_MASS_ATTR
protected static final java.lang.String SEQUENCE_MASS_ATTR
- See Also:
- Constant Field Values
-
SEQUENCE_CHECKSUM_ATTR
protected static final java.lang.String SEQUENCE_CHECKSUM_ATTR
- See Also:
- Constant Field Values
-
SEQUENCE_MODIFIED_ATTR
protected static final java.lang.String SEQUENCE_MODIFIED_ATTR
- See Also:
- Constant Field Values
-
rppat
protected static final java.util.regex.Pattern rppat
-
xmlSchema
protected static final java.util.regex.Pattern xmlSchema
-
-
Method Detail
-
canRead
public boolean canRead(java.io.File file) throws java.io.IOExceptionCheck to see if a given file is in our format. Some formats may be able to determine this by filename, whilst others may have to open the file and read it to see what format it is in. A file is in UniProtXML format if the second XML line contains the phrase "http://www.uniprot.org/support/docs/uniprot.xsd".- Specified by:
canReadin interfaceRichSequenceFormat- Overrides:
canReadin classRichSequenceFormat.BasicFormat- Parameters:
file- theFileto check.- Returns:
- true if the file is readable by this format, false if not.
- Throws:
java.io.IOException- in case the file is inaccessible.
-
guessSymbolTokenization
public SymbolTokenization guessSymbolTokenization(java.io.File file) throws java.io.IOException
On the assumption that the file is readable by this format (not checked), attempt to guess which symbol tokenization we should use to read it. For formats that only accept one tokenization, just return it without checking the file. For formats that accept multiple tokenizations, its up to you how you do it. Always returns a protein tokenizer.- Specified by:
guessSymbolTokenizationin interfaceRichSequenceFormat- Overrides:
guessSymbolTokenizationin classRichSequenceFormat.BasicFormat- Parameters:
file- theFileobject to guess the format of.- Returns:
- a
SymbolTokenizationto read the file with. - Throws:
java.io.IOException- if the file is unrecognisable or inaccessible.
-
canRead
public boolean canRead(java.io.BufferedInputStream stream) throws java.io.IOExceptionCheck to see if a given stream is in our format. A stream is in UniProtXML format if the second XML line contains the phrase "http://www.uniprot.org/support/docs/uniprot.xsd".- Parameters:
stream- theBufferedInputStreamto check.- Returns:
- true if the stream is readable by this format, false if not.
- Throws:
java.io.IOException- in case the stream is inaccessible.
-
guessSymbolTokenization
public SymbolTokenization guessSymbolTokenization(java.io.BufferedInputStream stream) throws java.io.IOException
On the assumption that the stream is readable by this format (not checked), attempt to guess which symbol tokenization we should use to read it. For formats that only accept one tokenization, just return it without checking the stream. For formats that accept multiple tokenizations, its up to you how you do it. Always returns a protein tokenizer.- Parameters:
stream- theBufferedInputStreamobject to guess the format of.- Returns:
- a
SymbolTokenizationto read the stream with. - Throws:
java.io.IOException- if the stream is unrecognisable or inaccessible.
-
readSequence
public boolean readSequence(java.io.BufferedReader reader, SymbolTokenization symParser, SeqIOListener listener) throws IllegalSymbolException, java.io.IOException, ParseExceptionRead a sequence and pass data on to a SeqIOListener.- Parameters:
reader- The stream of data to parse.symParser- A SymbolParser defining a mapping from character data to Symbols.listener- A listener to notify when data is extracted from the stream.- Returns:
- a boolean indicating whether or not the stream contains any more sequences.
- Throws:
IllegalSymbolException- if it is not possible to translate character data from the stream into valid BioJava symbols.java.io.IOException- if an error occurs while reading from the stream.ParseException
-
readRichSequence
public boolean readRichSequence(java.io.BufferedReader reader, SymbolTokenization symParser, RichSeqIOListener rlistener, Namespace ns) throws IllegalSymbolException, java.io.IOException, ParseExceptionReads a sequence from the given buffered reader using the given tokenizer to parse sequence symbols. Events are passed to the listener, and the namespace used for sequences read is the one given. If the namespace is null, then the default namespace for the parser is used, which may depend on individual implementations of this interface. If namespace is null, then the namespace of the sequence in the fasta is used. If the namespace is null and so is the namespace of the sequence in the fasta, then the default namespace is used.- Parameters:
reader- the input sourcesymParser- the tokenizer which understands the sequence being readrlistener- the listener to send sequence events tons- the namespace to read sequences into.- Returns:
- true if there is more to read after this, false otherwise.
- Throws:
IllegalSymbolException- if the tokenizer couldn't understand one of the sequence symbols in the file.java.io.IOException- if there was a read error.ParseException
-
beginWriting
public void beginWriting() throws java.io.IOExceptionInforms the writer that we want to start writing. This will do any initialisation required, such as writing the opening tags of an XML file that groups sequences together.- Throws:
java.io.IOException- if writing fails.
-
finishWriting
public void finishWriting() throws java.io.IOExceptionInforms the writer that are done writing. This will do any finalisation required, such as writing the closing tags of an XML file that groups sequences together.- Throws:
java.io.IOException- if writing fails.
-
writeSequence
public void writeSequence(Sequence seq, java.io.PrintStream os) throws java.io.IOException
writeSequencewrites a sequence to the specified PrintStream, using the default format.- Parameters:
seq- the sequence to write out.os- the printstream to write to.- Throws:
java.io.IOException
-
writeSequence
public void writeSequence(Sequence seq, java.lang.String format, java.io.PrintStream os) throws java.io.IOException
writeSequencewrites a sequence to the specifiedPrintStream, using the specified format.- Parameters:
seq- aSequenceto write out.format- aStringindicating which sub-format of those available from a particularSequenceFormatimplemention to use when writing.os- aPrintStreamobject.- Throws:
java.io.IOException- if an error occurs.
-
writeSequence
public void writeSequence(Sequence seq, Namespace ns) throws java.io.IOException
Writes a sequence out to the outputstream given by beginWriting() using the default format of the implementing class. If namespace is given, sequences will be written with that namespace, otherwise they will be written with the default namespace of the implementing class (which is usually the namespace of the sequence itself). If you pass this method a sequence which is not a RichSequence, it will attempt to convert it using RichSequence.Tools.enrich(). Obviously this is not going to guarantee a perfect conversion, so it's better if you just use RichSequences to start with! If namespace is null, then the sequence's own namespace is used.- Parameters:
seq- the sequence to writens- the namespace to write it with- Throws:
java.io.IOException- in case it couldn't write something
-
getDefaultFormat
public java.lang.String getDefaultFormat()
getDefaultFormatreturns the String identifier for the default sub-format written by aSequenceFormatimplementation.- Returns:
- a
String.
-
-