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
public abstract class AbstractLocation extends Object implements Serializable, Location
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:
 - Serialized Form
 
 
- 
- 
Nested Class Summary
- 
Nested classes/interfaces inherited from interface org.biojava.nbio.core.sequence.location.template.Location
Location.Tools 
 - 
 
- 
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractLocation()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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidassertLocation()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 complementbooleanequals(Object obj)AccessionIDgetAccession()Returns the AccessionID this location is currently bound withPointgetEnd()End of the locationintgetLength()Returns the length of the outer bounds of this locationList<Location>getRelevantSubLocations()Returns the normalised list of sub locations i.e. only those locations which do not have a sub location.<C extends Compound>
Sequence<C>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 representedPointgetStart()Start of the locationStrandgetStrand()Strand which the location is located onList<Location>getSubLocations()Gives access to the sub locations for this location.<C extends Compound>
Sequence<C>getSubSequence(Sequence<C> sequence)If circular this will return the sequence represented by the sub locations joined.inthashCode()booleanisBetweenCompounds()Returns true if the position is meant to represent a point between two points such as 78^79.booleanisCircular()Indicates if this location is circular.booleanisComplex()Returns true if the location is considered to be complex meaning the location is actually composed of sub-locations.booleanisPartial()booleanisPartialOn3prime()booleanisPartialOn5prime()Iterator<Location>iterator()Iterates through all known sub-locations for this location but does not descendprotected <C extends Compound>
Sequence<C>reverseSequence(Sequence<C> sequence)Reverses and (if possible) complements the Sequence so as to represent the reverse strand (if one exists).voidsetAccession(AccessionID accession)voidsetBetweenCompounds(boolean betweenCompounds)protected voidsetCircular(boolean circular)protected voidsetEnd(Point end)voidsetPartialOn3prime(boolean partialOn3prime)voidsetPartialOn5prime(boolean partialOn5prime)protected voidsetStart(Point start)voidsetStrand(Strand strand)voidsetSubLocations(List<Location> subLocations)StringtoString()- 
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 Detail
- 
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 Detail
- 
assertLocation
protected void assertLocation()
 
- 
getLength
public int getLength()
Description copied from interface:LocationReturns the length of the outer bounds of this location 
- 
getStrand
public Strand getStrand()
Description copied from interface:LocationStrand which the location is located on 
- 
getSubLocations
public List<Location> getSubLocations()
Description copied from interface:LocationGives access to the sub locations for this location. However this does not return sub-locations of sub-locations. For that functionality use#getAllSubLocations().- Specified by:
 getSubLocationsin interfaceLocation- Returns:
 - A list of a single level of sub-locations
 
 
- 
isComplex
public boolean isComplex()
Description copied from interface:LocationReturns true if the location is considered to be complex meaning the location is actually composed of sub-locations. 
- 
getAccession
public AccessionID getAccession()
Description copied from interface:AccessionedReturns the AccessionID this location is currently bound with- Specified by:
 getAccessionin interfaceAccessioned
 
- 
isPartialOn5prime
public boolean isPartialOn5prime()
 
- 
setPartialOn5prime
public void setPartialOn5prime(boolean partialOn5prime)
 
- 
isPartialOn3prime
public boolean isPartialOn3prime()
 
- 
setPartialOn3prime
public void setPartialOn3prime(boolean partialOn3prime)
 
- 
isPartial
public boolean isPartial()
 
- 
iterator
public Iterator<Location> iterator()
Iterates through all known sub-locations for this location but does not descend 
- 
getRelevantSubLocations
public List<Location> 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:
 getRelevantSubLocationsin interfaceLocation- Returns:
 - List of all sub locations including sub-locations of sub locations
 
 
- 
isCircular
public boolean isCircular()
Description copied from interface:LocationIndicates if this location is circular.- Specified by:
 isCircularin interfaceLocation
 
- 
isBetweenCompounds
public boolean isBetweenCompounds()
Description copied from interface:LocationReturns 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:
 isBetweenCompoundsin interfaceLocation
 
- 
getSubSequence
public <C extends Compound> Sequence<C> getSubSequence(Sequence<C> sequence)
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:
 getSubSequencein interfaceLocation- Parameters:
 sequence- The sequence object to work with- Returns:
 - The sequence
 
 
- 
getRelevantSubSequence
public <C extends Compound> Sequence<C> getRelevantSubSequence(Sequence<C> sequence)
Description copied from interface:LocationWill 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:
 getRelevantSubSequencein interfaceLocation- Parameters:
 sequence- The sequence object to work with- Returns:
 - The full assembled sequence
 
 
- 
reverseSequence
protected <C extends Compound> Sequence<C> reverseSequence(Sequence<C> sequence)
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
protected <C extends Compound> boolean canComplement(Sequence<C> sequence)
Uses the Sequence's CompoundSet to decide if a compound can be assgined to ComplementCompound meaning it can complement 
- 
setCircular
protected void setCircular(boolean circular)
 
- 
setBetweenCompounds
public void setBetweenCompounds(boolean betweenCompounds)
 
- 
setSubLocations
public void setSubLocations(List<Location> subLocations)
 
- 
setAccession
public void setAccession(AccessionID accession)
 
 - 
 
 -