|
gnDNXSource.hGo 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.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 _gnDNXSource_h_ 00014 #define _gnDNXSource_h_ 00015 00016 #include "gn/gnDefs.h" 00017 00018 00019 #include <string> 00020 #include <vector> 00021 #include <fstream> 00022 #include <time.h> 00023 00024 #include "gn/gnSetup.h" 00025 #include "gn/gnFileSource.h" 00026 #include "gn/gnSourceSpec.h" 00027 #include "gn/gnSequence.h" 00028 00035 00036 class GNDLLEXPORT gnDNXSource : public gnFileSource 00037 { 00038 public: 00042 gnDNXSource(); 00047 gnDNXSource( const gnDNXSource& s ); 00051 ~gnDNXSource(); 00052 00053 gnDNXSource* Clone() const; 00054 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, uint32& bufLen, const uint32 contigI=ALL_CONTIGS ) ; 00062 00071 static boolean Write(gnSequence& sequence, const string& filename); 00081 static boolean Write(gnBaseSource *source, const string& filename); 00090 static boolean Write(gnGenomeSpec *spec, const string& filename); 00091 00092 gnGenomeSpec* GetSpec() const; 00093 gnFileContig* GetFileContig( const uint32 contigI ) const; 00094 private: 00095 boolean ParseStream( istream& fin ); 00096 static void ValidateName(string& name); 00097 00098 gnGenomeSpec *m_DNXSpec; 00099 };// class gnDNXSource 00100 00101 inline 00102 gnDNXSource* gnDNXSource::Clone() const 00103 { 00104 return new gnDNXSource( *this ); 00105 } 00106 00107 inline 00108 uint32 gnDNXSource::GetContigListLength() const 00109 { 00110 return m_DNXSpec->GetSpecListLength(); 00111 } 00112 //read sequence data from the file 00113 inline 00114 boolean gnDNXSource::SeqRead( const gnSeqI start, char* buf, uint32& bufLen, const uint32 contigI ) 00115 { 00116 return m_DNXSpec->SeqRead(start, buf, bufLen, contigI); 00117 } 00118 00119 inline 00120 boolean gnDNXSource::Write(gnSequence& sequence, const string& filename){ 00121 return Write(sequence.GetSpec(), filename); 00122 } 00123 inline 00124 boolean gnDNXSource::Write(gnBaseSource *source, const string& filename){ 00125 return Write(source->GetSpec(), filename); 00126 } 00127 inline 00128 gnGenomeSpec *gnDNXSource::GetSpec() const{ 00129 return m_DNXSpec->Clone(); 00130 } 00131 00132 #endif 00133 // _gnDNXSource_h_ 00134 Generated at Fri Nov 30 15:36:51 2001 for libGenome by 1.2.8.1 written by Dimitri van Heesch, © 1997-2001 |