de.jstacs.data.sequences.annotation
Class SplitSequenceAnnotationParser

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

public class SplitSequenceAnnotationParser
extends Object
implements SequenceAnnotationParser

This class implements a simple SequenceAnnotationParser which simply splits the comments by specific delimiters.

Author:
Jens Keilwagen

Constructor Summary
SplitSequenceAnnotationParser()
          Creates a new SplitSequenceAnnotationParser with specific delimiters, i.e., key value delimiter "=" and annotation delimiter ";".
SplitSequenceAnnotationParser(String keyValueDelimiter, String annotationDelimiter)
          Creates a new SplitSequenceAnnotationParser with user-specified delimiters.
 
Method Summary
 void addToAnnotation(String unparsed)
          This method adds the unparsed String in some way to the SequenceAnnotation.
 void clearAnnotation()
          This method reset the current SequenceAnnotation.
 SequenceAnnotation[] getCurrentAnnotation()
          This method returns the current SequenceAnnotation.
 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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SplitSequenceAnnotationParser

public SplitSequenceAnnotationParser()
Creates a new SplitSequenceAnnotationParser with specific delimiters, i.e., key value delimiter "=" and annotation delimiter ";".

See Also:
SplitSequenceAnnotationParser(String, String)

SplitSequenceAnnotationParser

public SplitSequenceAnnotationParser(String keyValueDelimiter,
                                     String annotationDelimiter)
Creates a new SplitSequenceAnnotationParser with user-specified delimiters.

Parameters:
keyValueDelimiter - the delimiter between key and corresponding value
annotationDelimiter - the delimiter between different SequenceAnnotations
Throws:
IllegalArgumentException - if the delimiters are identical
Method Detail

addToAnnotation

public void addToAnnotation(String unparsed)
Description copied from interface: SequenceAnnotationParser
This method adds the unparsed String in some way to the SequenceAnnotation.

Specified by:
addToAnnotation in interface SequenceAnnotationParser
Parameters:
unparsed - the String containing the annotation

clearAnnotation

public void clearAnnotation()
Description copied from interface: SequenceAnnotationParser
This method reset the current SequenceAnnotation.

Specified by:
clearAnnotation in interface SequenceAnnotationParser

getCurrentAnnotation

public SequenceAnnotation[] getCurrentAnnotation()
Description copied from interface: SequenceAnnotationParser
This method returns the current SequenceAnnotation.

Specified by:
getCurrentAnnotation in interface SequenceAnnotationParser
Returns:
the current 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
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:
Sample.save(java.io.OutputStream, char, SequenceAnnotationParser)