Class CircularLocation
- All Implemented Interfaces:
Location
Note also that as a location that overlaps the origin is a compound location it's min will be 1 and its max will be length (by default). In these cases it is imperative to use the block iterator if you wish to know the 'true' min and max (bearing in mind that there is no logical value for a min or max on a circular sequence).
The symbols() method has been overridden to handle the weirdness of a location crossing the origin.
- Since:
- 1.2
- Author:
- Matthew Pocock, Mark Schreiber
-
Field Summary
Fields inherited from interface org.biojava.bio.symbol.Location
empty, full, naturalOrder -
Constructor Summary
ConstructorsConstructorDescriptionCircularLocation(Location wrapped, int length) Constructs a CircularLocation by wrapping another Location It is preferable to use LocationTools to make CircularLocationsCircularLocation(Location wrapped, int length, int fivePrimeEnd) Makes a CircularLocation where the 5' end of the Location is specified. -
Method Summary
Modifier and TypeMethodDescriptionbooleancontains(int p) Checks if this location contains a point.booleanChecks if this location contains the other.protected LocationbooleanChecks if this location is equivalent to the other.Iterates over the location blocks in order starting with the most 5'intintThe point at which indicates the 5' end of the Location.final intintgetMax()This will give you the coordinate of the maximum point contained by this Location.intgetMin()This will give you the coordinate of the minimum point contained by this Location.Returns a Location that contains all points common to both ranges.booleanDelegates to the wrapped location.booleanChecks if these two locations overlap, using this location's concept of overlapping.booleanDoes the Location overlap the origin (position 1) of the sequence?symbols(SymbolList seq) Return the symbols in a sequence that fall within this range.toString()Return a Location containing all points in either ranges.Methods inherited from class org.biojava.bio.symbol.AbstractLocationDecorator
blockIterator, getDecorator, getWrapped, newInstance, translate
-
Constructor Details
-
CircularLocation
Constructs a CircularLocation by wrapping another Location It is preferable to use LocationTools to make CircularLocations- Parameters:
wrapped- the Location to wrap.length- the length of the Sequence
-
CircularLocation
Makes a CircularLocation where the 5' end of the Location is specified. ThefivePrimeEndparameter must match one of the minimum coordinates of the wrappedLocation. This allows the creation of Locations whose polarity can be specified. This method is used internally byLocationTools.union()and by the other constructor.- Parameters:
wrapped- theLocationto map to a Circlelength- the lenght of the circlefivePrimeEnd- the 5' polar end of the sequence- Throws:
IllegalArgumentException- if the 5' end doesn't match the min coordinate of eitherwrappedor one of its blocks.
-
-
Method Details
-
getLength
-
overlapsOrigin
Does the Location overlap the origin (position 1) of the sequence?If it does the Location will internally be composed of a CompoundLocation.
- Returns:
- true if it does, false otherwise
-
decorate
- Specified by:
decoratein classAbstractLocationDecorator
-
contains
Description copied from interface:LocationChecks if this location contains a point.- Specified by:
containsin interfaceLocation- Overrides:
containsin classAbstractLocationDecorator- Parameters:
p- the point to check- Returns:
- true if this contains p, otherwise false
-
intersection
Description copied from interface:LocationReturns a Location that contains all points common to both ranges.- Specified by:
intersectionin interfaceLocation- Overrides:
intersectionin classAbstractLocationDecorator- Parameters:
l- the Location to intersect with- Returns:
- a Location containing all points common to both, or the empty range if there are no such points
-
overlaps
Description copied from interface:LocationChecks if these two locations overlap, using this location's concept of overlapping.Abstractly, two locations overlap if they both contain any point.
- Specified by:
overlapsin interfaceLocation- Overrides:
overlapsin classAbstractLocationDecorator- Parameters:
l- the Location to check- Returns:
- true if they overlap, otherwise false
-
union
Description copied from interface:LocationReturn a Location containing all points in either ranges.- Specified by:
unionin interfaceLocation- Overrides:
unionin classAbstractLocationDecorator- Parameters:
l- the Location to union with- Returns:
- a Location representing the union
-
contains
Description copied from interface:LocationChecks if this location contains the other.Abstractly, a location contains another if every point in the other location is contained within this one.
- Specified by:
containsin interfaceLocation- Overrides:
containsin classAbstractLocationDecorator- Parameters:
l- the Location to check- Returns:
- true if this contains l, otherwise false
-
equals
Description copied from interface:LocationChecks if this location is equivalent to the other.Abstractly, a location is equal to another if for every point in one it is also in the other. This is equivalent to a.contains(b) && b.contains(a). You should call LocationTools.areEqual after casting l to Location.
- Specified by:
equalsin interfaceLocation- Overrides:
equalsin classAbstractLocationDecorator- Parameters:
o- the Object to check- Returns:
- true if this equals l, otherwise false
-
toString
-
isContiguous
Delegates to the wrapped location. Currently as locations that cross the origin are wrapped CompoundLocations they are not considered contiguous. This is desirable from the point of view of logical operations as it greatly simplifies the calculations of things such as contains, overlaps etc.- Specified by:
isContiguousin interfaceLocation- Overrides:
isContiguousin classAbstractLocationDecorator- Returns:
- true if the location is contiguous and doesn't overlap the origin
-
get5PrimeEnd
The point at which indicates the 5' end of the Location. This is needed as compound circular locations have polarity. For example (18..30, 1..12) is not the same as (1..12, 18..30). The 5' coordinate is derived during construction of the Location. In particular during a union operation the 5' coordinate is generally the 5' coordinate of the first location in the union. In the case where this cannot be logically maintained the 5' coordinate will revert togetMin()- Returns:
- the most 5' coordinate
- See Also:
-
get3PrimeEnd
- Returns:
- the most 3' coordinate
- See Also:
-
getMin
This will give you the coordinate of the minimum point contained by this Location. Generally this will be the leftmost end however if the Location crosses the origin then it will actually be the origin that is the minimum point and the method will return 1. If you want to be guarenteed of getting the leftmost coordinate then callget5PrimeEnd()- Specified by:
getMinin interfaceLocation- Overrides:
getMinin classAbstractLocationDecorator- Returns:
- the minimum coord
- See Also:
-
getMax
This will give you the coordinate of the maximum point contained by this Location. Generally this will be the rightmost end however if the Location crosses the origin then it will actually be the point before the origin that is the maximum point and the method will returngetLength(). If you want to be guarenteed of getting the rightmost coordinate then callget3PrimeEnd()- Specified by:
getMaxin interfaceLocation- Overrides:
getMaxin classAbstractLocationDecorator- Returns:
- the maximum coord
- See Also:
-
symbols
Description copied from interface:LocationReturn the symbols in a sequence that fall within this range.- Specified by:
symbolsin interfaceLocation- Overrides:
symbolsin classAbstractLocationDecorator- Parameters:
seq- the SymbolList to process- Returns:
- the SymbolList containing the symbols in seq in this range
-
fivePrimeBlockIterator
Iterates over the location blocks in order starting with the most 5'- Returns:
- a ListIterator
- See Also:
-