Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.biojava.bio.seq
Class FeatureTypes

    java.lang.Object
      org.biojava.bio.seq.FeatureTypes

    public class FeatureTypes

extends Object

Registry of known types of features.

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
`static interface` | `FeatureTypes.Repository` A named collection of Types.
`static class` | `FeatureTypes.RepositoryImpl` A simple implementation of a Repository.
`static interface` | `FeatureTypes.Type` A type of feature.

Field Summary
`static String` | `URI_PREFIX` The standard prefix for all type URIs

Constructor Summary
`FeatureTypes()`

Method Summary
`static void` | `addRepository(FeatureTypes.Repository repos)` Add a repository to FeatureTypes.
`static FeatureTypes.Repository` | `getRepository(String name)` Fetch a repository by name.
`static Set` | `getRepositoryNames()` Find the names of all known repositories.
`static FeatureTypes.Type` | `getType(String uri)` 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` | `removeRepository(FeatureTypes.Repository repos)` Remove a repository from FeaturTypes.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### URI_PREFIX

    public static final String URI_PREFIX

  The standard prefix for all type URIs

  See Also:
    Constant Field Values

Constructor Detail

### FeatureTypes

    public FeatureTypes()

Method Detail

### getRepository

    public static FeatureTypes.Repository getRepository(String name)
                                                 throws NoSuchElementException

  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

    public static Set getRepositoryNames()

  Find the names of all known repositories.

  Returns:
    a Set of all repository names

### addRepository

    public static void addRepository(FeatureTypes.Repository repos)

  Add a repository to FeatureTypes.

  Parameters:
    `repos` - the Repository to add

### removeRepository

    public static void removeRepository(FeatureTypes.Repository repos)

  Remove a repository from FeaturTypes.

  Parameters:
    `repos` - the Repository to remove

### getType

    public static FeatureTypes.Type getType(String uri)

  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

    public static boolean isSubTypeOf(FeatureTypes.Type subType,
                                      FeatureTypes.Type superType)

  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 type
    `superType` - the Type of the potential super type
  Returns:
    true if they are sub-super types, false otherwise

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD