edu.unc.csbio.data
Class Feature

java.lang.Object
  extended by edu.unc.csbio.data.Feature
All Implemented Interfaces:
java.lang.Comparable<Feature>
Direct Known Subclasses:
Deletion, Exon, Gene, Insertion, Transcript

public abstract class Feature
extends java.lang.Object
implements java.lang.Comparable<Feature>

The abstract class for all annotation features. Each feature belongs to only one chromosome, and it is in the region between its start position (inclusively) and end position(inclusively) in the chromosome. The unit of a position is a base pair. These properties are all valid for all inherited classes.

Version:
0.1
Author:
Shunping Huang , Jack Wang

Field Summary
protected  java.lang.String chrom
          The chromosome of the feature.
protected  int end
          The end position of the feature.
protected  int start
          The start position of the feature.
 
Constructor Summary
Feature()
           
 
Method Summary
 int compareTo(Feature f)
          A necessary method for the Comparable interface.
 java.lang.String getChromosome()
          Get the chromosome
 int getEnd()
          Get the offset of the end position from the beginning of the chromosome.
 int getLength()
          Get the number of base pairs in the sequence related to this feature.
 int getRange()
          Get the size of the spanning/effective range of this feature, from start position to end position in the reference coordinate.
 int getStart()
          Get the offset of the start position from the beginning of the chromosome.
abstract  java.lang.String toString()
          An abstract method of toString()
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

chrom

protected java.lang.String chrom
The chromosome of the feature.


start

protected int start
The start position of the feature.


end

protected int end
The end position of the feature.

Constructor Detail

Feature

public Feature()
Method Detail

compareTo

public int compareTo(Feature f)
A necessary method for the Comparable interface. Features are ordered first by their chromosome alphabetically, then by start position, and finally by end position. Two features are considered to be the same only if their chromosome, start position and end position are the same, which means they are totally overlapped.

Specified by:
compareTo in interface java.lang.Comparable<Feature>
See Also:
Comparable.compareTo(java.lang.Object)

getChromosome

public final java.lang.String getChromosome()
Get the chromosome

Returns:
chromosome

getEnd

public final int getEnd()
Get the offset of the end position from the beginning of the chromosome. The position starts at 1.

Returns:
end position.

getLength

public int getLength()
Get the number of base pairs in the sequence related to this feature. The length of a feature is not necessarily equal to its range. For example, a complex/composite feature, such as a transcript, may consists of a few disjoint segments. Another example is the insertion. It is range is zero, but the length is the length of the inserted sequence.

Returns:
the length

getRange

public final int getRange()
Get the size of the spanning/effective range of this feature, from start position to end position in the reference coordinate.

Returns:
the size of range

getStart

public final int getStart()
Get the offset of the start position from the beginning of the chromosome. The position starts at 1.

Returns:
start position.

toString

public abstract java.lang.String toString()
An abstract method of toString()

Overrides:
toString in class java.lang.Object
See Also:
Object.toString()