gnRAWSource.h Source File

Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Compound Members File Members

# gnRAWSource.h

Go to the documentation of this file.

    00001
    00002 // File:            gnRAWSource.h
    00003 // Purpose:         Implements gnBaseSource for raw data 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
    00014 #ifndef _gnRAWSource_h_
    00015 #define _gnRAWSource_h_
    00016
    00017 #include "gn/gnDefs.h"
    00018
    00019 #include <string>
    00020 #include <fstream>
    00021 #include <vector>
    00022 #include "gn/gnFileSource.h"
    00023 #include "gn/gnFileContig.h"
    00024 #include "gn/gnSourceSpec.h"
    00025 #include "gn/gnSequence.h"
    00026
    00035
    00036 class GNDLLEXPORT gnRAWSource : public gnFileSource
    00037 {
    00038 public:
    00042         gnRAWSource();
    00047         gnRAWSource( const gnRAWSource& s );
    00051         ~gnRAWSource();
    00055         gnRAWSource* Clone() const;
    00056 // Contig Access methods
    00057         uint32 GetContigListLength() const;
    00058         boolean HasContig( const string& name ) const;
    00059         uint32 GetContigID( const string& name ) const;
    00060         string GetContigName( const uint32 i ) const;
    00061         gnSeqI GetContigSeqLength( const uint32 i ) const;
    00062
    00063         boolean SeqRead( const gnSeqI start, char* buf, uint32& bufLen, const uint32 contigI=ALL_CONTIGS );
    00064
    00071         static boolean Write(gnSequence& sequence, const string& filename);
    00078         static boolean Write(gnBaseSource *source, const string& filename);
    00079         gnGenomeSpec *GetSpec() const;
    00080         gnFileContig* GetFileContig( const uint32 contigI ) const;
    00081 private:
    00082         boolean SeqSeek( const gnSeqI start, const uint32& contigI, uint64& startPos, uint64& readableBytes );
    00083         boolean SeqStartPos( const gnSeqI start, gnFileContig& contig, uint64& startPos, uint64& readableBytes );
    00084         boolean ParseStream( istream& fin );
    00085
    00086         gnFileContig* m_contig;
    00087         gnGenomeSpec* m_spec;
    00088 };// class gnRAWSource
    00089 // Clone
    00090 inline
    00091 gnRAWSource* gnRAWSource::Clone() const
    00092 {
    00093         return new gnRAWSource( *this );
    00094 }
    00095 // Contig Access methods
    00096 inline
    00097 uint32 gnRAWSource::GetContigListLength() const
    00098 {
    00099         return m_contig == NULL? 0 : 1;
    00100 }
    00101 inline
    00102 boolean gnRAWSource::Write(gnBaseSource *source, const string& filename){
    00103         gnSequence gns(*source->GetSpec());
    00104         return Write(gns, filename);
    00105 }
    00106
    00107 #endif
    00108         // _gnRAWSource_h_