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
  • Field Details

  • Constructor Details

  • 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

      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