Package org.biojavax.bio.seq.io
Class RichSequenceFormat.BasicFormat
- java.lang.Object
-
- org.biojavax.bio.seq.io.RichSequenceFormat.BasicFormat
-
- All Implemented Interfaces:
SequenceFormat
,RichSequenceFormat
- Direct Known Subclasses:
EMBLxmlFormat
,INSDseqFormat
,RichSequenceFormat.HeaderlessFormat
,UniProtXMLFormat
- Enclosing interface:
- RichSequenceFormat
public abstract static class RichSequenceFormat.BasicFormat extends Object implements RichSequenceFormat
Provides a basic format with simple things like line-widths precoded.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.biojavax.bio.seq.io.RichSequenceFormat
RichSequenceFormat.BasicFormat, RichSequenceFormat.HeaderlessFormat
-
-
Constructor Summary
Constructors Constructor Description BasicFormat()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canRead(File file)
Check to see if a given file is in our format.boolean
getElideComments()
Is the format going to emit events when comments data or remarks from bibliographic references are read?boolean
getElideFeatures()
Is the format going to emit events when feature data is read?boolean
getElideReferences()
Is the format going to emit events when bibliographic reference data is read?boolean
getElideSymbols()
Is the format going to emit events when sequence data is read?int
getLineWidth()
Retrive the current line width.PrintStream
getPrintStream()
Gets the print stream currently being written to.SymbolTokenization
guessSymbolTokenization(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.void
setElideComments(boolean elideComments)
Use this method to toggle reading of comments data.void
setElideFeatures(boolean elideFeatures)
Use this method to toggle reading of feature data.void
setElideReferences(boolean elideReferences)
Use this method to toggle reading of bibliographic reference data.void
setElideSymbols(boolean elideSymbols)
Use this method to toggle reading of sequence data.void
setLineWidth(int width)
Set the line width.void
setPrintStream(PrintStream os)
Sets the stream to write to.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.biojavax.bio.seq.io.RichSequenceFormat
beginWriting, canRead, finishWriting, guessSymbolTokenization, readRichSequence, writeSequence
-
Methods inherited from interface org.biojava.bio.seq.io.SequenceFormat
getDefaultFormat, readSequence, writeSequence, writeSequence
-
-
-
-
Constructor Detail
-
BasicFormat
public BasicFormat()
-
-
Method Detail
-
canRead
public boolean canRead(File file) throws IOException
Check 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.- Specified by:
canRead
in interfaceRichSequenceFormat
- Parameters:
file
- theFile
to check.- Returns:
- true if the file is readable by this format, false if not.
- Throws:
IOException
- in case the file is inaccessible.
-
guessSymbolTokenization
public SymbolTokenization guessSymbolTokenization(File file) throws 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.- Specified by:
guessSymbolTokenization
in interfaceRichSequenceFormat
- Parameters:
file
- theFile
object to guess the format of.- Returns:
- a
SymbolTokenization
to read the file with. - Throws:
IOException
- if the file is unrecognisable or inaccessible.
-
getLineWidth
public int getLineWidth()
Retrive the current line width. Defaults to 80.- Specified by:
getLineWidth
in interfaceRichSequenceFormat
- Returns:
- the line width
-
setLineWidth
public void setLineWidth(int width)
Set the line width. When writing, the lines of sequence will never be longer than the line width. Defaults to 80.- Specified by:
setLineWidth
in interfaceRichSequenceFormat
- Parameters:
width
- the new line width
-
getElideSymbols
public boolean getElideSymbols()
Is the format going to emit events when sequence data is read?- Specified by:
getElideSymbols
in interfaceRichSequenceFormat
- Returns:
- true if it is not otherwise false (false is default) .
-
setElideSymbols
public void setElideSymbols(boolean elideSymbols)
Use this method to toggle reading of sequence data.- Specified by:
setElideSymbols
in interfaceRichSequenceFormat
- Parameters:
elideSymbols
- set to true if you don't want the sequence data.
-
getElideFeatures
public boolean getElideFeatures()
Is the format going to emit events when feature data is read?- Specified by:
getElideFeatures
in interfaceRichSequenceFormat
- Returns:
- true if it is not otherwise false (false is default).
-
setElideFeatures
public void setElideFeatures(boolean elideFeatures)
Use this method to toggle reading of feature data.- Specified by:
setElideFeatures
in interfaceRichSequenceFormat
- Parameters:
elideFeatures
- set to true if you don't want the feature data.
-
getElideReferences
public boolean getElideReferences()
Is the format going to emit events when bibliographic reference data is read?- Specified by:
getElideReferences
in interfaceRichSequenceFormat
- Returns:
- true if it is not otherwise false (false is default) .
-
setElideReferences
public void setElideReferences(boolean elideReferences)
Use this method to toggle reading of bibliographic reference data.- Specified by:
setElideReferences
in interfaceRichSequenceFormat
- Parameters:
elideReferences
- set to true if you don't want the bibliographic reference data.
-
getElideComments
public boolean getElideComments()
Is the format going to emit events when comments data or remarks from bibliographic references are read?- Specified by:
getElideComments
in interfaceRichSequenceFormat
- Returns:
- true if it is not otherwise false (false is default).
-
setElideComments
public void setElideComments(boolean elideComments)
Use this method to toggle reading of comments data. Will also ignore remarks lines in bibliographic references.- Specified by:
setElideComments
in interfaceRichSequenceFormat
- Parameters:
elideComments
- set to true if you don't want the comments data.
-
setPrintStream
public void setPrintStream(PrintStream os)
Sets the stream to write to.- Specified by:
setPrintStream
in interfaceRichSequenceFormat
- Parameters:
os
- the PrintStream to write to.
-
getPrintStream
public PrintStream getPrintStream()
Gets the print stream currently being written to.- Specified by:
getPrintStream
in interfaceRichSequenceFormat
- Returns:
- the current print stream.
-
-