RichLocation.Tools (BioJava-1.5-beta API)
Keywords: org.biojavax.bio.seq.RichLocation.Tools class

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.biojavax.bio.seq
Class RichLocation.Tools

    java.lang.Object
      org.biojavax.bio.seq.RichLocation.Tools

Enclosing interface:
  RichLocation

    public static class RichLocation.Tools

extends Object

Some useful tools for working with Locations.

Method Summary
`static RichLocation` | `construct(Collection members)` Constructs a RichLocation object based on the given collection of members.
`static RichLocation` | `enrich(Location l)` Attempts to convert a plain Location into a RichLocation.
`static Collection` | `flatten(Collection members)` Takes a set of locations and returns the set of all members.
`static Collection` | `flatten(RichLocation location)` Takes a location and returns the set of all members.
`static boolean` | `isMultiSource(Collection members)` Returns false if all the locations in the set are from the same strand of the same sequence.
`static Collection` | `merge(Collection members)` Takes a set of locations and tries to merge all pairs where the union operation results in a simple rich location, not a compound one.
`static int` | `modulateCircularIndex(int index, int seqLength)` Takes a point on a circular location and moves it left until it falls at the earliest possible point that represents the same base.
`static int[]` | `modulateCircularLocation(int start, int end, int seqLength)` Takes a start and end position on a circular location of given length, and shifts them left along the sequence until they sit at the earliest possible point where they still would represent the same sequence.
`static int[]` | `modulateCircularLocationPair(Location a, Location b, int seqLength)` Takes two circular locations of given length, and shifts them left along the sequence until they sit at the earliest possible point where they still would represent the same sequence.

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

Method Detail

### construct

    public static RichLocation construct(Collection members)

  Constructs a RichLocation object based on the given collection of members. It first tries to merge them together. If the merge results in a single location, that is returned. If it results in multiple locations it returns a CompoundRichLocation covering them all, with the default term associated. Else, it returns the empty location if the set was empty.

  Parameters:
    `members` - the members to construct a location from.
  Returns:
    the corresponding RichLocation

### isMultiSource

    public static boolean isMultiSource(Collection members)

  Returns false if all the locations in the set are from the same strand of the same sequence.

  Parameters:
    `members` - the set of locations to check.
  Returns:
    true if they are from multiple sources.

### merge

    public static Collection merge(Collection members)

  Takes a set of locations and tries to merge all pairs where the union operation results in a simple rich location, not a compound one.

  Parameters:
    `members` - the members to merge
  Returns:
    the resulting merged set, which may have only one location in it.

### flatten

    public static Collection flatten(RichLocation location)

  Takes a location and returns the set of all members. If any members are compound, it flattens them too.

  Parameters:
    `location` - the location to flatten
  Returns:
    the flattened collection of members.

### flatten

    public static Collection flatten(Collection members)

  Takes a set of locations and returns the set of all members. If any members are compound, it flattens them too.

  Parameters:
    `members` - the locations to flatten
  Returns:
    the flattened collection of members.

### modulateCircularLocation

    public static int[] modulateCircularLocation(int start,
                                                 int end,
                                                 int seqLength)

  Takes a start and end position on a circular location of given length, and shifts them left along the sequence until they sit at the earliest possible point where they still would represent the same sequence.

  Parameters:
    `start` - the start of the circular location
    `end` - the end of the circular location
    `seqLength` - the circular length of the sequence underlying the location
  Returns:
    an integer array where [0] is the translated start and [1] the end.

### modulateCircularLocationPair

    public static int[] modulateCircularLocationPair(Location a,
                                                     Location b,
                                                     int seqLength)

  Takes two circular locations of given length, and shifts them left along the sequence until they sit at the earliest possible point where they still would represent the same sequence. The end result ensures that simple overlap calculations will always work on the coordinates returned.

  Parameters:
    `a` - the first location to shift
    `b` - the second location to shift
    `seqLength` - the circular length of the sequence underlying the location
  Returns:
    an integer array where [0] is the translated start and [1] the end of location a, and [2] and [3] are the translated start and end of location b.

### modulateCircularIndex

    public static int modulateCircularIndex(int index,
                                            int seqLength)

  Takes a point on a circular location and moves it left until it falls at the earliest possible point that represents the same base.

  Parameters:
    `index` - the point on the location to shift
    `seqLength` - the size of the circular location
  Returns:
    the shifted point

### enrich

    public static RichLocation enrich(Location l)

  Attempts to convert a plain Location into a RichLocation.

  Parameters:
    `l` - the location to convert
  Returns:
    the converted location

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