de.jstacs.data.sequences.annotation
Class ReferenceSequenceAnnotationParser

java.lang.Object
  extended by de.jstacs.data.sequences.annotation.SplitSequenceAnnotationParser
      extended by de.jstacs.data.sequences.annotation.ReferenceSequenceAnnotationParser
All Implemented Interfaces:
SequenceAnnotationParser

public class ReferenceSequenceAnnotationParser
extends SplitSequenceAnnotationParser

This class implements an SequenceAnnotationParser that parses a ReferenceSequenceAnnotation from the comment lines of a sequence.

Author:
Jan Grau

Field Summary
 
Fields inherited from class de.jstacs.data.sequences.annotation.SplitSequenceAnnotationParser
annot, annotationDelimiter, keyValueDelimiter
 
Constructor Summary
ReferenceSequenceAnnotationParser(String key, AlphabetContainer alphabet, String keyValueDelimiter, String annotationDelimiter)
          Creates a new ReferenceSequenceAnnotationParser with user-specified delimiters.
ReferenceSequenceAnnotationParser(String key, AlphabetContainer alphabet, String keyValueDelimiter, String annotationDelimiter, String delim)
          Creates a new ReferenceSequenceAnnotationParser with user-specified delimiters.
 
Method Summary
protected  void add(String type, String identifier)
          This method actually adds a SequenceAnnotation to the internal list.
 String parseAnnotationToComment(char commentChar, SequenceAnnotation... annotations)
          This method returns a String representation of the given SequenceAnnotations that can be used as comment line in a file.
 
Methods inherited from class de.jstacs.data.sequences.annotation.SplitSequenceAnnotationParser
addToAnnotation, clearAnnotation, getCurrentAnnotation
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReferenceSequenceAnnotationParser

public ReferenceSequenceAnnotationParser(String key,
                                         AlphabetContainer alphabet,
                                         String keyValueDelimiter,
                                         String annotationDelimiter,
                                         String delim)
                                  throws IllegalArgumentException
Creates a new ReferenceSequenceAnnotationParser with user-specified delimiters.

Parameters:
key - the key for the ReferenceSequenceAnnotation
alphabet - the AlphabetContainer of the reference sequence
keyValueDelimiter - the delimiter between key and corresponding value
annotationDelimiter - the delimiter between different SequenceAnnotations
delim - the delimiter between symbols a the reference sequence
Throws:
IllegalArgumentException - if the delimiters are identical

ReferenceSequenceAnnotationParser

public ReferenceSequenceAnnotationParser(String key,
                                         AlphabetContainer alphabet,
                                         String keyValueDelimiter,
                                         String annotationDelimiter)
                                  throws IllegalArgumentException
Creates a new ReferenceSequenceAnnotationParser with user-specified delimiters.

Parameters:
key - the key for the ReferenceSequenceAnnotation
alphabet - the AlphabetContainer of the reference sequence
keyValueDelimiter - the delimiter between key and corresponding value
annotationDelimiter - the delimiter between different SequenceAnnotations
Throws:
IllegalArgumentException - if the delimiters are identical
Method Detail

add

protected void add(String type,
                   String identifier)
Description copied from class: SplitSequenceAnnotationParser
This method actually adds a SequenceAnnotation to the internal list.

Overrides:
add in class SplitSequenceAnnotationParser
Parameters:
type - the type of the SequenceAnnotation
identifier - the identifier of the SequenceAnnotation

parseAnnotationToComment

public String parseAnnotationToComment(char commentChar,
                                       SequenceAnnotation... annotations)
Description copied from interface: SequenceAnnotationParser
This method returns a String representation of the given SequenceAnnotations that can be used as comment line in a file.
Normally, the method should do the opposite of SequenceAnnotationParser.addToAnnotation(String).

Specified by:
parseAnnotationToComment in interface SequenceAnnotationParser
Overrides:
parseAnnotationToComment in class SplitSequenceAnnotationParser
Parameters:
commentChar - the char at the beginning of comment lines
annotations - the SequenceAnnotations to be parsed
Returns:
a String representing the given SequenceAnnotations
See Also:
DataSet.save(java.io.OutputStream, char, SequenceAnnotationParser)