|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.upenn.gloDB.Track
public class Track
Tracks are collections of Features and allow accessing the Features as a sorted Set (sorted by source and position information) or grouped by the Feature source information.
Nested Class Summary | |
---|---|
private static class |
Track.FeatureMaxComparator
|
Field Summary | |
---|---|
protected java.util.HashMap |
attributes
This is similar to "qualifiers" in GenBank (ex: scores, strand (+/-), phase (within codon)). |
private java.util.TreeSet |
features
TreeSet of Feature objects comprising the Track. |
protected java.lang.String |
id
This is a unique name for the Track, that is used by the parser to identify the Track. |
private static java.util.Random |
random
Used to create random IDs. |
private java.util.HashMap |
sources
Map of Sequence object IDs to Features. |
Constructor Summary | |
---|---|
Track()
Create a new Track object and add it to the trackPool. |
|
Track(boolean addToPool)
Create a new Track object and add the newly create Track object to the trackPool if addToPool is true. |
|
Track(boolean addToPool,
java.lang.String id)
Create a new Track object and add the newly create Track object to the trackPool if addToPool is true. |
|
Track(java.lang.String id)
Create a new Track object with the specified ID, and add it to the trackPool. |
Method Summary | |
---|---|
void |
addAttribute(java.lang.Object key,
java.lang.Object value)
Add an attribute. |
void |
addFeature(Feature newFeature)
Adds a Feature to 'features'. |
void |
addFeature(Feature newFeature,
boolean rebuildPool)
Adds a Feature to 'features'. |
void |
addFeatures(java.util.TreeSet features)
This will add 'features' to the current feature set. |
java.lang.Object |
clone()
Create a shallow clone of the existing object (clone the structure but not the Objects). |
Track |
cloneMerged()
Create a shallow clone of the existing object (clone the structure but not the Objects). |
java.lang.Object |
cloneTrack(boolean addToPool)
Create a shallow clone of the existing object (clone the structure but not the Objects). |
Track |
cluster(java.lang.String id,
int maxSpace,
int threshold)
Deprecated. replaced with cluster.py |
int |
compareTo(java.lang.Object o)
Compares this object with the specified object for order. |
boolean |
contains(Feature feature)
Returns 'true' if 'feature' exists in this Track. |
int |
contains(int pos)
Returns '-1' if this Track exists after the integer 'pos', returns '0' if 'pos' is contained in this Track, and '1' if 'pos' occurs after this Track. |
boolean |
contains(java.lang.String source)
Returns 'true' if this Track contains any Features on 'source'. |
boolean |
containsAttribute(java.lang.Object key)
Returns true if attribute 'key' exists. |
void |
delAttribute(java.lang.Object key)
Remove an attribute. |
void |
erase()
Erases all Track information, except for the ID. |
java.util.Iterator |
featureIterator()
Returns an Iterator over 'features'. |
java.util.TreeSet |
featuresBySource(Sequence sequence)
Get the set of Features based on the Sequence object. |
java.util.TreeSet |
featuresBySource(java.lang.String sequence)
Get the set of Features based on the Sequence ID. |
void |
filterOnAttribute(java.lang.String key,
java.lang.String value)
This will remove all Features from this Track that do not contain the specified attribute. |
void |
filterOnLength(int min,
int max)
This will remove all Features from this Track that are outside of the specifed range. |
void |
filterOnRepeat(int minR,
int maxR,
int minW,
int maxW)
This will remove all Features from this Track that do not conform to the repeat criterion. |
void |
filterOnSeqPos(int min,
int max)
This will remove all Features from this Track that are not within the 'min'/'max' boundaries. |
void |
filterOnSequence(java.lang.String sequence)
This will remove all Features from this Track that do not exist on the specified Sequence. |
Track |
flip()
Inverts the positions of each feature in the Track. |
java.lang.Object |
getAttribute(java.lang.Object key)
Get value for attribute 'key'. |
java.util.HashMap |
getAttributes()
Get the attributes. |
java.util.ArrayList |
getData()
Returns the sequence data. |
java.lang.String |
getDataFASTA()
Returns the sequence data formatted as a multi-sequence FASTA file. |
java.lang.String |
getDataFormatted()
Returns the sequence data formatted with "\n" inserted every Sequence.FORMAT_WIDTH characters and blank lines inserted between sequences. |
java.util.TreeSet |
getFeatures()
Get the features, sorted by their min values. |
java.util.TreeSet |
getFeaturesByMax()
Get the features, sorted by their max values. |
java.lang.String |
getID()
Get the ID. |
int |
getMax()
Returns the maximum stop position in the Track. |
int |
getMin()
Returns the minimum start position in the Track. |
java.util.HashMap |
getSources()
Get the map of source Sequences to Features. |
java.util.Set |
getSourceSet()
Get the set of source Sequence objects. |
boolean |
isContiguous()
Returns 'true' if the Track does not contain gaps between Features. |
boolean |
isSingleSource()
Returns 'true' if the Features contained in the Track all refer to the same sequence. |
int |
length()
Returns the number of positions contained in the Track. |
void |
mergeContiguous()
This will merge all overlapping Features in the Track, creating new Feature objects as necessary. |
Track |
noRepeats()
This will return a copy of the track without any duplicate features (based on start/stop values). |
int |
numFeatures()
Returns the number of Features contained in the Track. |
int |
numSources()
Returns the number of Sources spanned by the Track. |
boolean |
overlaps(Feature featureB)
Returns 'true' if the Feature 'featureB' overlaps at least one Feature in this Track. |
boolean |
overlaps(Track trackB)
Returns 'true' if a Feature in trackB overlaps at least one Feature in this Track. |
static java.lang.String |
randomID(java.lang.String base)
Uses 'base' to create a random ID string that doesn't already exist in the trackPool. |
void |
removeFeature(Feature newFeature)
Removes a Feature from 'features'. |
void |
setAttributes(java.util.HashMap attributes)
Set the attributes. |
void |
setFeatures(java.util.TreeSet features)
This will replace 'features' with the TreeSet argument. |
void |
setID(java.lang.String id)
Set the ID. |
void |
setID(java.lang.String id,
boolean updatePool)
Set the ID. |
static java.util.TreeSet |
sortByMax(java.util.TreeSet features)
Sort the Feature TreeSet by max values. |
java.lang.String |
toString()
Only returns Feature start/stop position information. |
java.lang.String |
toStringFull()
Returns all description and Feature information. |
java.lang.String |
toStringMore()
Only returns Feature start/stop position information. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected java.lang.String id
protected java.util.HashMap attributes
private java.util.TreeSet features
private java.util.HashMap sources
features
.private static java.util.Random random
Constructor Detail |
---|
public Track()
public Track(java.lang.String id)
public Track(boolean addToPool)
public Track(boolean addToPool, java.lang.String id)
Method Detail |
---|
public void setID(java.lang.String id) throws InvalidIDException
id
- a String that is a unique identifier for the Track.
InvalidIDException
public void setID(java.lang.String id, boolean updatePool) throws InvalidIDException
id
- a String that is a unique identifier for the Track.
InvalidIDException
public java.lang.String getID()
public void setAttributes(java.util.HashMap attributes)
attributes
- a HashMap of Feature attributespublic java.util.HashMap getAttributes()
public void setFeatures(java.util.TreeSet features)
sources
HashMap based on the
new set of Features.
public java.util.TreeSet getFeatures()
public java.util.TreeSet getFeaturesByMax()
public java.util.HashMap getSources()
public static java.util.TreeSet sortByMax(java.util.TreeSet features)
public void filterOnSequence(java.lang.String sequence)
public void filterOnSeqPos(int min, int max)
public void filterOnLength(int min, int max)
public void filterOnRepeat(int minR, int maxR, int minW, int maxW)
public void filterOnAttribute(java.lang.String key, java.lang.String value)
public void addAttribute(java.lang.Object key, java.lang.Object value)
public void delAttribute(java.lang.Object key)
public boolean containsAttribute(java.lang.Object key)
public java.lang.Object getAttribute(java.lang.Object key)
public void addFeatures(java.util.TreeSet features)
sources
HashMap based on the new
set of Features.
public void addFeature(Feature newFeature)
sources
HashMap. If 'features' doesn't exist a new
TreeSet will be created. If 'newFeature' is null, then this
method won't do anything.
public void addFeature(Feature newFeature, boolean rebuildPool)
sources
HashMap. If 'features' doesn't exist a new
TreeSet will be created. If 'newFeature' is null, then this
method won't do anything.
public void removeFeature(Feature newFeature)
sources
HashMap. If 'newFeature' is null,
then this method won't do anything.
public int numFeatures()
public int numSources()
public java.util.Iterator featureIterator()
public java.util.Set getSourceSet()
public java.util.TreeSet featuresBySource(Sequence sequence)
public java.util.TreeSet featuresBySource(java.lang.String sequence)
public java.util.ArrayList getData()
public java.lang.String getDataFormatted()
public java.lang.String getDataFASTA()
public boolean isContiguous()
public void mergeContiguous()
public Track cluster(java.lang.String id, int maxSpace, int threshold)
id
- the name of the new TrackmaxSpace
- the maximum allowed space between Features in a
clusterthreshold
- the minimum number of Features needed in a
cluster, for the cluster to be included in the outputpublic Track noRepeats()
public boolean isSingleSource()
isContiguous()
but allows for gaps between Features.
public Track flip()
public int getMin()
isSingleSource()
returns 'false').
public int getMax()
isSingleSource()
returns 'false').
public int length()
public int compareTo(java.lang.Object o)
public int contains(int pos)
public boolean contains(Feature feature)
public boolean contains(java.lang.String source)
public boolean overlaps(Feature featureB)
public boolean overlaps(Track trackB)
public Track cloneMerged()
public java.lang.Object clone()
clone
in class java.lang.Object
public java.lang.Object cloneTrack(boolean addToPool)
public void erase()
public static java.lang.String randomID(java.lang.String base)
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toStringMore()
public java.lang.String toStringFull()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |