edu.upenn.gloDB
Interface Feature

All Superinterfaces:
java.lang.Comparable, java.io.Serializable
All Known Implementing Classes:
AbstractFeature, ExactFeature, FuzzyFeature

public interface Feature
extends java.lang.Comparable, java.io.Serializable

Feature interface. Features implement Comparable and thus must implement a compareTo() method. This is required to maintain the sorting of Features in Tracks.

Version:
$Id: Feature.java,v 1.53.2.9 2007/03/01 21:17:32 fisher Exp $

Method Summary
 int compareTo(java.lang.Object o)
          Compares this object with the specified object for order.
 boolean contains(Feature feature)
          Returns 'true' if the Feature 'feature' exists in this Feature.
 int contains(int pos)
          Returns '-1' if this Feature exists after the integer 'pos', returns '0' if 'pos' is contained in this Feature, and '1' if 'pos' occurs after this Feature.
 boolean containsAttribute(java.lang.String key)
          Returns true if attribute 'key' exists.
 boolean equals(java.lang.Object o)
          This will return true if the features are equal and the sources are the same.
 Feature flip()
          Inverts the positions, returning a new Feature object.
 java.lang.String getAttribute(java.lang.String key)
          Get value for attribute 'key'.
 java.lang.String getAttributes()
          Get the Feature attributes.
 java.util.HashMap getAttributesMap()
          Get the Feature attributes as HashMap.
 java.lang.String getData()
          Returns the underlying sequence data.
 java.lang.String getDataFormatted()
          Returns the Sequence data, with "\n" inserted every Sequence.FORMAT_WIDTH characters (usually 50 to 80 chars).
 int getMax()
          Returns the maximum position of the Feature.
 int getMin()
          Returns the initial position of the Feature.
 Sequence getSource()
          Returns the underlying Sequence object.
 java.lang.String getSourceID()
          Returns the underlying Sequence object's ID.
 int getStart()
          Returns the start position of the Feature.
 int getStop()
          Returns the maximum position of the Feature.
 int length()
          Returns the number of positions contained in the Feature.
 Feature overlap(Feature feature)
          Returns the overlapping region between the two Features.
 boolean overlaps(Feature feature)
          Returns 'true' if the Feature 'feature' has at least one position that overlaps positions in this Feature.
 void setAttributes(java.util.HashMap attribMap)
          Set the Feature attributes from a HashMap.
 void setAttributes(java.lang.String attributes)
          Set the Feature attributes.
 java.lang.String toString()
          Only returns basic Feature information.
 java.lang.String toStringFull()
          Returns all Feature information, except the data.
 java.lang.String toStringMin()
          Only returns Feature start/stop information.
 

Method Detail

setAttributes

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


setAttributes

void setAttributes(java.util.HashMap attribMap)
Set the Feature attributes from a HashMap.


getAttributes

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


containsAttribute

boolean containsAttribute(java.lang.String key)
Returns true if attribute 'key' exists.


getAttributesMap

java.util.HashMap getAttributesMap()
Get the Feature attributes as HashMap.


getAttribute

java.lang.String getAttribute(java.lang.String key)
Get value for attribute 'key'.


getStart

int getStart()
Returns the start position of the Feature. This should return the same value as getMin().


getStop

int getStop()
Returns the maximum position of the Feature. If the Feature consists of a fuzzy Feature, this may not be the maximum position.


length

int length()
Returns the number of positions contained in the Feature.


getMin

int getMin()
Returns the initial position of the Feature. This should return the same value as getStart().


getMax

int getMax()
Returns the maximum position of the Feature. If the Feature consists of a fuzzy Feature, this may not be equal to 'stop'.


getSource

Sequence getSource()
Returns the underlying Sequence object.


getSourceID

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


getData

java.lang.String getData()
Returns the underlying sequence data.


getDataFormatted

java.lang.String getDataFormatted()
Returns the Sequence data, with "\n" inserted every Sequence.FORMAT_WIDTH characters (usually 50 to 80 chars).


compareTo

int compareTo(java.lang.Object o)
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Specified by:
compareTo in interface java.lang.Comparable
Notes:
This is necessary for 'Comparable'.

equals

boolean equals(java.lang.Object o)
This will return true if the features are equal and the sources are the same. If can't cast argument as a valid feature, then throws a java.lang.ClassCastException.

Overrides:
equals in class java.lang.Object

contains

int contains(int pos)
Returns '-1' if this Feature exists after the integer 'pos', returns '0' if 'pos' is contained in this Feature, and '1' if 'pos' occurs after this Feature.

Notes:
This assumes 'pos' is positive within this Feature's Sequence boundaries., Not clear how to deal with Sequences in Tracks., For Tracks, this should test contains() for each Feature within the Track.

contains

boolean contains(Feature feature)
Returns 'true' if the Feature 'feature' exists in this Feature.


overlaps

boolean overlaps(Feature feature)
Returns 'true' if the Feature 'feature' has at least one position that overlaps positions in this Feature.


overlap

Feature overlap(Feature feature)
Returns the overlapping region between the two Features. If no overlap, then null is returned.


flip

Feature flip()
Inverts the positions, returning a new Feature object. For example, if the Feature had a start position of 10 and a stop position of 20 on a Sequence that was 100 positions long, then flipping the Feature would result in a new Feature object with a start position of 80 and a stop position of 90.


toString

java.lang.String toString()
Only returns basic Feature information.

Overrides:
toString in class java.lang.Object

toStringMin

java.lang.String toStringMin()
Only returns Feature start/stop information.


toStringFull

java.lang.String toStringFull()
Returns all Feature information, except the data.




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