gnFASSource.h Source File

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

# gnFASSource.h

Go to the documentation of this file.

    00001
    00002 // File:            gnFASSource.h
    00003 // Purpose:         Implements gnBaseSource for .FAS 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 _gnFASSource_h_
    00014 #define _gnFASSource_h_
    00015
    00016 #include "gn/gnDefs.h"
    00017
    00018 #include <string>
    00019 #include <fstream>
    00020 #include <vector>
    00021 #include "gn/gnFileSource.h"
    00022 #include "gn/gnSequence.h"
    00023
    00024 #define FAS_LINE_WIDTH 80
    00025
    00032
    00033 class GNDLLEXPORT gnFASSource : public gnFileSource
    00034 {
    00035 public:
    00039         gnFASSource();
    00044         gnFASSource( const gnFASSource& s );
    00048         ~gnFASSource();
    00052         gnFASSource* Clone() const;
    00053
    00054         uint32 GetContigListLength() const;
    00055         boolean HasContig( const string& nameStr ) const;
    00056         uint32 GetContigID( const string& nameStr ) const;
    00057         string GetContigName( const uint32 i ) const;
    00058         gnSeqI GetContigSeqLength( const uint32 i ) const;
    00059         gnFileContig* GetContig( const uint32 i ) const;
    00060
    00061         boolean SeqRead( const gnSeqI start, char* buf, uint32& bufLen, const uint32 contigI=ALL_CONTIGS ) ;
    00062
    00077         static void Write(gnSequence& sequence, const string& filename, boolean write_coords = true, boolean enforce_unique_names = true);
    00078
    00092         static void Write(gnSequence& sequence, ostream& m_ostream, boolean write_coords = true, boolean enforce_unique_names = true);
    00093
    00100         static boolean Write(gnBaseSource *source, const string& filename);
    00101 //      /**
    00102 //       * deprecated - do not use
    00103 //       * Writes the given spec to a FastA file named "filename".
    00104 //       * @param spec The spec to write out.
    00105 //       * @param filename The name of the file to write.
    00106 //       * @return True if successful, false otherwise.
    00107 //       */
    00108 //      static boolean Write(gnGenomeSpec *spec, const string& filename);
    00109         gnGenomeSpec *GetSpec() const;
    00110
    00111         gnFileContig* GetFileContig( const uint32 contigI ) const;
    00112 private:
    00113         boolean SeqSeek( const gnSeqI start, const uint32 contigI, uint64& startPos, uint64& readableBytes );
    00114         boolean SeqStartPos( const gnSeqI start, gnFileContig& contig, uint64& startPos, uint64& readableBytes );
    00115         boolean ParseStream( istream& fin );
    00116
    00117         vector< gnFileContig* > m_contigList;
    00118 };// class gnFASSource
    00119
    00120 inline
    00121 gnFASSource* gnFASSource::Clone() const
    00122 {
    00123         return new gnFASSource( *this );
    00124 }
    00125
    00126 inline
    00127 uint32 gnFASSource::GetContigListLength() const
    00128 {
    00129         return m_contigList.size();
    00130 }
    00131
    00132 #endif
    00133         // _gnFASSource_h_