00001 #ifndef OBJECTS_OBJMGR___SEQ_MAP_SWITCH__HPP
00002 #define OBJECTS_OBJMGR___SEQ_MAP_SWITCH__HPP
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #include <objmgr/seq_map.hpp>
00038 #include <objmgr/bioseq_handle.hpp>
00039 #include <objects/seq/seq_id_handle.hpp>
00040 #include <util/range.hpp>
00041 #include <vector>
00042 #include <list>
00043 #include <map>
00044
00045 BEGIN_NCBI_SCOPE
00046 BEGIN_SCOPE(objects)
00047
00048 class CSeqMap;
00049 class CBioseq_Handle;
00050 class CSeq_align;
00051
00052
00053
00054
00055
00056
00057 class CSeqMapSwitchPoint : public CObject
00058 {
00059 public:
00060
00061
00062 CBioseq_Handle m_Master;
00063
00064 TSeqPos m_MasterPos;
00065
00066
00067 CConstRef<CSeq_align> m_FirstAlign;
00068
00069
00070 CSeq_id_Handle m_LeftId;
00071 TSeqPos m_LeftPos;
00072 bool m_LeftMinusStrand;
00073
00074
00075 CSeq_id_Handle m_RightId;
00076 TSeqPos m_RightPos;
00077 bool m_RightMinusStrand;
00078
00079
00080 CRange<TSeqPos> m_MasterRange;
00081
00082 CRange<TSeqPos> m_ExactMasterRange;
00083
00084
00085
00086
00087 typedef pair<TSeqPos, TSeqPos> TInsertDelete;
00088
00089 typedef map<TSeqPos, TInsertDelete> TDifferences;
00090 TDifferences m_LeftDifferences, m_RightDifferences;
00091
00092
00093 TInsertDelete GetDifferences(TSeqPos new_pos, TSeqPos add = 0) const;
00094
00095 int GetLengthDifference(TSeqPos new_pos, TSeqPos add = 0) const
00096 {
00097 TInsertDelete diff = GetDifferences(new_pos, add);
00098 return diff.first - diff.second;
00099 }
00100
00101 int GetSequenceDifference(TSeqPos new_pos, TSeqPos add = 0) const
00102 {
00103 TInsertDelete diff = GetDifferences(new_pos, add);
00104 return diff.first + diff.second;
00105 }
00106
00107 TSeqPos GetInsert(TSeqPos pos) const;
00108 TSeqPos GetLeftInPlaceInsert(void) const;
00109 TSeqPos GetRightInPlaceInsert(void) const;
00110
00111 void ChangeSwitchPoint(TSeqPos pos, TSeqPos add);
00112 void InsertInPlace(TSeqPos add_left, TSeqPos add_right);
00113
00114 bool operator<(const CSeqMapSwitchPoint& p) const
00115 {
00116 _ASSERT(m_Master == p.m_Master);
00117 return m_MasterPos < p.m_MasterPos;
00118 }
00119 };
00120
00121
00122
00123
00124
00125 CRef<CSeqMapSwitchPoint> GetSwitchPoint(const CBioseq_Handle& seq,
00126 const CSeq_align& align);
00127
00128 typedef vector<CRef<CSeqMapSwitchPoint> > TSeqMapSwitchPoints;
00129 typedef list<CRef<CSeq_align> > TSeqMapSwitchAligns;
00130
00131
00132
00133 TSeqMapSwitchPoints GetAllSwitchPoints(const CBioseq_Handle& seq,
00134 const TSeqMapSwitchAligns& aligns);
00135
00136
00137
00138 TSeqMapSwitchPoints GetAllSwitchPoints(const CBioseq_Handle& seq);
00139
00140 END_SCOPE(objects)
00141 END_NCBI_SCOPE
00142
00143 #endif // OBJECTS_OBJMGR___SEQ_MAP_SWITCH__HPP
00144
00145