|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.biojavax.bio.seq.io.RichSequenceFormat.BasicFormat
org.biojavax.bio.seq.io.RichSequenceFormat.HeaderlessFormat
org.biojavax.bio.seq.io.FastaFormat
public class FastaFormat
Format object representing FASTA files. These files are almost pure sequence data.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface org.biojavax.bio.seq.io.RichSequenceFormat |
|---|
RichSequenceFormat.BasicFormat, RichSequenceFormat.HeaderlessFormat |
| Field Summary | |
|---|---|
protected static java.util.regex.Pattern |
aminoAcids
|
protected static java.util.regex.Pattern |
dp
|
static java.lang.String |
FASTA_FORMAT
The name of this format |
protected static java.util.regex.Pattern |
hp
|
protected static java.util.regex.Pattern |
readableFiles
|
| Constructor Summary | |
|---|---|
FastaFormat()
|
|
| Method Summary | |
|---|---|
boolean |
canRead(java.io.BufferedInputStream stream)
Check to see if a given stream is in our format. |
boolean |
canRead(java.io.File file)
Check to see if a given file is in our format. |
java.lang.String |
getDefaultFormat()
getDefaultFormat returns the String identifier for
the default sub-format written by a SequenceFormat
implementation. |
FastaHeader |
getHeader()
|
SymbolTokenization |
guessSymbolTokenization(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. |
SymbolTokenization |
guessSymbolTokenization(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. |
void |
processHeader(java.lang.String line,
RichSeqIOListener rsiol,
Namespace ns)
Parse the Header information from the Fasta Description line |
boolean |
readRichSequence(java.io.BufferedReader reader,
SymbolTokenization symParser,
RichSeqIOListener rsiol,
Namespace ns)
Reads a sequence from the given buffered reader using the given tokenizer to parse sequence symbols. |
boolean |
readSequence(java.io.BufferedReader reader,
SymbolTokenization symParser,
SeqIOListener listener)
Read a sequence and pass data on to a SeqIOListener. |
void |
setHeader(FastaHeader header)
|
void |
writeSequence(Sequence seq,
Namespace ns)
Writes a sequence out to the outputstream given by beginWriting() using the default format of the implementing class. |
void |
writeSequence(Sequence seq,
java.io.PrintStream os)
writeSequence writes a sequence to the specified
PrintStream, using the default format. |
void |
writeSequence(Sequence seq,
java.lang.String format,
java.io.PrintStream os)
writeSequence writes a sequence to the specified
PrintStream, using the specified format. |
| Methods inherited from class org.biojavax.bio.seq.io.RichSequenceFormat.HeaderlessFormat |
|---|
beginWriting, finishWriting |
| Methods inherited from class org.biojavax.bio.seq.io.RichSequenceFormat.BasicFormat |
|---|
getElideComments, getElideFeatures, getElideReferences, getElideSymbols, getLineWidth, getPrintStream, setElideComments, setElideFeatures, setElideReferences, setElideSymbols, setLineWidth, setPrintStream |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String FASTA_FORMAT
protected static final java.util.regex.Pattern hp
protected static final java.util.regex.Pattern dp
protected static final java.util.regex.Pattern readableFiles
protected static final java.util.regex.Pattern aminoAcids
| Constructor Detail |
|---|
public FastaFormat()
| Method Detail |
|---|
public boolean canRead(java.io.File file)
throws java.io.IOException
canRead in interface RichSequenceFormatcanRead in class RichSequenceFormat.BasicFormatfile - the File to check.
java.io.IOException - in case the file is inaccessible.
public SymbolTokenization guessSymbolTokenization(java.io.File file)
throws java.io.IOException
guessSymbolTokenization in interface RichSequenceFormatguessSymbolTokenization in class RichSequenceFormat.BasicFormatfile - the File object to guess the format of.
SymbolTokenization to read the file with.
java.io.IOException - if the file is unrecognisable or inaccessible.
public boolean canRead(java.io.BufferedInputStream stream)
throws java.io.IOException
stream - the BufferedInputStream to check.
java.io.IOException - in case the stream is inaccessible.
public SymbolTokenization guessSymbolTokenization(java.io.BufferedInputStream stream)
throws java.io.IOException
stream - the BufferedInputStream object to guess the format of.
SymbolTokenization to read the stream with.
java.io.IOException - if the stream is unrecognisable or inaccessible.
public boolean readSequence(java.io.BufferedReader reader,
SymbolTokenization symParser,
SeqIOListener listener)
throws IllegalSymbolException,
java.io.IOException,
ParseException
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.
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
public boolean readRichSequence(java.io.BufferedReader reader,
SymbolTokenization symParser,
RichSeqIOListener rsiol,
Namespace ns)
throws IllegalSymbolException,
java.io.IOException,
ParseException
reader - the input sourcesymParser - the tokenizer which understands the sequence being readrsiol - the listener to send sequence events tons - the namespace to read sequences into.
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
public void processHeader(java.lang.String line,
RichSeqIOListener rsiol,
Namespace ns)
throws java.io.IOException,
ParseException
line - rsiol - ns -
java.io.IOException
ParseException
public void writeSequence(Sequence seq,
java.io.PrintStream os)
throws java.io.IOException
writeSequence writes a sequence to the specified
PrintStream, using the default format.
seq - the sequence to write out.os - the printstream to write to.
java.io.IOException
public void writeSequence(Sequence seq,
java.lang.String format,
java.io.PrintStream os)
throws java.io.IOException
writeSequence writes a sequence to the specified
PrintStream, using the specified format.
seq - a Sequence to write out.format - a String indicating which sub-format
of those available from a particular
SequenceFormat implemention to use when
writing.os - a PrintStream object.
java.io.IOException - if an error occurs.
public void writeSequence(Sequence seq,
Namespace ns)
throws java.io.IOException
seq - the sequence to writens - the namespace to write it with
java.io.IOException - in case it couldn't write somethingpublic java.lang.String getDefaultFormat()
getDefaultFormat returns the String identifier for
the default sub-format written by a SequenceFormat
implementation.
String.public FastaHeader getHeader()
public void setHeader(FastaHeader header)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||