NCBI C++ ToolKit
seq_text_ds.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 #ifndef GUI_WIDGETS_SEQ_TEXT___SEQ_TEXT_DS__HPP
2 #define GUI_WIDGETS_SEQ_TEXT___SEQ_TEXT_DS__HPP
3 
4 /* $Id: seq_text_ds.hpp 35180 2016-04-05 14:49:47Z asztalos $
5  * ===========================================================================
6  *
7  * PUBLIC DOMAIN NOTICE
8  * National Center for Biotechnology Information
9  *
10  * This software/database is a "United States Government Work" under the
11  * terms of the United States Copyright Act. It was written as part of
12  * the author's official duties as a United States Government employee and
13  * thus cannot be copyrighted. This software/database is freely available
14  * to the public for use. The National Library of Medicine and the U.S.
15  * Government have not placed any restriction on its use or reproduction.
16  *
17  * Although all reasonable efforts have been taken to ensure the accuracy
18  * and reliability of the software and data, the NLM and the U.S.
19  * Government do not and cannot warrant the performance or results that
20  * may be obtained by using this software or data. The NLM and the U.S.
21  * Government disclaim all warranties, express or implied, including
22  * warranties of performance, merchantability or fitness for any particular
23  * purpose.
24  *
25  * Please cite the author in any work or product based on this material.
26  *
27  * ===========================================================================
28  *
29  * Authors: Colleen Bollin (adapted from a file by Andrey Yazhuk)
30  *
31  * File Description:
32  *
33  */
34 
35 #include <corelib/ncbistd.hpp>
36 #include <corelib/ncbimisc.hpp>
37 
38 #include <gui/gui_export.h>
39 //#include <gui/opengl/glpane.hpp>
40 
41 #include <objmgr/scope.hpp>
42 #include <objmgr/bioseq_handle.hpp>
43 #include <objmgr/seq_vector.hpp>
45 #include <objmgr/feat_ci.hpp>
46 
52 
53 #include <serial/iterator.hpp>
54 #include <util/icanceled.hpp>
55 
59 
61 
63 {
64 public:
65  CSeqTextDataSourceInterval(const objects::CSeq_loc& loc, objects::CScope& scope, TSeqPos offset);
67 
68  TSeqPos GetSourceStart() const { return m_Offset; };
69  TSeqPos GetSourceStop() const { return m_Offset + m_Length - 1; };
73  void GetSeqString(TSeqPos src_start, TSeqPos src_stop, string& buffer) const;
74  void GetSeqData (TSeqPos src_start, TSeqPos src_stop, string& buffer, objects::SAnnotSelector* feat_sel/*objects::CSeqFeatData::ESubtype subtype*/) const;
75  objects::ENa_strand GetStrand() const { return m_Loc->GetStrand(); };
76  void GetToolTipForPosition(TSeqPos src_pos, string& tooltip_text);
77  bool IntersectingSourceInterval(TSeqPos& src_start, TSeqPos& src_stop) const;
78  bool SourcePosToIntervalPos(TSeqPos& pos) const;
79  bool SequencePosToIntervalPos(TSeqPos& pos) const;
80  void RenderFeatureExtras (ISeqTextGeometry* pParent, TSeqPos start_offset, TSeqPos stop_offset);
81  void GetFeatureData
82 (TSeqPos start_offset,
83  TSeqPos stop_offset,
84  CSeqTextConfig *cfg,
85  ISeqTextGeometry* pParent,
87  CSeqTextDefs::TSpliceSiteVector &splice_sites,
89 
90  void GetVariations (TSeqPos start_offset, TSeqPos stop_offset, CSeqTextDefs::TVariationGraphVector &variations);
91  void GetSubtypesForAlternatingExons (TSeqPos start_offset,
92  TSeqPos stop_offset,
93  ISeqTextGeometry* pParent,
95  bool& even);
97  objects::CBioseq_Handle GetSeq() {return m_Seq;}
98 protected:
100  objects::CFeat_CI m_Feat;
103  objects::CBioseq_Handle m_Seq;
104  objects::CSeqVector m_Vect;
105 
106  void x_AddVariationsFromFeature(const objects::CSeq_feat &feat, const objects::CSeq_loc &loc, CSeqTextDefs::TVariationGraphVector &variations) const;
107  void LookForSpliceJunctions (const objects::CMappedFeat& feat, CSeqTextDefs::TSpliceSiteVector &splice_sites, TSeqPos start_offset, TSeqPos stop_offset) const;
108  CRef<objects::CSeq_loc> x_GetSeqLocForInterval(TSeqPos interval_start, TSeqPos interval_stop) const;
109  bool x_IsSpliceSite(string splice_buffer, bool before_loc, bool is_minus) const;
110 };
111 
112 /// CSeqTextDataSource implements Adapter design pattern. It adapts given
113 /// CSeq_annot ot CSeq_align_set object by providing standard interface
114 /// representing data as plain list of pair-wise alignments.
115 
117  : public CObject
118 {
119 public:
121  typedef vector<bool> TAvailableSubtypeVector;
122 
123  static int ChooseBetterSubtype (int subtype1, int subtype2);
124 
125  CSeqTextDataSource(objects::CSeq_entry& sep, objects::CScope& scope);
126  CSeqTextDataSource(objects::CBioseq_Handle handle, objects::CScope& scope);
127  CSeqTextDataSource(objects::CSeq_loc &loc, objects::CScope& scope);
128 
129  virtual ~CSeqTextDataSource();
130 
131  void GetSeqData (TSeqPos start, TSeqPos stop, string& buffer, objects::SAnnotSelector *feat_sel = NULL, bool showFeatAsLower = false);
132  void GetFeatureData (TSeqPos start_offset, TSeqPos stop_offset, CSeqTextConfig *cfg, ISeqTextGeometry* pParent, CSeqTextDefs::TSubtypeVector &subtypes, CSeqTextDefs::TSpliceSiteVector &splice_sites, CSeqTextDefs::TVariationGraphVector &variations);
133  void GetSubtypesForAlternatingExons (TSeqPos start_offset, TSeqPos stop_offset, ISeqTextGeometry* pParent, CSeqTextDefs::TSubtypeVector &subtypes);
134  void GetIntervalBreaks (TSeqPos start_offset, TSeqPos stop_offset, CSeqTextDefs::TSeqPosVector &breaks);
135  void GetVariations (TSeqPos start_offset, TSeqPos stop_offset, CSeqTextDefs::TVariationGraphVector &variations);
136  void RenderFeatureExtras (ISeqTextGeometry* pParent, CGlPane &pane, TSeqPos seq_start, TSeqPos seq_stop);
137 
138  TSeqPos GetDataLen ();
139  string GetTitle ();
140  TIdRef GetId() const;
141 
142  TSeqPos SequencePosToSourcePos (TSeqPos sequence_pos, bool *found_in_source = NULL);
143  TSeqPos SourcePosToSequencePos (TSeqPos source_pos);
144  string GetToolTipForSourcePos (TSeqPos source_pos);
145 
146  vector<CConstRef<objects::CSeq_feat> > GetFeaturesAtPosition(TSeqPos source_pos);
147  int FindSequenceFragment (const string& fragment, TSeqPos start_search);
148  void FindSequenceFragmentList (const string& fragment, CSeqTextDefs::TSeqPosVector &locations, ICanceled* cancel);
149 
150  bool IsmRNASequence ();
151 
152  const objects::CSeq_loc* GetLoc() const;
153 
154  objects::CScope& GetScope();
155  objects::CBioseq_Handle GetSeq() {return m_SubjectHandle;}
156 protected:
157 
158  void GetSeqString (TSeqPos start, TSeqPos stop, string &buffer);
159  void x_PopulateFeatureIterators();
160 
164  objects::CBioseq_Handle m_SubjectHandle;
166 
167  typedef vector<CSeqTextDataSourceInterval> TIntervalList;
169 };
170 
171 
173 
174 #endif // GUI_WIDGETS_SEQ_TEXT___SEQ_TEXT_DS__HPP
@ eExtreme_Positional
numerical value
Definition: Na_strand.hpp:63
bool GetSeqData(ParserPtr pp, const DataBlk &entry, CBioseq &bioseq, Int4 nodetype, unsigned char *seqconv, Uint1 seq_data_type)
Definition: asci_blk.cpp:1686
class CGlPane
Definition: glpane.hpp:62
CObject –.
Definition: ncbiobj.hpp:180
bool SourcePosToIntervalPos(TSeqPos &pos) const
void GetFeaturesAtPosition(TSeqPos source_pos, vector< CConstRef< objects::CSeq_feat > > &features)
bool IntersectingSourceInterval(TSeqPos &src_start, TSeqPos &src_stop) const
void GetSeqData(TSeqPos src_start, TSeqPos src_stop, string &buffer, objects::SAnnotSelector *feat_sel) const
void RenderFeatureExtras(ISeqTextGeometry *pParent, TSeqPos start_offset, TSeqPos stop_offset)
objects::CBioseq_Handle m_Seq
objects::CBioseq_Handle GetSeq()
Definition: seq_text_ds.hpp:97
objects::CSeqVector m_Vect
bool SequencePosToIntervalPos(TSeqPos &pos) const
TSeqPos GetLength() const
Definition: seq_text_ds.hpp:72
TSeqPos GetSequenceStart() const
Definition: seq_text_ds.hpp:70
void GetSubtypesForAlternatingExons(TSeqPos start_offset, TSeqPos stop_offset, ISeqTextGeometry *pParent, CSeqTextDefs::TSubtypeVector &subtypes, bool &even)
void x_AddVariationsFromFeature(const objects::CSeq_feat &feat, const objects::CSeq_loc &loc, CSeqTextDefs::TVariationGraphVector &variations) const
void GetSeqString(TSeqPos src_start, TSeqPos src_stop, string &buffer) const
void LookForSpliceJunctions(const objects::CMappedFeat &feat, CSeqTextDefs::TSpliceSiteVector &splice_sites, TSeqPos start_offset, TSeqPos stop_offset) const
CSeqTextDataSourceInterval(const objects::CSeq_loc &loc, objects::CScope &scope, TSeqPos offset)
bool x_IsSpliceSite(string splice_buffer, bool before_loc, bool is_minus) const
void GetFeatureData(TSeqPos start_offset, TSeqPos stop_offset, CSeqTextConfig *cfg, ISeqTextGeometry *pParent, CSeqTextDefs::TSubtypeVector &subtypes, CSeqTextDefs::TSpliceSiteVector &splice_sites, CSeqTextDefs::TVariationGraphVector &variations)
CRef< objects::CSeq_loc > m_Loc
Definition: seq_text_ds.hpp:99
void GetToolTipForPosition(TSeqPos src_pos, string &tooltip_text)
CRef< objects::CSeq_loc > x_GetSeqLocForInterval(TSeqPos interval_start, TSeqPos interval_stop) const
TSeqPos GetSourceStart() const
Definition: seq_text_ds.hpp:68
TSeqPos GetSourceStop() const
Definition: seq_text_ds.hpp:69
TSeqPos GetSequenceStop() const
Definition: seq_text_ds.hpp:71
objects::ENa_strand GetStrand() const
Definition: seq_text_ds.hpp:75
objects::CFeat_CI m_Feat
void GetVariations(TSeqPos start_offset, TSeqPos stop_offset, CSeqTextDefs::TVariationGraphVector &variations)
CSeqTextDataSource implements Adapter design pattern.
vector< CSeqTextDataSourceInterval > TIntervalList
CRef< objects::CSeq_entry > m_Sep
CConstRef< objects::CSeq_id > TIdRef
CRef< objects::CSeq_loc > m_Loc
vector< bool > TAvailableSubtypeVector
objects::CBioseq_Handle m_SubjectHandle
CSeqTextDataSource(objects::CSeq_entry &sep, objects::CScope &scope)
CSeqTextDataSource(objects::CBioseq_Handle handle, objects::CScope &scope)
CSeqTextDataSource(objects::CSeq_loc &loc, objects::CScope &scope)
TIntervalList m_Intervals
objects::CBioseq_Handle GetSeq()
CRef< objects::CScope > m_Scope
vector< CSeqTextVariationGraph > TVariationGraphVector
vector< bool > TSpliceSiteVector
vector< int > TSubtypeVector
vector< TSeqPos > TSeqPosVector
Interface for testing cancellation request in a long lasting operation.
Definition: icanceled.hpp:51
class ISeqTextGeometry
Include a standard set of the NCBI C++ Toolkit most basic headers.
int offset
Definition: replacements.h:160
unsigned int TSeqPos
Type for sequence locations and lengths.
Definition: ncbimisc.hpp:875
#define NULL
Definition: ncbistd.hpp:225
const CSeq_id & GetId(const CSeq_loc &loc, CScope *scope)
If all CSeq_ids embedded in CSeq_loc refer to the same CBioseq, returns the first CSeq_id found,...
NCBI_XOBJUTIL_EXPORT string GetTitle(const CBioseq_Handle &hnd, TGetTitleFlags flags=0)
Definition: seqtitle.cpp:106
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define NCBI_GUIWIDGETS_SEQTEXT_EXPORT
Definition: gui_export.h:538
ENa_strand
strand of nucleic acid
Definition: Na_strand_.hpp:64
Defines to provide correct exporting from DLLs in Windows.
Miscellaneous common-use basic types and functionality.
static pcre_uint8 * buffer
Definition: pcretest.c:1051
int GetLoc(const string &acc, const string &pat, CSeq_loc &loc, CScope &scope)
CScope & GetScope()
static const char *const features[]
Modified on Tue Apr 23 07:41:01 2024 by modify_doxy.py rev. 669887