00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef _gnGenomeSpec_h_
00013 #define _gnGenomeSpec_h_
00014
00015 #include "gn/gnDefs.h"
00016
00017 #include <vector>
00018 #include <string>
00019
00020 #include "gn/gnClone.h"
00021 #include "gn/gnBaseFeature.h"
00022 #include "gn/gnBaseHeader.h"
00023 #include "gn/gnMultiSpec.h"
00024 #include "gn/gnFragmentSpec.h"
00025 #include "gn/gnException.h"
00026
00027
00028
00029
00030
00031
00032
00033 class GNDLLEXPORT gnGenomeSpec : public gnMultiSpec
00034 {
00035 public:
00036 gnGenomeSpec();
00037
00038
00039
00040
00041 gnGenomeSpec( const gnGenomeSpec& s);
00042
00043
00044
00045 virtual ~gnGenomeSpec();
00046
00047 virtual gnGenomeSpec* Clone() const;
00048 virtual void Clear();
00049
00050 virtual void SetReverseComplement( const boolean value );
00051
00052
00053 virtual uint32 GetSpecListLength() const;
00054 virtual gnFragmentSpec* GetSpec( const uint32 i ) const;
00055 virtual gnFragmentSpec* GetSpecByBase( const gnSeqI baseI ) const;
00056 virtual void AddSpec( gnBaseSpec* spec, const uint32 i = UINT32_MAX );
00057 virtual void RemoveSpec( uint32 i );
00058 virtual void MergeFragments( const uint32 startC, const uint32 endC);
00059
00060 virtual uint32 AddFeature( gnBaseFeature* feat );
00061 virtual uint32 GetFeatureListLength() const;
00062 virtual gnBaseFeature* GetFeature( const uint32 i ) const;
00063 virtual void GetContainedFeatures(const gnLocation& lt, vector<gnBaseFeature*>& feature_vector, vector<uint32>& index_vector) const;
00064 virtual void GetIntersectingFeatures(const gnLocation& lt, vector<gnBaseFeature*>& feature_vector, vector<uint32>& index_vector) const;
00065 virtual void GetBrokenFeatures(const gnLocation& lt, vector<gnBaseFeature*>& feature_vector) const;
00066 virtual void RemoveFeature( const uint32 i );
00067
00068
00069
00070
00071
00072
00073
00074
00075 virtual gnGenomeSpec* CloneRange( const gnSeqI startI, const gnSeqI len ) const;
00076
00077 protected:
00078 vector <gnFragmentSpec*> m_SpecList;
00079
00080 };
00081
00082 inline
00083 gnGenomeSpec* gnGenomeSpec::Clone() const{
00084 return new gnGenomeSpec(*this);
00085 }
00086
00087 inline
00088 uint32 gnGenomeSpec::GetSpecListLength() const{
00089 return m_SpecList.size();
00090 }
00091
00092 inline
00093 gnFragmentSpec* gnGenomeSpec::GetSpec( const uint32 i ) const{
00094 if(i < m_SpecList.size())
00095 return m_SpecList[i];
00096 Throw_gnEx(FragmentIndexOutOfBounds());
00097 }
00098
00099 inline
00100 gnFragmentSpec* gnGenomeSpec::GetSpecByBase( const gnSeqI baseI ) const{
00101 return m_SpecList[GetSpecIndexByBase(baseI)];
00102 }
00103
00104 inline
00105 void gnGenomeSpec::AddSpec( gnBaseSpec* spec, const uint32 i ){
00106 uint32 index = i == UINT32_MAX ? m_SpecList.size() : i;
00107 if(index <= m_SpecList.size()){
00108 m_SpecList.insert(m_SpecList.begin() + index, (gnFragmentSpec*)spec);
00109 }
00110 }
00111
00112 inline
00113 void gnGenomeSpec::RemoveSpec( uint32 i ){
00114 if(i < GetSpecListLength()){
00115 m_SpecList.erase(m_SpecList.begin() + i);
00116 }
00117 }
00118
00119 #endif
00120