|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.biojava.utils.AbstractChangeable
org.biojava.bio.seq.AbstractFeatureHolder
org.biojava.bio.seq.ProjectedFeatureHolder
Helper class for projecting Feature objects into an alternative
coordinate system. This class offers a view onto a set of features,
projecting them into a different coordinate system, and also changing
their parent
property. The destination coordinate system
can run in the opposite direction from the source, in which case the
strand
property of StrandedFeatures is flipped.
The projected features returned by this class are small proxy objects.
Proxy classes are autogenerated on demand for any sub-interface of
Feature
by the ProjectionEngine
class.
Nested Class Summary |
Nested classes inherited from class org.biojava.bio.seq.FeatureHolder |
FeatureHolder.EmptyFeatureHolder |
Field Summary |
Fields inherited from interface org.biojava.bio.seq.FeatureHolder |
EMPTY_FEATURE_HOLDER, FEATURES, SCHEMA |
Constructor Summary | |
ProjectedFeatureHolder(FeatureHolder fh,
FeatureFilter filter,
FeatureHolder parent,
int translation,
boolean oppositeStrand)
Deprecated. Now just wraps up a LazyFilterFeatureHolder |
|
ProjectedFeatureHolder(FeatureHolder fh,
FeatureHolder parent,
int translation,
boolean oppositeStrand)
Construct a new FeatureHolder which projects a set of features into a new coordinate system. |
Method Summary | |
void |
addChangeListener(Feature f,
ChangeListener cl,
ChangeType ct)
Delegate for addChangeListener |
boolean |
containsFeature(Feature f)
Check if the feature is present in this holder. |
int |
countFeatures()
Count how many features are contained. |
Feature |
createFeature(Feature.Template templ)
Create a new Feature, and add it to this FeatureHolder. |
Feature |
createFeature(Feature f,
Feature.Template templ)
Delegate for createFeature |
java.util.Iterator |
features()
Iterate over the features in no well defined order. |
FeatureHolder |
filter(FeatureFilter ff)
Query this set of features using a supplied FeatureFilter . |
FeatureHolder |
filter(FeatureFilter ff,
boolean recurse)
Return a new FeatureHolder that contains all of the children of this one that passed the filter fc. |
protected ChangeEvent |
forwardChangeEvent(ChangeEvent cev)
Called internally to generate a forwarded version of a ChangeEvent from our underlying FeatureHolder |
protected ChangeEvent |
forwardFeatureChangeEvent(Feature f,
ChangeEvent cev)
Called internally to generate a forwarded version of a ChangeEvent from a ProjectedFeature |
Annotation |
getAnnotation(Feature f)
Get the annotation bundle of the projected feature. |
Location |
getLocation(Feature f)
Get the location of the projected feature |
FeatureHolder |
getParent()
Return the parent of all top-level features in this FeatureHolder. |
FeatureHolder |
getParent(Feature f)
Get the parent FeatureHolder into which a feature should be projected |
FeatureFilter |
getSchema()
Return a schema-filter for this FeatureHolder . |
FeatureFilter |
getSchema(Feature f)
Delegate for getSchema |
Sequence |
getSequence(Feature f)
Get the Sequence which defines the coordinate system for the projected feature. |
StrandedFeature.Strand |
getStrand(StrandedFeature sf)
Get the strand of the projected feature. |
int |
getTranslation()
Return the translation component of the transformation applied by this FeatureHolder |
protected FeatureHolder |
getWrapped()
|
boolean |
isOppositeStrand()
Return true if projected features should be flipped to the opposite strand |
protected FeatureHolder |
makeProjectionSet(FeatureHolder fh)
Called internally to construct a lightweight projected view of a set of features |
FeatureHolder |
projectChildFeatures(Feature f,
FeatureHolder parent)
Get the child features of the projected feature. |
Feature |
projectFeature(Feature f)
Create a single projected feature using the rules of this ProjectedFeatureHolder . |
void |
removeChangeListener(Feature f,
ChangeListener cl,
ChangeType ct)
Delegate for removeChangeListener |
void |
removeFeature(Feature f)
Remove a feature from this FeatureHolder. |
void |
removeFeature(Feature f,
Feature f2)
Delegate for removeFeature |
protected FeatureFilter |
transformFilter(FeatureFilter ff)
Called to transform a FeatureFilter applying to our parent FeatureHolder into the coordinate system of our parent. |
protected Location |
transformLocation(Location oldLoc)
Called to transform a location from underlying to projection coordinates. |
protected StrandedFeature.Strand |
transformStrand(StrandedFeature.Strand strand)
Called to transform a strand property between projection and underlying coordinates. |
protected FeatureFilter |
untransformFilter(FeatureFilter ff)
Called to transform a FeatureFilter applying to our projections into a corresponding filter on the parent FeatureHolder. |
protected Location |
untransformLocation(Location oldLoc)
Called to transform a location from projection to underlying coordinates. |
Methods inherited from class org.biojava.utils.AbstractChangeable |
addChangeListener, addChangeListener, generateChangeSupport, getChangeSupport, hasListeners, isUnchanging, removeChangeListener, removeChangeListener |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface org.biojava.utils.Changeable |
addChangeListener, addChangeListener, isUnchanging, removeChangeListener, removeChangeListener |
Constructor Detail |
public ProjectedFeatureHolder(FeatureHolder fh, FeatureFilter filter, FeatureHolder parent, int translation, boolean oppositeStrand)
translation
is 0
and oppositeStrand
is false
, the features
are simply reparented without any transformation.
fh
- The set of features to project.filter
- A FeatureFilter to apply to the set of features before projection.parent
- The FeatureHolder which is to act as parent
for the projected features.translation
- The translation to apply to map locations into
the projected coordinate system. This is the point
in the destination coordinate system which is equivalent
to 0 in the source coordinate system.oppositeStrand
- true
if translating into the opposite coordinate system.
This alters the transformation applied to locations, and also flips
the strand
property of StrandedFeatures.public ProjectedFeatureHolder(FeatureHolder fh, FeatureHolder parent, int translation, boolean oppositeStrand)
translation
is 0
and oppositeStrand
is false
, the features
are simply reparented without any transformation.
fh
- The set of features to project.parent
- The FeatureHolder which is to act as parent
for the projected features.translation
- The translation to apply to map locations into
the projected coordinate system. This is the point
in the destination coordinate system which is equivalent
to 0 in the source coordinate system.oppositeStrand
- true
if translating into the opposite coordinate system.
This alters the transformation applied to locations, and also flips
the strand
property of StrandedFeatures.Method Detail |
protected FeatureHolder getWrapped()
public java.util.Iterator features()
FeatureHolder
features
in interface FeatureHolder
public int countFeatures()
FeatureHolder
countFeatures
in interface FeatureHolder
public boolean containsFeature(Feature f)
FeatureHolder
containsFeature
in interface FeatureHolder
f
- the Feature to check
public FeatureHolder filter(FeatureFilter ff)
FeatureHolder
FeatureFilter
.
filter
in interface FeatureHolder
filter
in class AbstractFeatureHolder
public FeatureHolder filter(FeatureFilter ff, boolean recurse)
FeatureHolder
filter
in interface FeatureHolder
filter
in class AbstractFeatureHolder
public Feature createFeature(Feature.Template templ) throws ChangeVetoException, BioException
FeatureHolder
createFeature
in interface FeatureHolder
createFeature
in class AbstractFeatureHolder
ChangeVetoException
BioException
public void removeFeature(Feature f) throws ChangeVetoException
FeatureHolder
removeFeature
in interface FeatureHolder
removeFeature
in class AbstractFeatureHolder
ChangeVetoException
public FeatureFilter getSchema()
FeatureHolder
FeatureHolder
. This is a filter
which all Feature
s immediately contained by this FeatureHolder
will match. It need not directly match their child features, but it can (and should!) provide
information about them using FeatureFilter.OnlyChildren
filters. In cases where there
is no feature hierarchy, this can be indicated by including FeatureFilter.leaf
in
the schema filter.
For the truly non-informative case, it is possible to return FeatureFilter.all
. However,
it is almost always possible to provide slightly more information that this. For example, Sequence
objects should, at a minimum, return FeatureFilter.top_level
. Feature
objects
should, as a minimum, return FeatureFilter.ByParent(new FeatureFilter.ByFeature(this))
.
getSchema
in interface FeatureHolder
protected FeatureFilter untransformFilter(FeatureFilter ff)
protected FeatureFilter transformFilter(FeatureFilter ff)
protected StrandedFeature.Strand transformStrand(StrandedFeature.Strand strand)
protected Location transformLocation(Location oldLoc)
protected Location untransformLocation(Location oldLoc)
public Feature projectFeature(Feature f)
ProjectedFeatureHolder
.
public int getTranslation()
public boolean isOppositeStrand()
public FeatureHolder getParent()
protected FeatureHolder makeProjectionSet(FeatureHolder fh)
public FeatureHolder getParent(Feature f)
ProjectionContext
getParent
in interface ProjectionContext
public Sequence getSequence(Feature f)
ProjectionContext
getSequence
in interface ProjectionContext
public Location getLocation(Feature f)
ProjectionContext
getLocation
in interface ProjectionContext
public StrandedFeature.Strand getStrand(StrandedFeature sf)
ProjectionContext
getStrand
in interface ProjectionContext
public Annotation getAnnotation(Feature f)
ProjectionContext
getAnnotation
in interface ProjectionContext
public FeatureHolder projectChildFeatures(Feature f, FeatureHolder parent)
ProjectionContext
projectChildFeatures
in interface ProjectionContext
public Feature createFeature(Feature f, Feature.Template templ) throws BioException, ChangeVetoException
ProjectionContext
createFeature
in interface ProjectionContext
BioException
ChangeVetoException
public void removeFeature(Feature f, Feature f2) throws ChangeVetoException
ProjectionContext
removeFeature
in interface ProjectionContext
ChangeVetoException
public FeatureFilter getSchema(Feature f)
ProjectionContext
getSchema
in interface ProjectionContext
public void addChangeListener(Feature f, ChangeListener cl, ChangeType ct)
ProjectionContext
addChangeListener
in interface ProjectionContext
public void removeChangeListener(Feature f, ChangeListener cl, ChangeType ct)
ProjectionContext
removeChangeListener
in interface ProjectionContext
protected ChangeEvent forwardFeatureChangeEvent(Feature f, ChangeEvent cev)
f
- the feature who's projection is due to receive an event.
null
to cancel the event.protected ChangeEvent forwardChangeEvent(ChangeEvent cev)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |