Class AbstractLocation
java.lang.Object
org.biojava.nbio.core.sequence.location.template.AbstractLocation
- All Implemented Interfaces:
Serializable
,Iterable<Location>
,Location
,Accessioned
- Direct Known Subclasses:
InsdcLocations.BondLocation
,InsdcLocations.OneOfLocation
,SimpleLocation
Base abstraction of a location which encodes for the majority of important
features about a location such as the start, end and strand
- Author:
- ayates, Paolo Pavan
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.biojava.nbio.core.sequence.location.template.Location
Location.Tools
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
AbstractLocation
(Point start, Point end, Strand strand, boolean circular, boolean betweenCompounds, List<Location> subLocations) Default constructorAbstractLocation
(Point start, Point end, Strand strand, boolean circular, boolean betweenCompounds, AccessionID accession, List<Location> subLocations) Default constructor -
Method Summary
Modifier and TypeMethodDescriptionprotected void
protected <C extends Compound>
booleancanComplement
(Sequence<C> sequence) Uses the Sequence's CompoundSet to decide if a compound can be assgined to ComplementCompound meaning it can complementboolean
Returns the AccessionID this location is currently bound withgetEnd()
End of the locationint
Returns the length of the outer bounds of this locationReturns the normalised list of sub locations i.e. only those locations which do not have a sub location.getRelevantSubSequence
(Sequence<C> sequence) Will return a SequenceReader object which offers a view of all resolved locations i.e. those locations which are not complex and define the true Sequence representedgetStart()
Start of the locationStrand which the location is located onGives access to the sub locations for this location.getSubSequence
(Sequence<C> sequence) If circular this will return the sequence represented by the sub locations joined.int
hashCode()
boolean
Returns true if the position is meant to represent a point between two points such as 78^79.boolean
Indicates if this location is circular.boolean
Returns true if the location is considered to be complex meaning the location is actually composed of sub-locations.boolean
boolean
boolean
iterator()
Iterates through all known sub-locations for this location but does not descendreverseSequence
(Sequence<C> sequence) Reverses and (if possible) complements the Sequence so as to represent the reverse strand (if one exists).void
setAccession
(AccessionID accession) void
setBetweenCompounds
(boolean betweenCompounds) protected void
setCircular
(boolean circular) protected void
void
setPartialOn3prime
(boolean partialOn3prime) void
setPartialOn5prime
(boolean partialOn5prime) protected void
void
void
setSubLocations
(List<Location> subLocations) toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
AbstractLocation
protected AbstractLocation() -
AbstractLocation
public AbstractLocation(Point start, Point end, Strand strand, boolean circular, boolean betweenCompounds, List<Location> subLocations) Default constructor- Parameters:
start
- start of the locationend
- end of the locationstrand
- strand it is located oncircular
- Boolean which says if the current location was circular or notbetweenCompounds
- Indicates the location lies at the position between a pair of bases; means the bases must be next to each other (and therefore cannot be complex)subLocations
- Sub locations which composes this location
-
AbstractLocation
public AbstractLocation(Point start, Point end, Strand strand, boolean circular, boolean betweenCompounds, AccessionID accession, List<Location> subLocations) Default constructor- Parameters:
start
- start of the locationend
- end of the locationstrand
- strand it is located oncircular
- Boolean which says if the current location was circular or notbetweenCompounds
- Indicates the location lies at the position between a pair of bases; means the bases must be next to each other (and therefore cannot be complex)accession
- The accession ID to link this location tosubLocations
- Sub locations which composes this location
-
-
Method Details
-
assertLocation
-
getEnd
Description copied from interface:Location
End of the location -
getStart
Description copied from interface:Location
Start of the location -
getLength
Description copied from interface:Location
Returns the length of the outer bounds of this location -
getStrand
Description copied from interface:Location
Strand which the location is located on -
getSubLocations
Description copied from interface:Location
Gives access to the sub locations for this location. However this does not return sub-locations of sub-locations. For that functionality useLocation.getRelevantSubLocations()
.- Specified by:
getSubLocations
in interfaceLocation
- Returns:
- A list of a single level of sub-locations
-
isComplex
Description copied from interface:Location
Returns true if the location is considered to be complex meaning the location is actually composed of sub-locations. -
getAccession
Description copied from interface:Accessioned
Returns the AccessionID this location is currently bound with- Specified by:
getAccession
in interfaceAccessioned
-
isPartialOn5prime
-
setPartialOn5prime
-
isPartialOn3prime
-
setPartialOn3prime
-
isPartial
-
iterator
Iterates through all known sub-locations for this location but does not descend -
getRelevantSubLocations
Returns the normalised list of sub locations i.e. only those locations which do not have a sub location. Useful for when you need to get the exact elements of a location back for sub sequences.- Specified by:
getRelevantSubLocations
in interfaceLocation
- Returns:
- List of all sub locations including sub-locations of sub locations
-
equals
-
hashCode
-
isCircular
Description copied from interface:Location
Indicates if this location is circular.- Specified by:
isCircular
in interfaceLocation
-
isBetweenCompounds
Description copied from interface:Location
Returns true if the position is meant to represent a point between two points such as 78^79. Only valid if start and stop are next to each other.- Specified by:
isBetweenCompounds
in interfaceLocation
-
getSubSequence
If circular this will return the sequence represented by the sub locations joined. If not circular then we get the Sequence for the outer-bounds defined by this location.- Specified by:
getSubSequence
in interfaceLocation
- Type Parameters:
C
- The type of compound to use- Parameters:
sequence
- The sequence object to work with- Returns:
- The sequence
-
getRelevantSubSequence
Description copied from interface:Location
Will return a SequenceReader object which offers a view of all resolved locations i.e. those locations which are not complex and define the true Sequence represented- Specified by:
getRelevantSubSequence
in interfaceLocation
- Type Parameters:
C
- The type of compound to use- Parameters:
sequence
- The sequence object to work with- Returns:
- The full assembled sequence
-
reverseSequence
Reverses and (if possible) complements the Sequence so as to represent the reverse strand (if one exists). Also does checking to see if the location we are on is on the reverse strand or not. -
canComplement
Uses the Sequence's CompoundSet to decide if a compound can be assgined to ComplementCompound meaning it can complement -
toString
-
setCircular
-
setEnd
-
setStart
-
setStrand
-
setBetweenCompounds
-
setSubLocations
-
setAccession
-