org.biojavax.bio.seq.io
Class RichSequenceFormat.BasicFormat

java.lang.Object
  extended by 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
RichSequenceFormat.BasicFormat()
           
 
Method Summary
 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

RichSequenceFormat.BasicFormat

public RichSequenceFormat.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 interface RichSequenceFormat
Parameters:
file - the File 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 interface RichSequenceFormat
Parameters:
file - the File 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 interface RichSequenceFormat
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 interface RichSequenceFormat
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 interface RichSequenceFormat
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 interface RichSequenceFormat
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 interface RichSequenceFormat
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 interface RichSequenceFormat
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 interface RichSequenceFormat
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 interface RichSequenceFormat
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 interface RichSequenceFormat
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 interface RichSequenceFormat
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 interface RichSequenceFormat
Parameters:
os - the PrintStream to write to.

getPrintStream

public PrintStream getPrintStream()
Gets the print stream currently being written to.

Specified by:
getPrintStream in interface RichSequenceFormat
Returns:
the current print stream.