64 #include <wx/richmsgdlg.h>
106 m_ConsensusRow(
NULL),
113 m_fExtOrgLookup(
true),
116 m_PixLeft(-1), m_PixRight(-1), m_ModelLeft(-1), m_ModelRight(-1)
151 if (aln_from > aln_to)
152 swap(aln_from, aln_to);
153 aln_from = floor(aln_from);
154 aln_to = floor(aln_to );
157 int rc_right = floor(source_rc_vis.
Right());
158 int rc_left = floor(source_rc_vis.
Left());
160 if (aln_to == rc_right) {
165 if (aln_from == rc_left) {
172 if (aln_from == rc_left) {
176 if (aln_to == rc_right) {
215 s_row,
"Click to expand/collapse",
"toggle_expand");
466 }
catch(std::exception& e) {
469 if (!
error.empty()) {
545 wxEventType
type =
event.GetEventType();
547 wxPoint pos =
event.GetPosition();
560 wxPoint pos =
event.GetPosition();
570 if (
type == wxEVT_LEFT_DOWN) {
572 }
else if (
type == wxEVT_LEFT_UP) {
573 skipped = glyph->
OnLeftUp(hit_point);
581 if (!event.CmdDown()) {
583 sel_visitor->
Clear();
591 }
else if (
type == wxEVT_LEFT_DCLICK) {
616 tooltip.
AddRow(
"First position in sequence coordinates");
619 tooltip.
AddRow(
"First visible position in alignment coordinates");
625 tooltip.
AddRow(
"Last visible position in alignment coordinates");
628 tooltip.
AddRow(
"Last position in sequence");
631 tooltip.
AddRow(
"Sequence length");
634 tooltip.
AddRow(
"Organism name");
651 tooltip.
AddRow(sequence::CDeflineGenerator().GenerateDefline(handle));
687 s_tip =
"Graphs: Click to ";
690 s_tip =
"No graphs available - nothing to expand";
700 #define TOOLTIP_RANGE_PIX 3
714 const function <
bool(
CGlPane& pane)>&
f)
724 using TRangeData = tuple < IAlnExplorer::TSignedRange, IAlnExplorer::TSignedRange, COpenRange<double> >;
725 vector <TRangeData> render_list;
727 for (; *align_it; ++(*align_it)) {
732 if (seq_range.Empty())
735 if (aln_range.Empty())
741 double x1 = aln_range.
GetFrom();
742 double x2 = aln_range.GetTo();
745 x1 = (x1 - offset_x) / scale_x;
746 x2 = (x2 - offset_x + 1) / scale_x;
747 x1 = max<TModelUnit>(x1 + left, left);
748 x2 = min<TModelUnit>(x2 + left, right);
766 for (
auto&
data : render_list) {
767 auto& seq_range = get<0>(
data);
768 auto& aln_range = get<1>(
data);
769 auto& view_range = get<2>(
data);
770 viewport.
SetHorz(view_range.GetFrom(), view_range.GetTo());
773 auto l = view_range.GetFrom(),
r = view_range.GetTo();
775 if (m_PixRight <= l || m_PixLeft >=
r)
777 auto len = (
r -
l) + 1;
787 seq_range.GetFrom(), seq_range.GetTo(),
789 bool error =
f(target_pane);
840 hit_point = track_pane.
UnProject(vp_pt.
X(), vp_pt.
Y());
848 return layout_track_hit;
859 if (hit_point.
m_X < 0)
873 glyph =
m_TrackPanel->CGlyphContainer::HitTest(hit_point);
904 glyph->
GetTooltip(hit_point, *track_tooltip, s_tip);
905 if (!track_tooltip->IsEmpty()) {
910 tooltip.
Append(*track_tooltip);
915 s_tip +=
", Negative Strand";
919 tooltip.
Append(*track_tooltip);
938 return formatter->Render();
968 const int kMaxRegions = 5;
983 if(n_regions < kMaxRegions) {
988 if(n_regions < kMaxRegions) {
991 if (seq_from > seq_to)
992 swap(seq_from, seq_to);
996 if (aln_from > aln_to)
997 swap(aln_from, aln_to);
1003 }
else if(aligned) {
1004 if(aln_r.
GetFrom() == prev_aln_to + 1 && seq_r.
GetFrom() > prev_to + 1) {
1006 if(n_regions < kMaxRegions) {
1014 prev_aln_to = aln_r.
GetTo();
1015 prev_to = seq_r.
GetTo();
1019 if(n_regions > kMaxRegions)
1029 for (
auto seqdesc : descr.
Get()) {
1030 if (seqdesc->IsTitle()) {
1031 res = seqdesc->GetTitle();
1043 for (
auto seqdesc : descr.
Get()) {
1044 if (seqdesc->IsSource()) {
1048 if (subsrc->IsSetSubtype() && subsrc->GetSubtype() == subtype) {
1049 return subsrc->GetName();
1063 for (
auto seqdesc : descr.
Get()) {
1064 if (seqdesc->IsSource()) {
1069 for (
auto orgmod : on.
GetMod()) {
1070 if (orgmod->IsSetSubtype() &&
1073 return orgmod->GetSubname();
1095 if (!title.empty()) {
1107 s_tip +=
" residues)";
1112 s_tip +=
", Negative Strand";
1119 tooltip.
AddRow(
"Organism:", taxonomy);
1123 s_tip +=
", Negative Strand";
1140 if (!s.empty()) tooltip.
AddRow(
"Sequence title:", s);
1142 if (!s.empty()) tooltip.
AddRow(
"Country:", s);
1146 if (!s.empty()) tooltip.
AddRow(
"Host:", s);
1149 if (!s.empty()) tooltip.
AddRow(
"Isolation source:", s);
1151 if (!s.empty()) tooltip.
AddRow(
"Collection date:", s);
1159 seq_pos /= base_width;
1178 s_tip +=
"<br>[coordinates ";
1181 tooltip.
AddRow(
"Insertion:", s_tip);
1199 s_tip +=
" residue";
1205 tooltip.
AddRow(
"Gap:", s_tip);
1217 string s_tip =
"Unaligned region - ";
1223 s_tip +=
", on Sequence [";
1249 seq +=
"..." + right_seq;
1295 int left = (
int) floor(rc_model.
Left());
1296 int right =
int(ceil(rc_model.
Right())) - 1;
1315 bool can_render_scores = averageable || scale_x <
kScoreMinScale;
1323 if (has_scores && can_render_scores) {
1355 int start = (left < floor(rc_model.
Left())) ? left + 1 : left;
1356 int stop = (
int)ceil(rc_model.
Right());
1357 if (stop + 1 > rc_model.
Right()) {
1364 gl.
Viewport(orig_vp[0], orig_vp[1], orig_vp[2], orig_vp[3]);
1383 gl.
Vertex2f((
float)rc_vp.Right(), (
float)rc_vp.Top() + 1);
1384 gl.
Vertex2f((
float)rc_vp.Right(), (
float)rc_vp.Bottom() - 1);
1410 static CRgbaColor cl_insert(0.0f, 0.0f, 1.0f);
1411 static CRgbaColor cl_unaligned(0.0f, 0.5f, 0.0f);
1422 TModelUnit ins_pos = it_2->GetAlnRange().GetFrom() - offset_x;
1423 if (ins_pos < row_start || ins_pos > row_stop)
1433 log_len =
max(log_len, kMinLen);
1438 glLined(ins_pos, top_y - 1, ins_pos, bottom_y - 1);
1439 glLined(x1, top_y - 1, x2, top_y - 1);
1440 glLined(x1, bottom_y, x2, bottom_y);
1453 vector<TSeqRange> gaps;
1463 bool empty_seg = (
r.GetFrom() < row_start ||
r.GetTo() > row_stop);
1469 gaps.emplace_back(
r.GetFrom(),
r.GetTo());
1471 if (
r.GetFrom() - gaps.back().GetTo() == 1) {
1472 gaps.back().
SetTo(
r.GetTo());
1475 gaps.emplace_back(
r.GetFrom(),
r.GetTo());
1479 if (!gaps.empty()) {
1481 gl.
BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
1483 for (
const auto&
r : gaps) {
1484 double pix_len =
r.GetLength();
1486 if (pix_len < 1.5) {
1487 auto pos =
r.GetFrom() - offset_x;
1488 float alpha = 0.25 +
r.GetLength() * 0.75;
1524 if (aln_r.
GetFrom() == prev_aln_pos + 1 &&
r.GetFrom() > prev_pos + 1) {
1528 log_len =
max(log_len, kMinLen);
1533 glLined(ins_pos, top_y, ins_pos, bottom_y);
1534 glLined(x1, top_y, x2, top_y);
1535 glLined(x1, bottom_y, x2, bottom_y);
1538 prev_aln_pos = aln_r.
GetTo();
1539 prev_pos =
r.GetTo();
1547 void operator()(
float& dst,
const float& src,
float fraction,
bool long_seg)
1549 dst += src * fraction;
1569 TR rasterizer(rc_vp.Left(), rc_vp.Right(), rc_vis.
Left(), rc_vis.
Right());
1576 rasterizer.AddInterval(
r.GetFrom(),
r.GetToOpen(), 1.0, f_sum);
1580 TVPUnit vp_top_y = rc_vp.Top();
1583 const TR::TRaster& raster = rasterizer.GetRaster();
1587 gl.
BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
1591 int off_x = rc_vp.Left();
1592 static const float eps = 0.001f;
1599 if (!row_range.
Empty()) {
1601 TVPUnit y_c = floor((
float(vp_top_y + vp_bottom_y) / 2) + 0.5);
1608 glLined(row_start + off_x, y_c, row_stop + off_x, y_c);
1613 for(
size_t i = 0;
i < raster.size(); ) {
1615 float v = raster[
i];
1616 while(
i < raster.size() && raster[
i] == v) {
1624 double alpha = 0.25 + v * 0.75;
1627 gl.
Rectd(start + off_x, vp_top_y,
i + off_x, vp_bottom_y);
1686 gl.
BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
1688 TVPUnit vp_top_y = rc_vp.Top();
1692 int range_from = (
int) (floor(rc_vis.
Left()));
1694 CScoreCache::TScoreColl::const_iterator it = ScoreColl.
begin();
1695 const CScoreCache::TScoreColl::const_iterator it_end = ScoreColl.
end();
1696 it = ScoreColl.
find(it, it_end, range_from);
1748 static const float eps = 0.00001f;
1775 CScoreCache::TScoreColl::const_iterator it,
1776 const CScoreCache::TScoreColl::const_iterator it_end,
1777 int vp_top_y,
int vp_bottom_y)
1787 static const float eps = 0.001f;
1794 while(it_seg && it != it_end && it->GetFrom() <= rc_vis.
Right()) {
1798 int from = std::max<int>(
r.GetFrom(), it->GetFrom());
1799 int to = std::min<int>(
r.GetTo(), it->GetTo());
1802 SScPix2 pix = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
false };
1803 bool empty_seg = (from < row_start || to > row_stop);
1813 rasterizer.AddInterval(from, to + 1, pix, f_sum);
1814 }
else if (!empty_seg && ((to - from) + 1) > 0) {
1818 rasterizer.AddInterval(from, to + 1, pix, f_sum);
1824 if(to == (
int) it->GetTo())
1830 const TR::TRaster& raster = rasterizer.GetRaster();
1832 int shift_x = rc_vp.
Left();
1833 float value_scale = value_limits.
GetTo() - value_limits.
GetFrom();
1834 if (value_scale <= 0)
1836 TVPUnit y_c = floor((
float(vp_top_y + vp_bottom_y ) / 2) + 0.5);
1838 for(
size_t i = 0;
i < raster.size(); ) {
1839 auto x1 =
i + shift_x;
1841 while (
i < raster.size() && raster[
i] == sc_pix) {
1844 auto x2 =
i + shift_x;
1849 static const CRgbaColor kAmbiguousResidueColor(
"darkgrey");
1850 color = kAmbiguousResidueColor;
1856 sc =
min(1.0, max<double>(0., ((sc - value_limits.
GetFrom()) / value_scale)));
1858 float alpha = 1.0f - sc * 0.75f;
1863 gl.
Rectd(x1, vp_top_y, x2, vp_bottom_y);
1864 }
else if (sc_pix.
m_GapLen > eps) {
1871 gl.
Rectd(x1, y_c - 1, x2, y_c + 1);
1884 CScoreCache::TScoreColl::const_iterator it,
1885 const CScoreCache::TScoreColl::const_iterator it_end,
1886 int vp_top_y,
int vp_bottom_y)
1899 SScPix pix = { 0.0f, 0.0f,
false };
1901 while(it_seg && it != it_end && it->GetFrom() <= rc_vis.
Right()) {
1905 int from = std::max<int>(
r.GetFrom(), it->GetFrom());
1906 int to = std::min<int>(
r.GetTo(), it->GetTo());
1909 bool empty_seg = (from < row_start || to > row_stop);
1918 if(to ==
r.GetTo()) {
1921 if(to == (
int) it->GetTo()) {
1928 const TR::TRaster& raster = rasterizer.GetRaster();
1930 TVPUnit y_c = floor((
float(vp_top_y + vp_bottom_y ) / 2) + 0.5);
1931 static float eps = 0.0001f;
1933 int shift_x = rc_vp.
Left();
1934 for(
size_t i = 0;
i < raster.size(); ) {
1936 const SScPix& sc_pix = raster[
i];
1937 while(++
i < raster.size() && raster[
i] == sc_pix) ;
1945 gl.
Rectd(start + shift_x, y_c - 1 ,
i + shift_x, y_c + 1);
1947 gl.
Rectd(start + shift_x, vp_top_y,
i + shift_x, vp_bottom_y + 1);
1957 #define SEQ_OFF_VERT 0
1958 #define SEQ_OFF_HORZ 0
1968 return min_w >= scale_x;
1969 }
else return false;
1978 int start,
int stop)
1981 unique_ptr<IAlnSegmentIterator> p_it(
1994 off_y = floor(off_y/2. + 0.5);
2002 bool render_scores =
false;
2005 render_scores = method &&
2024 stop = aln_r.GetTo();
2028 auto sStart = seq_r.
GetFrom();
2029 auto sStop = seq_r.GetTo();
2032 if (base_width == 3) {
2033 frame_shift_f = sStart % base_width;
2034 frame_shift_t = 2 - sStop % base_width;
2043 if (base_width == 3) {
2049 vector<CRgbaColor*>
colors;
2050 if (render_scores) {
2053 CScoreCache::TScoreColl::const_iterator it = ScoreColl.
begin();
2054 const CScoreCache::TScoreColl::const_iterator it_end = ScoreColl.
end();
2055 it = ScoreColl.
find(it, it_end, start);
2057 int len = stop - start + 1;
2061 std::fill_n(
colors.begin(),
len, &default_color);
2063 for (; it != it_end; ++it) {
2070 std::fill_n(
colors.begin() + (from - start), to - from + 1, &cl);
2078 bool has_consensus =
false;
2083 (consensus.length() == seq.length())) {
2084 has_consensus =
true;
2088 bool has_colors = (
colors.size() == seq.length());
2091 string text_char(
" ");
2092 TModelUnit center_y = (top_y + bottom_y) * 0.5 + 0.5;
2094 double base_h = double(base_width)/2.;
2099 for (
size_t i = 0;
i < seq.size(); ++
i) {
2100 current_color = has_colors ? *
colors[
i] : default_color;
2101 if (has_consensus && seq[
i] !=
'X' && consensus[
i] == seq[
i]) {
2105 render_dot = dot_texture.
NotEmpty();
2108 gl.
Enable(GL_TEXTURE_2D);
2112 double w = dot_texture->GetImage()->GetWidth();
2113 dot_texture->MakeCurrent();
2126 gl.
ColorC(current_color);
2135 gl.
ColorC(current_color);
2136 text_char[0] = seq[
i];
2138 gl.
WriteText(x - off_x, y, text_char.c_str());
2176 int base_height = 0;
2185 auto offset_top = (rc_vp.
Top() - row_top);
2186 auto top = rc_vp.
Top();
2187 if (offset_top >= 0) {
2188 top -= (offset_top + base_height);
2215 double model_top =
abs(offset_top);
2216 double model_bottom = model_top + rc_vp.
Height();
2218 rc_vis.
SetVert(model_bottom, model_top);
2224 return model_height > 0;
2283 if (!
GetGl().IsPrinterFriendly()) {
2347 int y_top = rc_vp.Top() - h;
2363 for(
int i = 0;
i < 3;
i++ ) {
2395 gl.
Rectd(rc_vp.Left(), rc_vp.Bottom(), rc_vp.Right(), rc_vp.Top());
2403 int half = rc_btn.
Height() / 2;
2404 int x1 = rc_btn.
Left();
2405 int x2 = rc_btn.
Right();
2415 gl.
Begin(GL_TRIANGLES);
2483 int half = rc_btn.
Height() / 2;
2484 int x1 = rc_btn.
Left();
2485 int x2 = rc_btn.
Right();
2493 gl.
Begin(GL_TRIANGLES);
2549 const char *s_marker =
"";
2561 label.append(s_marker);
2590 gl.
Rectd(rc_vp.Left(), rc_vp.Bottom(), rc_vp.Right(), rc_vp.Top());
2618 gl.
Vertex2d(rc_vp.Right(), rc_vp.Top());
2619 gl.
Vertex2d(rc_vp.Right(), rc_vp.Bottom());
2620 gl.
Vertex2d(rc_vp.Left(), rc_vp.Bottom());
2621 gl.
Vertex2d(rc_vp.Right(), rc_vp.Bottom());
2707 }
catch (exception& e) {
2794 int aln_pos = (
int) floor(rc_vis.
Left());
2799 int aln_pos = -1 + (
int) ceil(rc_vis.
Right());
2855 pos = (pos / 3) * 3;
2871 if( alstart < alstop ){
2872 alrange.
Set( alstart, alstop);
2874 alrange.
Set( alstop, alstart);
2895 if (!aln_r.Empty()) {
2896 aligned += seq_r.GetLength();
2897 if (aln_r.GetFrom() == prev_aln_to + 1 && seq_r.GetFrom() > prev_seq_to + 1) {
2898 unaligned += seq_r.GetFrom() - prev_seq_to;
2901 indel += seq_r.GetLength();
2903 prev_aln_to = aln_r.GetTo();
2904 prev_seq_to = seq_r.GetTo();
2907 gap += aln_r.GetLength();
2910 indel += aln_r.GetLength();
2913 unaligned += aln_r.GetLength();
2925 start /= base_width;
2928 string aln_str =
"Sequence is aligned from ";
2929 aln_str += (is_aa) ?
"residues " :
"bases ";
2935 string bases = is_aa ?
"Residues" :
"Bases";
2987 track.
Reset(last_hit_track.GetPointer());
3059 if (max_height > 0) {
3080 widget->PopupMenu(menu);
3090 widget->PushEventHandler(
handler);
3099 widget->PopEventHandler();
3140 gConfig->SetDirty(
true);
3162 auto bottom = top - (
m_Height - 1);
static IGlFont::EAlignMode s_GetColumnAlignemnt(int col_type)
double CompressLength(double len)
static string s_GetSourceSubtype(const CSeq_descr &descr, CSubSource::ESubtype subtype)
static string s_GetTitle(const CSeq_descr &descr)
static const int kTextOffsetY
static const int kAlignSpace
height of "white-space" between row borders and alignment band
static const int kSeqVertSpace
static const int kTextVertSpace
USING_SCOPE(ncbi::objects)
static const int kTooltipMaxLines
ON_EVENT(CGraphNotification, CGraphNotification::eContentChanged, &CAlnVecRow::x_OnGraphContentChanged) ON_EVENT(CGraphNotification
static const int kMaxSeqInTooltip
static const int kTextOffsetX
static const int kButtonSignSize
string FormatRange(TSignedSeqPos from, TSignedSeqPos to)
#define TOOLTIP_RANGE_PIX
static const int kGapOffset
vertical offset from the border of the alignment band to the border of gap band
static const TModelUnit kScoreMinScale
static void s_PrepareTrackPane(TModelUnit aln_from, TModelUnit aln_to, TModelUnit seq_from, TModelUnit seq_to, const IAlignRowHandle &row_handle, const CGlPane &source_pane, CGlPane &target_pane)
static const int kButtonSize
static const int kButtonOffset
static void FSetPixMaxCoverage(SScPix &dst, const SScPix &src, float fraction, bool long_seg)
a pixel with the Max coverage (fraction) overrides all attributes
void glLined(TModelUnit x1, TModelUnit y1, TModelUnit x2, TModelUnit y2)
static string s_GetOrgModNatHost(const CSeq_descr &descr)
static const int kPosOffsetX
virtual int GetRowState() const
Returns row state (combination of EState flags)
CAlnRowState()
CAlnRowState.
virtual void SetRowState(int mask, bool b_set)
Set/Clear Row State.
class CAlnVecRow - implementation of IAlignRow for CAlnVec-based alignments.
const CRowDisplayStyle * m_Style
const IAlignRowHandle & m_Handle
void x_ForEachAlnSeg(const IAlnExplorer::TSignedRange &range, const CGlPane &src_pane, CGlPane &target_pane, const function< bool(CGlPane &pane)> &f)
virtual int GetRowNum() const
Returns index of row in IAlnMultiDataSource.
void ConfigureTracks(bool reset=false)
virtual void x_RenderIconStrand()
virtual void x_RenderAlign()
Renders graphical part of the row.
TVPUnit m_PixLeft
Graphics caching.
void x_RenderTracks(CGlPane &pane, const TSignedRange &range)
virtual void UpdateOnStyleChanged()
virtual TSeqPos GetColumnAsSeqPos(TColumnType type, const TModelRect &rc_vis) const
virtual void x_RenderNonAveragableScores(CGlPane &pane, IAlnSegmentIterator &it_seg, TScoreConstIterator it, const TScoreConstIterator it_end, int vp_top_y, int vp_bottom_y)
virtual void GetHTMLActiveAreas(TColumnType col_type, CGlPane &pane, TAreaVector &areas)
virtual void x_OnClickExpandBtn(CGlPane &pane)
virtual TVPRect x_GetButtonRect(EButtons btn, int shift=1)
virtual void OnMouseEvent(wxMouseEvent &event, TColumnType col_type, CGlPane &pane)
void x_GetAlnPosLabel(TSeqPos aln_pos, IAlnExplorer::ESearchDirection dir, string &label) const
virtual void x_RenderAveragableScores(CGlPane &pane, IAlnSegmentIterator &it_seg, TScoreConstIterator it, const TScoreConstIterator it_end, int vp_top_y, int vp_bottom_y)
virtual void x_RenderGraph(const TSignedRange &range)
string x_GetTooltipSequence(TSeqPos from, TSeqPos to)
void GetTaxonomy(string &taxonomy) const
virtual void x_GetIconsTooltip(const TVPPoint &pt, CGlPane &pane, ITooltipFormatter &tooltip)
void x_GetAlignmentTooltip_Gap(const TSignedSeqRange &aln_r, const TSignedSeqRange &seq_r, ITooltipFormatter &tooltip)
virtual float GetColumnAsFloat(TColumnType type) const
virtual void x_UpdateRowHeight()
virtual bool x_CanRenderSeq(CGlPane &pane)
Checks if sequence can be drawn.
virtual void x_RenderIconExpand()
void x_GetAlignmentTooltip_Insert(const TSignedSeqRange &aln_r, const TSignedSeqRange &seq_r, ITooltipFormatter &tooltip)
virtual void UseExternalOrganismLookup(bool f)
virtual void x_RenderDescr()
virtual void LTH_ConfigureTracksDlg(const string &category)
CRef< CFeaturePanel > m_TrackPanel
void ConfigureTracksDialog(const string &category=NcbiEmptyString)
virtual void x_CreateTrackPanel(CGlPane &pane)
virtual void GetTooltip(const TVPPoint &vp_pt, TColumnType col_type, CGlPane &pane, ITooltipFormatter &tooltip)
returns tooltip text by point in the viewport coordinates
AutoPtr< CLayoutTrackHandler > m_TrackHandler
virtual void UpdateOnAnchorChanged()
virtual bool IsExpanded() const
CRef< CSeqGlyph > x_HitTest(const TVPPoint &vp_pt, CGlPane &pane, TModelPoint &hit_point)
bool m_NeedUpdateSelection
unique_ptr< CGlPane > m_TrackPane
virtual void LTH_PushEventHandler(wxEvtHandler *handler)
virtual string & GetColumnText(TColumnType col_type, string &text, bool for_printer=false) const
unique_ptr< CRenderingContext > m_RenderingCtx
virtual void GHH_Redraw()
redraws the Host and the handler
void x_GetAlignmentTooltip_Unaligned(TSignedSeqPos aln_prev_to, TSignedSeqPos aln_from, TSignedSeqPos prev_to, TSignedSeqPos from, ITooltipFormatter &tooltip)
virtual EButtons x_HitTestButton(CGlPane &pane, const TVPPoint &pt)
virtual void GHH_ReleaseMouse()
releases captured mouse
virtual int x_GetBaseHeight() const
virtual void GHH_CaptureMouse()
captures mouse events in the hosting window for D&D
virtual void x_RenderSequence(CGlPane &pane, TModelUnit top_y, TModelUnit bottom_y, int start, int stop)
virtual void GHH_SetCursor(const wxCursor &cursor)
changes the cursor in the hosting window
virtual void PrepareRendering(CGlPane &pane, TVPUnit row_top, int state)
virtual void Update(const CGlPane &pane, bool layout_only=false)
virtual void SetDisplayStyle(const CRowDisplayStyle *style)
virtual void LTH_OnLayoutChanged()
provides mouse coords in OpenGL viewport coord system
virtual bool IsExpandable() const
virtual void LTH_PopEventHandler()
virtual bool IsNucProtAlignment() const
virtual void SetHost(IAlignRowHost *host)
void x_OnGraphSizeChanged(CEvent *evt)
virtual void SetScoreCache(CScoreCache *cache)
virtual const IAlnRowGraphProperties * GetProperties() const
virtual void x_GetDescrTooltip(const TVPPoint &pt, CGlPane &pane, ITooltipFormatter &tooltip)
virtual string & GetAlnSeqString(string &buffer, const IAlnExplorer::TSignedRange &aln_rng) const
CWeakRef< CLayoutTrack > m_LastHitTrack
virtual void x_RenderAlignSegments(CGlPane &pane, IAlnSegmentIterator &it_seg, TModelUnit top_y, TModelUnit bottom_y, const CRgbaColor &color)
virtual void x_RenderIcons()
virtual void x_GetAlignmentTooltip(const TVPPoint &pt, CGlPane &pane, ITooltipFormatter &tooltip)
virtual void x_RenderAlnPos(TSeqPos aln_pos, IAlnExplorer::ESearchDirection dir)
virtual TModelPoint THH_GetModelByWindow(const wxPoint &pt)
virtual string GetAlignmentTooltip(TSeqPos pos, TSeqPos half_width)
IAlignRowHost * x_GetHost()
virtual void x_ResetTrackPanel()
virtual void x_RenderAlignScores(IAlnSegmentIterator &it_seg, int top_y, int bottom_y, bool averageable)
void x_OnGraphContentChanged(CEvent *evt)
virtual void x_RenderInserts(CGlPane &pane, int from, int to, TModelUnit top_y, TModelUnit bottom_y)
virtual bool UsesAATranslation() const
virtual void x_RenderTextCell(const string &text, IGlFont::TAlign align)
bool x_InitTrackPane(const CGlPane &row_pane, CGlPane &track_pane)
IAlnExplorer::TSignedRange TSignedRange
virtual void SetProperties(IAlnRowGraphProperties *props)
virtual void RenderColumn(TColumnType col_type)
Renders a row cell corresponding to column specified by "col_type".
void x_GetAlignmentTooltip_Helper(TSeqPos pos, TSignedRange &range, ITooltipFormatter &tooltip)
virtual void x_RenderEmptyBox()
size_t GetTrackCount(CGlPane &pane)
CAlnVecRow(const IAlignRowHandle &handle)
CAlnVecRow.
virtual void LTH_PopupMenu(wxMenu *menu)
show track-specific context menu.
void x_GetAlignmentTooltip_General(TSeqPos pos, ITooltipFormatter &tooltip)
virtual string & GetStringAtPos(string &buffer, TSignedSeqPos aln_pos) const
virtual void x_RenderUnaligned(CGlPane &pane, int from, int to, TModelUnit top_y, TModelUnit bottom_y)
CConsensusRow * m_ConsensusRow
CScoreCache * m_Cache
row display style
unique_ptr< CRenderingContext > m_SequenceRenderingCtx
virtual const CRowDisplayStyle * GetDisplayStyle()
virtual void GetRowStatistics(ITooltipFormatter &tooltip) const
virtual void Expand(bool b_exp, CGlPane &pane)
virtual CRef< CLayoutTrack > THH_GetLayoutTrack()
Get the layout track under the current mouse position.
virtual int GetHeightPixels() const
Returns height of the row in pixels.
const COrgName & GetOrgname(void) const
bool IsSetOrgname(void) const
const IAlignRowHandle & GetHandle() const
virtual string & GetAlnSeqString(string &buffer, const IAlnExplorer::TSignedRange &aln_rng) const
CEvent - generic event implementation TODO TODO - Attachments.
void SetInputObject(SConstScopedObject &obj)
void SetConfigKey(const string &config_key)
virtual void Update(bool layout_only)
Update content and layout including the bounding box.
virtual CRef< CSeqGlyph > HitTest(const TModelPoint &p)
Hit testing.
void LoadDefaultTracks()
Reset tracks to the original default track list.
void ShowConfigureTracksDlg(const string &category)
void SetTrackConfig(const TTrackSettingsSet &settings_set)
void SetDSContext(ISGDataSourceContext *ds_ctx)
CGlAttrGuard - guard class for restoring OpenGL attributes.
const CLayoutGroup & GetGroup() const
void SaveSettings(const string &curr_color, const string &curr_size) const
size_t GetChildrenNum() const
Get total number of children.
CLayoutTrackHandler - is the handler for handling the user interactions on layout tracks.
void Render(CGlPane &pane)
void SetHost(ITrackHandlerHost *host)
CLayoutTrackHandler inline methods.
virtual void SetPane(CGlPane *pane)
void SetConfig(CRef< CSeqGraphicConfig > conf)
void SetProfile(const string &preset_style)
CLayoutTrack inline method implmentation.
void SetHost(ILayoutTrackHost *host)
void GetLabel(string *label) const
CRenderingContext offers the basic context and utility methods for rendering layout objects in featur...
@ fSkipGrid
track frame will be rendered when triggered.
@ fSkipTitleBar
can be collpased and expanded.
@ fSkipControls
track frame will be rendered when triggered.
class CRgbaColor provides a simple abstraction for managing colors.
CRowDisplayStyle is a base class representing a display style for IAlignRow.
CRef< CSeqGraphicConfig > GetSeqGraphicConfig() const
CRef< CGlTexture > GetDotTexture() const
virtual const CRgbaColor & GetColor(TColorType type) const
int GetShownElements() const
const string & GetTrackConfigKey() const
virtual bool GetShowIdenticalBases(void) const
const CTrackConfigManager::TTrackProxies & GetTrackSettings() const
bool IsWebRendering() const
virtual const CGlTextureFont & GetTextFont(void) const
virtual const CGlTextureFont & GetSeqFont(void) const
static const string & DefTrackProfile()
static bool IsBackgroundJob()
bool HasScores() const
returns "true" if CalculateScores() did produce results
const TScoreColl & GetScores(TNumrow row) const
IScoringMethod::TScore TScore
IScoringMethod * GetScoringMethod()
const CRgbaColor & GetColorForScore(TScore score, IScoringMethod::EColorType type) const
class CSelectionVisitor is a concrete glyph visitor for selection traversal and deselection traversal...
void UpdateSelection(CSeqGlyph *glyph)
void ResetObjectSelection(CSeqGlyph *glyph)
void SelectObject(const CObject *obj, bool verified)
bool IsObjectSelected(const CObject *obj)
void DeSelectObject(const CObject *obj)
bool HasSelectedObjects() const
virtual void SetHeight(TModelUnit h)
virtual bool IsClickable() const
Query if this glyph is clickable.
virtual void GetTooltip(const TModelPoint &, ITooltipFormatter &tt, string &t_title) const
Get the tooltip if available.
virtual bool OnLeftUp(const TModelPoint &)
virtual bool OnLeftDblClick(const TModelPoint &)
virtual TModelUnit GetHeight() const
virtual bool OnLeftDown(const TModelPoint &)
void Draw() const
render the layout.
CRef< CHistParamsManager > GetHistParamsManager() const
Get histogram config manager.
void SetTrackProfile(const string &profile)
@Seq_descr.hpp User-defined methods of the data storage class.
CTempTrackProxy::TTrackProxies TTrackProxies
bool IsTrackInitDone() const
FSetPix2(bool sequence_level)
void operator()(SScPix2 &dst, const SScPix2 &src, float fraction, bool long_seg)
accumulate weighted scores
IAlignRowHandle provides an abstract way to access alignment row data.
virtual bool UsesAATranslation() const =0
virtual int GetMismatches() const
virtual TSignedSeqPos GetSeqStart() const =0
virtual void GetHost(string &value) const
virtual bool CanGetBioseqHandle() const =0
virtual bool IsAnchor() const
virtual const string & GetOrgLabel(bool fExtOrgLookup=false) const
virtual TSignedSeqPos GetSeqAlnStart() const =0
virtual const objects::CBioseq_Handle & GetBioseqHandle() const =0
virtual void GetCountry(string &value) const
virtual double GetPctCoverage() const
virtual bool IsNucProtAlignment() const =0
virtual double GetPctIdentity() const
virtual size_t GetBaseWidth() const =0
virtual IAlnExplorer::TSignedRange GetSeqAlnRange() const =0
virtual TSeqPos GetSeqLength() const
virtual TSignedSeqPos GetSeqPosFromAlnPos(TSeqPos aln_pos, IAlnExplorer::ESearchDirection dir=IAlnExplorer::eNone, bool try_reverse_dir=true) const =0
virtual TNumrow GetRowNum() const =0
virtual string & GetAlnSeqString(string &buffer, const IAlnExplorer::TSignedRange &aln_rng) const =0
virtual TSignedSeqPos GetSeqAlnStop() const =0
virtual TSignedSeqPos GetSeqStop() const =0
virtual void GetCollectionDate(string &value) const
virtual string & GetSeqString(string &buffer, const IAlnExplorer::TRange &seq_rng) const =0
virtual void GetIsolationSource(string &value) const
virtual bool IsNegativeStrand() const =0
virtual void GetTaxonomy(string &taxonomy, bool fExtOrgLookup=false) const
virtual TSignedSeqPos GetAlnPosFromSeqPos(TSeqPos seq_pos, IAlnExplorer::ESearchDirection dir=IAlnExplorer::eNone, bool try_reverse_dir=true) const =0
virtual IAlnSegmentIterator * CreateSegmentIterator(const IAlnExplorer::TSignedRange &range, IAlnSegmentIterator::EFlags flags) const =0
virtual void GetGeneSymbol(string &value) const
virtual const string & GetText() const =0
IAlignRowHost represents a context in which IAlignRow lives.
virtual void ARH_OnSelectionChanged()=0
notifies a host about selection change
virtual CSelectionVisitor * ARH_GetSelectionVisitor()=0
notifies a host about selection change
virtual int ARH_GetRowTop(IAlignRow *p_row)=0
Returns Y-pos for row.
virtual TVPPoint ARH_GetVPPosByWindowPos(const wxPoint &pos)=0
provides mouse coords in OpenGL viewport coord system
virtual void ARH_OnRowChanged(IAlignRow *row)=0
notifies a host about changes the row
@ fWidgetFocused
it isn'e exactly a row state;
vector< CHTMLActiveArea > TAreaVector
@ ePctIdentity
% identity to consensus or anchor
@ eIconStrand
Icon for Positive/Negative (Mixed?) strand.
@ eIconExpand
Icon for expand (+) button.
@ eIcons
Strand + Expand icons.
@ ePctCoverage
% coverage to anchor
@ eMismatches
% number of mismatches to anchor/consensus
ESearchDirection
Position search options.
@ eRight
Towards higher aln coord (always to the right)
@ eLeft
Towards lower aln coord (always to the left)
Alignment segment iterator interface.
@ eSkipInserts
Iterate segments where at least some rows are aligned (including gap segments)
@ eInsertsOnly
Iterate only ranges not participating in the alignment (unaligned segments)
@ eAllSegments
Iterate all segments.
@ eSkipGaps
Skip gap segments (show only aligned ranges)
Alignment segment interface.
virtual const TSignedRange & GetRange(void) const =0
Get the selected row range.
@ fAligned
Aligned segment.
@ fIndel
Either anchor or the selected row is not present in the segment.
@ fUnaligned
The range on the selected sequence does not participate in the alignment (the alignment range of the ...
@ fGap
Both anchor row and the selected row are not included in the segment (some other row is present and t...
virtual TSegTypeFlags GetType(void) const =0
Get current segment type.
bool IsAligned(void) const
virtual const TSignedRange & GetAlnRange(void) const =0
Get alignment range for the segment.
static const int kAmbiguousResidueScore
virtual void GHH_ReleaseMouse()=0
releases captured mouse
virtual void GHH_Redraw()=0
redraws the Host and the handler
virtual void GHH_CaptureMouse()=0
captures mouse events in the hosting window for D&D
virtual void GHH_SetCursor(const wxCursor &cursor)=0
changes the cursor in the hosting window
virtual CConstRef< CObject > GetObject(TSeqPos pos) const =0
access our core component - we wrap an object(s) of some sort.
IScoringMethod represents an abstract algorithm for calculating alignment scores and assigning colors...
virtual int GetSupportedColorTypes() const =0
returns a combination of EColorType flags
virtual bool IsAverageable() const =0
return "true" if scores could be averaged
static const Colors colors
void(*)(CSeq_entry_Handle seh, IWorkbench *wb, const CSerialObject &obj) handler
Include a standard set of the NCBI C++ Toolkit most basic headers.
static const char * str(char *buf, int n)
void reset(element_type *p=0, EOwnership ownership=eTakeOwnership)
Reset will delete the old pointer (if owned), set content to the new value, and assume the ownership ...
unsigned int TSeqPos
Type for sequence locations and lengths.
int TSignedSeqPos
Type for signed sequence position.
void swap(NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair1, NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair2)
#define NCBI_ASSERT(expr, mess)
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
void Error(CExceptionArgs_Base &args)
const string & GetMsg(void) const
Get message string.
virtual const char * what(void) const noexcept
Standard report (includes full backlog).
CGlRect & IntersectWith(const CGlRect &r)
void SetModelLimitsRect(const TModelRect &R)
virtual void Viewport(GLint x, GLint y, GLsizei width, GLsizei height)=0
void SetViewport(const TVPRect &R)
virtual void Enable(GLenum glstate)=0
EAlignMode
alignment modes
virtual void Begin(GLenum mode)=0
Start rendering.
virtual void BlendFunc(GLenum sfactor, GLenum dfactor)=0
Options to be used when GL_BLEND is enabled.
virtual void BeginClippingRect(GLint x, GLint y, GLsizei width, GLsizei height)=0
TModelUnit UnProjectWidth(TVPUnit vp_w) const
TModelPoint UnProject(TVPUnit m_x, TVPUnit m_y) const
void Color3d(GLdouble r, GLdouble g, GLdouble b)
IRender & GetGl()
convenience function for getting current render manager
void Vertex2d(GLdouble x, GLdouble y)
TVPRect & GetViewport(void)
virtual void BeginText(const CGlTextureFont *font, const CRgbaColor &color)=0
Text is drawn is pixel coordinates.
virtual TModelUnit GetFontDescender() const
static string FormatSeparatedNumber(int number, bool b_postfix=false)
virtual void EndText()=0
Pops matrices and attributes after writing text.
const TVPRect * GetClipRect() const
returns clipping rect or NULL (if there is no clipping)
TModelUnit UnProjectX(TVPUnit m_x) const
CGlPoint< T > CenterPoint() const
TModelRect & GetModelLimitsRect(void)
virtual void EndClippingRect()=0
bool PtInRect(T x, T y) const
virtual bool IsPrinterFriendly() const =0
virtual void End()=0
Finish rendering (create buffer and send to renderer)
virtual void PolygonMode(GLenum face, GLenum mode)=0
Set the polygon rasterization mode.
void SetVert(T bottom, T top)
void SetVisibleRect(const TModelRect &R)
virtual TModelUnit GetMetric(EMetric metric, const char *text=NULL, int len=-1) const
virtual void WriteText(TModelUnit x, TModelUnit y, const char *text, TModelUnit rotate_degrees=0.0)=0
Write text at specified model coords.
virtual TModelUnit TextWidth(const char *text) const
Compute and return font metrics.
virtual TModelUnit TextHeight(void) const
TModelRect & GetVisibleRect(void)
void Vertex2f(GLfloat x, GLfloat y)
virtual void Disable(GLenum glstate)=0
glDisable()
virtual void LineWidth(GLfloat w)=0
Set line width for drawing: glLineWidth()
TModelUnit GetScaleX(void) const
TModelUnit GetOffsetX() const
void SetExactOrthoProjection(bool exact_projection)
void SetHorz(T left, T right)
CGlPoint< TModelUnit > TModelPoint
virtual void ColorC(const CRgbaColor &c)=0
Set current color (glColor{3,4}{f,d}{v,})
void Rectd(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2)
void EnableOffset(bool b_en=true)
Offset is used as a workaround for OpenGL precision problems emerging when size of visible range is s...
virtual void GetViewport(GLint *params)=0
virtual void AddRow(const string &sContents="", unsigned colspan=2)=0
add a row with a cell, spanning across all columns
const_iterator end() const
void Lighten(float scale)
static CIRef< ITooltipFormatter > CreateTooltipFormatter()
static CRgbaColor Interpolate(const CRgbaColor &color1, const CRgbaColor &color2, float alpha)
Interpolate two colors.
#define END_EVENT_MAP()
Ends definition of Command Map.
const_iterator find(position_type pos) const
#define BEGIN_EVENT_MAP(thisClass, baseClass)
Begins definition of Command Map for CEventHandler-derived class.
virtual void Append(const ITooltipFormatter &tooltip)=0
appends another formatter to this one
const_iterator begin() const
string GetProteinName(const CBioseq_Handle &seq)
Return protein name from corresponding Prot-ref feature.
const COrg_ref & GetOrg_ref(const CBioseq_Handle &handle)
Return the org-ref associated with a given sequence.
TSeqPos GetBioseqLength(void) const
CConstRef< CSeq_id > GetSeqId(void) const
Get id which can be used to access this bioseq handle Throws an exception if none is available.
const TDescr & GetDescr(void) const
CScope & GetScope(void) const
Get scope this handle belongs to.
bool CanGetDescr(void) const
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
void Reset(void)
Reset reference object.
bool NotEmpty(void) const THROWS_NONE
Check if CRef is not empty – pointing to an object and has a non-null value.
TRefType Lock(void) const
Lock the object and return reference to it.
void Reset(void)
Reset the containing pointer to null.
position_type GetLength(void) const
TThisType & IntersectWith(const TThisType &r)
TThisType IntersectionWith(const TThisType &r) const
position_type GetToOpen(void) const
TThisType & Set(position_type from, position_type to)
CRange< TSignedSeqPos > TSignedSeqRange
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static string DoubleToString(double value, int precision=-1, TNumToStringFlags flags=0)
Convert double to string.
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
static enable_if< is_arithmetic< TNumeric >::value||is_convertible< TNumeric, Int8 >::value, string >::type NumericToString(TNumeric value, TNumToStringFlags flags=0, int base=10)
Convert numeric value to string.
@ fWithCommas
Use commas as thousands separator.
static const char label[]
const TSubtype & GetSubtype(void) const
Get the Subtype member data.
bool IsSetSubtype(void) const
Check if a value has been assigned to Subtype data member.
@ eSubtype_collection_date
DD-MMM-YYYY format.
@ eSubtype_isolation_source
void SetFrom(TFrom value)
Assign a value to From data member.
TTo GetTo(void) const
Get the To member data.
TFrom GetFrom(void) const
Get the From member data.
void SetTo(TTo value)
Assign a value to To data member.
const TMod & GetMod(void) const
Get the Mod member data.
bool CanGetMod(void) const
Check if it is safe to call GetMod method.
@ eSubtype_nat_host
natural host of this specimen
const Tdata & Get(void) const
Get the member data.
unsigned int
A callback function used to compare two keys in a database.
if(yy_accept[yy_current_state])
static void text(MDB_val *v)
range(_Ty, _Ty) -> range< _Ty >
Defines: CTimeFormat - storage class for time format.
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
static SLJIT_INLINE sljit_ins l(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
void operator()(float &dst, const float &src, float fraction, bool long_seg)
~SRenderingContextGuard()
SRenderingContextGuard(const function< void()> &f)
represents a pixel with two scores, one corresponds to a gap interval, another - to an aligned segmen...
bool operator==(const SScPix2 &other) const
represents a pixel with a score, if several intervals cover a pixel, the interval with the maximum co...
float m_MaxCoverage
score assigned to the pixel
bool m_Gap
fraction of the pixel corresponding to the m_Score
bool operator==(const SScPix &other) const
true if this is a gap interval