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<?,?>>LENGTHSort features by length.static Comparator<FeatureInterface<?,?>>LOCATION_LENGTHSort features by start position and then longest length.static Comparator<FeatureInterface<?,?>>TYPESort 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 voidaddQualifier(String key, Qualifier qualifier)Add a qualifierList<FeatureInterface<S,C>>getChildrenFeatures()Get the children featuresStringgetDescription()Get the description that can be used to describe the featureAbstractLocationgetLocations()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 featureStringgetShortDescription()Get the short description that can be used to describe the featureStringgetSource()The feature sourceStringgetType()The feature typeObjectgetUserObject()voidsetChildrenFeatures(List<FeatureInterface<S,C>> features)Set the children featuresvoidsetDescription(String description)Set the description that can be used to describe the featurevoidsetLocation(AbstractLocation loc)A feature could be a single sequence position like a mutation or a post translational modification of an amino acid.voidsetParentFeature(FeatureInterface<S,C> feature)A feature can be the child or contained by a parent feature.voidsetQualifiers(Map<String,List<Qualifier>> qualifiers)Set the qualifiersvoidsetShortDescription(String shortDescription)Set the short description that can be used to describe the featurevoidsetSource(String source)Set the feature sourcevoidsetType(String type)Set the feature typevoidsetUserObject(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:
getLocationsin 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:
setLocationin interfaceFeatureInterface<S extends AbstractSequence<C>,C extends Compound>- Parameters:
loc-
-
getType
public String getType()
The feature type- Specified by:
getTypein interfaceFeatureInterface<S extends AbstractSequence<C>,C extends Compound>- Returns:
-
setType
public void setType(String type)
Set the feature type- Specified by:
setTypein interfaceFeatureInterface<S extends AbstractSequence<C>,C extends Compound>- Parameters:
type-
-
getSource
public String getSource()
The feature source- Specified by:
getSourcein interfaceFeatureInterface<S extends AbstractSequence<C>,C extends Compound>- Returns:
-
setSource
public void setSource(String source)
Set the feature source- Specified by:
setSourcein 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:
setParentFeaturein interfaceFeatureInterface<S extends AbstractSequence<C>,C extends Compound>- Parameters:
feature-
-
getParentFeature
public FeatureInterface<S,C> getParentFeature()
Get the parent Feature- Specified by:
getParentFeaturein interfaceFeatureInterface<S extends AbstractSequence<C>,C extends Compound>- Returns:
-
getChildrenFeatures
public List<FeatureInterface<S,C>> getChildrenFeatures()
Get the children features- Specified by:
getChildrenFeaturesin interfaceFeatureInterface<S extends AbstractSequence<C>,C extends Compound>- Returns:
-
setChildrenFeatures
public void setChildrenFeatures(List<FeatureInterface<S,C>> features)
Set the children features- Specified by:
setChildrenFeaturesin interfaceFeatureInterface<S extends AbstractSequence<C>,C extends Compound>- Parameters:
features-
-
getDescription
public String getDescription()
Description copied from interface:FeatureInterfaceGet the description that can be used to describe the feature- Specified by:
getDescriptionin interfaceFeatureInterface<S extends AbstractSequence<C>,C extends Compound>- Returns:
- the description
-
setDescription
public void setDescription(String description)
Description copied from interface:FeatureInterfaceSet the description that can be used to describe the feature- Specified by:
setDescriptionin interfaceFeatureInterface<S extends AbstractSequence<C>,C extends Compound>- Parameters:
description- the description to set
-
getShortDescription
public String getShortDescription()
Description copied from interface:FeatureInterfaceGet the short description that can be used to describe the feature- Specified by:
getShortDescriptionin interfaceFeatureInterface<S extends AbstractSequence<C>,C extends Compound>- Returns:
- the shortDescription
-
setShortDescription
public void setShortDescription(String shortDescription)
Description copied from interface:FeatureInterfaceSet the short description that can be used to describe the feature- Specified by:
setShortDescriptionin interfaceFeatureInterface<S extends AbstractSequence<C>,C extends Compound>- Parameters:
shortDescription- the shortDescription to set
-
getUserObject
public Object getUserObject()
- Specified by:
getUserObjectin 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:
setUserObjectin 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:FeatureInterfaceGet the qualifiers for this feature- Specified by:
getQualifiersin interfaceFeatureInterface<S extends AbstractSequence<C>,C extends Compound>- Returns:
-
setQualifiers
public void setQualifiers(Map<String,List<Qualifier>> qualifiers)
Description copied from interface:FeatureInterfaceSet the qualifiers- Specified by:
setQualifiersin interfaceFeatureInterface<S extends AbstractSequence<C>,C extends Compound>
-
addQualifier
public void addQualifier(String key, Qualifier qualifier)
Description copied from interface:FeatureInterfaceAdd a qualifier- Specified by:
addQualifierin interfaceFeatureInterface<S extends AbstractSequence<C>,C extends Compound>
-
-