apollo.datamodel
Class SeqFeature

java.lang.Object
  extended by apollo.datamodel.Range
      extended by apollo.datamodel.SeqFeature
All Implemented Interfaces:
Comparable, RangeI, SeqFeatureI, java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
FeaturePair, FeatureSet

public class SeqFeature
extends Range
implements SeqFeatureI, Comparable

A class to represent a basic sequence feature, such as a result span. This is also the base class for the FeatureSet and FeaturePair classes: FeatureSet should NOT subclass SeqFeature. SeqFeature should have methods hasChildren()

See Also:
Serialized Form

Field Summary
protected  java.lang.String biotype
           
protected  int edit_offset_adjust
          When translating the offset for the stop codon in genome coordinates needs to be adjusted to account for edits to the mRNA that alter the relative position of the Stop codon on the mRNA vs.
protected  java.lang.String id
           
protected static org.apache.log4j.Logger logger
           
protected  byte phase
           
protected  java.util.Hashtable properties
           
protected  java.util.Hashtable ref_features
           
protected  SeqFeatureI refFeature
           
protected  java.lang.String refId
           
protected  double score
           
protected  java.util.Hashtable scores
           
 
Fields inherited from class apollo.datamodel.Range
high, low, name, refSeq, strand, type
 
Fields inherited from interface apollo.datamodel.RangeI
NO_NAME, NO_TYPE
 
Constructor Summary
SeqFeature()
           
SeqFeature(int low, int high, java.lang.String type)
           
SeqFeature(int low, int high, java.lang.String type, int strand)
           
SeqFeature(SeqFeatureI sf)
           
 
Method Summary
 void accept(Visitor visitor)
          General implementation of Visitor pattern.
 void addDbXref(DbXref xref)
           
 void addFeature(SeqFeatureI child)
          no-op.
 void addFeature(SeqFeatureI feature, boolean sort)
          no-op - overridden by FeatureSet
 void addProperty(java.lang.String name, java.lang.String value)
           
 void addRefFeature(java.lang.String type, SeqFeatureI refFeature)
           
 void addScore(double score)
           
 void addScore(Score s)
           
 void addScore(java.lang.String name, double score)
           
 void addScore(java.lang.String name, java.lang.String score)
           
 boolean alignmentIsPeptide()
          Returns true if alignment is peptide sequence, false if nucleotide This is for the hit alignment(not query).
protected  java.lang.StringBuffer amend_RNA(java.lang.StringBuffer dna)
           
protected  SequenceEdit[] buildmRNAEditList()
           
 void clearKids()
          by default no kids - no-op
 void clearProperties()
           
 java.lang.Object clone()
          to get a field-by-field replica of this feature
 SeqFeatureI cloneFeature()
          clones feature
 int compareTo(java.lang.Object sfObj)
           
 boolean descendsFrom(SeqFeatureI sf)
          This is the opposite of contains.
 void flipFlop()
          Flips strand - FeatureSet overrides with a recursive version
 java.lang.String get_cDNA()
          This needs to be fixed to account for edits to the genomic sequence, but I don't think it is urgent because this case is still so extremely rare.
 java.lang.String get_ORF(java.lang.String sub_sequence)
          this will always return something even if the parent has not had a start of translation set.
 java.lang.String getAlignment()
          Alignment will be padded if peptide
 SeqFeatureI getAnalogousOppositeStrandFeature()
          Returns null if hasAnalogousOppositeStrandFeatureSet is false.
 AnnotatedFeatureI getAnnotatedFeature()
          if hasAnnotatedFeature is true, this returns the AnnotatedFeature
 java.lang.String getCigar()
          an explicit variable for cigar strings that are compact representations of alignments
 SeqFeatureI getCloneSource()
          If this feature was cloned from another feature, return the original feature.
 java.lang.String getCodingDNA()
          Calls get_ORF with the cdna.
 int getCodingProperties()
          Return an integer that describes coding props.
 java.lang.String getDatabase()
           
 DbXref getDbXref(int i)
           
 java.util.Vector getDbXrefs()
          These methods dealing with xrefs have been moved from AnnotatedFeature.
 int getEndPhase()
           
 java.lang.String getExplicitAlignment()
          Explicitly set alignment.
 SeqFeatureI getFeatureAt(int i)
          returns a seqfeature at the specified position
 SeqFeatureI getFeatureContaining(int position)
          returns self if self has position.
 int getFeatureIndex(SeqFeatureI sf)
          By default SeqFeature has no kids so returns -1 be default.
 int getFeaturePosition(int genomic_pos)
          This needs to be fixed to account for edits to the genomic sequence, but I don't think it is urgent because this case is still so extremely rare
 java.util.Vector getFeatures()
          returns a vector of all the child features belonging to this feature.
 SequenceI getFeatureSequence()
          Creates a Sequence object with Range.getResidues.
 int getFrame()
           
 java.util.HashMap getGenomicErrors()
          first gets all of the genomic sequencing errors from the reference sequence and then eliminates any that are from outside the region of this feature.
 int getGenomicPosForPeptidePos(int peptidePosition)
          For a position in peptide coordinates get the corresponding genomic position peptide object?
 int getGenomicPosition(int transcript_pos)
           
 int getHend()
           
 int getHhigh()
           
 SeqFeatureI getHitFeature()
          shoulnt this return null? yea it should - why is it returning this??
 SequenceI getHitSequence()
          returns null - FeaturePair and FeatureSet override
 int getHlow()
           
 java.lang.String getHname()
          Set explicit hit alignment - string with gaps.
 int getHstart()
           
 int getHstrand()
           
 java.lang.String getId()
           
 Identifier getIdentifier()
           
 FeatureList getLeafFeatsOver(int pos)
          This is used in the base editor to find the sub features that overlap a base with a sequence edit on it
 int getNumberOfChildren()
          Returns the number of direct children (not all descendants) this feature has.
 int getNumberOfDescendents()
          The number of descendants (direct and indirect) in this FeatureSetI.
 FeatureSetI getParent()
          Returns refFeature as FeatureSetI which I believe it is always the case that the refFeature is a FeatureSetI
 SequenceI getPeptideSequence()
          If SeqFeatureI has a peptide sequence returns it, otherwise returns null.
 int getPhase()
          Phase is the internal offset from feature start for translation.
 DbXref getPrimaryDbXref()
          Return the DbXref, if any, that has isPrimary==true
 java.lang.String getProgramName()
           
 java.util.Hashtable getProperties()
           
 java.util.Hashtable getPropertiesMulti()
           
 java.lang.String getProperty(java.lang.String name)
           
 java.util.Vector getPropertyMulti(java.lang.String name)
           
 Protein getProteinFeat()
          getProteinFeature().getReferenceSequence() should replace getPeptideSeq()
 SeqFeatureI getRefFeature()
          Retrieve the parent SeqFeatureI for this SeqFeatureI, or null if it is a tree root.
 SeqFeatureI getRefFeature(java.lang.String type)
           
 java.lang.String getRefId()
           
 double getScore()
           
 double getScore(java.lang.String name)
           
 java.util.Hashtable getScores()
           
 StrandedFeatureSetI getStrandedFeatSetAncestor()
           
protected  java.lang.String getSubSequence(java.lang.String sequence, int start_offset, int end_offset)
          This has nothing to do with translation starts, it merely obtains the string between the 2 positions.
 java.lang.String getSyntenyLinkInfo()
           
 java.lang.String getTopLevelType()
          If biotype is null, returns type
 TranslationI getTranslation()
          By default seqfeature has no translation - returns null
 java.lang.String getUnpaddedAlignment()
          Alignment without padding.
 java.lang.Object getUserObject()
          ADDED BY TAIR Return the user object or null if none exists
 boolean hasAlignable()
          A sequence feature is always alignable if it has sequence
 boolean hasAnalogousOppositeStrandFeature()
          Returns false if analog opp strand fs not set
 boolean hasAnnotatedFeature()
          Whether the SeqFeature is an annotation - return false by default - AnnotatedFeature overrides
protected  boolean hasCigar()
           
 boolean hasHitFeature()
          Whether SeqFeatureI has a hit feature.
 boolean hasId()
          returns false if getId() == null
 boolean hasKids()
          Return true if getFeatures().size() > 0, we actually have a kid
 boolean hasPeptideSequence()
          Whether feature has a peptide sequence - default is false - override if otherwise (Transcript returns true)
 boolean hasSyntenyLinkInfo()
           
 boolean hasTranslation()
          Return false by default - FeatureSet overrides - if this is the same as isProteinCodingGene then we should delete it
 boolean haveExplicitAlignment()
           
 boolean haveRealAlignment()
           
protected  void initWithSeqFeat(SeqFeatureI sf)
           
 boolean isAncestorOf(SeqFeatureI sf)
          Returns true if this == sf.
 boolean isAnnot()
          If we have an AnnotatedFeature then we are an annot and vice versa
 boolean isAnnotTop()
          true for top level annots (e.g.
 boolean isClone()
          Check to see if this feature is a cloned feature
 boolean isCodon()
          Returns true if feature is start or stop codon currently does with feature type - perhaps should have a setIsCodon(bool) method?
 boolean isExon()
           
 boolean isProtein()
           
 boolean isProteinCodingGene()
           
 boolean isSameFeat(SeqFeatureI seqFeat)
          Helper method designed to compare two feats which has just been initialized.
 boolean isSequencingError()
           
 boolean isTranscript()
          Return true is feature has translation start and stop.
static void main(java.lang.String[] args)
           
 SeqFeatureI merge(SeqFeatureI sf)
           
 java.lang.String na2aa(java.lang.String na)
           
 int numberOfGenerations()
          Returns the number of generations (including itself) that are at and below this feature.
 void parseCigar()
           
 void removeProperty(java.lang.String key)
           
 void replaceProperty(java.lang.String key, java.lang.String value)
           
 void setAlignment(java.lang.String alignment)
          set the alignment string (with padding if has it)
 void setAnalogousOppositeStrandFeature(SeqFeatureI oppositeFeature)
          As a convenience one can record what the analogous feature is on the opposite strand.
 void setCigar(java.lang.String cigar)
           
 void setDatabase(java.lang.String name)
           
 void setExplicitAlignment(java.lang.String align)
           
 void setId(java.lang.String id)
           
 void setIdentifier(Identifier identifier)
           
 void setPhase(int phase)
           
 void setProgramName(java.lang.String name)
           
 void setQueryFeature(SeqFeatureI queryFeat)
          Query feats hold cigars.
 void setRefFeature(SeqFeatureI refFeature)
          Set the parent SeqFeatureI.
 void setScore(double score)
           
 void setSyntenyLinkInfo(java.lang.String linkInfo)
          Trying this out?? can set information needed to make synteny links between features for the synteny viewer.
 void setTopLevelType(java.lang.String type)
           
 void setUserObject(java.lang.Object userObject)
          ADDED BY TAIR Set the user object
 int size()
          FeatureSet overrides - merge with getNumberOfChildren
 java.lang.String toString()
          For debugging
 java.lang.String translate()
          conceptually any piece of sequence may potentially be translated // this is useful to ascertain the potential of any given sequence // it may also be needed if a prediction program provides this // information // This method translates by extracting the coding pieces of // sequence from the exons to create a single string which // is then translated with phase 0.
 
Methods inherited from class apollo.datamodel.Range
canHaveChildren, contains, contains, convertFromBaseOrientedToInterbase, convertFromInterbaseToBaseOriented, getEnd, getEndAsString, getFeatureType, getHigh, getLeftOverlap, getLow, getName, getRangeClone, getRefSequence, getResidues, getRightOverlap, getStart, getStartAsString, getStrand, hasFeatureType, hasName, hasRefSequence, isContainedByRefSeq, isExactOverlap, isForwardStrand, isIdentical, isSequenceAvailable, length, overlaps, rangeIsUnassigned, sameRange, setEnd, setFeatureType, setHigh, setLow, setName, setRefSequence, setStart, setStrand
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface apollo.datamodel.RangeI
canHaveChildren, contains, contains, convertFromBaseOrientedToInterbase, convertFromInterbaseToBaseOriented, getEnd, getFeatureType, getHigh, getLeftOverlap, getLow, getName, getRangeClone, getRefSequence, getResidues, getRightOverlap, getStart, getStrand, hasFeatureType, hasName, hasRefSequence, isContainedByRefSeq, isExactOverlap, isForwardStrand, isIdentical, isSequenceAvailable, length, overlaps, rangeIsUnassigned, sameRange, setEnd, setFeatureType, setHigh, setLow, setName, setRefSequence, setStart, setStrand
 

Field Detail

logger

protected static final org.apache.log4j.Logger logger

id

protected java.lang.String id

refId

protected java.lang.String refId

refFeature

protected SeqFeatureI refFeature

ref_features

protected java.util.Hashtable ref_features

biotype

protected java.lang.String biotype

scores

protected java.util.Hashtable scores

score

protected double score

properties

protected java.util.Hashtable properties

phase

protected byte phase

edit_offset_adjust

protected int edit_offset_adjust
When translating the offset for the stop codon in genome coordinates needs to be adjusted to account for edits to the mRNA that alter the relative position of the Stop codon on the mRNA vs. the genome (e.g. from translational frame shift, or genomic sequencing errors

Constructor Detail

SeqFeature

public SeqFeature()

SeqFeature

public SeqFeature(SeqFeatureI sf)

SeqFeature

public SeqFeature(int low,
                  int high,
                  java.lang.String type)

SeqFeature

public SeqFeature(int low,
                  int high,
                  java.lang.String type,
                  int strand)
Method Detail

initWithSeqFeat

protected void initWithSeqFeat(SeqFeatureI sf)

getFeatureSequence

public SequenceI getFeatureSequence()
Creates a Sequence object with Range.getResidues. getResidues returns the substring of the refSequence from getStart to getEnd

Specified by:
getFeatureSequence in interface SeqFeatureI
Returns:
the current self SequenceI

flipFlop

public void flipFlop()
Flips strand - FeatureSet overrides with a recursive version

Specified by:
flipFlop in interface SeqFeatureI

get_cDNA

public java.lang.String get_cDNA()
This needs to be fixed to account for edits to the genomic sequence, but I don't think it is urgent because this case is still so extremely rare. If there are edits then the simple getResidues call is insufficient and needs post-processing

Specified by:
get_cDNA in interface SeqFeatureI

amend_RNA

protected java.lang.StringBuffer amend_RNA(java.lang.StringBuffer dna)

getSubSequence

protected java.lang.String getSubSequence(java.lang.String sequence,
                                          int start_offset,
                                          int end_offset)
This has nothing to do with translation starts, it merely obtains the string between the 2 positions. If the end is < 0 then it takes everything to the end


buildmRNAEditList

protected SequenceEdit[] buildmRNAEditList()

getGenomicErrors

public java.util.HashMap getGenomicErrors()
first gets all of the genomic sequencing errors from the reference sequence and then eliminates any that are from outside the region of this feature. only returns those that affect this feature

Specified by:
getGenomicErrors in interface SeqFeatureI

getCodingDNA

public java.lang.String getCodingDNA()
Calls get_ORF with the cdna.

Specified by:
getCodingDNA in interface SeqFeatureI

getRefFeature

public SeqFeatureI getRefFeature()
Description copied from interface: SeqFeatureI
Retrieve the parent SeqFeatureI for this SeqFeatureI, or null if it is a tree root.

Specified by:
getRefFeature in interface SeqFeatureI
Returns:
the parent SeqFeatureI Couldnt this return a FeatureSetI, doesnt a ref feature have to be a FeatureSetI?

getParent

public FeatureSetI getParent()
Returns refFeature as FeatureSetI which I believe it is always the case that the refFeature is a FeatureSetI

Specified by:
getParent in interface SeqFeatureI

getRefFeature

public SeqFeatureI getRefFeature(java.lang.String type)

setRefFeature

public void setRefFeature(SeqFeatureI refFeature)
Description copied from interface: SeqFeatureI
Set the parent SeqFeatureI.

When building a part-whole hieracy of features, you must both add a feature to its parent, and then call child.setRefFeature(parent). It is possible for a feature to be added to multiple feature sets, but there is only one legitimate parent.

Specified by:
setRefFeature in interface SeqFeatureI
Parameters:
refFeature - the new parent SeqFeatureI

addRefFeature

public void addRefFeature(java.lang.String type,
                          SeqFeatureI refFeature)

getRefId

public java.lang.String getRefId()
Specified by:
getRefId in interface SeqFeatureI

getTopLevelType

public java.lang.String getTopLevelType()
If biotype is null, returns type

Specified by:
getTopLevelType in interface SeqFeatureI

setTopLevelType

public void setTopLevelType(java.lang.String type)
Specified by:
setTopLevelType in interface SeqFeatureI

clone

public java.lang.Object clone()
to get a field-by-field replica of this feature

Specified by:
clone in interface SeqFeatureI
Overrides:
clone in class java.lang.Object

cloneFeature

public SeqFeatureI cloneFeature()
Description copied from interface: SeqFeatureI
clones feature

Specified by:
cloneFeature in interface SeqFeatureI

isClone

public boolean isClone()
Description copied from interface: SeqFeatureI
Check to see if this feature is a cloned feature

Specified by:
isClone in interface SeqFeatureI
Returns:
whether this feature is a cloned feature

getCloneSource

public SeqFeatureI getCloneSource()
Description copied from interface: SeqFeatureI
If this feature was cloned from another feature, return the original feature. Note that the original feature may have changed since the time of cloning. Returns null if this is not a cloned feature.

Specified by:
getCloneSource in interface SeqFeatureI
Returns:
the source of the cloned feature

getProgramName

public java.lang.String getProgramName()
Specified by:
getProgramName in interface SeqFeatureI

setProgramName

public void setProgramName(java.lang.String name)
Specified by:
setProgramName in interface SeqFeatureI

getDatabase

public java.lang.String getDatabase()
Specified by:
getDatabase in interface SeqFeatureI

setDatabase

public void setDatabase(java.lang.String name)
Specified by:
setDatabase in interface SeqFeatureI

setId

public void setId(java.lang.String id)
Specified by:
setId in interface SeqFeatureI

getId

public java.lang.String getId()
Specified by:
getId in interface SeqFeatureI

hasId

public boolean hasId()
Description copied from interface: SeqFeatureI
returns false if getId() == null

Specified by:
hasId in interface SeqFeatureI

getScore

public double getScore()
Specified by:
getScore in interface SeqFeatureI

getScore

public double getScore(java.lang.String name)
Specified by:
getScore in interface SeqFeatureI

getScores

public java.util.Hashtable getScores()
Specified by:
getScores in interface SeqFeatureI

setScore

public void setScore(double score)
Specified by:
setScore in interface SeqFeatureI

addScore

public void addScore(Score s)
Specified by:
addScore in interface SeqFeatureI

addScore

public void addScore(double score)
Specified by:
addScore in interface SeqFeatureI

addScore

public void addScore(java.lang.String name,
                     double score)
Specified by:
addScore in interface SeqFeatureI

addScore

public void addScore(java.lang.String name,
                     java.lang.String score)
Specified by:
addScore in interface SeqFeatureI

merge

public SeqFeatureI merge(SeqFeatureI sf)
Specified by:
merge in interface SeqFeatureI

main

public static void main(java.lang.String[] args)

setPhase

public void setPhase(int phase)
Specified by:
setPhase in interface SeqFeatureI

getPhase

public int getPhase()
Description copied from interface: SeqFeatureI
Phase is the internal offset from feature start for translation. It is NOT the frame relative to the ref sequence.

Specified by:
getPhase in interface SeqFeatureI
Returns:
0, 1, or 2

getEndPhase

public int getEndPhase()
Specified by:
getEndPhase in interface SeqFeatureI

getFrame

public int getFrame()
Specified by:
getFrame in interface SeqFeatureI
Returns:
1,2,3 for frame, or -1 if no frame

compareTo

public int compareTo(java.lang.Object sfObj)
Specified by:
compareTo in interface Comparable
Specified by:
compareTo in interface SeqFeatureI

addProperty

public void addProperty(java.lang.String name,
                        java.lang.String value)
Specified by:
addProperty in interface SeqFeatureI

removeProperty

public void removeProperty(java.lang.String key)
Specified by:
removeProperty in interface SeqFeatureI

replaceProperty

public void replaceProperty(java.lang.String key,
                            java.lang.String value)
Specified by:
replaceProperty in interface SeqFeatureI

getProperty

public java.lang.String getProperty(java.lang.String name)
Specified by:
getProperty in interface SeqFeatureI

getPropertyMulti

public java.util.Vector getPropertyMulti(java.lang.String name)
Specified by:
getPropertyMulti in interface SeqFeatureI

getProperties

public java.util.Hashtable getProperties()
Specified by:
getProperties in interface SeqFeatureI

getPropertiesMulti

public java.util.Hashtable getPropertiesMulti()
Specified by:
getPropertiesMulti in interface SeqFeatureI

clearProperties

public void clearProperties()
Specified by:
clearProperties in interface SeqFeatureI

translate

public java.lang.String translate()
conceptually any piece of sequence may potentially be translated // this is useful to ascertain the potential of any given sequence // it may also be needed if a prediction program provides this // information // This method translates by extracting the coding pieces of // sequence from the exons to create a single string which // is then translated with phase 0. The stop codon // is NOT included in the translated region when the // Translation start and stop have come from the fly XML data. translates get_ORF of cdna. get_ORF returns "" if no translation_start set, in this case the cdna is translated. Does phase need to be taken into account somehow?

Specified by:
translate in interface SeqFeatureI

na2aa

public java.lang.String na2aa(java.lang.String na)

get_ORF

public java.lang.String get_ORF(java.lang.String sub_sequence)
this will always return something even if the parent has not had a start of translation set. If translation start has not been set it equals 0 and wont pass the contains test and the empty string will be returned. Changed this so exons of annotations can get translated. If doesnt contain start uses phase as start (if doesnt contain end uses end of seq) Otherwise an exon that doesnt contain the start will not get translated. So a side effect of this is this will translate utr exons that are before the start of translation. Should this be checked for and not translated?


getGenomicPosition

public int getGenomicPosition(int transcript_pos)
Specified by:
getGenomicPosition in interface SeqFeatureI

getGenomicPosForPeptidePos

public int getGenomicPosForPeptidePos(int peptidePosition)
For a position in peptide coordinates get the corresponding genomic position peptide object?

Specified by:
getGenomicPosForPeptidePos in interface SeqFeatureI

getFeaturePosition

public int getFeaturePosition(int genomic_pos)
This needs to be fixed to account for edits to the genomic sequence, but I don't think it is urgent because this case is still so extremely rare

Specified by:
getFeaturePosition in interface SeqFeatureI

getNumberOfChildren

public int getNumberOfChildren()
Returns the number of direct children (not all descendants) this feature has. 0 is returned if not a FeatureSetI

Specified by:
getNumberOfChildren in interface SeqFeatureI

size

public int size()
FeatureSet overrides - merge with getNumberOfChildren

Specified by:
size in interface SeqFeatureI

clearKids

public void clearKids()
by default no kids - no-op

Specified by:
clearKids in interface SeqFeatureI

getFeatures

public java.util.Vector getFeatures()
returns a vector of all the child features belonging to this feature. an empty vector is returned if the feature is unable to have children

Specified by:
getFeatures in interface SeqFeatureI

hasKids

public boolean hasKids()
Return true if getFeatures().size() > 0, we actually have a kid

Specified by:
hasKids in interface SeqFeatureI

getFeatureAt

public SeqFeatureI getFeatureAt(int i)
returns a seqfeature at the specified position

Specified by:
getFeatureAt in interface SeqFeatureI

getFeatureIndex

public int getFeatureIndex(SeqFeatureI sf)
By default SeqFeature has no kids so returns -1 be default.

Specified by:
getFeatureIndex in interface SeqFeatureI

addFeature

public void addFeature(SeqFeatureI child)
no-op. SeqFeatures with children should override(eg FeatureSet). a non child bearing SeqFeature neednt do anything

Specified by:
addFeature in interface SeqFeatureI

addFeature

public void addFeature(SeqFeatureI feature,
                       boolean sort)
no-op - overridden by FeatureSet

Specified by:
addFeature in interface SeqFeatureI

getNumberOfDescendents

public int getNumberOfDescendents()
The number of descendants (direct and indirect) in this FeatureSetI. This method should find each child, and invoke numChildFeatures for each child that is a FeatureSetI, and add 1 to the count for all others. FeatureSetI implementors should not count themselves, but only the leaf SeqFeatureI implementations. This should be renamed numDescendants. numChild can lead one to think its its just the kids and not further descendants. In fact there should be 2 methods: numDescendants, numChildren

Specified by:
getNumberOfDescendents in interface SeqFeatureI
Returns:
the number of features contained anywhere under this FeatureSetI

numberOfGenerations

public int numberOfGenerations()
Description copied from interface: SeqFeatureI
Returns the number of generations (including itself) that are at and below this feature. In other words, how deep is the tree from this feature down to the leaves

Specified by:
numberOfGenerations in interface SeqFeatureI

accept

public void accept(Visitor visitor)
General implementation of Visitor pattern. (see apollo.util.Visitor). At this level, the SeqFeature just throws a not-implemented exception, but this is subject to change if and when people write more Visitors against this datamodel.

Specified by:
accept in interface SeqFeatureI

isSameFeat

public boolean isSameFeat(SeqFeatureI seqFeat)
Helper method designed to compare two feats which has just been initialized. If the name, start and end are not the default values, then we call Range.isIdentical. Otherwise, we compare the IDs.

Specified by:
isSameFeat in interface SeqFeatureI
Parameters:
seqFeat -
Returns:
boolean
See Also:
Range.isIdentical(RangeI range)

isAncestorOf

public boolean isAncestorOf(SeqFeatureI sf)
Returns true if this == sf. This is overridden by FeatureSet which checks for descendants with recursion. An alternate way of doing this class heirarchy would be to have SeqFeature inherit from FeatureSet, or to just allow SeqFeature to have kids (and if you wanted have a special subclass that didnt have kids that would have this function). Then these traversal functions would be more intuitive as its funny to have a contains function in SeqFeature superclass but awfully handy programaticly.

Specified by:
isAncestorOf in interface SeqFeatureI

descendsFrom

public boolean descendsFrom(SeqFeatureI sf)
This is the opposite of contains. Could be called isContainedBy I guess but I like descendsFrom better. Returns true if descends from (or is equal to) the SeqFeatureI passed in

Specified by:
descendsFrom in interface SeqFeatureI

getLeafFeatsOver

public FeatureList getLeafFeatsOver(int pos)
Description copied from interface: SeqFeatureI
This is used in the base editor to find the sub features that overlap a base with a sequence edit on it

Specified by:
getLeafFeatsOver in interface SeqFeatureI

hasAnnotatedFeature

public boolean hasAnnotatedFeature()
Whether the SeqFeature is an annotation - return false by default - AnnotatedFeature overrides

Specified by:
hasAnnotatedFeature in interface SeqFeatureI

isAnnot

public boolean isAnnot()
If we have an AnnotatedFeature then we are an annot and vice versa

Specified by:
isAnnot in interface SeqFeatureI

getAnnotatedFeature

public AnnotatedFeatureI getAnnotatedFeature()
Description copied from interface: SeqFeatureI
if hasAnnotatedFeature is true, this returns the AnnotatedFeature

Specified by:
getAnnotatedFeature in interface SeqFeatureI

hasHitFeature

public boolean hasHitFeature()
Whether SeqFeatureI has a hit feature. FeaturePair returns true.

Specified by:
hasHitFeature in interface SeqFeatureI

setQueryFeature

public void setQueryFeature(SeqFeatureI queryFeat)
Query feats hold cigars. This gives hit feats access to query feat & its cigar

Specified by:
setQueryFeature in interface SeqFeatureI

hasAlignable

public boolean hasAlignable()
A sequence feature is always alignable if it has sequence

Specified by:
hasAlignable in interface SeqFeatureI

getAlignment

public java.lang.String getAlignment()
Alignment will be padded if peptide

Specified by:
getAlignment in interface SeqFeatureI

setAlignment

public void setAlignment(java.lang.String alignment)
set the alignment string (with padding if has it)

Specified by:
setAlignment in interface SeqFeatureI

haveRealAlignment

public boolean haveRealAlignment()
Specified by:
haveRealAlignment in interface SeqFeatureI

hasCigar

protected boolean hasCigar()

parseCigar

public void parseCigar()
Specified by:
parseCigar in interface SeqFeatureI

getUnpaddedAlignment

public java.lang.String getUnpaddedAlignment()
Alignment without padding. peptide alignment with no padding.

Specified by:
getUnpaddedAlignment in interface SeqFeatureI

getExplicitAlignment

public java.lang.String getExplicitAlignment()
Explicitly set alignment. no padding

Specified by:
getExplicitAlignment in interface SeqFeatureI

setExplicitAlignment

public void setExplicitAlignment(java.lang.String align)
Specified by:
setExplicitAlignment in interface SeqFeatureI

haveExplicitAlignment

public boolean haveExplicitAlignment()
Specified by:
haveExplicitAlignment in interface SeqFeatureI

getCigar

public java.lang.String getCigar()
an explicit variable for cigar strings that are compact representations of alignments

Specified by:
getCigar in interface SeqFeatureI

setCigar

public void setCigar(java.lang.String cigar)
Specified by:
setCigar in interface SeqFeatureI

getHname

public java.lang.String getHname()
Set explicit hit alignment - string with gaps. The compact alternative to this is cigars(which should be migrated to this interface from FeaturePairI). For an alignment to work you must set both setHitAlignmnet and setRefAlignment. Previously this was set with hit.setProperty("alignment")

Specified by:
getHname in interface SeqFeatureI

getHstart

public int getHstart()
Specified by:
getHstart in interface SeqFeatureI

getHend

public int getHend()
Specified by:
getHend in interface SeqFeatureI

getHlow

public int getHlow()
Specified by:
getHlow in interface SeqFeatureI

getHhigh

public int getHhigh()
Specified by:
getHhigh in interface SeqFeatureI

getHstrand

public int getHstrand()
Specified by:
getHstrand in interface SeqFeatureI

alignmentIsPeptide

public boolean alignmentIsPeptide()
Returns true if alignment is peptide sequence, false if nucleotide This is for the hit alignment(not query). Rename hitAlignIsPeptide? actually this seems to be for both hit & query now This code aint right - its mixing up alignment seq and feat seq. feat seq can be dna while align seq can be aa - the feat seq translated (tblastx) - so ya cant muddle the 2. really we need a Sequence object for the alignment itself!

Specified by:
alignmentIsPeptide in interface SeqFeatureI

getHitFeature

public SeqFeatureI getHitFeature()
shoulnt this return null? yea it should - why is it returning this??

Specified by:
getHitFeature in interface SeqFeatureI

getHitSequence

public SequenceI getHitSequence()
returns null - FeaturePair and FeatureSet override

Specified by:
getHitSequence in interface SeqFeatureI

hasPeptideSequence

public boolean hasPeptideSequence()
Whether feature has a peptide sequence - default is false - override if otherwise (Transcript returns true)

Specified by:
hasPeptideSequence in interface SeqFeatureI

getPeptideSequence

public SequenceI getPeptideSequence()
If SeqFeatureI has a peptide sequence returns it, otherwise returns null. By default SeqFeature returns null. SeqFeature subclasses that have peptide sequence must override (eg Transcript)

Specified by:
getPeptideSequence in interface SeqFeatureI

getProteinFeat

public Protein getProteinFeat()
Description copied from interface: SeqFeatureI
getProteinFeature().getReferenceSequence() should replace getPeptideSeq()

Specified by:
getProteinFeat in interface SeqFeatureI

getFeatureContaining

public SeqFeatureI getFeatureContaining(int position)
returns self if self has position. Otherwise returns null. FeatureSet overrides this to return child who has pos position is genomic

Specified by:
getFeatureContaining in interface SeqFeatureI

setAnalogousOppositeStrandFeature

public void setAnalogousOppositeStrandFeature(SeqFeatureI oppositeFeature)
As a convenience one can record what the analogous feature is on the opposite strand. For instance a forward strand EST "analysis" would hold the reverse strand EST analysis. This comes in handy for moving results to opposite strand.

Specified by:
setAnalogousOppositeStrandFeature in interface SeqFeatureI

hasAnalogousOppositeStrandFeature

public boolean hasAnalogousOppositeStrandFeature()
Returns false if analog opp strand fs not set

Specified by:
hasAnalogousOppositeStrandFeature in interface SeqFeatureI

getAnalogousOppositeStrandFeature

public SeqFeatureI getAnalogousOppositeStrandFeature()
Returns null if hasAnalogousOppositeStrandFeatureSet is false. Otherwise returns the analog opposite strand feature set

Specified by:
getAnalogousOppositeStrandFeature in interface SeqFeatureI

isTranscript

public boolean isTranscript()
Return true is feature has translation start and stop. transcript returns true - should this be renamed isTranscript? should FeatureSet potentially return true

Specified by:
isTranscript in interface SeqFeatureI

isProtein

public boolean isProtein()
Specified by:
isProtein in interface SeqFeatureI

isExon

public boolean isExon()
Specified by:
isExon in interface SeqFeatureI

isAnnotTop

public boolean isAnnotTop()
Description copied from interface: SeqFeatureI
true for top level annots (e.g. genes & 1 level annots not transcripts nor exons) i think we also need an isResultTop or just isTop() especially if results get more varied in structure - like 1 level results

Specified by:
isAnnotTop in interface SeqFeatureI

isSequencingError

public boolean isSequencingError()
Specified by:
isSequencingError in interface SeqFeatureI

hasTranslation

public boolean hasTranslation()
Return false by default - FeatureSet overrides - if this is the same as isProteinCodingGene then we should delete it

Specified by:
hasTranslation in interface SeqFeatureI

isProteinCodingGene

public boolean isProteinCodingGene()
Specified by:
isProteinCodingGene in interface SeqFeatureI

getTranslation

public TranslationI getTranslation()
By default seqfeature has no translation - returns null

Specified by:
getTranslation in interface SeqFeatureI

getDbXrefs

public java.util.Vector getDbXrefs()
These methods dealing with xrefs have been moved from AnnotatedFeature.

Specified by:
getDbXrefs in interface SeqFeatureI

getDbXref

public DbXref getDbXref(int i)
Specified by:
getDbXref in interface SeqFeatureI

addDbXref

public void addDbXref(DbXref xref)
Specified by:
addDbXref in interface SeqFeatureI

getPrimaryDbXref

public DbXref getPrimaryDbXref()
Return the DbXref, if any, that has isPrimary==true


getIdentifier

public Identifier getIdentifier()

setIdentifier

public void setIdentifier(Identifier identifier)

setUserObject

public void setUserObject(java.lang.Object userObject)
ADDED BY TAIR Set the user object

Specified by:
setUserObject in interface SeqFeatureI

getUserObject

public java.lang.Object getUserObject()
ADDED BY TAIR Return the user object or null if none exists

Specified by:
getUserObject in interface SeqFeatureI

getCodingProperties

public int getCodingProperties()
Return an integer that describes coding props. Integers defined above. Changed logic here for undefined translation end. Previously transcripts with no end came back with UNKNOWN. Now if it has a start but no end it can be CODING, UTR_5PRIME, or MIXED_5PRIME. The reason the transcript can exist without a stop if the data just doesnt support a stop, or if its amidst editing. I felt ok modifying this method since it is only used in OtterXMLRenderingVisitor (and these changes should be ok for what its doing. There are redundant methods in DrawableGeneSeqFeature and DrawableAnnotatedGeneSeqFeature called getExonType(). All of these methods should be merged into one. If there is no translation start it still returns UNKNOWN which is probably appropriate. Suz- merged the methods (found a bug and rather than change it both places-ugh-did the merge). the bug was: not testing for the lack of a translation stop (transEnd == 0)

Specified by:
getCodingProperties in interface SeqFeatureI

getStrandedFeatSetAncestor

public StrandedFeatureSetI getStrandedFeatSetAncestor()
Specified by:
getStrandedFeatSetAncestor in interface SeqFeatureI

isCodon

public boolean isCodon()
Returns true if feature is start or stop codon currently does with feature type - perhaps should have a setIsCodon(bool) method?

Specified by:
isCodon in interface SeqFeatureI

setSyntenyLinkInfo

public void setSyntenyLinkInfo(java.lang.String linkInfo)
Description copied from interface: SeqFeatureI
Trying this out?? can set information needed to make synteny links between features for the synteny viewer. for now just a string (may need to be more involved in the future) actually this needs to be a list! so either set(List) or add(String) refactor!

Specified by:
setSyntenyLinkInfo in interface SeqFeatureI

getSyntenyLinkInfo

public java.lang.String getSyntenyLinkInfo()
Specified by:
getSyntenyLinkInfo in interface SeqFeatureI

hasSyntenyLinkInfo

public boolean hasSyntenyLinkInfo()
Specified by:
hasSyntenyLinkInfo in interface SeqFeatureI

toString

public java.lang.String toString()
For debugging

Overrides:
toString in class Range