Google

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

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.1.0 
00007 // Author:          Aaron Darling 
00008 // Last Edited:     April 15, 2001, 10:34:50pm 
00009 // Modified by:     
00010 // Copyright:       (c) Aaron Darling 
00011 // Licenses:        Proprietary 
00013 #ifndef _gnLocation_h_
00014 #define _gnLocation_h_
00015 
00016 #include "gn/gnDefs.h"
00017 #include <string>
00018 #include <iostream>
00019 #include "gn/gnClone.h"
00020 
00036 
00037 class GNDLLEXPORT gnLocation : public gnClone
00038 {
00039 public:
00040         enum intersectRestriction{
00041                 determinedRegions,
00042                 undeterminedRegions,
00043                 allRegions
00044         };
00045         
00046         enum gnLocationType{
00047                 LT_Standard,    //standard == join multiple locations.
00048                 LT_BetweenBases,
00049                 LT_Complement,
00050                 LT_Order,
00051                 LT_Group,
00052                 LT_OneOf,
00053                 LT_Nothing
00054         };
00055 
00056         static const gnSeqI Defined = 0;
00057         static const gnSeqI Unknown = GNSEQI_END;
00058 
00059 public:
00063         gnLocation();
00068         gnLocation( const gnLocation& s);
00077         gnLocation( const gnSeqI start, const gnSeqI end, const gnLocationType type = LT_Standard, string contigName = "");
00088         gnLocation( const gnSeqI start, const gnSeqI startLength, const gnSeqI end, gnSeqI endLength, const gnLocationType type = LT_Standard, string contigName = "");
00089 
00090         gnLocation* Clone() const;
00091 
00095         void Clear();
00101         boolean CropTo( const gnLocation &l );
00107         boolean CropStart( const gnSeqI start );
00113         boolean CropEnd( const gnSeqI end );
00114 
00121         boolean Intersects( const gnLocation &l, const intersectRestriction ir = allRegions ) const;
00127         boolean Contains( const gnLocation& l, const intersectRestriction cr = allRegions ) const;
00132         boolean MovePositive( const gnSeqI diff );
00137         boolean MoveNegative( const gnSeqI diff );
00143         boolean MoveTo( const int direction, const gnSeqI diff );
00144 
00149         gnSeqI GetEnd() const;
00154         gnSeqI GetEndLength() const;
00155         gnSeqI GetLast() const;
00160         gnSeqI GetStart() const;
00165         gnSeqI GetStartLength() const;
00166         gnSeqI GetFirst() const;
00167 
00173         gnLocationType GetType() const;
00174 
00182         void GetBounds( gnSeqI &s, gnSeqI &sl, gnSeqI &e, gnSeqI &el ) const;
00183 
00188         bool IsEndBoundLonger() const;
00193         bool IsStartBoundLonger() const;
00198         bool IsEndBoundShorter() const;
00203         bool IsStartBoundShorter() const;
00204 
00209         void SetEnd( const gnSeqI end );
00215         void SetEnd( const gnSeqI end, const gnSeqI endLength );
00220         void SetEndLength( const gnSeqI endLength );
00221 
00226         void SetStart( const gnSeqI start );
00232         void SetStart( const gnSeqI start, const gnSeqI startLength );
00237         void SetStartLength( const gnSeqI startLength );
00242         void SetType( const gnLocationType lt );
00250         void SetBounds( const gnSeqI start, const gnSeqI startLength, const gnSeqI end, const gnSeqI endLength);
00256         void SetBounds( const gnSeqI start, const gnSeqI end);
00257 
00258         gnLocation GetUnion( const gnLocation &l ) const;
00259         
00260         gnLocation GetIntersection( const gnLocation &l, const intersectRestriction ir ) const;
00261         
00262 private:
00263         string m_name;
00264         gnSeqI m_start;
00265         gnSeqI m_startLength;
00266         gnSeqI m_end;
00267         gnSeqI m_endLength;
00268         
00269         gnLocationType m_type;
00270 
00271 }; // class gnLocation
00272 
00273 // GET END
00274 inline
00275 gnSeqI gnLocation::GetEnd() const
00276 {
00277         return m_end;
00278 }
00279 inline
00280 gnSeqI gnLocation::GetEndLength() const
00281 {
00282         return m_endLength;
00283 }
00284 inline
00285 gnSeqI gnLocation::GetLast() const
00286 {
00287         return m_end + m_endLength;
00288 }
00289 // GET START
00290 inline
00291 gnSeqI gnLocation::GetStart() const
00292 {
00293         return m_start;
00294 }
00295 inline
00296 gnSeqI gnLocation::GetStartLength() const
00297 {
00298         return m_startLength;
00299 }
00300 inline
00301 gnSeqI gnLocation::GetFirst() const
00302 {
00303         return m_start > m_startLength ? m_start - m_startLength : 0;
00304 }
00305 
00306 inline
00307 gnLocation::gnLocationType gnLocation::GetType() const
00308 {
00309         return m_type;
00310 }
00311 
00312 inline
00313 bool gnLocation::IsEndBoundLonger() const
00314 {
00315         return m_endLength > 0;
00316 }
00317 inline
00318 bool gnLocation::IsStartBoundLonger() const
00319 {
00320         return m_startLength > 0;
00321 }
00322 inline
00323 bool gnLocation::IsEndBoundShorter() const
00324 {
00325         return m_endLength < 0;
00326 }
00327 inline
00328 bool gnLocation::IsStartBoundShorter() const
00329 {
00330         return m_startLength < 0;
00331 }
00332 
00333 inline
00334 void gnLocation::SetEnd( const gnSeqI end )
00335 {
00336         m_end = end;
00337 }
00338 inline
00339 void gnLocation::SetEnd( const gnSeqI end, const gnSeqI endLength )
00340 {
00341         m_end = end;
00342         m_endLength = endLength;
00343 }
00344 inline
00345 void gnLocation::SetEndLength( const gnSeqI endLength )
00346 {
00347         m_endLength = endLength;
00348 }
00349 inline
00350 void gnLocation::SetStart( const gnSeqI start )
00351 {
00352         m_start = start;
00353 }
00354 inline
00355 void gnLocation::SetStart( const gnSeqI start, const gnSeqI startLength )
00356 {
00357         m_start = start;
00358         m_startLength = startLength;
00359 }
00360 inline
00361 void gnLocation::SetStartLength( const gnSeqI startLength )
00362 {
00363         m_startLength = startLength;
00364 }
00365 
00366 inline
00367 void gnLocation::SetType( const gnLocationType lt )
00368 {
00369         m_type = lt;
00370 }
00371 
00372 
00373 #endif
00374         // _gnLocation_h_

Generated at Fri Nov 30 15:36:51 2001 for libGenome by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001