Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.ensembl.datamodel
Class Location

    java.lang.Object
      org.ensembl.datamodel.Location

All Implemented Interfaces:
  java.lang.Cloneable, java.lang.Comparable, java.io.Serializable

Direct Known Subclasses:
  AssemblyLocation, CloneFragmentLocation

public class Location
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable, java.lang.Comparable

A Location is an 'address' of regions on sequences.

Each Location is defined by a coordinate system (e.g. "chromosome", "contig", "supercontig"), sequence region (e.g. "X") and a region (start, end and strand).

Ensembl supports multiple coordinate systems; if a Location's coordinate system is "chromosome" then it's sequence region is a chromosome such as "X" or "21". Similarly if the coordinate system is "contig" then it's sequence region is a contig. It is often possible to convert locations from one coordinate system to another using a `LocationConverter`. e.g. `driver.getLocationConverter().convert(loc, "chromosome")`

Locations can exist as a single instance or as a node in a linked list of Locations but most users will only deal explicitly with the single instance flavour of locations. There are various cases where list behaviour is desirable because the thing being represented jumps parts of a sequence region. For example the translation coding location represents the coding part of exons and "jumps" introns and the non-coding parts of exons on a sequence. List related methods include next() , setNext(Location) , last() and append(Location) . getNodeLength() returns the length of this node and getLength() returns the combined length of all nodes in the list from this one to the last. If this node is the head of a list then length() returns the length for the whole list. containsGapNodes() and removeGapNodes() are also list aware methods for confirming the existence of gap nodes in a list and removing them respectively.

Useful methods:

- Equality: Use `loc1.compareTo(loc2)==0` to test for value equality. Use equals() to test for object identity. (The equals() and hashCode() methods are not overidden for performance reasons.)
- Change region: transform(int, int) is useful for resizing locations and finding flanking, explanded and cropped locations.
- Overlapping Locations: Whether locations overlap and the size of any overlap can be determined using overlaps(Location) , overlaps(Location, boolean) , overlapSize(Location) and overlapSize(Location, boolean) . Note that strand is ignored by default. If you want to take strand into account you should use the boolean flag version of the methods.
- Sorting: Arrays and collections of locations can be easily sorted because Location implements the Comparable interface. e.g. `Collections.sort(listOfLocation)` and `java.util.Arrays.sort(arrayOfLocations)`

See Also:
  `CoordinateSystem`, `SequenceRegion`, `LocationConverter`, Serialized Form

Constructor Summary
`Location(CoordinateSystem cs)` Location representing the whole coordinate system.
`Location(CoordinateSystem cs, boolean gap, int length)` Constructs a location with map=CloneFragmentLocation.DEFAULT_CS, start=1, end=length+1, strand=unset and whether it is a gap.
`Location(CoordinateSystem cs, SequenceRegion seqRegion)`
`Location(CoordinateSystem cs, java.lang.String seqRegionName)` The whole of the sequence region in the default version of the specified coordinate system.
`Location(CoordinateSystem cs, java.lang.String seqRegionName, int start, int end)` Default values: strand = 0, gap = false.
`Location(CoordinateSystem cs, java.lang.String seqRegionName, int start, int end, int strand)`
`Location(CoordinateSystem cs, java.lang.String seqRegionName, int start, int end, int strand, boolean gap)`
`Location(Location[] locations)` Create a list location by appending copies of the items in _locations_.
`Location(long seqRegionInternalID, int start, int end, int strand)` Create a location as a range on a sequence region defined by it's internalID.
`Location(java.lang.String s)` Location object is initialized to the value of the specified string.
`Location(java.lang.String coordinateSystemName, java.lang.String seqRegionName)` The whole of the sequence region in the default version of the specified coordinate system.
`Location(java.lang.String coordinateSystemName, java.lang.String seqRegionName, int start, int end)` Both strands of the sequence region from _start_ to _end_ in the default version of the specified coordinate system.
`Location(java.lang.String coordinateSystemName, java.lang.String seqRegionName, int start, int end, int strand)` The strand of the sequence region from _start_ to _end_ in the default version of the specified coordinate system.

Method Summary
`Location` | `append(Location location)`
`java.lang.Object` | `clone()` Performs a deep copy.
`int` | `compareTo(java.lang.Object other)` Iterate through this location and the other one comparing them.
`Location` | `complement()` "Complements" strand.
`boolean` | `containsGapNodes()` Returns whether this location contains a gap node.
`Location` | `copy()` Performs a deep copy.
`Location` | `copyNode()` Performs a deep of the head node.
`int` | `diff(Location otherLocation)` Convenience method to find the difference between to locations.
`CoordinateSystem` | `getCoordinateSystem()`
`int` | `getEnd()` End of this location node on the region.
`java.lang.String` | `getEndAsFormattedString()` Formats end by inserting commas every 3 decimal places.
`int` | `getGap()` Deprecated. Since ensj28.3. Use getLength() instead.
`int` | `getLength()` Sum of this nodeLength and any other ones after it in location list.
`java.lang.String` | `getLengthAsFormattedString()` Formats length by inserting commas every 3 decimal places.
`int` | `getNodeCount()` Number of nodes in list.
`int` | `getNodeLength()` Length is calculated by end - start + 1.
`java.lang.String` | `getNodeLengthAsFormattedString()` Formats nodeLength by inserting commas every 3 decimal places.
`long` | `getSegRegionID()` Return the sequence region internal ID this location node is on.
`java.lang.String` | `getSeqRegionName()`
`SequenceRegion` | `getSequenceRegion()`
`int` | `getStart()` Start of this location node on the region.
`java.lang.String` | `getStartAsFormattedString()` Formats start by inserting commas every 3 decimal places.
`int` | `getStrand()`
`boolean` | `hasNext()`
`boolean` | `isComplete()` The location is complete if it species a region unambiguously.
`boolean` | `isCoordinateSystemSet()`
`boolean` | `isEndSet()`
`boolean` | `isGap()` Return whether this node is a gap.
`boolean` | `isSeqRegionNameSet()`
`boolean` | `isStartSet()`
`boolean` | `isStrandSet()`
`Location` | `last()` Last node in location list.
`Location` | `mergeAdjacentNodes()` Merges nodes in this location that are adjacent on a sequence.
`Location` | `next()`
`boolean` | `overlaps(Location other)` Calls `overlaps(location,false)`.
`boolean` | `overlaps(Location other, boolean requireStrandsOverlap)` Checks if locations overlap each other.
`int` | `overlapSize(Location other)` Calls `overlapSize(location,true)`.
`int` | `overlapSize(Location other, boolean requireStrandsOverlap)` Finds the number of bases this location shares with the other location.
`Location` | `relative(int offset)` Creates a new 1 base pair location relative to this location where newLocation.start = newLocation.end = this.start + offset.
`Location` | `relative(int offset, int length)` Creates a new location relative to this location where start=this.start+offset, and end=this.start+length-1.
`Location` | `removeGapNodes()` Returns a location derived by removing all gap nodes from this location, null if only gaps present.
`void` | `setCoordinateSystem(CoordinateSystem cs)`
`void` | `setEnd(int end)` Sets the end attribute.
`void` | `setGap(boolean gap)`
`void` | `setNext(Location next)`
`void` | `setSegRegionID(long sequenceRegionInternalID)` Set the sequence region internal ID this location node is on.
`void` | `setSeqRegionName(java.lang.String seqRegionName)`
`void` | `setSequenceRegion(SequenceRegion sequenceRegion)`
`void` | `setStart(int start)` Sets the start.
`void` | `setStrand(int strand)` Sets the strand.
`int` | `size()` Returns number of elements in location list.
`java.lang.String` | `toString()` Converts all nodes into a string.
`java.lang.String` | `toString(boolean all, boolean extraInformation)` Converts this node into a string.
`java.lang.String` | `toString(boolean all, boolean extraInformation, boolean formatBigNumbers)` Converts this node into a string.
`Location` | `transform(int startDiff, int endDiff)` Transforms this location into another by changing the start and end positions.
`Location` | `transformNode(int startDiff, int endDiff)` Resizes location node taking into account the strand and ignoring rest of location list if present.

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### Location

    public Location(CoordinateSystem cs,
                    java.lang.String seqRegionName,
                    int start,
                    int end)
             throws InvalidLocationException

  Default values: strand = 0, gap = false.

Parameters:
  `cs` -
  `seqRegionName` -
  `start` -
  `end` -
Throws:
  `InvalidLocationException`

### Location

    public Location(java.lang.String coordinateSystemName,
                    java.lang.String seqRegionName,
                    int start,
                    int end)
             throws InvalidLocationException

  Both strands of the sequence region from _start_ to _end_ in the default version of the specified coordinate system.

Parameters:
  `coordinateSystemName` - The name of the CoordinateSystem this location is expressed in.
  `seqRegionName` - The name of the sequence region.
  `start` - Start position, >=0.
  `end` - End position, end>start.
Throws:
  `InvalidLocationException` - if location invalid.

### Location

    public Location(java.lang.String coordinateSystemName,
                    java.lang.String seqRegionName,
                    int start,
                    int end,
                    int strand)
             throws InvalidLocationException

  The strand of the sequence region from _start_ to _end_ in the default version of the specified coordinate system.

Parameters:
  `coordinateSystemName` - The name of the CoordinateSystem this location is expressed in.
  `seqRegionName` - The name of the sequence region.
  `start` - Start position, >=0.
  `end` - End position, end>start.
  `strand` - Strand -1,0 (unstranded) or +1.
Throws:
  `InvalidLocationException` - if location invalid.

### Location

    public Location(java.lang.String s)
             throws java.text.ParseException

  Location object is initialized to the value of the specified string. Below are examples demonstrating the supported format for the string.

  Examples:
  - "chromosome:20:50000000-51000000:0" Bases from both strands of chromosome 20 in the range 50m to 51m using the default version of the "chromosome" coordinate system.
  - "chromosome:20" All of chromosome 20.
  - "chromosome:20:33" All of Chromosome 20 from the 33rd base onwards.
  - "chromosome_2:20:33" All of Chromosome 20 from the 33rd base onwards from coordinate system "chromosome" version "2".
  - "chromosome:20:33-" Same.
  - "chromosome:20:33-40" All of Chromosome 20 from the 33rd to the 40th base inclusive.
  - "chromosome:20:33-40:1" The positive strand of chromosome 20 from the 33rd to the 40 base inclusive.
  - "chromosome:20:-40" The first 40 bases of chromosome 20.
  - "chromosome:20:-:1" The positive strand of chromosome 20.
  - "chromosome:x:1000000-2000000" X chromsome from 10m to 20m bases.
  - "chromosome:x:1m-2m" Same.
  - "chromosome:x:1,000,000-2,000,000:1" Same.
  - "chromosome:x:1k-2k" X chromsome from 1,000 to 2,000 bases.

Parameters:
  `s` - The string to be parsed.
Throws:
  `java.text.ParseException` - if the string can not be parsed as an AssemblyLocation.

### Location

    public Location(CoordinateSystem cs,
                    java.lang.String seqRegionName,
                    int start,
                    int end,
                    int strand,
                    boolean gap)
             throws InvalidLocationException

Parameters:
  `cs` - The CoordinateSystem that this location is expressed in.
  `start` - Start position, >=0.
  `end` - End position, end>start.
  `strand` - Strand -1,0 (unstranded) or +1.
  `gap` - whether the location is a gap.
Throws:
  `InvalidLocationException` - if location invalid.

### Location

    public Location(CoordinateSystem cs,
                    java.lang.String seqRegionName,
                    int start,
                    int end,
                    int strand)
             throws InvalidLocationException

### Location

    public Location(long seqRegionInternalID,
                    int start,
                    int end,
                    int strand)
             throws InvalidLocationException

  Create a location as a range on a sequence region defined by it's internalID. The method LocationConverter.completeSeqRegionNameAndCoordinateSystem(...) can 'fill in' the seq region name and coordinate system using this information. The use of that method and this class allows for certain optimisations.

Parameters:
  `seqRegionInternalID` - internal ID of sequence region location is on.
  `start` - start position on the sequence region. start<=end.
  `end` - end position on the sequence region. end>=start.
  `strand` - strand on sequence region. -1,0,+1
Throws:
  `InvalidLocationException`
See Also:
  `LocationConverter.assignSeqRegionNameAndCoordinateSystem(Location)`

### Location

    public Location(CoordinateSystem cs)
             throws InvalidLocationException

  Location representing the whole coordinate system.

Parameters:
  `cs` - The CoordinateSystem that this location is expressed in.
Throws:
  `InvalidLocationException` - if location invalid.

### Location

    public Location(CoordinateSystem cs,
                    java.lang.String seqRegionName)
             throws InvalidLocationException

  The whole of the sequence region in the default version of the specified coordinate system.

Parameters:
  `cs` - The CoordinateSystem that this location is expressed in.
  `seqRegionName` - The name of the sequence region.
Throws:
  `InvalidLocationException` - if location invalid.

### Location

    public Location(java.lang.String coordinateSystemName,
                    java.lang.String seqRegionName)
             throws InvalidLocationException

  The whole of the sequence region in the default version of the specified coordinate system.

Parameters:
  `coordinateSystemName` - The name of the CoordinateSystem this location is expressed in.
  `seqRegionName` - The name of the sequence region.
Throws:
  `InvalidLocationException` - if location invalid.

### Location

    public Location(CoordinateSystem cs,
                    SequenceRegion seqRegion)
             throws InvalidLocationException

Parameters:
  `cs` - The CoordinateSystem that this location is expressed in.
  `seqRegion` - The sequence region.
Throws:
  `InvalidLocationException` - if location invalid.

### Location

    public Location(CoordinateSystem cs,
                    boolean gap,
                    int length)
             throws InvalidLocationException

  Constructs a location with map=CloneFragmentLocation.DEFAULT_CS, start=1, end=length+1, strand=unset and whether it is a gap.

Parameters:
  `cs` - The CoordinateSystem that this location is expressed in.
  `gap` - Whether this Location is a gap.
  `length` - The length of the location.
Throws:
  `InvalidLocationException` - if location invalid.

### Location

    public Location(Location[] locations)
             throws java.lang.IllegalArgumentException

  Create a list location by appending copies of the items in _locations_.

Parameters:
  `locations` - list of 1 or more locations

Method Detail

### isComplete

    public boolean isComplete()

  The location is complete if it species a region unambiguously. The region is specified unambiguously if, for all nodes, start>=1, end>=1, seqName!=null and the coordinate system is complete.

  Returns:
    true if the location is complete, otherwise false.

### getEnd

    public int getEnd()

  End of this location node on the region.

  Returns:
    end position.

### getEndAsFormattedString

    public java.lang.String getEndAsFormattedString()

  Formats end by inserting commas every 3 decimal places. Can make large numbers easier to read. e.g. 1003298 -> 1,003,298.

  Returns:
    end with commas every 3 decimal places.

### setEnd

    public final void setEnd(int end)

  Sets the end attribute. Can only be called when seqRegionName is not null.

  Parameters:
    `end` - end position. end>start. end>=0. Where 0 means unset.
  Throws:
    `InvalidLocationException` - if end>start.
    `java.lang.IllegalStateException` - if seqRegionName is null.

### isEndSet

    public boolean isEndSet()

### getStrand

    public int getStrand()

### setStrand

    public void setStrand(int strand)

  Sets the strand. Can only be called when seqRegionName is not null.

  Parameters:
    `strand` - -1,0 (unstranded) or +1
  Throws:
    `InvalidLocationException` - if strand invalid.
    `java.lang.IllegalStateException` - if seqRegionName is null.

### isStrandSet

    public boolean isStrandSet()

  Returns:
    true if strand is +1 or -1, false if strand is 0.

### getStart

    public int getStart()

  Start of this location node on the region.

  Returns:
    start position.

### getStartAsFormattedString

    public java.lang.String getStartAsFormattedString()

  Formats start by inserting commas every 3 decimal places. Can make large numbers easier to read. e.g. 1003298 -> 1,003,298.

  Returns:
    start with commas every 3 decimal places.

### setStart

    public final void setStart(int start)

  Sets the start. Can only be called when seqRegionName is not null.

  Parameters:
    `start` - Start position, >=0. Where 0 means unset.
  Throws:
    `InvalidLocationException` - if start <0.

### isStartSet

    public boolean isStartSet()

### getCoordinateSystem

    public CoordinateSystem getCoordinateSystem()

### setCoordinateSystem

    public void setCoordinateSystem(CoordinateSystem cs)

### isCoordinateSystemSet

    public boolean isCoordinateSystemSet()

### getNodeLength

    public int getNodeLength()

  Length is calculated by end - start + 1. If start is not set length equals end (end = end - 1 + 1).

  Returns:
    length if end is set, otherwise -1.
  See Also:
    `getNodeLengthAsFormattedString()`

### getNodeLengthAsFormattedString

    public java.lang.String getNodeLengthAsFormattedString()

  Formats nodeLength by inserting commas every 3 decimal places. Can make large numbers easier to read. e.g. 1003298 -> 1,003,298.

  Returns:
    nodeLength with commas every 3 decimal places.
  See Also:
    `getNodeLength()`

### transform

    public Location transform(int startDiff,
                              int endDiff)
                       throws InvalidLocationException

  Transforms this location into another by changing the start and end positions. The new location will have start and end >=1;

           if strand==0 or strand==+1: start += startDiff end += endDiff elseif strand==-1 start -= endDiff end -= startDiff

  Example- expand location: Add 1000 bases to the upstream side of the location, and none to the downstream side. `loc.transform( -1000, 0);`

  Example- flanking location: Represent the 1000 bases downstream of the location. `loc.transform( loc.getLength(), 1000+1);`

  Example- crop location: Represent the location minus the first 100 and last 50 bases. `loc.transform( 100, -50);`

  *

  Parameters:
    `startDiff` - difference to make to start position.
    `endDiff` - difference to make to end position.
  Returns:
    a new location representing a transformed version of this location.
  Throws:
    `InvalidLocationException` - if start>end

### transformNode

    public Location transformNode(int startDiff,
                                  int endDiff)

  Resizes location node taking into account the strand and ignoring rest of location list if present. The new location will have start and end >=1; Only use this method if you want operate on a single node, most use cases should use transform(int, int).

  Parameters:
    `startDiff` - number of bases by which to change the start.
    `endDiff` - number of bases which to change the end of the location.
  Returns:
    a new location representing a transformed version of this location.
  Throws:
    `InvalidLocationException` - if changes start>end

### complement

    public Location complement()

  "Complements" strand. Converts +1 to -1 and -1 to +1. Does copy and flip order of pieces if location is unstranded (strand is 0).

  Returns:
    new location that is the complement of this one

### toString

    public java.lang.String toString()

  Converts all nodes into a string.

  Returns:
    string representation of the location including all nodes.
  See Also:
    `toString(boolean,boolean)`, `toString(boolean,boolean,boolean)`

### toString

    public java.lang.String toString(boolean all,
                                     boolean extraInformation)

  Converts this node into a string. If _all_ is true then all nodes in the linked list are appended to the string.

  Parameters:
    `all` - whether to include the nodes other than just this one in the string
  Returns:
    string representation of the location.

### toString

    public java.lang.String toString(boolean all,
                                     boolean extraInformation,
                                     boolean formatBigNumbers)

  Converts this node into a string. If _all_ is true then all nodes in the linked list are appended to the string.

  Parameters:
    `all` - whether to include the nodes other than just this one in the string
  Returns:
    string representation of the location.

### clone

    public java.lang.Object clone()

  Performs a deep copy. It is easier to use copy() which prevents the need for a caste to Location in many cases.

  Returns:
    deep copy of this instance.
  See Also:
    `copy()`

### copy

    public Location copy()

  Performs a deep copy.

  Returns:
    deep copy of this instance.

### copyNode

    public Location copyNode()

  Performs a deep of the head node. The next pointer is set to null in the returned node, i.e. `loc.copyNode().next()==null`.

  Returns:
    deep copy of this node instance.

### relative

    public Location relative(int offset)
                      throws InvalidLocationException

  Creates a new 1 base pair location relative to this location where newLocation.start = newLocation.end = this.start + offset.

  Parameters:
    `offset` - number of bases from the start current start
  Returns:
    new location at specified position
  Throws:
    `InvalidLocationException` - if start not set or offset is invalid

### relative

    public Location relative(int offset,
                             int length)
                      throws InvalidLocationException

  Creates a new location relative to this location where start=this.start+offset, and end=this.start+length-1.

  Parameters:
    `offset` - number of bases from the start of this location, any int is valid
    `length` - length of the new location, >=1
  Returns:
    new location at specified position
  Throws:
    `InvalidLocationException` - if start not set, length is <1 or the new location is invalid

### diff

    public int diff(Location otherLocation)

  Convenience method to find the difference between to locations. Works on first node in list.

  Returns:
    otherLocation.start - location.start

### getLength

    public int getLength()

  Sum of this nodeLength and any other ones after it in location list.

  Returns:
    total length of this location (list) or -1 if this node or one of it's subsequent locations has nodeLength=-1.
  See Also:
    `getLengthAsFormattedString()`

### getLengthAsFormattedString

    public java.lang.String getLengthAsFormattedString()

  Formats length by inserting commas every 3 decimal places. Can make large numbers easier to read. e.g. 1003298 -> 1,003,298.

  Returns:
    length with commas every 3 decimal places.
  See Also:
    `getLength()`

### last

    public Location last()

  Last node in location list. If only one element it returns this one.

  Returns:
    last node in list.

### isGap

    public boolean isGap()

  Return whether this node is a gap.

  Returns:
    true if this node is a gap.

### setGap

    public final void setGap(boolean gap)

### getGap

    public int getGap()

  Deprecated. Since ensj28.3. Use getLength() instead.

  Returns length of gap.

  Returns:
    length;
  See Also:
    `getLength()`

### size

    public int size()

  Returns number of elements in location list.

### next

    public Location next()

  Returns:
    next node in list.

### setNext

    public final void setNext(Location next)

### hasNext

    public boolean hasNext()

  Returns:
    true if next!=null.

### append

    public Location append(Location location)

### overlaps

    public boolean overlaps(Location other,
                            boolean requireStrandsOverlap)

  Checks if locations overlap each other.

  Parameters:
    `other` - other location
    `requireStrandsOverlap` - whether the strands should overlap.
  Returns:
    true if locations overlap.

### overlaps

    public boolean overlaps(Location other)

  Calls `overlaps(location,false)`.

  Parameters:
    `other` - other location
  Returns:
    whether this location overlaps with the other location
  See Also:
    `overlaps(Location,boolean)`

### overlapSize

    public int overlapSize(Location other,
                           boolean requireStrandsOverlap)

  Finds the number of bases this location shares with the other location.

  Possible problem: The coordinate system name AND version need to be the same for the locations to overlap. If either of these is unset then the the locations are not considered to overlap. For example, even if the gene with internal ID = 111 IS inside the first 1m bases of chromosome 1 then this use of overlapSize() will return 0 which is probably not what is expected.

          Location loc = new Location("chromosome:1:1-1m")
          // get the location for a gene
          Location loc2 = geneAdaptor.fetch(111).getLocation()
          int overlap = loc.overlapSize(loc2);

  and then call loc.overlaps(loc2) where This is because the gene.location.coordinateSystem.version is set by the geneAdaptor but loc.coordinateSystem.version is null. To ensure that the code works as intended `loc` should be complete . i.e. all fields should be set. This can be achieved like this:

          Location loc = locationConverter.fetchComplete(new Location("chromosome:1:1-1m"));
          // get the location for a gene
          Location loc2 = geneAdaptor.fetch(111).getLocation()
          int overlap = loc.overlapSize(loc2);

  and then call loc.overlaps(loc2) where

  Parameters:
    `other` - other location.
    `requireStrandsOverlap` - whether the strands should overlap.
  Returns:
    number of bases this location shares with other. Between 0 and getLength().
  Throws:
    `java.lang.IllegalArgumentException` - if "start" or "end" is not set on any of the location nodes in either this instance or other.

### overlapSize

    public int overlapSize(Location other)

  Calls `overlapSize(location,true)`.

  Parameters:
    `other` - other location
  Returns:
    number of bases the locations overlap by
  See Also:
    `overlapSize(Location,boolean)`

### compareTo

    public int compareTo(java.lang.Object other)

  Iterate through this location and the other one comparing them. The order of the attributes used for the ordering is: coordinateSystem, seqRegionName, start, end, strand.

  Specified by:
    `compareTo` in interface `java.lang.Comparable`
  Returns:
    -1 if this location is before other, 0 if it is equivalent, 1 if it is after it.

### getSeqRegionName

    public java.lang.String getSeqRegionName()

  Returns:
    sequence region name.

### isSeqRegionNameSet

    public boolean isSeqRegionNameSet()

### setSeqRegionName

    public void setSeqRegionName(java.lang.String seqRegionName)

  Parameters:
    `seqRegionName` -
  Throws:
    `java.lang.IllegalStateException` - if coordinate system is null.

### getSequenceRegion

    public SequenceRegion getSequenceRegion()

  Returns:
    sequenceRegion if set, otherwise null.

### setSequenceRegion

    public void setSequenceRegion(SequenceRegion sequenceRegion)

  Parameters:
    `sequenceRegion` - sequence region for this location. null if you want to remove a previously set sequence region.

### setSegRegionID

    public void setSegRegionID(long sequenceRegionInternalID)

  Set the sequence region internal ID this location node is on.

  Returns:
    set the sequence region internal ID. Set it to -1 to 'unset' it.

### getSegRegionID

    public long getSegRegionID()

  Return the sequence region internal ID this location node is on.

  Returns:
    sequence region internal ID, or -1 if not set.

### mergeAdjacentNodes

    public Location mergeAdjacentNodes()

  Merges nodes in this location that are adjacent on a sequence. Does nothing if this is a single node location or the nodes are not adjacent. Two nodes are merged when node.end+1 == node.next().start. In this case node.setEnd(node.next().end) and node.setNext(node.next()).

  Returns:
    this node.

### getNodeCount

    public int getNodeCount()

  Number of nodes in list.

  Returns:
    number of nodes in list, 1 if node.next is null.

### containsGapNodes

    public boolean containsGapNodes()

  Returns whether this location contains a gap node. Returns true if at least one node in the location is a gap.

  Returns:
    true if this location contains a gap node, otherwise false.
  See Also:
    `isGap()`

### removeGapNodes

    public Location removeGapNodes()

  Returns a location derived by removing all gap nodes from this location, null if only gaps present. If this location contains no gaps then this location is returned unmodified. If the location consists only of gaps then null is returned. If the location contains at least one gap and at least one none gap then a new node is returned.

  Returns:
    location derived by removing all gaps from this location, null if only gaps present and this node if it contains no gaps.
  See Also:
    `isGap()`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD