gnGenomeSpec.h Source File

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

# gnGenomeSpec.h

Go to the documentation of this file.

    00001
    00002 // File:            gnGenomeSpec.h
    00003 // Purpose:         abstract Spec class
    00004 // Description:     Genome level spec class
    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 _gnGenomeSpec_h_
    00014 #define _gnGenomeSpec_h_
    00015
    00016 #include "gn/gnDefs.h"
    00017
    00018 #include <vector>
    00019 #include <string>
    00020
    00021 #include "gn/gnClone.h"
    00022 #include "gn/gnBaseFeature.h"
    00023 #include "gn/gnBaseHeader.h"
    00024 #include "gn/gnMultiSpec.h"
    00025 #include "gn/gnFragmentSpec.h"
    00026 #include "gn/gnException.h"
    00027
    00034 class GNDLLEXPORT gnGenomeSpec : public gnMultiSpec
    00035 {
    00036 public:
    00037         gnGenomeSpec();
    00042         gnGenomeSpec( const gnGenomeSpec& s);
    00046         virtual ~gnGenomeSpec();
    00047 // Clone
    00048         virtual gnGenomeSpec* Clone() const;
    00049         virtual void Clear();
    00050 // Base Spec stuff
    00051         virtual void SetReverseComplement( const boolean value );
    00052
    00053 //Multispec stuff
    00054         virtual uint32 GetSpecListLength() const;
    00055         virtual gnFragmentSpec* GetSpec( const uint32 i ) const;
    00056         virtual gnFragmentSpec* GetSpecByBase( const gnSeqI baseI ) const;
    00057         virtual void AddSpec( gnBaseSpec* spec, const uint32 i = UINT32_MAX );
    00058         virtual void RemoveSpec( uint32 i );
    00059         virtual void MergeFragments( const uint32 startC, const uint32 endC);
    00060
    00061         virtual uint32 AddFeature( gnBaseFeature* feat );
    00062         virtual uint32 GetFeatureListLength() const;
    00063         virtual gnBaseFeature* GetFeature( const uint32 i ) const;
    00064         virtual void GetContainedFeatures(const gnLocation& lt, vector<gnBaseFeature*>& feature_vector, vector<uint32>& index_vector) const;
    00065         virtual void GetIntersectingFeatures(const gnLocation& lt, vector<gnBaseFeature*>& feature_vector, vector<uint32>& index_vector) const;
    00066         virtual void GetBrokenFeatures(const gnLocation& lt, vector<gnBaseFeature*>& feature_vector) const;
    00067         virtual void RemoveFeature( const uint32 i );
    00076         virtual gnGenomeSpec* CloneRange( const gnSeqI startI, const gnSeqI len ) const;
    00077
    00078 protected:
    00079         vector <gnFragmentSpec*> m_SpecList;
    00080
    00081 }; // class gnGenomeSpec
    00082
    00083 inline
    00084 gnGenomeSpec* gnGenomeSpec::Clone() const{
    00085         return new gnGenomeSpec(*this);
    00086 }
    00087
    00088 inline
    00089 uint32 gnGenomeSpec::GetSpecListLength() const{
    00090         return m_SpecList.size();
    00091 }
    00092
    00093 inline
    00094 gnFragmentSpec* gnGenomeSpec::GetSpec( const uint32 i ) const{
    00095         if(i < m_SpecList.size())
    00096                 return m_SpecList[i];
    00097         Throw_gnEx(FragmentIndexOutOfBounds());
    00098 }
    00099
    00100 inline
    00101 gnFragmentSpec* gnGenomeSpec::GetSpecByBase( const gnSeqI baseI ) const{
    00102         return m_SpecList[GetSpecIndexByBase(baseI)];
    00103 }
    00104
    00105 inline
    00106 void gnGenomeSpec::AddSpec( gnBaseSpec* spec, const uint32 i ){
    00107         uint32 index = i == UINT32_MAX ? m_SpecList.size() : i;
    00108         if(index <= m_SpecList.size()){
    00109                 m_SpecList.insert(m_SpecList.begin() + index, (gnFragmentSpec*)spec);
    00110         }
    00111 }
    00112
    00113 inline
    00114 void gnGenomeSpec::RemoveSpec( uint32 i ){
    00115         if(i < GetSpecListLength()){
    00116                 m_SpecList.erase(m_SpecList.begin() + i);
    00117         }
    00118 }
    00119
    00120 #endif
    00121         // _gnGenomeSpec_h_