Class AbstractFeature<S extends AbstractSequence<C>,C extends Compound>
- java.lang.Object
-
- org.biojava.nbio.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
Fields Modifier and Type Field Description static Comparator<FeatureInterface<?,?>>
LENGTH
Sort features by length.static Comparator<FeatureInterface<?,?>>
LOCATION_LENGTH
Sort features by start position and then longest length.static Comparator<FeatureInterface<?,?>>
TYPE
Sort features by type
-
Constructor Summary
Constructors Constructor Description AbstractFeature(String type, String source)
A feature has a type and a source
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addQualifier(String key, Qualifier qualifier)
Add a qualifierList<FeatureInterface<S,C>>
getChildrenFeatures()
Get the children featuresString
getDescription()
Get the description that can be used to describe the featureAbstractLocation
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 FeatureMap<String,List<Qualifier>>
getQualifiers()
Get the qualifiers for this featureString
getShortDescription()
Get the short description that can be used to describe the featureString
getSource()
The feature sourceString
getType()
The feature typeObject
getUserObject()
void
setChildrenFeatures(List<FeatureInterface<S,C>> features)
Set the children featuresvoid
setDescription(String description)
Set the description that can be used to describe the featurevoid
setLocation(AbstractLocation 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
setQualifiers(Map<String,List<Qualifier>> qualifiers)
Set the qualifiersvoid
setShortDescription(String shortDescription)
Set the short description that can be used to describe the featurevoid
setSource(String source)
Set the feature sourcevoid
setType(String type)
Set the feature typevoid
setUserObject(Object userObject)
Allow the user to associate an object with the feature.
-
-
-
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
-
TYPE
public static final Comparator<FeatureInterface<?,?>> TYPE
Sort features by type
-
-
Constructor Detail
-
AbstractFeature
public AbstractFeature(String type, String source)
A feature has a type and a source- Parameters:
type
-source
-
-
-
Method Detail
-
getLocations
public AbstractLocation 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 segment.- Specified by:
getLocations
in interfaceFeatureInterface<S extends AbstractSequence<C>,C extends Compound>
- Returns:
-
setLocation
public void setLocation(AbstractLocation 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 segment.- Specified by:
setLocation
in interfaceFeatureInterface<S extends AbstractSequence<C>,C extends Compound>
- Parameters:
loc
-
-
getType
public String getType()
The feature type- Specified by:
getType
in interfaceFeatureInterface<S extends AbstractSequence<C>,C extends Compound>
- Returns:
-
setType
public void setType(String type)
Set the feature type- Specified by:
setType
in interfaceFeatureInterface<S extends AbstractSequence<C>,C extends Compound>
- Parameters:
type
-
-
getSource
public String getSource()
The feature source- Specified by:
getSource
in interfaceFeatureInterface<S extends AbstractSequence<C>,C extends Compound>
- Returns:
-
setSource
public void setSource(String source)
Set the feature source- Specified by:
setSource
in interfaceFeatureInterface<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 interfaceFeatureInterface<S extends AbstractSequence<C>,C extends Compound>
- Parameters:
feature
-
-
getParentFeature
public FeatureInterface<S,C> getParentFeature()
Get the parent Feature- Specified by:
getParentFeature
in interfaceFeatureInterface<S extends AbstractSequence<C>,C extends Compound>
- Returns:
-
getChildrenFeatures
public List<FeatureInterface<S,C>> getChildrenFeatures()
Get the children features- Specified by:
getChildrenFeatures
in interfaceFeatureInterface<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 interfaceFeatureInterface<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 interfaceFeatureInterface<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 interfaceFeatureInterface<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 interfaceFeatureInterface<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 interfaceFeatureInterface<S extends AbstractSequence<C>,C extends Compound>
- Parameters:
shortDescription
- the shortDescription to set
-
getUserObject
public Object getUserObject()
- Specified by:
getUserObject
in interfaceFeatureInterface<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 interfaceFeatureInterface<S extends AbstractSequence<C>,C extends Compound>
- Parameters:
userObject
- the userObject to set
-
getQualifiers
public Map<String,List<Qualifier>> getQualifiers()
Description copied from interface:FeatureInterface
Get the qualifiers for this feature- Specified by:
getQualifiers
in interfaceFeatureInterface<S extends AbstractSequence<C>,C extends Compound>
- Returns:
-
setQualifiers
public void setQualifiers(Map<String,List<Qualifier>> qualifiers)
Description copied from interface:FeatureInterface
Set the qualifiers- Specified by:
setQualifiers
in interfaceFeatureInterface<S extends AbstractSequence<C>,C extends Compound>
-
addQualifier
public void addQualifier(String key, Qualifier qualifier)
Description copied from interface:FeatureInterface
Add a qualifier- Specified by:
addQualifier
in interfaceFeatureInterface<S extends AbstractSequence<C>,C extends Compound>
-
-