org.biojava3.core.sequence.features
Class AbstractFeature<S extends AbstractSequence<C>,C extends Compound>

java.lang.Object
  extended by org.biojava3.core.sequence.features.AbstractFeature<S,C>
All Implemented Interfaces:
FeatureInterface<S,C>
Direct Known Subclasses:
QualityFeature, QuantityFeature, TextFeature

public abstract class AbstractFeature<S extends AbstractSequence<C>,C extends Compound>
extends Object
implements FeatureInterface<S,C>

A feature is currently any descriptive item that can be associated with a sequence position(s) A feature has a type and a source which is currently a string to allow flexibility for the user Ideally well defined features should have a class to describe attributes of that feature

Author:
Scooter Willis

Field Summary
static Comparator<FeatureInterface<?,?>> LENGTH
          Sort features by length.
static Comparator<FeatureInterface<?,?>> LOCATION_LENGTH
          Sort features by start position and then longest length.
 
Constructor Summary
AbstractFeature(String type, String source)
          A feature has a type and a source
 
Method Summary
 List<FeatureInterface<S,C>> getChildrenFeatures()
          Get the children features
 String getDescription()
          Get the description that can be used to describe the feature
 SequenceLocation<S,C> getLocations()
          A feature could be a single sequence position like a mutation or a post translational modification of an amino acid.
 FeatureInterface<S,C> getParentFeature()
          Get the parent Feature
 String getShortDescription()
          Get the short description that can be used to describe the feature
 String getSource()
          The feature source
 String getType()
          The feature type
 Object getUserObject()
           
 void setChildrenFeatures(List<FeatureInterface<S,C>> features)
          Set the children features
 void setDescription(String description)
          Set the description that can be used to describe the feature
 void setLocation(SequenceLocation<S,C> loc)
          A feature could be a single sequence position like a mutation or a post translational modification of an amino acid.
 void setParentFeature(FeatureInterface<S,C> feature)
          A feature can be the child or contained by a parent feature.
 void setShortDescription(String shortDescription)
          Set the short description that can be used to describe the feature
 void setSource(String source)
          Set the feature source
 void setType(String type)
          Set the feature type
 void setUserObject(Object userObject)
          Allow the user to associate an object with the feature.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOCATION_LENGTH

public static final Comparator<FeatureInterface<?,?>> LOCATION_LENGTH
Sort features by start position and then longest length. When features are added having them sorted by start position and then longest length helps on the layout of overlapping features so they are delivered in a proper order.


LENGTH

public static final Comparator<FeatureInterface<?,?>> LENGTH
Sort features by length. //TODO need to handle cases where features have multiple locations, strand etc

Constructor Detail

AbstractFeature

public AbstractFeature(String type,
                       String source)
A feature has a type and a source

Parameters:
type -
source -
Method Detail

getLocations

public SequenceLocation<S,C> getLocations()
A feature could be a single sequence position like a mutation or a post translational modification of an amino acid. It could also be the docking interface of N number of amino acids on the surface. The location wold then be a collection of sequence positions instead of a single sequence position or the begin and end of a sequence seqment.

Specified by:
getLocations in interface FeatureInterface<S extends AbstractSequence<C>,C extends Compound>
Returns:

setLocation

public void setLocation(SequenceLocation<S,C> loc)
A feature could be a single sequence position like a mutation or a post translational modification of an amino acid. It could also be the docking interface of N number of amino acids on the surface. The location wold then be a collection of sequence positions instead of a single sequence position or the begin and end of a sequence seqment.

Specified by:
setLocation in interface FeatureInterface<S extends AbstractSequence<C>,C extends Compound>
Parameters:
loc -

getType

public String getType()
The feature type

Specified by:
getType in interface FeatureInterface<S extends AbstractSequence<C>,C extends Compound>
Returns:

setType

public void setType(String type)
Set the feature type

Specified by:
setType in interface FeatureInterface<S extends AbstractSequence<C>,C extends Compound>
Parameters:
type -

getSource

public String getSource()
The feature source

Specified by:
getSource in interface FeatureInterface<S extends AbstractSequence<C>,C extends Compound>
Returns:

setSource

public void setSource(String source)
Set the feature source

Specified by:
setSource in interface FeatureInterface<S extends AbstractSequence<C>,C extends Compound>
Parameters:
source -

setParentFeature

public void setParentFeature(FeatureInterface<S,C> feature)
A feature can be the child or contained by a parent feature. An example is a Helix feature could contain children features. A PFAM domain could contain secondary structures.

Specified by:
setParentFeature in interface FeatureInterface<S extends AbstractSequence<C>,C extends Compound>
Parameters:
feature -

getParentFeature

public FeatureInterface<S,C> getParentFeature()
Get the parent Feature

Specified by:
getParentFeature in interface FeatureInterface<S extends AbstractSequence<C>,C extends Compound>
Returns:

getChildrenFeatures

public List<FeatureInterface<S,C>> getChildrenFeatures()
Get the children features

Specified by:
getChildrenFeatures in interface FeatureInterface<S extends AbstractSequence<C>,C extends Compound>
Returns:

setChildrenFeatures

public void setChildrenFeatures(List<FeatureInterface<S,C>> features)
Set the children features

Specified by:
setChildrenFeatures in interface FeatureInterface<S extends AbstractSequence<C>,C extends Compound>
Parameters:
features -

getDescription

public String getDescription()
Description copied from interface: FeatureInterface
Get the description that can be used to describe the feature

Specified by:
getDescription in interface FeatureInterface<S extends AbstractSequence<C>,C extends Compound>
Returns:
the description

setDescription

public void setDescription(String description)
Description copied from interface: FeatureInterface
Set the description that can be used to describe the feature

Specified by:
setDescription in interface FeatureInterface<S extends AbstractSequence<C>,C extends Compound>
Parameters:
description - the description to set

getShortDescription

public String getShortDescription()
Description copied from interface: FeatureInterface
Get the short description that can be used to describe the feature

Specified by:
getShortDescription in interface FeatureInterface<S extends AbstractSequence<C>,C extends Compound>
Returns:
the shortDescription

setShortDescription

public void setShortDescription(String shortDescription)
Description copied from interface: FeatureInterface
Set the short description that can be used to describe the feature

Specified by:
setShortDescription in interface FeatureInterface<S extends AbstractSequence<C>,C extends Compound>
Parameters:
shortDescription - the shortDescription to set

getUserObject

public Object getUserObject()
Specified by:
getUserObject in interface FeatureInterface<S extends AbstractSequence<C>,C extends Compound>
Returns:
the userObject

setUserObject

public void setUserObject(Object userObject)
Allow the user to associate an object with the feature. This way if a feature which is displayed in a GUI is clicked on the application can then get a user defined object associated with the feature.

Specified by:
setUserObject in interface FeatureInterface<S extends AbstractSequence<C>,C extends Compound>
Parameters:
userObject - the userObject to set