include/gn/gnDNXSource.h

Go to the documentation of this file.
00001 00002 // File: gnDNXSource.h 00003 // Purpose: Implements gnBaseSource for .DNX 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 #ifndef _gnDNXSource_h_ 00013 #define _gnDNXSource_h_ 00014 00015 #include "gn/gnDefs.h" 00016 00017 00018 #include <string> 00019 #include <vector> 00020 #include <fstream> 00021 #include <time.h> 00022 00023 #include "gn/gnSetup.h" 00024 #include "gn/gnFileSource.h" 00025 #include "gn/gnSourceSpec.h" 00026 #include "gn/gnSequence.h" 00027 00035 class GNDLLEXPORT gnDNXSource : public gnFileSource 00036 { 00037 public: 00041 gnDNXSource(); 00046 gnDNXSource( const gnDNXSource& s ); 00050 ~gnDNXSource(); 00051 00052 gnDNXSource* Clone() const; 00053 00054 uint32 GetContigListLength() const; 00055 boolean HasContig( const string& name ) const; 00056 uint32 GetContigID( const string& name ) const; 00057 string GetContigName( const uint32 i ) const; 00058 gnSeqI GetContigSeqLength( const uint32 i ) const; 00059 00060 boolean SeqRead( const gnSeqI start, char* buf, gnSeqI& bufLen, const uint32 contigI=ALL_CONTIGS ) ; 00061 00070 static boolean Write(gnSequence& sequence, const string& filename); 00080 static boolean Write(gnBaseSource *source, const string& filename); 00089 static boolean Write(gnGenomeSpec *spec, const string& filename); 00090 00091 gnGenomeSpec* GetSpec() const; 00092 gnFileContig* GetFileContig( const uint32 contigI ) const; 00093 private: 00094 boolean ParseStream( istream& fin ); 00095 static void ValidateName(string& name); 00096 00097 gnGenomeSpec *m_DNXSpec; 00098 };// class gnDNXSource 00099 00100 inline 00101 gnDNXSource* gnDNXSource::Clone() const 00102 { 00103 return new gnDNXSource( *this ); 00104 } 00105 00106 inline 00107 uint32 gnDNXSource::GetContigListLength() const 00108 { 00109 return m_DNXSpec->GetSpecListLength(); 00110 } 00111 //read sequence data from the file 00112 inline 00113 boolean gnDNXSource::SeqRead( const gnSeqI start, char* buf, gnSeqI& bufLen, const uint32 contigI ) 00114 { 00115 return m_DNXSpec->SeqRead(start, buf, bufLen, contigI); 00116 } 00117 00118 inline 00119 boolean gnDNXSource::Write(gnSequence& sequence, const string& filename){ 00120 return Write(sequence.GetSpec(), filename); 00121 } 00122 inline 00123 boolean gnDNXSource::Write(gnBaseSource *source, const string& filename){ 00124 return Write(source->GetSpec(), filename); 00125 } 00126 inline 00127 gnGenomeSpec *gnDNXSource::GetSpec() const{ 00128 return m_DNXSpec->Clone(); 00129 } 00130 00131 #endif 00132 // _gnDNXSource_h_ 00133

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