Package org.biojava.bio.seq.distributed
Interface DistDataSource
-
- All Known Implementing Classes:
GFFDataSource
,SequenceDBDataSource
public interface DistDataSource
Object which contributes data to a DistributedSequenceDB.
DistDataSource is responsible for providing some information about what sequences exist, what the SymbolList associated with it and what features are here. Typically, the objects returned from DistributedSequenceDB will be composed from information from multiple DistDataSource instances.
- Since:
- 1.2 Take an instance of this interface and add it to a DistributedSequenceDB. Implement this if you have information about some seqeunces but do not wish to or can not integrate this with the main sequence at source. For example, if you have some locally annotated features for SwissProt entries, you could create a DistDataSource providing just your features and let the DistDataSource API integrate these in software with a SwissProt sequence db provider. DistDataSource instances can provided sequence information and feature information. These are integrated seperately. To provide sequences, implement hasSequence(), getSequence() and ids(). ids(false).contains(id) should equal hasSequence(id). Features are provided by implementing hasFeatures(), and the two getFeatures() methods. In the case where hasFeatures() returns true, getFeatures() should return a FeatureHolder. If it is false, getFeatures() may raise a BioException. If these rules are not followed, the results are undefined and may not be consistent.
- Author:
- Thomas Down
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description FeatureHolder
getFeatures(String id, FeatureFilter ff, boolean recurse)
Get all features matching a FeatureFilter on a Sequence with an ID and recurse flats.FeatureHolder
getFeatures(FeatureFilter ff)
Get all features matching a FeatureFilter provided by this DistDataSource.Sequence
getSequence(String id)
Get a Sequence object for an ID.boolean
hasFeatures(String id)
Find out if this DistDataSource can provide features on a sequence with a particular ID.boolean
hasSequence(String id)
Find out if this DistDataSource provides the sequence information for a sequence ID.Set
ids(boolean topLevel)
Get the complete set of sequence IDs provided by this DistDataSource.
-
-
-
Method Detail
-
hasSequence
boolean hasSequence(String id) throws BioException
Find out if this DistDataSource provides the sequence information for a sequence ID.- Parameters:
id
- the String id of a sequence- Returns:
- true if this DistDataSource provides the primary sequence, false otherwise
- Throws:
BioException
-
hasFeatures
boolean hasFeatures(String id) throws BioException
Find out if this DistDataSource can provide features on a sequence with a particular ID.- Parameters:
id
- the String id of a sequence- Returns:
- true if this DistDataSource provides features for the sequence, false otherwise
- Throws:
BioException
-
getFeatures
FeatureHolder getFeatures(FeatureFilter ff) throws BioException
Get all features matching a FeatureFilter provided by this DistDataSource. You can simulate getFeatures(id, ff, recurse) by using the advanced FeatureFilter implementations.- Parameters:
ff
- the FeatureFilter to search with- Returns:
- a FeatureHolder with all matching filters
- Throws:
BioException
-
getFeatures
FeatureHolder getFeatures(String id, FeatureFilter ff, boolean recurse) throws BioException
Get all features matching a FeatureFilter on a Sequence with an ID and recurse flats. You can simulate getFeatures(ff) by adding the apropreate FeatureFilter implementations.- Parameters:
id
- the ID of the Sequenceff
- the FeatureFilter to search withrecurse
- 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
Sequence getSequence(String id) throws BioException
Get a Sequence object for an ID.- 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
Set ids(boolean topLevel) throws BioException
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.
- 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
-
-