edu.upenn.gloDB
Class AbstractFeature

java.lang.Object
  extended by edu.upenn.gloDB.AbstractFeature
All Implemented Interfaces:
Feature, java.io.Serializable, java.lang.Comparable
Direct Known Subclasses:
ExactFeature, FuzzyFeature

public abstract class AbstractFeature
extends java.lang.Object
implements Feature

AbstractFeature.

Version:
$Id: AbstractFeature.java,v 1.1.2.10 2007/03/01 21:17:32 fisher Exp $
See Also:
Serialized Form

Field Summary
protected  java.lang.String attributes
          This is similar to "qualifiers" in GenBank.
protected  java.lang.String source
          The contig that underlies the positions.
 
Constructor Summary
AbstractFeature(Sequence source)
          Set the source when the Feature is created.
 
Method Summary
 void addAttribute(java.lang.String value)
          Add an attribute (key/value pair).
 void addAttribute(java.lang.String key, java.lang.String value)
          Add an attribute.
 boolean containsAttribute(java.lang.String key)
          Returns true if attribute 'key' exists.
 void delAttribute(java.lang.String key)
          Remove an attribute.
 java.lang.String getAttribute(java.lang.String key)
          Get value for attribute 'key'.
 java.lang.String getAttributes()
          Get the attributes.
 java.util.HashMap getAttributesMap()
          Get the attributes as HashMap.
 Sequence getSource()
          Returns the underlying Sequence object.
 java.lang.String getSourceID()
          Returns the underlying Sequence object's ID.
 int getType()
          Returns Feature type (see GloDBUtils)
 void setAttributes(java.util.HashMap attribMap)
          Set the attributes using a HashMap.
 void setAttributes(java.lang.String attributes)
          Set the attributes.
 java.lang.String toString()
          Returns description and Feature information.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface edu.upenn.gloDB.Feature
compareTo, contains, contains, equals, flip, getData, getDataFormatted, getMax, getMin, getStart, getStop, length, overlap, overlaps, toStringFull, toStringMin
 

Field Detail

source

protected java.lang.String source
The contig that underlies the positions.


attributes

protected java.lang.String attributes
This is similar to "qualifiers" in GenBank. ex: scores, strand (+/-), phase (within codon). Each key/value pair is delimited by a ";". the keys and values are separated by "=". ex: "scores=.; strand=+". Key based attribute searches are case sensitive.

Notes:
Should any of these be hardcoded as fields?
Constructor Detail

AbstractFeature

public AbstractFeature(Sequence source)
Set the source when the Feature is created. Don't allow the source to change there after.

Notes:
Should throw an exception if source is null.
Method Detail

getType

public int getType()
Returns Feature type (see GloDBUtils)


setAttributes

public void setAttributes(java.lang.String attributes)
Set the attributes.

Specified by:
setAttributes in interface Feature
Parameters:
attributes - a String of Feature attributes

setAttributes

public void setAttributes(java.util.HashMap attribMap)
Set the attributes using a HashMap.

Specified by:
setAttributes in interface Feature
Parameters:
attribMap - a HashMap of Feature attributes

getAttributes

public java.lang.String getAttributes()
Get the attributes.

Specified by:
getAttributes in interface Feature

getSource

public Sequence getSource()
Returns the underlying Sequence object.

Specified by:
getSource in interface Feature
Returns:
Returns the sequence object.

getSourceID

public java.lang.String getSourceID()
Returns the underlying Sequence object's ID.

Specified by:
getSourceID in interface Feature

addAttribute

public void addAttribute(java.lang.String key,
                         java.lang.String value)
Add an attribute.


addAttribute

public void addAttribute(java.lang.String value)
Add an attribute (key/value pair).


delAttribute

public void delAttribute(java.lang.String key)
Remove an attribute. This is case sensitive.


containsAttribute

public boolean containsAttribute(java.lang.String key)
Returns true if attribute 'key' exists. This is case sensitive.

Specified by:
containsAttribute in interface Feature

getAttributesMap

public java.util.HashMap getAttributesMap()
Get the attributes as HashMap. If no attributes, then an empty HashMap is returned.

Specified by:
getAttributesMap in interface Feature

getAttribute

public java.lang.String getAttribute(java.lang.String key)
Get value for attribute 'key'. This is case sensitive.

Specified by:
getAttribute in interface Feature

toString

public java.lang.String toString()
Returns description and Feature information.

Specified by:
toString in interface Feature
Overrides:
toString in class java.lang.Object



Copyright 2012 Stephen Fisher and Junhyong Kim, University of Pennsylvania. All Rights Reserved.