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

gnSourceSpec.h

Go to the documentation of this file.
00001 /////////////////////////////////////////////////////////////////////////////
00002 // File:            gnSourceSpec.h
00003 // Purpose:         implements gnBaseSpec for source specs
00004 // Description:     
00005 // Changes:        
00006 // Version:         libGenome 0.5.1 
00007 // Author:          Aaron Darling 
00008 // Modified by:     
00009 // Copyright:       (c) Aaron Darling 
00010 // Licenses:        See COPYING file for details 
00011 /////////////////////////////////////////////////////////////////////////////
00012 #ifndef _gnSourceSpec_h_
00013 #define _gnSourceSpec_h_
00014 
00015 #include "gn/gnDefs.h"
00016 
00017 #include <string>
00018 #include "gn/gnContigSpec.h"
00019 #include "gn/gnBaseSource.h"
00020 
00021 /**
00022  * gnSourceSpec stores sequence and annotation data from another source.
00023  * @see gnContigSpec
00024  * @see gnBaseSpec
00025  */
00026 class GNDLLEXPORT gnSourceSpec : public gnContigSpec
00027 {
00028 public:
00029         /**
00030          * Empty constructor.
00031          */
00032         gnSourceSpec();
00033         /**
00034          * Constructor, creates a gnSourceSpec using sequence data in the given source.
00035          * A circular spec will be created if the end index is greater than the start.
00036          * @param m_pSource The source to read base pairs from.
00037          * @param m_ContigIndex The index of the contig in the source, ALL_CONTIGS by default.
00038          * @param startI The index to start reading base pairs from the source.
00039          * @param endI The index to stop reading base pairs from the source.
00040          * @param revComp True if the sequence is read reverse complement.
00041          */
00042         gnSourceSpec( gnBaseSource* m_pSource, const uint32 m_ContigIndex=ALL_CONTIGS, const gnSeqI startI=0, const gnSeqI endI=GNSEQI_END, const boolean revComp = false);
00043         /**
00044          * Copy constructor.
00045          * @param s the gnSourceSpec to copy.
00046          */
00047         gnSourceSpec( const gnSourceSpec& s );
00048         ~gnSourceSpec();
00049 
00050         gnSourceSpec* Clone() const;
00051 // Source Spec Specific functions
00052         virtual void Clear();
00053         virtual gnSeqI GetSourceLength() const; 
00054         virtual gnBaseSource *GetSource() const;
00055 
00056         /**
00057          * Copies a specified range of bases and returns a pointer to
00058          * the resulting gnSourceSpec.  You must delete the copy when you
00059          * are finished with it.
00060          * @param startI The first base pair to copy
00061          * @param len The length of the piece to copy
00062          * @return A copy of the gnSourceSpec containing only the specified bases
00063          */
00064         virtual gnSourceSpec* CloneRange( const gnSeqI startI, const gnSeqI len ) const;
00065 
00066 protected:
00067         virtual boolean Read(const gnSeqI start, gnSeqC* buf, uint32& bufLen ) const;
00068         gnBaseSource* m_pSource;
00069         
00070 }; // class gnSourceSpec
00071 
00072 inline
00073 gnSourceSpec* gnSourceSpec::Clone() const
00074 {
00075         return new gnSourceSpec( *this );
00076 }
00077 inline
00078 gnSeqI gnSourceSpec::GetSourceLength() const{
00079         return m_pSource->GetContigSeqLength(m_SourceContigIndex);
00080 }
00081 inline
00082 gnBaseSource* gnSourceSpec::GetSource() const
00083 {
00084         return m_pSource;
00085 }
00086 
00087 inline
00088 boolean gnSourceSpec::Read(const gnSeqI start, gnSeqC* buf, uint32& bufLen) const{
00089         return m_pSource->SeqRead(start, buf, bufLen, m_SourceContigIndex);
00090 }
00091 
00092 #endif
00093         // _gnSourceSpec_h_

Generated on Mon Feb 3 02:34:41 2003 for libGenome by doxygen1.3-rc3