edu.upenn.gloDB
Class FuzzyFeature

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

public class FuzzyFeature
extends AbstractFeature

These objects code Features that don't have definite boundaries. It's not clear whether it's more advantagous to have separate class definitions: FuzzyFeature - make abstract class BetweenFeature - same fields as below AfterFeature - no stop -> stop = sequence length; stopExtension = 0 BeforeFeature - no start -> start = 0; startExtension = 0

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

Field Summary
private  int start
          The initial position defining this Feature.
private  int startExt
          The number of the positions defining the start position.
private  int stop
          The last position defining this Feature.
private  int stopExt
          The number of the positions defining the stop position.
 
Fields inherited from class edu.upenn.gloDB.AbstractFeature
attributes, source
 
Constructor Summary
FuzzyFeature(int start, int startExt, int stop, int stopExt, Sequence source)
          Create a new FuzzyFeature object and add it to the set of Feature objects.
FuzzyFeature(int start, int startExt, int stop, int stopExt, Sequence source, boolean addToPool)
          Create a new FuzzyFeature object and add the newly created FuzzyFeature object to the set of Feature objects if addToPool is true.
 
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' is contained 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 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 getData()
          Returns the Sequence data from start to stopExt.
 java.lang.String getDataFormatted()
          Returns the Sequence data from start to stopExt, with "\n" inserted every 80 characters.
 int getMax()
          Returns the maximum position of the Feature.
 int getMin()
          Returns the initial position of the Feature.
 int getStart()
          Returns the start position.
 int getStartExt()
          Returns the startExt position.
 int getStop()
          Returns the stop position.
 int getStopExt()
          Returns the stopExt.
 int length()
          Returns the maximum number of positions contained in the Feature (((stop + stopExt) - start) + 1).
 int maxLength()
          This is the same as length().
 int minLength()
          Returns the minimum number of positions contained in the Feature ((stop - start) + 1).
 Feature overlap(Feature feature)
          Returns the overlapping region between the two Features.
 boolean overlaps(Feature feature)
          Returns 'true' if the feature 'featCk' has positions that overlap positions in this feature.
 java.lang.String toString()
          Only returns basic Feature information.
 java.lang.String toStringFull()
          Returns all Feature information.
 java.lang.String toStringMin()
          Only returns start/stop position information.
 
Methods inherited from class edu.upenn.gloDB.AbstractFeature
addAttribute, addAttribute, containsAttribute, delAttribute, getAttribute, getAttributes, getAttributesMap, getSource, getSourceID, getType, setAttributes, setAttributes
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

start

private int start
The initial position defining this Feature.


startExt

private int startExt
The number of the positions defining the start position.


stop

private int stop
The last position defining this Feature.


stopExt

private int stopExt
The number of the positions defining the stop position.

Constructor Detail

FuzzyFeature

public FuzzyFeature(int start,
                    int startExt,
                    int stop,
                    int stopExt,
                    Sequence source)
Create a new FuzzyFeature object and add it to the set of Feature objects.


FuzzyFeature

public FuzzyFeature(int start,
                    int startExt,
                    int stop,
                    int stopExt,
                    Sequence source,
                    boolean addToPool)
Create a new FuzzyFeature object and add the newly created FuzzyFeature object to the set of Feature objects if addToPool is true.

Notes:
This should probably be 'protected' instead of 'public' because all FuzzyFeatures should really be added to featurePool.
Method Detail

getStart

public int getStart()
Returns the start position.


getStartExt

public int getStartExt()
Returns the startExt position.


getStop

public int getStop()
Returns the stop position.


getStopExt

public int getStopExt()
Returns the stopExt.


getData

public java.lang.String getData()
Returns the Sequence data from start to stopExt. Note that this includes the fuzzy boundaries.


getDataFormatted

public java.lang.String getDataFormatted()
Returns the Sequence data from start to stopExt, with "\n" inserted every 80 characters.


length

public int length()
Returns the maximum number of positions contained in the Feature (((stop + stopExt) - start) + 1).


getMin

public int getMin()
Returns the initial position of the Feature.


getMax

public int getMax()
Returns the maximum position of the Feature.


minLength

public int minLength()
Returns the minimum number of positions contained in the Feature ((stop - start) + 1).


maxLength

public int maxLength()
This is the same as length().


flip

public 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 contig 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.

Notes:
Not yet implemented.

contains

public 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.

contains

public boolean contains(Feature feature)
Returns 'true' if the Feature 'feature' is contained in this Feature.


overlaps

public boolean overlaps(Feature feature)
Returns 'true' if the feature 'featCk' has positions that overlap positions in this feature.


overlap

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


compareTo

public int compareTo(java.lang.Object o)
              throws java.lang.ClassCastException
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. If can't cast argument as an Feature, then throws a java.lang.ClassCastException. If different sources, then sorts on the source ID.

Throws:
java.lang.ClassCastException

equals

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

Specified by:
equals in interface Feature
Overrides:
equals in class java.lang.Object
Throws:
java.lang.ClassCastException

toString

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

Specified by:
toString in interface Feature
Overrides:
toString in class AbstractFeature

toStringMin

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


toStringFull

public java.lang.String toStringFull()
Returns all Feature information.




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