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:

gnClone 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 Member Functions

 gnLocation ()
 Empty constructor, does nothing.

 gnLocation (const gnLocation &s)
 Copy constructor, copies a gnLocation.

 gnLocation (const gnSeqI start, const gnSeqI end, const gnLocationType type=LT_Standard, string contigName="")
 Constructor, creates a gnLocation.

 gnLocation (const gnSeqI start, const gnSeqI startLength, const gnSeqI end, gnSeqI endLength, const gnLocationType type=LT_Standard, string contigName="")
 Constructor, creates a gnLocation.

gnLocation * Clone () const
void Clear ()
 Resets this location to default values.

boolean CropTo (const gnLocation &l)
 Crops this location to fit within the specified location boundaries.

boolean CropStart (const gnSeqI start)
 Crops the start location by the specified amount.

boolean CropEnd (const gnSeqI end)
 Crops the end location by the specified amount.

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".

boolean Contains (const gnLocation &l, const intersectRestriction cr=allRegions) const
 Checks wether another gnLocation is contained by this one.

boolean MovePositive (const gnSeqI diff)
 Increases the location start and end.

boolean MoveNegative (const gnSeqI diff)
 Decreases the location start and end.

boolean MoveTo (const int direction, const gnSeqI diff)
 Moves the location start and end.

gnSeqI GetEnd () const
 Gets the ending base pair.

gnSeqI GetEndLength () const
 Gets the ending base pair's definition value.

gnSeqI GetLast () const
gnSeqI GetStart () const
 Gets the starting base pair.

gnSeqI GetStartLength () const
 Gets the starting base pair's definition value.

gnSeqI GetFirst () const
gnLocationType GetType () const
 Gets the location type.

void GetBounds (gnSeqI &s, gnSeqI &sl, gnSeqI &e, gnSeqI &el) const
 Gets the location's boundaries.

bool IsEndBoundLonger () const
 Returns true if the end is unbounded to the right.

bool IsStartBoundLonger () const
 Returns true if the start is unbounded to the right.

bool IsEndBoundShorter () const
 Returns true if the end is unbounded to the left.

bool IsStartBoundShorter () const
 Returns true if the start is unbounded to the left.

void SetEnd (const gnSeqI end)
 Sets the end location.

void SetEnd (const gnSeqI end, const gnSeqI endLength)
 Sets the end location and definition.

void SetEndLength (const gnSeqI endLength)
 Sets the end definition.

void SetStart (const gnSeqI start)
 Sets the start location/.

void SetStart (const gnSeqI start, const gnSeqI startLength)
 Sets the start location and definition.

void SetStartLength (const gnSeqI startLength)
 Sets the start definition.

void SetType (const gnLocationType lt)
 Sets the location type.

void SetBounds (const gnSeqI start, const gnSeqI startLength, const gnSeqI end, const gnSeqI endLength)
 Sets the location's boundaries.

void SetBounds (const gnSeqI start, const gnSeqI end)
 Sets the location's boundaries.

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 36 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 45 of file gnLocation.h.

Referenced by gnBaseFeature::GetLocationType(), GetType(), gnSEQSource::ParseStream(), gnGBKSource::ParseStream(), and gnGBKSource::Write().

enum gnLocation::intersectRestriction
 

Enumeration values:
determinedRegions 
undeterminedRegions 
allRegions 

Definition at line 39 of file gnLocation.h.


Constructor & Destructor Documentation

gnLocation::gnLocation  
 

Empty constructor, does nothing.

Definition at line 15 of file gnLocation.cpp.

References Clear().

Referenced by Clone().

gnLocation::gnLocation const gnLocation &    s
 

Copy constructor, copies a gnLocation.

Parameters:
s the location to copy.

Definition at line 19 of file gnLocation.cpp.

References m_end, m_endLength, m_start, m_startLength, m_type, and SetBounds().

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 30 of file gnLocation.cpp.

References m_name, m_type, and SetBounds().

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 24 of file gnLocation.cpp.

References m_name, m_type, and SetBounds().


Member Function Documentation

void gnLocation::Clear  
 

Resets this location to default values.

Definition at line 42 of file gnLocation.cpp.

References LT_Nothing, m_end, m_endLength, m_start, m_startLength, and m_type.

Referenced by CropTo(), and gnLocation().

gnLocation * gnLocation::Clone   const [virtual]
 

Implements gnClone.

Definition at line 37 of file gnLocation.cpp.

References gnLocation().

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

Checks wether another gnLocation is contained by this one.

Parameters:
l The gnLocation to be checked.
cr A specification of the type of intersection to be checked.
See also:
intersectRestriction
Returns:
True if the location still exists, false if the crop amount is larger than the location.

Definition at line 165 of file gnLocation.cpp.

References determinedRegions, GetFirst(), GetLast(), m_end, m_start, and undeterminedRegions.

Referenced by 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 130 of file gnLocation.cpp.

References gnSeqI, m_end, m_endLength, and m_start.

Referenced by 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 118 of file gnLocation.cpp.

References gnSeqI, m_end, m_start, and m_startLength.

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 71 of file gnLocation.cpp.

References Clear(), GetEnd(), GetFirst(), GetLast(), GetStart(), gnSeqI, m_end, m_endLength, m_start, and m_startLength.

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 52 of file gnLocation.cpp.

References m_end, m_endLength, m_start, and m_startLength.

gnSeqI gnLocation::GetEnd   const [inline]
 

Gets the ending base pair.

Returns:
The ending base pair.

Definition at line 277 of file gnLocation.h.

References gnSeqI, and m_end.

Referenced by gnBaseFeature::Crop(), CropTo(), 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 282 of file gnLocation.h.

References gnSeqI, and m_endLength.

gnSeqI gnLocation::GetFirst   const [inline]
 

Definition at line 303 of file gnLocation.h.

References gnSeqI, m_start, and m_startLength.

Referenced by Contains(), CropTo(), GetIntersection(), and Intersects().

gnLocation gnLocation::GetIntersection const gnLocation &    l,
const intersectRestriction    ir
const
 

Definition at line 206 of file gnLocation.cpp.

References allRegions, determinedRegions, ErrorMsg(), GetFirst(), GetLast(), m_end, m_start, and undeterminedRegions.

gnSeqI gnLocation::GetLast   const [inline]
 

Definition at line 287 of file gnLocation.h.

References gnSeqI, m_end, and m_endLength.

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 293 of file gnLocation.h.

References gnSeqI, and m_start.

Referenced by gnBaseFeature::Crop(), CropTo(), and gnGBKSource::Write().

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 298 of file gnLocation.h.

References gnSeqI, and m_startLength.

gnLocation::gnLocationType gnLocation::GetType   const [inline]
 

Gets the location type.

Returns:
the location type.
See also:
gnLocationType

Definition at line 309 of file gnLocation.h.

References gnLocationType, and m_type.

Referenced by gnGBKSource::Write().

gnLocation gnLocation::GetUnion const gnLocation &    l const
 

Definition at line 199 of file gnLocation.cpp.

References ErrorMsg().

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
See also:
intersectRestriction
Returns:
True if the location still exists, false if the crop amount is larger than the location.

Definition at line 143 of file gnLocation.cpp.

References allRegions, determinedRegions, GetFirst(), GetLast(), m_end, m_start, and undeterminedRegions.

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 315 of file gnLocation.h.

References m_endLength.

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 325 of file gnLocation.h.

References m_endLength.

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 320 of file gnLocation.h.

References m_startLength.

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 330 of file gnLocation.h.

References m_startLength.

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 184 of file gnLocation.cpp.

References m_end, and m_start.

Referenced by gnGenomeSpec::GetBrokenFeatures(), gnGenomeSpec::GetContainedFeatures(), gnGenomeSpec::GetIntersectingFeatures(), 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 176 of file gnLocation.cpp.

References GNSEQI_END, m_end, and m_start.

Referenced by 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 192 of file gnLocation.cpp.

References MoveNegative(), and MovePositive().

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 65 of file gnLocation.cpp.

References m_end, and m_start.

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 60 of file gnLocation.cpp.

References SetEnd(), and SetStart().

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 341 of file gnLocation.h.

References m_end, and m_endLength.

void gnLocation::SetEnd const gnSeqI    end [inline]
 

Sets the end location.

Parameters:
end The end location.

Definition at line 336 of file gnLocation.h.

References m_end.

Referenced by gnFragmentSpec::CloneRange(), 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 347 of file gnLocation.h.

References m_endLength.

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 357 of file gnLocation.h.

References m_start, and m_startLength.

void gnLocation::SetStart const gnSeqI    start [inline]
 

Sets the start location/.

Parameters:
start The start location.

Definition at line 352 of file gnLocation.h.

References m_start.

Referenced by gnFragmentSpec::CloneRange(), 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 363 of file gnLocation.h.

References m_startLength.

void gnLocation::SetType const gnLocationType    lt [inline]
 

Sets the location type.

Parameters:
lt The location type.

Definition at line 369 of file gnLocation.h.

References m_type.


Member Data Documentation

const gnSeqI gnLocation::Defined = 0 [static]
 

Definition at line 55 of file gnLocation.h.

gnSeqI gnLocation::m_end [private]
 

Definition at line 268 of file gnLocation.h.

Referenced by Clear(), Contains(), CropEnd(), CropStart(), CropTo(), GetBounds(), GetEnd(), GetIntersection(), GetLast(), gnLocation(), Intersects(), MoveNegative(), MovePositive(), SetBounds(), and SetEnd().

gnSeqI gnLocation::m_endLength [private]
 

Definition at line 269 of file gnLocation.h.

Referenced by Clear(), CropEnd(), CropTo(), GetBounds(), GetEndLength(), GetLast(), gnLocation(), IsEndBoundLonger(), IsEndBoundShorter(), SetEnd(), and SetEndLength().

string gnLocation::m_name [private]
 

Definition at line 265 of file gnLocation.h.

Referenced by gnLocation().

gnSeqI gnLocation::m_start [private]
 

Definition at line 266 of file gnLocation.h.

Referenced by Clear(), Contains(), CropEnd(), CropStart(), CropTo(), GetBounds(), GetFirst(), GetIntersection(), GetStart(), gnLocation(), Intersects(), MoveNegative(), MovePositive(), SetBounds(), and SetStart().

gnSeqI gnLocation::m_startLength [private]
 

Definition at line 267 of file gnLocation.h.

Referenced by Clear(), CropStart(), CropTo(), GetBounds(), GetFirst(), GetStartLength(), gnLocation(), IsStartBoundLonger(), IsStartBoundShorter(), SetStart(), and SetStartLength().

gnLocationType gnLocation::m_type [private]
 

Definition at line 271 of file gnLocation.h.

Referenced by Clear(), GetType(), gnLocation(), and SetType().

const gnSeqI gnLocation::Unknown = GNSEQI_END [static]
 

Definition at line 56 of file gnLocation.h.


The documentation for this class was generated from the following files:
Generated on Mon Feb 3 02:34:49 2003 for libGenome by doxygen1.3-rc3