include/gn/gnLocation.h

Go to the documentation of this file.
00001 00002 // File: gnLocation.h 00003 // Purpose: Standard Location for Feature 00004 // Description: Feature location 00005 // Changes: 00006 // Version: libGenome 0.5.1 00007 // Author: Aaron Darling 00008 // Modified by: 00009 // Copyright: (c) Aaron Darling 00010 // Licenses: See COPYING file for details 00012 #ifndef _gnLocation_h_ 00013 #define _gnLocation_h_ 00014 00015 #include "gn/gnDefs.h" 00016 #include <string> 00017 #include <iostream> 00018 #include "gn/gnClone.h" 00019 00036 class GNDLLEXPORT gnLocation : public gnClone 00037 { 00038 public: 00039 enum intersectRestriction{ 00040 determinedRegions, 00041 undeterminedRegions, 00042 allRegions 00043 }; 00044 00045 enum gnLocationType{ 00046 LT_Standard, //standard == join multiple locations. 00047 LT_BetweenBases, 00048 LT_Complement, 00049 LT_Order, 00050 LT_Group, 00051 LT_OneOf, 00052 LT_Nothing 00053 }; 00054 00055 static const gnSeqI Defined = 0; 00056 static const gnSeqI Unknown = GNSEQI_END; 00057 00058 public: 00062 gnLocation(); 00067 gnLocation( const gnLocation& s); 00076 gnLocation( const gnSeqI start, const gnSeqI end, const gnLocationType type = LT_Standard, string contigName = ""); 00087 gnLocation( const gnSeqI start, const gnSeqI startLength, const gnSeqI end, gnSeqI endLength, const gnLocationType type = LT_Standard, string contigName = ""); 00088 00089 gnLocation* Clone() const; 00090 00094 void Clear(); 00100 boolean CropTo( const gnLocation &l ); 00106 boolean CropStart( const gnSeqI start ); 00112 boolean CropEnd( const gnSeqI end ); 00113 00121 boolean Intersects( const gnLocation &l, const intersectRestriction ir = allRegions ) const; 00129 boolean Contains( const gnLocation& l, const intersectRestriction cr = allRegions ) const; 00134 boolean MovePositive( const gnSeqI diff ); 00139 boolean MoveNegative( const gnSeqI diff ); 00145 boolean MoveTo( const int direction, const gnSeqI diff ); 00146 00151 gnSeqI GetEnd() const; 00156 gnSeqI GetEndLength() const; 00157 gnSeqI GetLast() const; 00162 gnSeqI GetStart() const; 00167 gnSeqI GetStartLength() const; 00168 gnSeqI GetFirst() const; 00169 00175 gnLocationType GetType() const; 00176 00184 void GetBounds( gnSeqI &s, gnSeqI &sl, gnSeqI &e, gnSeqI &el ) const; 00185 00190 bool IsEndBoundLonger() const; 00195 bool IsStartBoundLonger() const; 00200 bool IsEndBoundShorter() const; 00205 bool IsStartBoundShorter() const; 00206 00211 void SetEnd( const gnSeqI end ); 00217 void SetEnd( const gnSeqI end, const gnSeqI endLength ); 00222 void SetEndLength( const gnSeqI endLength ); 00223 00228 void SetStart( const gnSeqI start ); 00234 void SetStart( const gnSeqI start, const gnSeqI startLength ); 00239 void SetStartLength( const gnSeqI startLength ); 00244 void SetType( const gnLocationType lt ); 00252 void SetBounds( const gnSeqI start, const gnSeqI startLength, const gnSeqI end, const gnSeqI endLength); 00258 void SetBounds( const gnSeqI start, const gnSeqI end); 00259 00260 gnLocation GetUnion( const gnLocation &l ) const; 00261 00262 gnLocation GetIntersection( const gnLocation &l, const intersectRestriction ir ) const; 00263 00264 private: 00265 string m_name; 00266 gnSeqI m_start; 00267 gnSeqI m_startLength; 00268 gnSeqI m_end; 00269 gnSeqI m_endLength; 00270 00271 gnLocationType m_type; 00272 00273 }; // class gnLocation 00274 00275 // GET END 00276 inline 00277 gnSeqI gnLocation::GetEnd() const 00278 { 00279 return m_end; 00280 } 00281 inline 00282 gnSeqI gnLocation::GetEndLength() const 00283 { 00284 return m_endLength; 00285 } 00286 inline 00287 gnSeqI gnLocation::GetLast() const 00288 { 00289 return m_end + m_endLength; 00290 } 00291 // GET START 00292 inline 00293 gnSeqI gnLocation::GetStart() const 00294 { 00295 return m_start; 00296 } 00297 inline 00298 gnSeqI gnLocation::GetStartLength() const 00299 { 00300 return m_startLength; 00301 } 00302 inline 00303 gnSeqI gnLocation::GetFirst() const 00304 { 00305 return m_start > m_startLength ? m_start - m_startLength : 0; 00306 } 00307 00308 inline 00309 gnLocation::gnLocationType gnLocation::GetType() const 00310 { 00311 return m_type; 00312 } 00313 00314 inline 00315 bool gnLocation::IsEndBoundLonger() const 00316 { 00317 return m_endLength > 0; 00318 } 00319 inline 00320 bool gnLocation::IsStartBoundLonger() const 00321 { 00322 return m_startLength > 0; 00323 } 00324 inline 00325 bool gnLocation::IsEndBoundShorter() const 00326 { 00327 return m_endLength == GNSEQI_END; 00328 } 00329 inline 00330 bool gnLocation::IsStartBoundShorter() const 00331 { 00332 return m_startLength == GNSEQI_END; 00333 } 00334 00335 inline 00336 void gnLocation::SetEnd( const gnSeqI end ) 00337 { 00338 m_end = end; 00339 } 00340 inline 00341 void gnLocation::SetEnd( const gnSeqI end, const gnSeqI endLength ) 00342 { 00343 m_end = end; 00344 m_endLength = endLength; 00345 } 00346 inline 00347 void gnLocation::SetEndLength( const gnSeqI endLength ) 00348 { 00349 m_endLength = endLength; 00350 } 00351 inline 00352 void gnLocation::SetStart( const gnSeqI start ) 00353 { 00354 m_start = start; 00355 } 00356 inline 00357 void gnLocation::SetStart( const gnSeqI start, const gnSeqI startLength ) 00358 { 00359 m_start = start; 00360 m_startLength = startLength; 00361 } 00362 inline 00363 void gnLocation::SetStartLength( const gnSeqI startLength ) 00364 { 00365 m_startLength = startLength; 00366 } 00367 00368 inline 00369 void gnLocation::SetType( const gnLocationType lt ) 00370 { 00371 m_type = lt; 00372 } 00373 00374 00375 #endif 00376 // _gnLocation_h_

Generated on Mon Feb 14 19:28:18 2005 for libGenome by doxygen 1.3.8