org.biojava.bio.seq.distributed
Class GFFDataSource

java.lang.Object
  extended byorg.biojava.bio.seq.distributed.GFFDataSource
All Implemented Interfaces:
DistDataSource

public class GFFDataSource
extends java.lang.Object
implements DistDataSource

Use a GFFEntrySet as a DataSource for adding annotation to sequences.

Author:
Thomas Down
For general use:
Instantiate this and add it to an instance of DistributeSequenceDB. All of the GFF features that have sequence fields matching sequence IDs in the db will be merged in.

Constructor Summary
GFFDataSource(GFFEntrySet gffe)
           
 
Method Summary
 FeatureHolder getFeatures(FeatureFilter ff)
          Get all features matching a FeatureFilter provided by this DistDataSource.
 FeatureHolder getFeatures(java.lang.String id, FeatureFilter ff, boolean recurse)
          Get all features matching a FeatureFilter on a Sequence with an ID and recurse flats.
 Sequence getSequence(java.lang.String id)
          Get a Sequence object for an ID.
 boolean hasFeatures(java.lang.String id)
          Find out if this DistDataSource can provide features on a sequence with a particular ID.
 boolean hasSequence(java.lang.String id)
          Find out if this DistDataSource provides the sequence information for a sequence ID.
 java.util.Set ids(boolean topLevel)
          Get the complete set of sequence IDs provided by this DistDataSource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GFFDataSource

public GFFDataSource(GFFEntrySet gffe)
Method Detail

hasSequence

public boolean hasSequence(java.lang.String id)
                    throws BioException
Description copied from interface: DistDataSource
Find out if this DistDataSource provides the sequence information for a sequence ID.

Specified by:
hasSequence in interface DistDataSource
Parameters:
id - the String id of a sequence
Returns:
true if this DistDataSource provides the primary sequence, false otherwise
Throws:
BioException

hasFeatures

public boolean hasFeatures(java.lang.String id)
                    throws BioException
Description copied from interface: DistDataSource
Find out if this DistDataSource can provide features on a sequence with a particular ID.

Specified by:
hasFeatures in interface DistDataSource
Parameters:
id - the String id of a sequence
Returns:
true if this DistDataSource provides features for the sequence, false otherwise
Throws:
BioException

getFeatures

public FeatureHolder getFeatures(FeatureFilter ff)
                          throws BioException
Description copied from interface: DistDataSource
Get all features matching a FeatureFilter provided by this DistDataSource.

Specified by:
getFeatures in interface DistDataSource
Parameters:
ff - the FeatureFilter to search with
Returns:
a FeatureHolder with all matching filters
Throws:
BioException

getFeatures

public FeatureHolder getFeatures(java.lang.String id,
                                 FeatureFilter ff,
                                 boolean recurse)
                          throws BioException
Description copied from interface: DistDataSource
Get all features matching a FeatureFilter on a Sequence with an ID and recurse flats.

Specified by:
getFeatures in interface DistDataSource
Parameters:
id - the ID of the Sequence
ff - the FeatureFilter to search with
recurse - true if we are to recurse the feature hierachy, false otherwise
Returns:
a FeatureHolder containing all feature matching
Throws:
BioException - if the features could not be fetched

getSequence

public Sequence getSequence(java.lang.String id)
                     throws BioException
Description copied from interface: DistDataSource
Get a Sequence object for an ID.

Specified by:
getSequence in interface DistDataSource
Parameters:
id - the ID of the Sequence to fetch
Returns:
a Seqeunce if hasSequence(id) would return true
Throws:
BioException - if either the ID could not be resolved or if the sequence could not be fetched

ids

public java.util.Set ids(boolean topLevel)
                  throws BioException
Description copied from interface: DistDataSource

Get the complete set of sequence IDs provided by this DistDataSource.

If the recurse flat is true, the IDs associated with the top level will be returned. However, if it is false, then IDs should be returned for all levels of an assembly hierachy including the top level IDs.

Specified by:
ids in interface DistDataSource
Parameters:
topLevel - if true, return top level IDs, otherwise all IDs
Returns:
a Set of String IDs
Throws:
BioException - if the IDs could not be fetched