gnFileContig.h Source File

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

# gnFileContig.h

Go to the documentation of this file.

    00001 /////////////////////////////////////////////////////////////////////////////
    00002 // File:            gnFileContig.h
    00003 // Purpose:         File Position holder.
    00004 // Description:
    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
    00011 /////////////////////////////////////////////////////////////////////////////
    00012 #ifndef _gnFileContig_h_
    00013 #define _gnFileContig_h_
    00014
    00015 #include "gn/gnDefs.h"
    00016
    00017 #include <string>
    00018 #include "gn/gnClone.h"
    00019 #include <utility>
    00020
    00021 /**
    00022  * gnFileContig is used by source classes to track the location of
    00023  * sequence data on disk.  gnFileContig stores the start and end byte
    00024  * offset, and the size of a repeated gap in the sequence data.
    00025  * Also stores whether the sequence data is in the expected format or
    00026  * if it is corrupted.
    00027  */
    00028 class GNDLLEXPORT gnFileContig : public gnClone
    00029 {
    00030 public:
    00031         gnFileContig();
    00032         gnFileContig( string nameStr, const uint64 pos, const uint64 len );
    00033         gnFileContig( const gnFileContig& fc );
    00034         ~gnFileContig();
    00035
    00036         gnFileContig* Clone() const;
    00037         void Clear();
    00038
    00039         string GetName() const;
    00040         gnSeqI GetSeqLength() const;
    00041         pair<uint64,uint64> GetFileStartEnd() const;
    00042         uint64 GetFileLength() const;
    00043         pair<uint64,uint64> GetSectStartEnd( const gnContigSection i ) const;
    00044         uint64 GetSectLength( gnContigSection i ) const;
    00045         boolean HasRepeatSeqGap() const;
    00046         pair<uint32,uint32> GetRepeatSeqGapSize() const;
    00047
    00048         boolean SetName( string nameStr );
    00049         boolean SetSeqLength( const gnSeqI len );
    00050         boolean AddToSeqLength( const gnSeqI len );
    00051         boolean SetFileStart( const uint64 s );
    00052         boolean SetFileEnd( const uint64 e );
    00053         boolean SetFileStartEnd( const pair<uint64,uint64> se );
    00054         boolean SetSectStart( const gnContigSection i, const uint64 s );
    00055         boolean SetSectEnd( const gnContigSection i, const uint64 e );
    00056         boolean SetSectStartEnd( const gnContigSection i, const pair<uint64,uint64> se);
    00057         boolean SetRepeatSeqGap( const boolean rsg );
    00058         boolean SetRepeatSeqGapSize( const pair<uint64,uint64> rsgSize );
    00059         boolean SetRepeatSeqSize( const uint64 seqSize );
    00060         boolean SetRepeatGapSize( const uint64 gapSize );
    00061 private:
    00062         string m_name;
    00063         gnSeqI m_seqLength;
    00064         pair<uint64,uint64> m_fileStartEnd;
    00065
    00066         pair<uint64,uint64> m_startEndArray[CONTIG_SECTION_SIZE];
    00067         // sequence access
    00068         boolean m_repeatSeqGap;  // if true, use m_repeatSeqGapSize
    00069         pair< uint64, uint64 > m_repeatSeqGapSize;
    00070 };// class gnFileContig
    00071
    00072   // Clone
    00073 inline
    00074 gnFileContig* gnFileContig::Clone() const
    00075 {
    00076         return new gnFileContig( *this );
    00077 }
    00078   // GET
    00079 inline
    00080 string gnFileContig::GetName() const
    00081 {
    00082         return m_name;
    00083 }
    00084 inline
    00085 gnSeqI gnFileContig::GetSeqLength() const
    00086 {
    00087         return m_seqLength;
    00088 }
    00089 inline
    00090 pair<uint64,uint64> gnFileContig::GetFileStartEnd() const
    00091 {
    00092         return m_fileStartEnd;
    00093 }
    00094 inline
    00095 uint64 gnFileContig::GetFileLength() const
    00096 {
    00097         return m_fileStartEnd.second - m_fileStartEnd.first + 1;
    00098 }
    00099 inline
    00100 pair<uint64,uint64> gnFileContig::GetSectStartEnd( const gnContigSection i ) const
    00101 {
    00102         if( (uint32)i < CONTIG_SECTION_SIZE )
    00103                 return m_startEndArray[(uint32)i];
    00104         return pair<uint64,uint64>(0,0);
    00105 }
    00106 inline
    00107 uint64 gnFileContig::GetSectLength( gnContigSection i ) const
    00108 {
    00109         if( (uint32)i < CONTIG_SECTION_SIZE )
    00110                 return m_startEndArray[(uint32)i].second - m_startEndArray[(uint32)i].first + 1;
    00111         return 0;
    00112 }
    00113 inline
    00114 boolean gnFileContig::HasRepeatSeqGap() const
    00115 {
    00116         return m_repeatSeqGap;
    00117 }
    00118 inline
    00119 pair<uint32,uint32> gnFileContig::GetRepeatSeqGapSize() const
    00120 {
    00121         return m_repeatSeqGapSize;
    00122 }
    00123   // SET
    00124 inline
    00125 boolean gnFileContig::SetName( string nameStr )
    00126 {
    00127         m_name = nameStr;
    00128         return true;
    00129 }
    00130 inline
    00131 boolean gnFileContig::SetSeqLength( const gnSeqI len )
    00132 {
    00133         m_seqLength = len;
    00134         return true;
    00135 }
    00136 inline
    00137 boolean gnFileContig::AddToSeqLength( const gnSeqI len )
    00138 {
    00139         m_seqLength += len;
    00140         return true;
    00141 }
    00142 inline
    00143 boolean gnFileContig::SetFileStart( const uint64 s )
    00144 {
    00145         m_fileStartEnd.first = s;
    00146         return true;
    00147 }
    00148 inline
    00149 boolean gnFileContig::SetFileEnd( const uint64 e )
    00150 {
    00151         m_fileStartEnd.second = e;
    00152         return true;
    00153 }
    00154 inline
    00155 boolean gnFileContig::SetFileStartEnd( const pair<uint64,uint64> se )
    00156 {
    00157         m_fileStartEnd = se;
    00158         return true;
    00159 }
    00160 inline
    00161 boolean gnFileContig::SetSectStart( const gnContigSection i, const uint64 s )
    00162 {
    00163         if( (uint32)i < CONTIG_SECTION_SIZE )
    00164         {
    00165                 m_startEndArray[(uint32)i].first = s;
    00166                 return true;
    00167         }
    00168         return false;
    00169 }
    00170 inline
    00171 boolean gnFileContig::SetSectEnd( const gnContigSection i, const uint64 e )
    00172 {
    00173         if( (uint32)i < CONTIG_SECTION_SIZE )
    00174         {
    00175                 m_startEndArray[(uint32)i].second = e;
    00176                 return true;
    00177         }
    00178         return false;
    00179 }
    00180 inline
    00181 boolean gnFileContig::SetSectStartEnd( const gnContigSection i, const pair<uint64,uint64> se )
    00182 {
    00183         if( (uint32)i < CONTIG_SECTION_SIZE )
    00184         {
    00185                 m_startEndArray[(uint32)i] = se;
    00186                 return true;
    00187         }
    00188         return false;
    00189 }
    00190 inline
    00191 boolean gnFileContig::SetRepeatSeqGap( const boolean rsg )
    00192 {
    00193         m_repeatSeqGap = rsg;
    00194         return true;
    00195 }
    00196 inline
    00197 boolean gnFileContig::SetRepeatSeqGapSize( const pair<uint64,uint64> rsgSize )
    00198 {
    00199         return  SetRepeatSeqSize( rsgSize.first ) &&
    00200                 SetRepeatGapSize( rsgSize.second );
    00201 }
    00202
    00203
    00204 #endif
    00205         // _gnFileContig_h_