org.biojava.bio.program.gff
Class GFFEntrySet

java.lang.Object
  |
  +--org.biojava.bio.program.gff.GFFEntrySet

public class GFFEntrySet
extends java.lang.Object

A set of entries and comments as a representation of a GFF file.

This is an intermediate stoorage solution for GFF stuff. It lets you collect together an arbitrary set of GFF records and comments, and then do something with them later.

Author:
Matthew Pocock

Constructor Summary
GFFEntrySet()
          Make an empty GFFEntrySet.
 
Method Summary
 void add(GFFRecord record)
          Add a GFFRecord to the end of this set.
 void add(java.lang.String comment)
          Add a comment to the end of this set.
 GFFEntrySet filter(GFFRecordFilter filter)
          Filter this entry set into another set.
 GFFDocumentHandler getAddHandler()
          Get the GFFDocumentHandler for adding to this set.
 SequenceAnnotator getAnnotator()
          Get an annotator that can add GFF features to a Sequence using the features in this GFFEntrySet.
 java.util.Iterator lineIterator()
          Loop over all lines in the set.
 int size()
          Return how many lines are in this set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GFFEntrySet

public GFFEntrySet()
Make an empty GFFEntrySet.
Method Detail

lineIterator

public java.util.Iterator lineIterator()
Loop over all lines in the set.

The Iterator will return String and GFFRecord objects in the order that they were added to this set. It is your responsibility to check the type of hasNext before casting it.


add

public void add(java.lang.String comment)
Add a comment to the end of this set.

This should be the text of the comment, without the leading '#'.

Parameters:
comment - a String giving the comment

add

public void add(GFFRecord record)
Add a GFFRecord to the end of this set.
Parameters:
comment - a GFFRecord to append

size

public int size()
Return how many lines are in this set.
Returns:
the size

getAnnotator

public SequenceAnnotator getAnnotator()
Get an annotator that can add GFF features to a Sequence using the features in this GFFEntrySet. The SequenceAnnotator returned by this method currently adds new features to an existing sequence (assuming it implements MutableFeatureHolder).

Sequences are only annotated if their getName() method returns a name equal to the sequence name field of one or more records in this GFFEntrySet.

Returns:
an SequenceAnnotator that adds GFF features

filter

public GFFEntrySet filter(GFFRecordFilter filter)
Filter this entry set into another set.
Parameters:
filter - the GFFRecordFilter to filter with
Returns:
a new GFFEntrySet containing only the items filtered in by the filter

getAddHandler

public GFFDocumentHandler getAddHandler()
Get the GFFDocumentHandler for adding to this set.
Returns:
a GFFDocumentHandler that adds everything that it recieves to this set