include/gn/gnSEQSource.h

Go to the documentation of this file.
00001 00002 // File: gnSEQSource.h 00003 // Purpose: Implements gnBaseSource for .SEQ files 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 00012 00013 #ifndef _gnSEQSource_h_ 00014 #define _gnSEQSource_h_ 00015 00016 #include "gn/gnDefs.h" 00017 00018 #include <string> 00019 #include <fstream> 00020 #include <vector> 00021 #include "gn/gnFileSource.h" 00022 #include "gn/gnFileContig.h" 00023 #include "gn/gnSourceSpec.h" 00024 #include "gn/gnSequence.h" 00025 00034 class GNDLLEXPORT gnSEQSource : public gnFileSource 00035 { 00036 public: 00040 gnSEQSource(); 00045 gnSEQSource( const gnSEQSource& s ); 00049 ~gnSEQSource(); 00053 gnSEQSource* Clone() const; 00054 // Contig Access methods 00055 uint32 GetContigListLength() const; 00056 boolean HasContig( const string& name ) const; 00057 uint32 GetContigID( const string& name ) const; 00058 string GetContigName( const uint32 i ) const; 00059 gnSeqI GetContigSeqLength( const uint32 i ) const; 00060 00061 boolean SeqRead( const gnSeqI start, char* buf, gnSeqI& bufLen, const uint32 contigI=ALL_CONTIGS ); 00062 00069 static boolean Write(gnSequence& sequence, const string& filename); 00076 static boolean Write(gnBaseSource *source, const string& filename); 00083 static boolean Write(gnGenomeSpec *spec, const string& filename); 00084 gnGenomeSpec *GetSpec() const; 00085 gnFileContig* GetFileContig( const uint32 contigI ) const; 00086 private: 00087 boolean SeqSeek( const gnSeqI start, const uint32& contigI, uint64& startPos, uint64& readableBytes ); 00088 boolean SeqStartPos( const gnSeqI start, gnFileContig& contig, uint64& startPos, uint64& readableBytes ); 00089 boolean ParseStream( istream& fin ); 00090 00091 static string& Filler(uint32 length); 00092 static void FormatString(string& data, uint32 offset, uint32 width); 00093 static void BaseCount(const string& bases, gnSeqI& a_count, gnSeqI& c_count, gnSeqI& g_count, gnSeqI& t_count, gnSeqI& other_count); 00094 // gnSeqI m_seqLength; 00095 00096 gnGenomeSpec *m_spec; 00097 vector< gnFileContig* > m_contigList; 00098 };// class gnSEQSource 00099 // Clone 00100 inline 00101 gnSEQSource* gnSEQSource::Clone() const 00102 { 00103 return new gnSEQSource( *this ); 00104 } 00105 // Contig Access methods 00106 inline 00107 uint32 gnSEQSource::GetContigListLength() const 00108 { 00109 return m_contigList.size(); 00110 } 00111 inline 00112 boolean gnSEQSource::Write(gnSequence& sequence, const string& filename){ 00113 return Write(sequence.GetSpec(), filename); 00114 } 00115 inline 00116 boolean gnSEQSource::Write(gnBaseSource *source, const string& filename){ 00117 return Write(source->GetSpec(), filename); 00118 } 00119 inline 00120 gnGenomeSpec *gnSEQSource::GetSpec() const{ 00121 return m_spec->Clone(); 00122 } 00123 00124 #endif 00125 // _gnSEQSource_h_ 00126

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