00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef _gnABISource_h_
00013 #define _gnABISource_h_
00014
00015 #include "gn/gnDefs.h"
00016
00017 #include <string>
00018 #include "gn/gnFileSource.h"
00019 #include "gn/gnFileContig.h"
00020 #include "gn/gnSourceSpec.h"
00021 #include "gn/gnFilter.h"
00022
00023
00024
00025
00026 class GNDLLEXPORT gnABISource : public gnFileSource
00027 {
00028 public:
00029 gnABISource();
00030
00031
00032
00033
00034 gnABISource( const gnABISource& s );
00035 ~gnABISource();
00036 gnABISource* Clone() const;
00037
00038 uint32 GetContigListLength() const;
00039 boolean HasContig( const string& name ) const;
00040 uint32 GetContigID( const string& name ) const;
00041 string GetContigName( uint32 i ) const;
00042 gnSeqI GetContigSeqLength( uint32 i ) const;
00043 gnFileContig* GetContig( const uint32 i ) const;
00044
00045 boolean SeqRead( const gnSeqI start, char* buf, uint32& bufLen, const uint32 contigI=ALL_CONTIGS );
00046
00047
00048
00049
00050
00051
00052
00053 static boolean Write(gnSequence& sequence, const string& filename);
00054 gnGenomeSpec *GetSpec() const;
00055
00056 gnFileContig* GetFileContig( const uint32 contigI ) const;
00057 private:
00058 boolean SeqSeek( const gnSeqI start, const uint32& contigI, uint64& startPos, uint64& readableBytes );
00059 boolean SeqStartPos( const gnSeqI start, gnFileContig& contig, uint64& startPos, uint64& readableBytes );
00060 boolean ParseStream( istream& fin );
00061
00062 gnGenomeSpec *m_spec;
00063 vector< gnFileContig* > m_contigList;
00064
00065 };
00066
00067 inline
00068 gnABISource* gnABISource::Clone() const
00069 {
00070 return new gnABISource( *this );
00071 }
00072 inline
00073 uint32 gnABISource::GetContigListLength() const
00074 {
00075 return m_contigList.size();
00076 }
00077 inline
00078 gnGenomeSpec *gnABISource::GetSpec() const
00079 {
00080 return m_spec->Clone();
00081 }
00082
00083 #endif
00084