de.jstacs.io
Class AbstractStringExtractor

java.lang.Object
  extended by de.jstacs.io.AbstractStringExtractor
All Implemented Interfaces:
Enumeration<String>
Direct Known Subclasses:
InfixStringExtractor, LimitedStringExtractor, SimpleStringExtractor, SparseStringExtractor, StringExtractor

public abstract class AbstractStringExtractor
extends Object
implements Enumeration<String>

This class implements the reader that extracts strings. The class ignores lines starting with a given character, since those lines are treated as comments. If the user does not specify this character, it is set to "#" internally. If the user specifies this character as ">", the file or String will be treated as in FastA-format, i.e. lines beginning with ">" will be stripped and the lines between two ">" (or until the end of the file) will be appended to form a new String.

Author:
Jan Grau, Jens Keilwagen

Field Summary
protected  String annotation
          The annotation of the source.
static char FASTA
          The comment character for FastA-formatted files is ">".
protected  char ignore
          The internal comment character.
protected  Pattern ignorePattern
          The pattern for ignoring comment lines.
static char USUALLY
          The usual comment character is "#".
 
Constructor Summary
protected AbstractStringExtractor(char ignore)
          Creates a new AbstractStringExtractor with the specified character as start of each comment line.
 
Method Summary
 String getAnnotation()
          Returns the annotation of the source.
 SequenceAnnotation[] getCurrentSequenceAnnotations()
          Returns the SequenceAnnotation or null if no SequenceAnnotation is available.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Enumeration
hasMoreElements, nextElement
 

Field Detail

USUALLY

public static final char USUALLY
The usual comment character is "#". Lines beginning with this sign will be ignored.

See Also:
Constant Field Values

FASTA

public static final char FASTA
The comment character for FastA-formatted files is ">". If ">" is specified as the comment character, the file or String will be interpreted as in FastA format.

See Also:
Constant Field Values

annotation

protected String annotation
The annotation of the source.


ignorePattern

protected Pattern ignorePattern
The pattern for ignoring comment lines.


ignore

protected char ignore
The internal comment character.

Constructor Detail

AbstractStringExtractor

protected AbstractStringExtractor(char ignore)
Creates a new AbstractStringExtractor with the specified character as start of each comment line.

Parameters:
ignore - the comment character
See Also:
Pattern
Method Detail

getAnnotation

public final String getAnnotation()
Returns the annotation of the source.

Returns:
the annotation

getCurrentSequenceAnnotations

public SequenceAnnotation[] getCurrentSequenceAnnotations()
Returns the SequenceAnnotation or null if no SequenceAnnotation is available.

Returns:
the SequenceAnnotation or null if no SequenceAnnotation is available.