|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.io.Reader
de.unibi.techfak.jpredictor.sequences.SequenceReader
de.unibi.techfak.jpredictor.sequences.RawReader
public class RawReader
Class for adding filter functionality to the SequenceReader
and, if wished, discarding of new line characters, too. While reading the
file, one SequenceInformationBlock is filled, especially
start and length.
Every read from the underlying reader is filtered (if a filter is
installed). Due to not uppercasing the read characters, the filter can be
applied for lowercase chars, too. Lowercase chars start 32 indices after
the uppercase char's start.
The filter string functions the following: the characters of the
string represent the uppercase and all following letters. Thus
filter.charAt(0) holds the character that replaces all
uppercase A's, filter.charAt(1) stands for B's to be
replaced and so on.
A space in the filter string stands for discarding that character,
e.g. the string "A B" lets through only A's and C's, and C's are
transformed to B's.
SequenceInformationBlock| Field Summary | |
|---|---|
private boolean |
discardNewLineChars
Decides whether new-line characters are left through or not. |
private java.lang.String |
filter
The file filter used in the readFiltered()-method. |
| Fields inherited from class de.unibi.techfak.jpredictor.sequences.SequenceReader |
|---|
countCharsRead, mark, sequenceBlocks |
| Fields inherited from class java.io.Reader |
|---|
lock |
| Constructor Summary | |
|---|---|
RawReader(java.io.Reader reader,
boolean discardNewLine)
Sets reader and a rudimentary filter. |
|
RawReader(java.io.Reader reader,
java.lang.String filter)
Sets filter and reader. |
|
| Method Summary | |
|---|---|
static java.lang.String |
createSequenceFromFile(java.lang.String filename,
java.lang.String filter)
Reads a file completely and stores the sequence in it to a String. |
java.lang.String |
getFilter()
Returns the filter used to filter the read sequence befor returning it. |
protected int |
readFiltered()
Reads characters from the stream until the next valid character occurs which is returned. |
void |
setFilter(java.lang.String filter)
Sets a new filter. |
| Methods inherited from class de.unibi.techfak.jpredictor.sequences.SequenceReader |
|---|
close, mark, markSupported, read, read, readLine, readUnfiltered, reset, sequences, skip |
| Methods inherited from class java.io.Reader |
|---|
read, read, ready |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private java.lang.String filter
readFiltered()-method.
FastaReader.setFilter(String),
SequenceReader.readFiltered()private boolean discardNewLineChars
false.
| Constructor Detail |
|---|
public RawReader(java.io.Reader reader,
boolean discardNewLine)
throws java.lang.NullPointerException
reader - The Reader to read from.discardNewLine - true, if new-line characters
should be discarded from the stream, false otherwise.
java.lang.NullPointerException - If reader is null.
public RawReader(java.io.Reader reader,
java.lang.String filter)
throws java.lang.NullPointerException
filter is null
all characters are left through. Otherwise, if filter is
not null all characters with their order below 'A' are
discarded and on the remaining chars the filter is applied.
reader - The Reader to read from.filter - Filter for every character read.
java.lang.NullPointerException - If reader is null.| Method Detail |
|---|
public java.lang.String getFilter()
public void setFilter(java.lang.String filter)
SequenceFilter.DNA_FILTER.
filter - The new filter to set.SequenceFilter
protected int readFiltered()
throws NewSequenceBlockException
SequenceReader
readFiltered in class SequenceReaderNewSequenceBlockException - An IOException
thrown when a new sequence occurs within the file.
public static java.lang.String createSequenceFromFile(java.lang.String filename,
java.lang.String filter)
SequenceFilter.filterString(String, String) is called.
filename - The name of the file to read.filter - Used to filter the read characters.
String, null in
case of any error.SequenceFilter.filterString(String, String)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||