apollo.util
Class FeatureList

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.ArrayList
              extended by apollo.util.FeatureList
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable, java.util.Collection, java.util.List, java.util.RandomAccess
Direct Known Subclasses:
Selection

public class FeatureList
extends java.util.ArrayList

Just a little helper class. Holds an array list of SeqFeatureIs, add more list methods as needed. This should be replaced by FeatureSet once FeatureSet is refactored, right now FeatureSet is just too heavyweight for such a lightweight activity. Once FS is refactored this should be deleted/incorporated.

See Also:
Serialized Form

Field Summary
protected static org.apache.log4j.Logger logger
           
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
FeatureList()
           
FeatureList(boolean doUniqueCheck)
          if unique check is true, check that feat doesnt already exist on adding
FeatureList(int size)
           
FeatureList(SeqFeatureI seqFeat, boolean addLeaves)
          Create FeatureList from seqFeat.
FeatureList(java.util.Vector features)
           
 
Method Summary
 boolean add(java.lang.Object o)
          addFeature should be used in lieu of add.
 void addAlignable(SeqFeatureI alignable)
           
 void addAll(FeatureList feats)
          Adds all feats that are new, that it doesnt already have.
 void addAllFeatures(FeatureList feats)
           
 void addFeature(SeqFeatureI feat)
          Adds SeqFeatureI if not already in list
 void addFeaturePair(FeaturePairI featPair)
           
 void addVector(java.util.Vector v)
           
 FeatureList cloneList()
          Returns a FeatureList that contains seq feature clones of all features in current list.
 FeatureIterator featureIterator()
           
 FeatureList filterForFeaturePairs()
           
 SeqFeatureI first()
           
 SeqFeatureI getAlignable(int index)
           
 FeatureList getAllFeaturePairLeaves()
           
 FeatureList getAllLeaves()
          Returns a list of all the descendants of the current list that are leaves.
 FeatureList getConsolidatedFeatures()
          Consolidates features.
 FeatureList getFeatsWithAlignments()
          Filters FeatureList for features with hasAlignable==true and the Alignable hasAlignmentSequence
 FeatureList getFeatsWithinRefSeqRegion()
           
 SeqFeatureI getFeature(int index)
           
 FeaturePairI getFeaturePair(int i)
           
 SeqFeatureI getFeatWithName(java.lang.String name)
          not recursive - just gets first feature with name - null if none
 FeatureList getParents()
          Returns unique list of parents
 RangeI getRangeOfWholeList()
          Assumes feats on same strand
 java.lang.String[] getUniqueHitNames()
           
 SeqFeatureI last()
           
 void removeFeature(SeqFeatureI feat)
           
 void setAlignablesOnly(boolean alignablesOnly)
           
 void setDoUniqueCheck(boolean doUniqueCheck)
           
 void setFeaturePairsOnly(boolean featPairOnly)
          We could just have a FeaturePairList?
 void sortByStart()
          this is misnamed.
 java.util.Vector toVector()
           
 
Methods inherited from class java.util.ArrayList
add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, removeRange, set, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList
 

Field Detail

logger

protected static final org.apache.log4j.Logger logger
Constructor Detail

FeatureList

public FeatureList()

FeatureList

public FeatureList(int size)

FeatureList

public FeatureList(java.util.Vector features)

FeatureList

public FeatureList(boolean doUniqueCheck)
if unique check is true, check that feat doesnt already exist on adding


FeatureList

public FeatureList(SeqFeatureI seqFeat,
                   boolean addLeaves)
Create FeatureList from seqFeat. If addLeaves is true make feat list of all leaves(descendants) of seqFeat, if addLeaves is false make a list of just the seqFeat itself

Method Detail

addFeature

public void addFeature(SeqFeatureI feat)
Adds SeqFeatureI if not already in list


setDoUniqueCheck

public void setDoUniqueCheck(boolean doUniqueCheck)

addAll

public void addAll(FeatureList feats)
Adds all feats that are new, that it doesnt already have. If we need to do addAll that doesnt guarantee uniqueness we can paramaterize


removeFeature

public void removeFeature(SeqFeatureI feat)

add

public boolean add(java.lang.Object o)
addFeature should be used in lieu of add. This is here as an override to ArrayList.add. cant call addFeature as it calls add. Ive added the constraint that it only adds feature if doesnt already have, in other words cant have redundant features. I think this is always how FeatureLists are used. If not, this can be parameterized.

Specified by:
add in interface java.util.Collection
Specified by:
add in interface java.util.List
Overrides:
add in class java.util.ArrayList

featureIterator

public FeatureIterator featureIterator()

getFeature

public SeqFeatureI getFeature(int index)

last

public SeqFeatureI last()

first

public SeqFeatureI first()

addAllFeatures

public void addAllFeatures(FeatureList feats)

getParents

public FeatureList getParents()
Returns unique list of parents


cloneList

public FeatureList cloneList()
Returns a FeatureList that contains seq feature clones of all features in current list.


toVector

public java.util.Vector toVector()

addVector

public void addVector(java.util.Vector v)

getRangeOfWholeList

public RangeI getRangeOfWholeList()
Assumes feats on same strand


getAllLeaves

public FeatureList getAllLeaves()
Returns a list of all the descendants of the current list that are leaves. Leaves are SeqFeatures with no children (eg Exons, FeaturePairs)


getAllFeaturePairLeaves

public FeatureList getAllFeaturePairLeaves()

getFeatsWithAlignments

public FeatureList getFeatsWithAlignments()
Filters FeatureList for features with hasAlignable==true and the Alignable hasAlignmentSequence


getFeatsWithinRefSeqRegion

public FeatureList getFeatsWithinRefSeqRegion()

getConsolidatedFeatures

public FeatureList getConsolidatedFeatures()
Consolidates features. eg if all exons in a transcript are in the feature list, the transcript is added and the exons are removed. Presently this is not recursive, only does one level of processing as that is all that is needed, change if need be. This stops at "holders". In other words if we have selected all the genes on a strand it will not consolidate to the FeatureSet that is the holder of all those genes.

See Also:
#FeatureSetI.isHolder

sortByStart

public void sortByStart()
this is misnamed. Its sorting by low not start


setFeaturePairsOnly

public void setFeaturePairsOnly(boolean featPairOnly)
We could just have a FeaturePairList?


addFeaturePair

public void addFeaturePair(FeaturePairI featPair)

filterForFeaturePairs

public FeatureList filterForFeaturePairs()

getFeaturePair

public FeaturePairI getFeaturePair(int i)

getUniqueHitNames

public java.lang.String[] getUniqueHitNames()

setAlignablesOnly

public void setAlignablesOnly(boolean alignablesOnly)

addAlignable

public void addAlignable(SeqFeatureI alignable)

getAlignable

public SeqFeatureI getAlignable(int index)

getFeatWithName

public SeqFeatureI getFeatWithName(java.lang.String name)
not recursive - just gets first feature with name - null if none