47 static const string kScale =
"GraphScale";
74 if(dlg.ShowModal() == wxID_OK) {
110 if (idx >= 0 && idx < (
int)
m_StatVec.size()) {
119 sprintf(
buf,
"%2.1f", 100.0 * num / total);
129 sprintf(
buf,
"%2.1f", 100.0 * num / total);
139 sprintf(
buf,
"%2.1f", 100.0 * num / total);
150 sprintf(
buf,
"%2.1f", 100.0 * num / total);
161 sprintf(
buf,
"%2.1f", 100.0 * num / total);
171 sprintf(
buf,
"%2.1f", 100.0 * num / total);
181 sprintf(
buf,
"%2.1f", 100.0 * num / total);
191 sprintf(
buf,
"%2.1f", 100.0 * num / total);
199 tt.
AddRow(
"Double click on the statistics graph to change settings...");
239 config->SetName(
"Alignment statistics");
248 p_areas->push_back(area);
263 auto right = view_width;
282 p_areas->emplace_back(label_area);
293 vector<int>::reverse_iterator iter = rows.rbegin();
294 for (; iter != rows.rend(); ++iter) {
317 p_areas->push_back(area);
383 double max_value = max_t;
407 if (total == 0)
continue;
408 double total_factor = 1.0;
409 double log_total = 1.;
412 total_factor /= total;
421 total_factor /= total;
422 total_factor *= log_total;
425 double curr_total= 0;
433 ITERATE (vector<int>, v_iter, show_list) {
434 double val = iter->m_Data[*v_iter];
435 if (
val == 0)
continue;
436 if (curr_total +
val > total)
437 val = total - curr_total;
444 if (curr_total >= total)
459 double tick_dist = 30.0;
460 int tick_n = (
int)(floor(bar_h / tick_dist));
461 tick_dist = bar_h / tick_n;
471 if (max_t == 0)
return;
473 for (
int i = 0;
i < tick_n; ++
i) {
474 m_Context->
DrawLine(left, bottom - tick_dist * (
i + 1), right, bottom - tick_dist * (
i + 1));
480 if (dist_x < min_dist) {
488 for (; x < right; x += dist_x) {
505 const TModelRect& vr = pane->GetVisibleRect();
507 auto x = vr.
Right() - ((w + 16) * one_px);
508 auto y = vr.
Top() + h + 2;
546 gl.
Color4f(0.6f, 0.6f, 0.8f, 0.5f);
552 if (max_t == 0)
return;
572 if (total == 0)
continue;
574 double total_factor = 1.0;
576 total_factor /= total;
579 ITERATE (vector<int>, v_iter, show_list) {
581 if (iter->m_Data[*v_iter] == 0)
continue;
588 c_factor *= total_factor * d_factor;
590 if ( !show_count ) num *= 100;
609 }
else if (num < 1.0) {
626 vector<string> labels;
628 ITERATE (vector<int>, v_iter, show_list) {
633 labels.push_back(
label);
640 gl.
Color4f(0.8f, 1.0f, 0.8f, 1.0f);
646 ITERATE (vector<string>, l_iter, labels) {
647 const string&
label = *l_iter;
670 vector<int> show_list;
698 "Alignment Pileup Display");
704 "Match/Mismatch graph (count)",
705 "Show matches, mismatches, and gaps count as bar graph",
710 "Match/Mismatch graph (percentage)",
711 "Show matches, mismatches, and gaps percentage as bar graph",
716 "ATGC graph (count)",
717 "Show A, T, G, C, and gaps count as bar graph",
722 "ATGC graph (percentage)",
723 "Show A, T, G, C, and gaps percentage as bar graph",
728 "Match/Mismatch table (count)",
729 "Show matches, mismatches, and gaps count as table",
734 "Match/Mismatch table (percentage)",
735 "Show matches, mismatches, and gaps percentage as table",
740 "ATGC table (count)",
741 "Show A, T, G, C, and gaps count as table",
746 "ATGC table (percentage)",
747 "Show A, T, G, C, and gaps percentage as table",
static const string kScale
static const string kPileUpLabel
static const string kPileUpColor
static void s_GetLabel(CHistParams::EScale scale, string &label)
static int kSmearRowHeight
static double s_log_value(double value, CHistParams::EScale scale)
static string GetStatLabel(int stat)
@ fBarGraph
otherwise, shown as density table
@ fShowCount
otherwise, shown percentage
@ fShowMismatch
otherwise, shown individual count
void SetDisplayFlag(FDisplay bit, bool f)
int m_StatZoomLevel
at what zoom level to turn on statistics
array< CRgbaColor, eStat_Total+1 > m_Colors
color settings
@ eStat_Intron
intron (for mRNA-to-genome alignments)
@ eStat_Ambig
ambiguous consensus (for MSA pileup)
@ eStat_Mismatch
mismatches (A+G+T+C - matches)
@ eStat_Total
total alignment count at this base (A+G+T+C+Gap)
bool IsBarGraph() const
CAlnStatConfig inline method implementation.
virtual bool OnLeftDblClick(const TModelPoint &p)
virtual void GetTooltip(const TModelPoint &p, ITooltipFormatter &tt, string &t_title) const
Get the tooltip if available.
virtual void x_Draw() const
The default renderer for this layout object.
virtual void x_UpdateBoundingBox()
Update the bounding box assuming children's sizes are fixed if any.
virtual void GetHTMLActiveAreas(TAreaVector *p_areas) const
Get html active areas.
virtual bool NeedTooltip(const TModelPoint &p, ITooltipFormatter &tt, string &t_title) const
Check if need to show tooltip.
int x_GetMaxTotal() const
TModelUnit m_ZoomScale
zoom scale when this statistics are computed.
void x_DrawDensityTable() const
CAlnStatGlyph(TSeqPos start, TModelUnit sacle)
CAlnStatGlyph.
vector< SStatStruct > TStatVec
CRef< CAlnStatConfig > m_Config
void x_DrawBarGraph() const
virtual bool IsClickable() const
Query if this glyph is clickable.
vector< int > x_GetShowList() const
CRef< CHistParams > m_GraphParams
IGlyphDialogHost * m_DlgHost
static CRef< objects::CChoice > CreateDisplayOptions(const string &option_name, int display_flag)
CGlAttrGuard - guard class for restoring OpenGL attributes.
string m_Descr
description that can be used as label or tooltip
@ fNoTooltip
do not request and show tooltip
@ fZoomOnDblClick
Zoom on Double click.
@ fNoPin
tooltip is not pinnable
@ fNoHighlight
no highlighting on mouse over
@ fDrawBackground
highlight background for this area
@ fComment
render a label/comment on client side
@ fNoSelection
the object can't be selected
string m_Color
optional area color (used for legen items)
string m_ID
area identifier
int m_Flags
area flags, will need to replace m_Type
CRef< objects::CTrackConfig > m_Config
Area specific configuration settings.
bool m_PositiveStrand
the default is true
static CRef< objects::CChoice > CreateScaleOptions(const string &option_name, CHistParams::EScale option_value)
EScale m_Scale
requested scale
static const string & ScaleValueToName(CHistParams::EScale scale)
void TextOut(const CGlTextureFont *font, const char *text, TModelUnit x, TModelUnit y, bool center, bool adjust_flip=true) const
TModelUnit GetVisibleFrom() const
CGlPane * GetGlPane()
inline method implementations
const TModelRange & GetVisibleRange() const
TModelRange IntersectVisible(const CSeqGlyph *obj) const
void DrawLine(TModelUnit x1, TModelUnit y1, TModelUnit x2, TModelUnit y2) const
void DrawQuad(const TModelRect &rc, bool border=false) const
const TModelUnit & GetScale() const
TModelUnit SeqToScreen(const TModelUnit &size) const
convert from sequence positions to screen pixels
TModelUnit ScreenToSeq(const TModelUnit &size) const
convert from screen pixels to sequence positions
TSeqPos GetViewWidth() const
class CRgbaColor provides a simple abstraction for managing colors.
void x_InitHTMLActiveArea(CHTMLActiveArea &area) const
initialize the basic information for a given active area.
CRenderingContext * m_Context
the rendering context
virtual void x_OnLayoutChanged()
update the layout.
virtual void SetHeight(TModelUnit h)
virtual TModelUnit GetRight() const
virtual void SetWidth(TModelUnit w)
virtual void SetLeft(TModelUnit l)
virtual TModelUnit GetTop() const
void x_Local2World(TModelPoint &p) const
Transform the coordiantes from local coord. to world coord.
virtual TModelUnit GetWidth() const
virtual TModelUnit GetLeft() const
vector< CHTMLActiveArea > TAreaVector
virtual TModelUnit GetBottom() const
static CRef< objects::CChoice > CreateChoice(const string &name, const string &disp_name, const string &curr_val, const string &help, bool optional=false)
static CRef< objects::CChoiceItem > CreateChoiceItem(const string &name, const string &disp_name, const string &help, const string &legend_txt, bool optional=false)
void SetDisplay(bool is_graph)
void SetContent(bool is_agtc)
void SetValueType(bool is_count)
void SetGraphHeight(int h)
int GetGraphHeight() const
virtual void PostDialogShow()=0
Post-processing after showing a dialog.
virtual void PreDialogShow()=0
Prepare for showing a dialog.
unsigned int TSeqPos
Type for sequence locations and lengths.
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
void Color3f(GLfloat r, GLfloat g, GLfloat b)
IRender & GetGl()
convenience function for getting current render manager
virtual TModelUnit TextHeight(const CGlTextureFont *font) const =0
virtual TModelUnit TextWidth(const CGlTextureFont *font, const char *text) const =0
void Color4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a)
virtual void Disable(GLenum glstate)=0
glDisable()
virtual void LineWidth(GLfloat w)=0
Set line width for drawing: glLineWidth()
virtual void ColorC(const CRgbaColor &c)=0
Set current color (glColor{3,4}{f,d}{v,})
@ eFontFace_Helvetica_Bold
virtual void AddRow(const string &sContents="", unsigned colspan=2)=0
add a row with a cell, spanning across all columns
static CRgbaColor Interpolate(const CRgbaColor &color1, const CRgbaColor &color2, float alpha)
Interpolate two colors.
virtual void AddSectionRow(const string &sContents)=0
add a section row
uint64_t Uint8
8-byte (64-bit) unsigned integer
position_type GetLength(void) const
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static string Int8ToString(Int8 value, TNumToStringFlags flags=0, int base=10)
Convert Int8 to string.
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
static string UIntToString(unsigned int value, TNumToStringFlags flags=0, int base=10)
Convert UInt 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[]
void SetFrom(TFrom value)
Assign a value to From data member.
void SetTo(TTo value)
Assign a value to To data member.
unsigned int
A callback function used to compare two keys in a database.
int m_Data[CAlnStatConfig::eStat_Total+1]