apollo.datamodel
Class Range

java.lang.Object
  extended by apollo.datamodel.Range
All Implemented Interfaces:
RangeI, java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
CutSite, GenomicRange, SeqFeature

public class Range
extends java.lang.Object
implements RangeI, java.io.Serializable

See Also:
Serialized Form

Field Summary
protected  int high
           
protected static org.apache.log4j.Logger logger
           
protected  int low
           
protected  java.lang.String name
           
protected  SequenceI refSeq
           
protected  byte strand
           
protected  java.lang.String type
           
 
Fields inherited from interface apollo.datamodel.RangeI
NO_NAME, NO_TYPE
 
Constructor Summary
Range()
           
Range(int start, int end)
          Range with NO_NAME name
Range(java.lang.String name, int start, int end)
           
 
Method Summary
 boolean canHaveChildren()
          If SeqFeature is an instanceof FeatureSetI and FeatureSetI.hasChildFeatures is true then true.
 boolean contains(int position)
           
 boolean contains(RangeI sf)
          Returns true if range of sf is entierly within this RangeI
 void convertFromBaseOrientedToInterbase()
          Converts base oriented range to interbase range
 void convertFromInterbaseToBaseOriented()
          Converts interbase range to base oriented range
 int getEnd()
           
 java.lang.String getEndAsString()
           
 java.lang.String getFeatureType()
          getType is not the "visual" type, ie the type one sees in the EvidencePanel.
 int getHigh()
           
 int getLeftOverlap(RangeI sf)
           
 int getLow()
           
 java.lang.String getName()
          In the case where the range is chromosomal the name is the chromosome name
 RangeI getRangeClone()
          returns clone of self
 SequenceI getRefSequence()
          Retrieve the SequenceI that this feature annotates.
 java.lang.String getResidues()
           
 int getRightOverlap(RangeI sf)
           
 int getStart()
           
 java.lang.String getStartAsString()
           
 int getStrand()
           
 boolean hasFeatureType()
          convenience method returns !getType()==NO_TYPE
 boolean hasName()
          return true if name !equal NO_NAME
 boolean hasRefSequence()
          return false if no ref seq, ranges should generally have ref seq, only during initialization might it not
 boolean isContainedByRefSeq()
          Return true if ref seq contains this range
 boolean isExactOverlap(RangeI sf)
           
 boolean isForwardStrand()
          Convenience method for getStrand() == 1
 boolean isIdentical(RangeI range)
          Returns true if same start,end,type and name.
 boolean isSequenceAvailable(int position)
           
 int length()
           
 boolean overlaps(RangeI sf)
           
 boolean rangeIsUnassigned()
          Return true if range has not been assigned high & low
 boolean sameRange(RangeI r)
          Return true if start and end are equal
 void setEnd(int end)
           
 void setFeatureType(java.lang.String type)
           
 void setHigh(int high)
           
 void setLow(int low)
           
 void setName(java.lang.String name)
           
 void setRefSequence(SequenceI sequence)
          Set the SequenceI that this feature annotates.
 void setStart(int start)
           
 void setStrand(int strand)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

protected static final org.apache.log4j.Logger logger

low

protected int low

high

protected int high

strand

protected byte strand

name

protected java.lang.String name

type

protected java.lang.String type

refSeq

protected SequenceI refSeq
Constructor Detail

Range

public Range()

Range

public Range(int start,
             int end)
Range with NO_NAME name


Range

public Range(java.lang.String name,
             int start,
             int end)
Method Detail

getRangeClone

public RangeI getRangeClone()
returns clone of self

Specified by:
getRangeClone in interface RangeI

isIdentical

public boolean isIdentical(RangeI range)
Returns true if same start,end,type and name. This could potentially be changed to equals, theres implications there for hashing. A range and its clone will be identical barring modifications.

Specified by:
isIdentical in interface RangeI

setName

public void setName(java.lang.String name)
Specified by:
setName in interface RangeI

getName

public java.lang.String getName()
Description copied from interface: RangeI
In the case where the range is chromosomal the name is the chromosome name

Specified by:
getName in interface RangeI

hasName

public boolean hasName()
Description copied from interface: RangeI
return true if name !equal NO_NAME

Specified by:
hasName in interface RangeI

getFeatureType

public java.lang.String getFeatureType()
getType is not the "visual" type, ie the type one sees in the EvidencePanel. getType returns the "logical" type(the type from the data). These are the types in the squiggly brackets in the tiers file that map to the visual type listed before the squigglies. gui.scheme.FeatureProperty maps logical types to visual types (convenience function in DetailInfo.getPropertyType)

Specified by:
getFeatureType in interface RangeI

setFeatureType

public void setFeatureType(java.lang.String type)
Specified by:
setFeatureType in interface RangeI

hasFeatureType

public boolean hasFeatureType()
Description copied from interface: RangeI
convenience method returns !getType()==NO_TYPE

Specified by:
hasFeatureType in interface RangeI

getStrand

public int getStrand()
Specified by:
getStrand in interface RangeI
Returns:
1 for forward strand, -1 for reverse strand, 0 for strandless

isForwardStrand

public boolean isForwardStrand()
Convenience method for getStrand() == 1

Specified by:
isForwardStrand in interface RangeI

setStrand

public void setStrand(int strand)
Specified by:
setStrand in interface RangeI

setStart

public void setStart(int start)
Specified by:
setStart in interface RangeI

getStart

public int getStart()
Specified by:
getStart in interface RangeI

setEnd

public void setEnd(int end)
Specified by:
setEnd in interface RangeI

getEnd

public int getEnd()
Specified by:
getEnd in interface RangeI

getLow

public int getLow()
Specified by:
getLow in interface RangeI

setLow

public void setLow(int low)
Specified by:
setLow in interface RangeI

getHigh

public int getHigh()
Specified by:
getHigh in interface RangeI

setHigh

public void setHigh(int high)
Specified by:
setHigh in interface RangeI

getStartAsString

public java.lang.String getStartAsString()

getEndAsString

public java.lang.String getEndAsString()

getRefSequence

public SequenceI getRefSequence()
Description copied from interface: RangeI
Retrieve the SequenceI that this feature annotates.

Specified by:
getRefSequence in interface RangeI
Returns:
the current parent SequenceI

hasRefSequence

public boolean hasRefSequence()
Description copied from interface: RangeI
return false if no ref seq, ranges should generally have ref seq, only during initialization might it not

Specified by:
hasRefSequence in interface RangeI

isContainedByRefSeq

public boolean isContainedByRefSeq()
Description copied from interface: RangeI
Return true if ref seq contains this range

Specified by:
isContainedByRefSeq in interface RangeI

setRefSequence

public void setRefSequence(SequenceI sequence)
Description copied from interface: RangeI
Set the SequenceI that this feature annotates.

Specified by:
setRefSequence in interface RangeI
Parameters:
sequence - the new parent SequenceI

getResidues

public java.lang.String getResidues()
Specified by:
getResidues in interface RangeI

getLeftOverlap

public int getLeftOverlap(RangeI sf)
Specified by:
getLeftOverlap in interface RangeI

getRightOverlap

public int getRightOverlap(RangeI sf)
Specified by:
getRightOverlap in interface RangeI

isExactOverlap

public boolean isExactOverlap(RangeI sf)
Specified by:
isExactOverlap in interface RangeI

contains

public boolean contains(RangeI sf)
Description copied from interface: RangeI
Returns true if range of sf is entierly within this RangeI

Specified by:
contains in interface RangeI

contains

public boolean contains(int position)
Specified by:
contains in interface RangeI

overlaps

public boolean overlaps(RangeI sf)
Specified by:
overlaps in interface RangeI

sameRange

public boolean sameRange(RangeI r)
Return true if start and end are equal

Specified by:
sameRange in interface RangeI

length

public int length()
Specified by:
length in interface RangeI

isSequenceAvailable

public boolean isSequenceAvailable(int position)
Specified by:
isSequenceAvailable in interface RangeI

canHaveChildren

public boolean canHaveChildren()
If SeqFeature is an instanceof FeatureSetI and FeatureSetI.hasChildFeatures is true then true. Basically convenience method that does the awkward instanceof for you.

Specified by:
canHaveChildren in interface RangeI

rangeIsUnassigned

public boolean rangeIsUnassigned()
Return true if range has not been assigned high & low

Specified by:
rangeIsUnassigned in interface RangeI

convertFromBaseOrientedToInterbase

public void convertFromBaseOrientedToInterbase()
Description copied from interface: RangeI
Converts base oriented range to interbase range

Specified by:
convertFromBaseOrientedToInterbase in interface RangeI

convertFromInterbaseToBaseOriented

public void convertFromInterbaseToBaseOriented()
Description copied from interface: RangeI
Converts interbase range to base oriented range

Specified by:
convertFromInterbaseToBaseOriented in interface RangeI

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object