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