Class FeatureTypes
Historically, the type of a feature within a sequence has been represented by the class or interface of the feature, or by the type property. Different databases use different names for types, and the same name can mean different things depending on where it came from.
This class attempts to provide a framework for registering and managing feature types. It includes the concept of a type having a FeatureFilter schema that would match all examples of that type, and a URI for that type. Groups of related types, such as all those defined in embl, can be packaged up into a single namespace. One type can refer to any number of others, indicating that they are direct parents. This lets us say things like an Ensembl exon is a specific type of the general exon type, and also an instance of the Ensembl feature type.
All feature types are presumed to have URIs that are of the form:
uri:biojava.org:types:${repository}/${type}
where
${repository}
is something like embl or ensembl. Feature types
defined within biojava will be in the repository called "core".
${type}
is the local type of the feature. This will be something
like exon, or repeat. The total URI must be unique. Different repositories
can (and are encouraged to) define types with the same names.
- Since:
- 1.3
- Author:
- Matthew Pocock
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
A named collection of Types.static class
A simple implementation of a Repository.static interface
A type of feature. -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
Add a repository to FeatureTypes.static FeatureTypes.Repository
getRepository
(String name) Fetch a repository by name.static Set
Find the names of all known repositories.static FeatureTypes.Type
Get a Type by URI.static boolean
isSubTypeOf
(FeatureTypes.Type subType, FeatureTypes.Type superType) Work out if one type is a sub-type of another.static void
Remove a repository from FeaturTypes.
-
Field Details
-
URI_PREFIX
The standard prefix for all type URIs- See Also:
-
-
Constructor Details
-
FeatureTypes
public FeatureTypes()
-
-
Method Details
-
getRepository
Fetch a repository by name.
Use this to find out what types a repository can provide.
- Parameters:
name
- the name of the Repository to fetch- Returns:
- the Repository with that name
- Throws:
NoSuchElementException
- if there is no repository by that name
-
getRepositoryNames
Find the names of all known repositories.- Returns:
- a Set of all repository names
-
addRepository
Add a repository to FeatureTypes.- Parameters:
repos
- the Repository to add
-
removeRepository
Remove a repository from FeaturTypes.- Parameters:
repos
- the Repository to remove
-
getType
Get a Type by URI.
This will attemt to resolve the URI to a type by first matching the standard prefix, then finding a repository of the right name and finally searching that with the type-name portion of the URI.
- Parameters:
uri
- the URI to resolve- Returns:
- a Type with that URI
- Throws:
NoSuchElementException
- if the type could not be resolved
-
isSubTypeOf
Work out if one type is a sub-type of another.
This is the transiative closure of Type.getParent(). It will return true if superType is reachable by following getParent() calls, and false otherwise.
- Parameters:
subType
- the Type of the potential sub typesuperType
- the Type of the potential super type- Returns:
- true if they are sub-super types, false otherwise
-