Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Compound Members File Members

# gnLocation Class Reference

This class is used to store sequence locations. More...

`#include <gnLocation.h>`

Inheritance diagram for gnLocation::

List of all members.

## Public Types
enum | intersectRestriction { determinedRegions, undeterminedRegions, allRegions }
enum | gnLocationType { LT_Standard, LT_BetweenBases, LT_Complement, LT_Order, LT_Group, LT_OneOf, LT_Nothing }
## Public Methods
| gnLocation ()
| Empty constructor, does nothing. More...
| gnLocation (const gnLocation &s)
| Copy constructor, copies a gnLocation. More...
| gnLocation (const gnSeqI start, const gnSeqI end, const gnLocationType type=LT_Standard, string contigName="")
| Constructor, creates a gnLocation. More...
| gnLocation (const gnSeqI start, const gnSeqI startLength, const gnSeqI end, gnSeqI endLength, const gnLocationType type=LT_Standard, string contigName="")
| Constructor, creates a gnLocation. More...
gnLocation* | Clone () const
void | Clear ()
| Resets this location to default values. More...
boolean | CropTo (const gnLocation &l)
| Crops this location to fit within the specified location boundaries. More...
boolean | CropStart (const gnSeqI start)
| Crops the start location by the specified amount. More...
boolean | CropEnd (const gnSeqI end)
| Crops the end location by the specified amount. More...
boolean | Intersects (const gnLocation &l, const intersectRestriction ir=allRegions) const
| Returns true if the given location intersects this location in the region specified by the parameter "ir". More...
boolean | Contains (const gnLocation &l, const intersectRestriction cr=allRegions) const
| Crops the end location by the specified amount. More...
boolean | MovePositive (const gnSeqI diff)
| Increases the location start and end. More...
boolean | MoveNegative (const gnSeqI diff)
| Decreases the location start and end. More...
boolean | MoveTo (const int direction, const gnSeqI diff)
| Moves the location start and end. More...
gnSeqI | GetEnd () const
| Gets the ending base pair. More...
gnSeqI | GetEndLength () const
| Gets the ending base pair's definition value. More...
gnSeqI | GetLast () const
gnSeqI | GetStart () const
| Gets the starting base pair. More...
gnSeqI | GetStartLength () const
| Gets the starting base pair's definition value. More...
gnSeqI | GetFirst () const
gnLocationType | GetType () const
| Gets the location type. More...
void | GetBounds (gnSeqI &s, gnSeqI &sl, gnSeqI &e, gnSeqI &el) const
| Gets the location's boundaries. More...
bool | IsEndBoundLonger () const
| Returns true if the end is unbounded to the right. More...
bool | IsStartBoundLonger () const
| Returns true if the start is unbounded to the right. More...
bool | IsEndBoundShorter () const
| Returns true if the end is unbounded to the left. More...
bool | IsStartBoundShorter () const
| Returns true if the start is unbounded to the left. More...
void | SetEnd (const gnSeqI end)
| Sets the end location. More...
void | SetEnd (const gnSeqI end, const gnSeqI endLength)
| Sets the end location and definition. More...
void | SetEndLength (const gnSeqI endLength)
| Sets the end definition. More...
void | SetStart (const gnSeqI start)
| Sets the start location/. More...
void | SetStart (const gnSeqI start, const gnSeqI startLength)
| Sets the start location and definition. More...
void | SetStartLength (const gnSeqI startLength)
| Sets the start definition. More...
void | SetType (const gnLocationType lt)
| Sets the location type. More...
void | SetBounds (const gnSeqI start, const gnSeqI startLength, const gnSeqI end, const gnSeqI endLength)
| Sets the location's boundaries. More...
void | SetBounds (const gnSeqI start, const gnSeqI end)
| Sets the location's boundaries. More...
gnLocation | GetUnion (const gnLocation &l) const
gnLocation | GetIntersection (const gnLocation &l, const intersectRestriction ir) const
## Static Public Attributes
const gnSeqI | Defined = 0
const gnSeqI | Unknown = GNSEQI_END
## Private Attributes
string | m_name
gnSeqI | m_start
gnSeqI | m_startLength
gnSeqI | m_end
gnSeqI | m_endLength
gnLocationType | m_type

## Detailed Description

This class is used to store sequence locations.

gnBaseFeature uses it to track feature locations. gnLocation is capable of representing any GenBank style location qualifier. gnLocation stores the start coordinate and a startLength value which represents the length of an undetermined region of sequence prior to the starting coordinate. A startLength of GNSEQI_END represents an unknown start, whereas a startLength of 0 implies that the start coordinate is unambiguous. Any value other value indicates a range of coordinates for the starting position. The range is bounded by the given start coordinate and extends startLength characters upstream. Likewise, an endLength of GNSEQI_END represents an unknown ambiguous end coordinate, and an endLength of 0 implies that the end coordinate is unambiguous. Any other value for endLength denotes a range of ending coordinates starting at end and continuing for endLength characters.

Definition at line 37 of file gnLocation.h.

## Member Enumeration Documentation

enum gnLocation::gnLocationType

  | Enumeration values:
  LT_Standard |
  LT_BetweenBases |
  LT_Complement |
  LT_Order |
  LT_Group |
  LT_OneOf |
  LT_Nothing |
Definition at line 46 of file gnLocation.h.

enum gnLocation::intersectRestriction

  | Enumeration values:
  determinedRegions |
  undeterminedRegions |
  allRegions |
Definition at line 40 of file gnLocation.h.

## Constructor & Destructor Documentation

gnLocation::gnLocation ( | )

| Empty constructor, does nothing. Definition at line 16 of file gnLocation.cpp. Referenced by Clone().

gnLocation::gnLocation ( | const gnLocation & s )

  | Copy constructor, copies a gnLocation. Parameters:
  s | the location to copy.
Definition at line 20 of file gnLocation.cpp.

gnLocation::gnLocation ( | const gnSeqI start,
| const gnSeqI end,
| const gnLocationType type = LT_Standard,
| string contigName = "" )

  | Constructor, creates a gnLocation. Parameters:
  start | The start position within the sequence.
  end | The end position within the sequence.
  type | The type of the location, LT_Standard by default.
  contigName | The name of the contig associated with this location, empty by default.
See also: gnLocationType Definition at line 31 of file gnLocation.cpp.

gnLocation::gnLocation ( | const gnSeqI start,
| const gnSeqI startLength,
| const gnSeqI end,
| gnSeqI endLength,
| const gnLocationType type = LT_Standard,
| string contigName = "" )

  | Constructor, creates a gnLocation. Parameters:
  start | The start position within the sequence.
  startLength | GNSEQI_END if the starting location is unbounded to the left, 0 if defined, otherwise it specifies a range
  end | The end position within the sequence.
  endLength | 0 if defined, GNSEQI_END if unbounded to the right, otherwise specifies a range
  type | The type of the location, LT_Standard by default.
  contigName | The name of the contig associated with this location, empty by default.
See also: gnLocationType Definition at line 25 of file gnLocation.cpp.

## Member Function Documentation

void gnLocation::Clear ( | )

| Resets this location to default values. Definition at line 43 of file gnLocation.cpp. Referenced by CropTo(), and gnLocation().

gnLocation * gnLocation::Clone ( | ) const`[virtual]`

| Reimplemented from gnClone. Definition at line 38 of file gnLocation.cpp.

boolean gnLocation::Contains ( | const gnLocation & l,
| const intersectRestriction cr = allRegions ) const

  | Crops the end location by the specified amount. Parameters:
  end | The amount to crop.
Returns: True if the location still exists, false if the crop amount is larger than the location. Definition at line 166 of file gnLocation.cpp. Referenced by gnBaseFeature::Contains(), and gnBaseFeature::IsContainedBy().

boolean gnLocation::CropEnd ( | const gnSeqI end )

  | Crops the end location by the specified amount. Parameters:
  end | The amount to crop.
Returns: True if the location still exists, false if the crop amount is larger than the location. Definition at line 131 of file gnLocation.cpp. Referenced by gnBaseFeature::CropEnd(), gnGenomeSpec::GetBrokenFeatures(), gnGenomeSpec::GetContainedFeatures(), and gnGenomeSpec::GetIntersectingFeatures().

boolean gnLocation::CropStart ( | const gnSeqI start )

  | Crops the start location by the specified amount. Parameters:
  start | The amount to crop.
Returns: True if the location still exists, false if the crop amount is larger than the location. Definition at line 119 of file gnLocation.cpp. Referenced by gnBaseFeature::CropStart().

boolean gnLocation::CropTo ( | const gnLocation & l )

  | Crops this location to fit within the specified location boundaries. Parameters:
  l | The location boundaries.
Returns: True if the location still exists, false if the crop amount is larger than the location. Definition at line 72 of file gnLocation.cpp.

void gnLocation::GetBounds ( | gnSeqI & s,
| gnSeqI & sl,
| gnSeqI & e,
| gnSeqI & el ) const

  | Gets the location's boundaries. Parameters:
  s | The start index.
  sl | The start length.
  e | The end index.
  el | The end length.
Definition at line 53 of file gnLocation.cpp.

gnSeqI gnLocation::GetEnd ( | ) const`[inline]`

| Gets the ending base pair. Returns: The ending base pair. Definition at line 275 of file gnLocation.h. Referenced by gnBaseFeature::Contains(), gnBaseFeature::Crop(), CropTo(), LocationEndLessthan(), LocationSizeLessthan(), and gnGBKSource::Write().

gnSeqI gnLocation::GetEndLength ( | ) const`[inline]`

| Gets the ending base pair's definition value. Returns: -1 if the ending location is unbounded to the left, 0 if defined, 1 if unbounded to the right Definition at line 280 of file gnLocation.h.

gnSeqI gnLocation::GetFirst ( | ) const`[inline]`

| Definition at line 301 of file gnLocation.h. Referenced by Contains(), CropTo(), GetIntersection(), and Intersects().

gnLocation gnLocation::GetIntersection ( | const gnLocation & l,
| const intersectRestriction ir ) const

| Definition at line 207 of file gnLocation.cpp.

gnSeqI gnLocation::GetLast ( | ) const`[inline]`

| Definition at line 285 of file gnLocation.h. Referenced by Contains(), CropTo(), GetIntersection(), and Intersects().

gnSeqI gnLocation::GetStart ( | ) const`[inline]`

| Gets the starting base pair. Returns: The starting base pair. Definition at line 291 of file gnLocation.h. Referenced by gnBaseFeature::Contains(), gnBaseFeature::Crop(), CropTo(), LocationEndLessthan(), LocationLessthan(), LocationSizeLessthan(), gnGBKSource::Write(), and loc_binary_search().

gnSeqI gnLocation::GetStartLength ( | ) const`[inline]`

| Gets the starting base pair's definition value. Returns: -1 if the starting location is unbounded to the left, 0 if defined, 1 if unbounded to the right Definition at line 296 of file gnLocation.h.

gnLocation::gnLocationType gnLocation::GetType ( | ) const`[inline]`

| Gets the location type. Returns: the location type. See also: gnLocationType Definition at line 307 of file gnLocation.h. Referenced by gnGBKSource::Write().

gnLocation gnLocation::GetUnion ( | const gnLocation & l ) const

| Definition at line 200 of file gnLocation.cpp.

boolean gnLocation::Intersects ( | const gnLocation & l,
| const intersectRestriction ir = allRegions ) const

  | Returns true if the given location intersects this location in the region specified by the parameter "ir". Parameters:
  l | The location to check for intersection.
  ir | The region to check for intersection. This can be either determinedRegions, undeterminedRegions, or allRegions
Returns: True if the location still exists, false if the crop amount is larger than the location. Definition at line 144 of file gnLocation.cpp. Referenced by gnBaseFeature::Intersects().

bool gnLocation::IsEndBoundLonger ( | ) const`[inline]`

| Returns true if the end is unbounded to the right. Returns: True if the end is unbounded to the right. Definition at line 313 of file gnLocation.h. Referenced by gnGBKSource::Write().

bool gnLocation::IsEndBoundShorter ( | ) const`[inline]`

| Returns true if the end is unbounded to the left. Returns: True if the end is unbounded to the left. Definition at line 323 of file gnLocation.h. Referenced by gnGBKSource::Write().

bool gnLocation::IsStartBoundLonger ( | ) const`[inline]`

| Returns true if the start is unbounded to the right. Returns: True if the start is unbounded to the right. Definition at line 318 of file gnLocation.h. Referenced by gnGBKSource::Write().

bool gnLocation::IsStartBoundShorter ( | ) const`[inline]`

| Returns true if the start is unbounded to the left. Returns: True if the start is unbounded to the left. Definition at line 328 of file gnLocation.h. Referenced by gnGBKSource::Write().

boolean gnLocation::MoveNegative ( | const gnSeqI diff )

  | Decreases the location start and end. Parameters:
  diff | The amount to decrease the location start and end.
Definition at line 185 of file gnLocation.cpp. Referenced by gnGenomeSpec::GetBrokenFeatures(), gnGenomeSpec::GetContainedFeatures(), gnGenomeSpec::GetIntersectingFeatures(), gnBaseFeature::MoveNegative(), and MoveTo().

boolean gnLocation::MovePositive ( | const gnSeqI diff )

  | Increases the location start and end. Parameters:
  diff | The amount to increase the location start and end.
Definition at line 177 of file gnLocation.cpp. Referenced by gnBaseFeature::MovePositive(), and MoveTo().

boolean gnLocation::MoveTo ( | const int direction,
| const gnSeqI diff )

  | Moves the location start and end. Parameters:
  direction | Negative integer will decrease start and end, positive will increase them.
  diff | The amount to move the location start and end.
Definition at line 193 of file gnLocation.cpp.

void gnLocation::SetBounds ( | const gnSeqI start,
| const gnSeqI end )

  | Sets the location's boundaries. Parameters:
  start | The start index.
  end | The end index.
Definition at line 66 of file gnLocation.cpp.

void gnLocation::SetBounds ( | const gnSeqI start,
| const gnSeqI startLength,
| const gnSeqI end,
| const gnSeqI endLength )

  | Sets the location's boundaries. Parameters:
  start | The start index.
  startLength | -1 if the ending location is unbounded to the left, 0 if defined, 1 if unbounded to the right
  end | The end index.
  endLength | -1 if the ending location is unbounded to the left, 0 if defined, 1 if unbounded to the right
Definition at line 61 of file gnLocation.cpp. Referenced by gnLocation().

void gnLocation::SetEnd ( | const gnSeqI end,
| const gnSeqI endLength )`[inline]`

  | Sets the end location and definition. Parameters:
  end | The end location.
  endLength | -1 if the ending location is unbounded to the left, 0 if defined, 1 if unbounded to the right
Definition at line 339 of file gnLocation.h.

void gnLocation::SetEnd ( | const gnSeqI end )`[inline]`

  | Sets the end location. Parameters:
  end | The end location.
Definition at line 334 of file gnLocation.h. Referenced by gnFragmentSpec::CloneRange(), ComplementLocation(), and SetBounds().

void gnLocation::SetEndLength ( | const gnSeqI endLength )`[inline]`

  | Sets the end definition. Parameters:
  endLength | -1 if the ending location is unbounded to the left, 0 if defined, 1 if unbounded to the right
Definition at line 345 of file gnLocation.h.

void gnLocation::SetStart ( | const gnSeqI start,
| const gnSeqI startLength )`[inline]`

  | Sets the start location and definition. Parameters:
  start | The end location.
  startLength | -1 if the ending location is unbounded to the left, 0 if defined, 1 if unbounded to the right
Definition at line 355 of file gnLocation.h.

void gnLocation::SetStart ( | const gnSeqI start )`[inline]`

  | Sets the start location/. Parameters:
  end | The start location.
Definition at line 350 of file gnLocation.h. Referenced by gnFragmentSpec::CloneRange(), ComplementLocation(), and SetBounds().

void gnLocation::SetStartLength ( | const gnSeqI startLength )`[inline]`

  | Sets the start definition. Parameters:
  startLength | -1 if the ending location is unbounded to the left, 0 if defined, 1 if unbounded to the right
Definition at line 361 of file gnLocation.h.

void gnLocation::SetType ( | const gnLocationType lt )`[inline]`

  | Sets the location type. Parameters:
  lt | The location type.
Definition at line 367 of file gnLocation.h.

## Member Data Documentation

const gnSeqI gnLocation::Defined = 0`[static]`

| Definition at line 56 of file gnLocation.h.

const gnSeqI gnLocation::Unknown = GNSEQI_END`[static]`

| Definition at line 57 of file gnLocation.h.

gnSeqI gnLocation::m_end`[private]`

| Definition at line 266 of file gnLocation.h.

gnSeqI gnLocation::m_endLength`[private]`

| Definition at line 267 of file gnLocation.h.

string gnLocation::m_name`[private]`

| Definition at line 263 of file gnLocation.h.

gnSeqI gnLocation::m_start`[private]`

| Definition at line 264 of file gnLocation.h.

gnSeqI gnLocation::m_startLength`[private]`

| Definition at line 265 of file gnLocation.h.

gnLocationType gnLocation::m_type`[private]`

| Definition at line 269 of file gnLocation.h.

The documentation for this class was generated from the following files:

- gnLocation.h
- gnLocation.cpp