edu.upenn.gloDB
Class FeatureUtils

java.lang.Object
  extended by edu.upenn.gloDB.FeatureUtils

public class FeatureUtils
extends java.lang.Object

FeatureUtils. Miscellaneous functions that act on Features and Sets of Features.

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

Constructor Summary
FeatureUtils()
           
 
Method Summary
static java.util.TreeSet cluster(Track track, int maxSpace, int threshold)
          Deprecated. replaced with cluster.py
static int compareFeatures(Feature featureA, Feature featureB)
          Compares two Features for order.
static Feature contained(Feature feature, int minB, int maxB)
          Returns a new Feature containing the region in 'feature' that is bounded by minB/maxB.
static boolean contains(Feature featureA, Feature featureB)
          Returns 'true' if the second Feature ('featureB') is contained in the first Feature ('featureA').
static int contains(Feature feature, int pos)
          Returns '-1' if 'feature' exists after the integer 'pos', returns '0' if 'pos' is contained in 'feature', and '1' if 'pos' occurs after 'feature'.
static boolean isContiguous(java.util.TreeSet features)
          Returns 'true' if the set of Features does not contain gaps between Features.
static java.util.TreeSet mergeContiguous(Track track)
          This will merge all overlapping Features in the track, creating new Feature objects as necessary.
static Feature overlap(Feature featureA, Feature featureB)
          Returns the overlapping region between the two Features.
static boolean overlaps(Feature featureA, Feature featureB)
          Returns 'true' if the Features have overlapping positions.
static boolean overlaps(Feature featureA, Track track)
          Returns 'true' if the Feature and Track overlap.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FeatureUtils

public FeatureUtils()
Method Detail

contained

public static Feature contained(Feature feature,
                                int minB,
                                int maxB)
Returns a new Feature containing the region in 'feature' that is bounded by minB/maxB. Returns null if 'feature' doesn't overlap with minB/maxB.

Notes:
Doesn't deal with multiple Sequences.

contains

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

Notes:
This assumes 'pos' is positive within this Feature's Sequence boundaries.

contains

public static boolean contains(Feature featureA,
                               Feature featureB)
Returns 'true' if the second Feature ('featureB') is contained in the first Feature ('featureA'). If the Features are on different Sources, then returns 'false'.


overlaps

public static boolean overlaps(Feature featureA,
                               Track track)
Returns 'true' if the Feature and Track overlap. If the Features are on different Sources, then returns 'false'. f1: t-------u aa|------------------------------|bb |012345678901234567890123456789| f2: a-b c-d e-f g---h i-j f2.max < f1.min : continue f2.min <= f1.max : true else false


overlaps

public static boolean overlaps(Feature featureA,
                               Feature featureB)
Returns 'true' if the Features have overlapping positions. If the Features are on different Sources, then returns 'false'.


overlap

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

Notes:
should test for same source

compareFeatures

public static int compareFeatures(Feature featureA,
                                  Feature featureB)
Compares two Features for order. Returns '-1', '0', or '1' if the first Feature ('featureA') is less than, equal to, or greater than the second Feature ('featureB'). If the Features have different Source sequences, then they will be sorted by Source ID.


isContiguous

public static boolean isContiguous(java.util.TreeSet features)
Returns 'true' if the set of Features does not contain gaps between Features. This assumes that the Features all occur on the same sequence (ie they refer to the same Sequence object).


cluster

public static java.util.TreeSet cluster(Track track,
                                        int maxSpace,
                                        int threshold)
Deprecated. replaced with cluster.py

This will merge all Features in the Track that are within maxSpace of each other. New Features will be created to span the entire cluster. Threshold sets the minimum number of Features necessary to be considered a cluster and thus included in the output set. A new Track will be returned containing the clusters.


mergeContiguous

public static java.util.TreeSet mergeContiguous(Track track)
This will merge all overlapping Features in the track, creating new Feature objects as necessary. If no Features in 'track', then this returns an empty TreeSet.




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