org.biojava.bio.seq.io
Interface FastaDescriptionReader

All Known Implementing Classes:
DefaultDescriptionReader

public interface FastaDescriptionReader

Converts the description line of a fasta entry into useful information.

Fasta files can have rich information shoe-horned into the description. This is unpredictable, and it would be fruitless to write a single routine for decoding all description formats. This interface lets you pop in your own parser, as apropriate.

Author:
Matthew Pocock

Method Summary
 void parseAnnotation(java.lang.String desc, Annotation annotation)
          Add any annotation to this annotation bundle that can be extracted from the description.
 java.lang.String[] parseURNName(java.lang.String desc)
          Parse out the name and urn from the description line.
 java.lang.String writeDescription(Sequence seq)
          Write the description for a sequence.
 

Method Detail

parseURNName

public java.lang.String[] parseURNName(java.lang.String desc)
Parse out the name and urn from the description line.

Most description lines contain some sort of unique id for the sequence. This routine should extract that information, and construct a sequence name and urn from it.

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)
Add any annotation to this annotation bundle that can be extracted from the description.
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)
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.

Parameters:
seq - the Sequence to generate a description for
Returns:
the description text