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

gnContigSpec.h

Go to the documentation of this file.
00001 /////////////////////////////////////////////////////////////////////////////
00002 // File:            gnContigSpec.h
00003 // Purpose:         Abstract Contig Spec class
00004 // Description:     Defines an interface for contig specs
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 _gnContigSpec_h_
00013 #define _gnContigSpec_h_
00014 
00015 #include "gn/gnDefs.h"
00016 
00017 #include <vector>
00018 #include <string>
00019 
00020 #include "gn/gnBaseSpec.h"
00021 #include "gn/gnBaseFeature.h"
00022 #include "gn/gnDebug.h"
00023 /**
00024  * gnContigSpec is an interface for classes which store contigs, or reads,
00025  * of DNA or protein sequence
00026  */
00027 class GNDLLEXPORT gnContigSpec : public gnBaseSpec
00028 {
00029 public:
00030         gnContigSpec(){}
00031         /**
00032          * Destructor, frees memory.
00033          */
00034         virtual ~gnContigSpec(){}
00035         virtual gnContigSpec* Clone() const = 0;
00036         virtual gnContigSpec* CloneRange( const uint32 startI, const uint32 len ) const = 0;
00037         /**
00038          * Get the name of the source associated with this spec.
00039          * @return The source name or an empty string if none exists.
00040          */
00041         virtual string GetSourceName() const;
00042         /**
00043          * Get the base pair index where this contig starts inside of the sequence data.
00044          * @return The starting base pair.
00045          */
00046         virtual gnSeqI GetStart() const;
00047         /**
00048          * Get the length of this contig inside of the sequence data.
00049          * @return This contigs length.
00050          */
00051         virtual gnSeqI GetLength() const;
00052         /**
00053          * Get the length of the source for this spec.
00054          * @return The source length.
00055          */
00056         virtual gnSeqI GetSourceLength() const = 0;
00057         /**
00058          * Returns this contig's index in its source sequence.
00059          * @return This contig's index in the source sequence.
00060          */
00061         virtual uint32 GetSourceContigIndex() const;
00062         /**
00063          * Sets the name of the source associated with this contig.
00064          * @param sourceName The new name.
00065          * @return True if successful.
00066          */
00067         virtual void SetSourceName( const string& sourceName );
00068         /**
00069          * Sets the starting base pair to read from in the contig's sequence.
00070          * This does not affect the actual sequence data but only where to begin
00071          * using it in this contig.
00072          * @param start The new starting base pair.
00073          * @return True if successful.
00074          */
00075         virtual void SetStart( const gnSeqI start );
00076         /**
00077          * Sets the length of reads into this sequence.
00078          * This does not affect the actual sequence data but only how much of it
00079          * is used in this contig.
00080          * @param len The new sequence length.
00081          * @return True if successful.
00082          */
00083         virtual void SetLength( const gnSeqI len );
00084         /**
00085          * Sets this contig's index in its source sequence.
00086          * @param contigI This contig's index in the source sequence.
00087          */
00088         virtual void SetSourceContigIndex( const uint32 contigI );
00089         /**
00090          * Sets the reverse complement bit for this contig.
00091          * This routine will translate the start index to the reverse base pair.
00092          * @param value True for reverse complement, false otherwise.
00093          * @return True if successful.
00094          */
00095         virtual void SetReverseComplement( const boolean value );
00096 
00097         virtual void CropStart( gnSeqI cropLen );
00098         virtual void CropEnd( gnSeqI cropLen );
00099 
00100         virtual boolean SeqRead(const gnSeqI start, gnSeqC* buf, uint32& bufLen, const uint32 contigI ) const;
00101         virtual void Clear();
00102 protected:
00103         gnSeqI m_start;  //start within the genome.
00104         gnSeqI m_length;
00105         uint32 m_SourceContigIndex;
00106 
00107         /**
00108          * all derived classes must implement this!
00109          * it simply reads the specified bases into buf, disregarding circularity and reverse complement.
00110          */
00111         virtual boolean Read(const gnSeqI start, gnSeqC* buf, uint32& bufLen ) const = 0;
00112 
00113 private:
00114 
00115 }; // class gnContigSpec
00116 
00117 
00118 inline
00119 string gnContigSpec::GetSourceName() const{
00120         return m_sourceName;
00121 }
00122 inline
00123 void gnContigSpec::SetSourceName(const string& sourceName){
00124         m_sourceName = sourceName;
00125 }
00126 
00127 inline
00128 gnSeqI gnContigSpec::GetStart() const
00129 {
00130         return m_start;
00131 }
00132 inline
00133 gnSeqI gnContigSpec::GetLength() const
00134 {
00135         return m_length;
00136 }
00137 // SET
00138 inline
00139 void gnContigSpec::SetStart( const gnSeqI start )
00140 {
00141         m_start = start;
00142 }
00143 inline
00144 void gnContigSpec::SetLength( const gnSeqI len )
00145 {
00146         m_length = len;
00147 }
00148 inline
00149 uint32 gnContigSpec::GetSourceContigIndex() const{
00150         return m_SourceContigIndex;
00151 }
00152 inline
00153 void gnContigSpec::SetSourceContigIndex( const uint32 contigI ){
00154         m_SourceContigIndex = contigI;
00155 }
00156 
00157 #endif
00158         // _gnContigSpec_h_

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