00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
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
00028
00029
00030
00031
00032
00033
00034
00035 class GNDLLEXPORT gnDNXSource : public gnFileSource
00036 {
00037 public:
00038
00039
00040
00041 gnDNXSource();
00042
00043
00044
00045
00046 gnDNXSource( const gnDNXSource& s );
00047
00048
00049
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, uint32& bufLen, const uint32 contigI=ALL_CONTIGS ) ;
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070 static boolean Write(gnSequence& sequence, const string& filename);
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080 static boolean Write(gnBaseSource *source, const string& filename);
00081
00082
00083
00084
00085
00086
00087
00088
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 };
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
00112 inline
00113 boolean gnDNXSource::SeqRead( const gnSeqI start, char* buf, uint32& 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
00133