org.biojava.bio.seq.io
Class DefaultDescriptionReader

java.lang.Object
  |
  +--org.biojava.bio.seq.io.DefaultDescriptionReader

public class DefaultDescriptionReader
extends java.lang.Object
implements FastaDescriptionReader, java.io.Serializable

Assumes that the description is of the form 'id\s*desc'.

Author:
Matthew Pocock
See Also:
Serialized Form

Constructor Summary
DefaultDescriptionReader()
           
 
Method Summary
 void parseAnnotation(java.lang.String desc, Annotation annotation)
          Parses annotation out from the description line.
 java.lang.String[] parseURNName(java.lang.String desc)
          Parses the description line, extracting the names for the URI and name fields.
 java.lang.String writeDescription(Sequence seq)
          Write the description for a sequence.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultDescriptionReader

public DefaultDescriptionReader()
Method Detail

parseURNName

public java.lang.String[] parseURNName(java.lang.String desc)
Parses the description line, extracting the names for the URI and name fields.

The uri will be of the form urn:sequence/fasta:id. The name will be null.

Specified by:
parseURNName in interface FastaDescriptionReader
Tags copied from interface: FastaDescriptionReader
Parameters:
desc - the description text from the first non-white space character after > in the file untill the end of that line
Returns:
String [] { urn, name }

parseAnnotation

public void parseAnnotation(java.lang.String desc,
                            Annotation annotation)
Parses annotation out from the description line.

This will set the id property to the id, and the description property to everything following the first word.

Specified by:
parseAnnotation in interface FastaDescriptionReader
Tags copied from interface: FastaDescriptionReader
Parameters:
desc - the description text from the first non-white space character after > in the file untill the end of that line
annotation - the Annotation bundle to modify

writeDescription

public java.lang.String writeDescription(Sequence seq)
Description copied from interface: FastaDescriptionReader
Write the description for a sequence.

This should generate a suitable description line, not including the leading > and spaces, or the trailing newline, and return it as a string.

Specified by:
writeDescription in interface FastaDescriptionReader
Tags copied from interface: FastaDescriptionReader
Parameters:
seq - the Sequence to generate a description for
Returns:
the description text