102 const string& ref_allele,
103 const string& alt_alleles) :
104 m_Object(new
CVcfVariant(seq_id, sID, pos, ref_allele, alt_alleles))
107 m_Intervals.push_back(GetRange());
114 m_Intervals.push_back(GetRange());
128 const auto &info_fields =
m_Object->GetInfoColumns();
129 auto it = info_fields.find(
"RS");
130 if (it != info_fields.end()) {
135 it = info_fields.find(
"CLNSIG");
136 if (it != info_fields.end()) {
137 string clinsig = it->second;
141 it = info_fields.find(
"CLNREVSTAT");
142 if (it != info_fields.end()) {
144 if (!str_buff.empty()) {
145 str_buff[0] =
toupper(str_buff[0]);
149 tooltip.
AddRow(
"Review status:", str_buff);
153 it = info_fields.find(
"CLNVCSO");
154 if (it != info_fields.end()) {
156 {
"SO:0000159",
"Deletion"},
157 {
"SO:1000035",
"Duplication"},
158 {
"SO:1000032",
"DELINS"},
159 {
"SO:0000667",
"Insertion"},
160 {
"SO:1000036",
"Inversion"},
161 {
"SO:0000289",
"Microsatellite"},
162 {
"SO:0001563",
"Structural variant"},
163 {
"SO:1000173",
"Tandem_duplication"},
164 {
"SO:0001059",
"Sequence alteration"},
165 {
"SO:0000199",
"Translocation"},
166 {
"SO:0001742",
"Copy number gain"},
167 {
"SO:0001743",
"Copy number loss"},
168 {
"SO:0001483",
"SNV"},
169 {
"SO:0001013",
"MNP"}
171 auto clnvcso_it = sm_CLNVCSO2Type.
find(it->second);
172 if (clnvcso_it != sm_CLNVCSO2Type.
end())
173 str_buff = clnvcso_it->second;
175 if (str_buff.empty()) {
176 it = info_fields.find(
"CLNVC");
177 if (it != info_fields.end() && it->second.empty() ==
false) {
179 str_buff[0] =
toupper(str_buff[0]);
182 if (str_buff.empty())
183 str_buff =
m_Object->GetVariationTypeAsString();
185 if (!str_buff.empty()) {
186 tooltip.
AddRow(
"Variation type:", str_buff);
190 if (!
m_Object->GetAltAlleles_display().empty() &&
m_Object->GetAltAlleles_display().front() !=
".")
191 allele =
m_Object->GetAltAlleles_display().front();
193 allele =
m_Object->GetRefAllele_display();
195 tooltip.
AddRow(
"ClinVar allele:", allele);
197 it = info_fields.find(
"MC");
198 if (it != info_fields.end()) {
203 for (
const auto& s : v) {
217 str_buff =
"complement(";
227 tooltip.
AddRow(
"Location:", str_buff);
238 const auto &info_fields =
m_Object->GetInfoColumns();
242 bool all_alt_alleles_same_len(
true);
243 int allele_len =
m_Object->GetLongestAlleleLen(all_alt_alleles_same_len);
244 if (allele_len > 0) {
248 bool var_type_shown{
false };
250 if (info_fields.size() > 0) {
251 if (info_fields.count(
"SVTYPE")) {
253 {
"DEL",
"Deletion" },
254 {
"INS",
"Insertion" },
255 {
"DUP",
"Duplication" },
256 {
"INV",
"Inversion" },
257 {
"CNV",
"Copy number variation" },
258 {
"BND",
"Translocation" }
260 string svtype = info_fields.at(
"SVTYPE");
262 if (labels.count(svtype) > 0) {
263 tooltip.
AddRow(
"Variant Type:", labels.at(svtype));
264 var_type_shown =
true;
267 if (info_fields.count(
"END"))
268 tooltip.
AddRow(
"Endpoint:", info_fields.at(
"END"));
269 if (info_fields.count(
"CIPOS"))
270 tooltip.
AddRow(
"Confidence intervals around POS:", info_fields.at(
"CIPOS"));
271 if (info_fields.count(
"CIEND"))
272 tooltip.
AddRow(
"Confidence intervals around END:", info_fields.at(
"CIEND"));
273 if (info_fields.count(
"SVLEN")) {
274 string svlen = info_fields.at(
"SVLEN");
275 if (svlen.size() > 0) {
278 tooltip.
AddRow(
"Variant length:", svlen);
282 if (!var_type_shown) {
283 tooltip.
AddRow(
"Variant Type:",
m_Object->GetVariationTypeAsString());
288 const auto &info_fields =
m_Object->GetInfoColumns();
289 if (info_fields.count(
"DBVARID")) {
291 auto dbvarid = info_fields.at(
"DBVARID");
292 string dbvar_link{
"https://www.ncbi.nlm.nih.gov/dbvar/variants/" };
296 tooltip.
AddLinkRow(
"dbVar:", dbvarid, dbvar_link);
315 const auto &info_fields =
m_Object->GetInfoColumns();
316 auto clnsig_it = info_fields.find(
"CLNSIG");
317 string clinsig =
"other";
318 if (clnsig_it != info_fields.end()) {
328 const auto &info_fields =
m_Object->GetInfoColumns();
329 auto svtype_it = info_fields.find(
"SVTYPE");
337 string sColorKey(
"Default");
339 switch(
m_Object->GetVariationType()) {
341 sColorKey =
"SingleBase";
344 sColorKey =
"MultiBase";
347 sColorKey =
"Insertion";
350 sColorKey =
"Deletion";
358 if(sColorKey !=
"Default") {
392 tooltip->SetTrustedData(
false);
394 s = tooltip->Render();
397 p_areas->push_back(area);
445 if (!
m_Object->GetAltAlleles_display().empty() &&
m_Object->GetAltAlleles_display().front() !=
".")
446 sAdditionalInfo =
m_Object->GetAltAlleles_display().front();
448 sAdditionalInfo =
m_Object->GetRefAllele_display();
450 sAdditionalInfo.clear();
497 base += bar_height * 0.5;
542 if (visible_range_pos.
GetLength() < min_text_w_pos) {
550 string sAdditionalInfo;
552 if (!sAdditionalInfo.empty()) {
594 bool all_same_type =
false;
597 while (parent !=
NULL) {
606 string track_title =
lt->GetFullTitle();
607 size_t start_idx =
label.find_first_not_of(
" ()[]'\" <>,.@#$&*");
608 size_t stop_idx =
label.find_last_not_of(
" ()[]'\" <>,.@#$&*");
609 size_t len = stop_idx-start_idx;
666 string sLabelTextOut;
688 m_Context->
TextOut(&font, sLabelTextOut.c_str(), LabelX, LabelY,
true,
true);
701 if (exon_int.
Empty())
715 bool side_lbl{
false };
720 LabelVisibleWidth = (FeatureBarLeft < visible_range.
GetFrom() ? 0 : FeatureBarLeft - visible_range.
GetFrom());
723 LabelVisibleWidth = (FeatureBarRight > visible_range.
GetTo() ? 0 : visible_range.
GetTo() - FeatureBarRight);
759 (FeatureBarLeft < visible_range_pos.
GetFrom() ? 0 : FeatureBarLeft - visible_range_pos.
GetFrom())
761 (FeatureBarRight > visible_range_pos.
GetToOpen() ? 0 : visible_range_pos.
GetToOpen() - FeatureBarRight));
771 if (AvailableLabelVisibleWidthPos < m_Context->GetMinLabelWidthPos(font)) {
779 if (label_width_px > max_width_px) {
780 label_width_px = max_width_px;
781 fl_content = font.
Truncate(fl_content.c_str(), label_width_px);
782 if ((string::npos != fl_content.find(
"...")) && (fl_content.length() <= 5))
791 label_base += (font_height * 0.5);
796 label_clear_base = label_base;
797 if (bar_height > font_height) {
798 label_clear_height = bar_height;
799 label_clear_base = floor(base) + (label_clear_height * 0.5);
802 label_x_pos = visible_range_pos.
GetFrom();
806 TModelRect(label_x_pos, label_clear_base + 1, label_x_pos + label_width_pos,
807 label_clear_base - label_clear_height - 1), 0);
810 label_x_pos = visible_range_pos.
GetToOpen() - label_width_pos;
815 label_clear_base - label_clear_height - 1), 0);
822 label_base,
false,
true);
834 string sAdditionalInfo;
836 if (sAdditionalInfo.empty())
851 (FeatureBarLeft < visible_range.
GetFrom() ? 0 : FeatureBarLeft - visible_range.
GetFrom())
853 (FeatureBarRight > visible_range.
GetToOpen() ? 0 : visible_range.
GetToOpen() - FeatureBarRight));
857 if(AvailableAdditionalInfoVisibleWidthPos < m_Context->GetMinLabelWidthPos(font)) {
872 if (info_width_px > max_width_px) {
873 info_width_px = max_width_px;
874 sAdditionalInfo = font.
Truncate(sAdditionalInfo.c_str(), info_width_px);
883 info_base += (font_height * 0.5);
889 info_clear_base = info_base;
890 if (bar_height > font_height) {
891 info_clear_height = bar_height;
892 info_clear_base = floor(base) + (info_clear_height * 0.5);
895 info_x_pos = visible_range.
GetFrom();
900 TModelRect(info_x_pos, info_clear_base + 1, info_x_pos + info_width_pos,
901 info_clear_base - info_clear_height - 1), 0);
904 info_x_pos = visible_range.
GetToOpen() - info_width_pos;
910 info_clear_base - info_clear_height - 1), 0);
916 m_Context->
TextOut(&font, sAdditionalInfo.c_str(), info_x_pos, info_base,
false,
true);
929 m_Context->
DrawLine(SeqPosTriangleMidPointX, BoundaryYLow, SeqPosTriangleMidPointX, BoundaryYHigh);
931 SeqPosTriangleMidPointX + SeqTriangleHalf, BoundaryYLow - TriangleOffsetY,
932 SeqPosTriangleMidPointX - SeqTriangleHalf, BoundaryYLow - TriangleOffsetY);
934 SeqPosTriangleMidPointX + SeqTriangleHalf, BoundaryYHigh + TriangleOffsetY,
935 SeqPosTriangleMidPointX - SeqTriangleHalf, BoundaryYHigh + TriangleOffsetY);
949 SeqPosTriangleMidPointX + SeqTriangleHalf, BoundaryYLow - TriangleOffsetY,
950 SeqPosTriangleMidPointX - SeqTriangleHalf, BoundaryYLow - TriangleOffsetY);
975 TModelUnit BoundaryYLow = YCenterLine - bar_height * 0.5f;
976 TModelUnit BoundaryYHigh = YCenterLine + bar_height * 0.5f;
991 x_IntersectVisible<TSeqPos>(SeqRange, SeqPosFrom, SeqPosTo);
1006 x_DrawInsertion((SeqPosFrom + SeqPosTo) * 0.5 + 0.5, BoundaryYLow, BoundaryYHigh, YCenterLine);
1010 x_DrawDeletion((SeqPosFrom + SeqPosTo) * 0.5 + 0.5, BoundaryYLow, BoundaryYHigh);
1054 if (label_width > available_width) {
1056 if ((string::npos != fl_content.find(
"...")) && (fl_content.length() <= 5))
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
static void redundant(Char *flag)
TModelUnit m_OverviewFactor
ratio to bar height
CGlTextureFont m_LabelFont
TModelUnit GetBarHeight(bool overview) const
ELabelPosition m_LabelPos
TModelUnit m_BarHeight
absolute size (in pixel)
@ ePos_Side
always on 5' side
@ ePos_Inside
inside the rendered bar
@ ePos_Above
above the rendered bar
static CGuiRegistry & GetInstance()
access the application-wide singleton
string m_Descr
description that can be used as label or tooltip
bool m_PositiveStrand
the default is true
CLayoutGroup is a container of CSeqGlyphs (layout objects).
bool AllChildrenSameType() const
Return true if there are 0 or 1 children, or all children are features of the same type (e....
static string GetVcfVariantSignature(const objects::CVcfVariant &vcf_variant, objects::CScope *scope)
class CRegistryReadView provides a nested hierarchical view at a particular key.
void TextOut(const CGlTextureFont *font, const char *text, TModelUnit x, TModelUnit y, bool center, bool adjust_flip=true) const
static const int kLabelSpacePx
extra space for side labeling, in screen pixels
void DrawTriangle(TModelUnit x1, TModelUnit y1, TModelUnit x2, TModelUnit y2, TModelUnit x3, TModelUnit y3, bool border=false) const
void DrawHighlight(const TModelRect &rect, const CRgbaColor *color=0) const
const TSeqRange & GetVisSeqRange() const
TModelRange IntersectVisible(const CSeqGlyph *obj) const
TModelUnit GetMinLabelWidthPos() const
void DrawLine(TModelUnit x1, TModelUnit y1, TModelUnit x2, TModelUnit y2) const
objects::CScope & GetScope()
TModelUnit GetVisibleTo() const
void DrawQuad(const TModelRect &rc, bool border=false) const
void DrawSelection(const TModelRect &rc) const
TModelUnit SeqToScreen(const TModelUnit &size) const
convert from sequence positions to screen pixels
TModelUnit GetMaxLabelWidth(const CGlBitmapFont &font) const
In screen pixel..
TModelUnit ScreenToSeq(const TModelUnit &size) const
convert from screen pixels to sequence positions
bool IsOverviewMode() const
const CRgbaColor & GetSelLabelColor() const
bool WillLabelFit(const TModelRect &rc) const
void Draw3DQuad(TModelUnit x1, TModelUnit y1, TModelUnit x2, TModelUnit y2, const CRgbaColor &color, bool border=false) const
void DrawBackground(const TModelRect &rcm, TModelUnit border) const
class CRgbaColor provides a simple abstraction for managing colors.
static CRegistryReadView GetColorReadView(const CGuiRegistry ®, const string &base_key, const string §, const string &key, const string &def_sect="")
Create a read view specifically for 'Color' section.
static void GetColor(const CRegistryReadView &view, const string &key, CRgbaColor &color)
class CSeqGlyph defines an interface that wraps a rectilinear abstract object.
void x_InitHTMLActiveArea(CHTMLActiveArea &area) const
initialize the basic information for a given active area.
CRenderingContext * m_Context
the rendering context
virtual bool HitTestHor(TSeqPos x, const CObject *obj)
virtual void x_OnLayoutChanged()
update the layout.
virtual void SetHeight(TModelUnit h)
const CRenderingContext * GetRenderingContext() const
Get the rendering context.
virtual TModelUnit GetRight() const
void x_DrawInnerLabels(TModelUnit base, const string &label, const CRgbaColor &color, const CGlTextureFont &font, bool side_label_visible, bool inside_only, vector< TModelRange > *labels_ranges=nullptr, TSeqRange *interval=nullptr, bool XOR_mode=false) const
virtual void SetWidth(TModelUnit w)
CSeqGlyph * m_Parent
parent/child relationships for this feature
virtual void SetLeft(TModelUnit l)
virtual TModelUnit GetTop() const
virtual TModelUnit GetHeight() const
virtual bool LessBySeqPos(const CSeqGlyph &obj) const
compare this object to another based on glyph sequence position.
virtual void SetTop(TModelUnit b)
virtual bool SetSelected(bool flag)
Select or deselect this glyph.
virtual TModelUnit GetWidth() const
virtual TModelUnit GetLeft() const
TModelRect GetModelRect() const
get the bounding box.
vector< CHTMLActiveArea > TAreaVector
const CSeqGlyph * GetParent(void) const
void GetLabel(string &label, CLabel::ELabelType type) const
retrieve label for a given type
CConstRef< objects::CVcfVariant > m_Object
void x_DrawDeletion(TModelUnit SeqPosTriangleMidPointX, TModelUnit BoundaryYLow, TModelUnit BoundaryYHigh) const
virtual void GetObjects(vector< CConstRef< CObject > > &objs) const
retrieve CObjects corresponding to this CSeqGlyph.
virtual const TIntervals & GetIntervals(void) const
access sub-intervals (if any).
void GetAdditionalInfo(string &sAdditionalInfo) const
variation additional info on the right (alleles)
bool x_LabelOnLeft() const
true if a label should be placed to the left of the feature bar (provided that it is ePos_Side)
void x_DrawLabelWithYPinned(TModelUnit base) const
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.
void x_DrawInsertion(TModelUnit SeqPosTriangleMidPointX, TModelUnit BoundaryYLow, TModelUnit BoundaryYHigh, TModelUnit YCenterLine) const
void LayoutChanged()
update the layout for everything encompassing this glyph
void x_DrawAdditionalInfo(TModelUnit base) const
TModelUnit x_GetBarHeight() const
virtual void GetHTMLActiveAreas(TAreaVector *p_areas) const
Get html active areas.
void x_DrawLabelWithXPinned(TModelUnit &base) const
virtual bool HitTestHor(TSeqPos x, const CObject *obj)
virtual void SetHideLabel(bool b)
Force to hide label.
bool x_RedundantLabelCheck(const string &label) const
bool x_isDrawn() const
determines whether the glyph should be drawn or not at all (currently children of unselected parents ...
virtual void x_DrawHighlight() const
virtual const objects::CSeq_loc & GetLocation(void) const
access the position of this object.
virtual bool IsClickable() const
Query if this glyph is clickable.
virtual bool LessBySeqPos(const CSeqGlyph &obj) const
compare this object to another based on glyph sequence position.
void x_GetClinVarToolTip(ITooltipFormatter &tooltip) const
void x_MaybeDrawLabelAbove(TModelUnit &base) const
virtual string GetSignature() const
return signature for this glyph.
bool GetCustomColor(CRgbaColor &color) const
Get the customized color for a given feature.
virtual bool NeedTooltip(const TModelPoint &, ITooltipFormatter &, string &) const
Check if need to show tooltip.
void x_DrawInnerLabels(TModelUnit base, vector< TModelRange > *labels_range=nullptr, TSeqRange *interval=nullptr) const
virtual CConstRef< CObject > GetObject(TSeqPos pos) const
access our core component - we wrap an object(s) of some sort.
virtual bool HasSideLabel() const
Query if there is label and label is on the side.
CVcfGlyph(objects::CSeq_id &seq_id, const string &sID, size_t pos, const string &ref_allele, const string &alt_alleles)
alternative alleles separated by /
virtual bool HasObject(CConstRef< CObject > obj) const
check if the wrapped object(s) is the one.
void x_DrawVariationBar(TModelUnit base) const
virtual void x_UpdateBoundingBox()
Update the bounding box assuming children's sizes are fixed if any.
void x_MaybeDrawLabelOthers(TModelUnit base) const
CConstRef< CFeatureParams > m_Config
virtual bool SetSelected(bool f)
Select or deselect this glyph.
unique_ptr< CRgbaColor > m_CustomColorPtr
virtual TSeqRange GetRange(void) const
get the total range of this object.
vector< TSeqRange > TIntervals
const_iterator end() const
const_iterator find(const key_type &key) const
bool Empty(const CNcbiOstrstream &src)
unsigned int TSeqPos
Type for sequence locations and lengths.
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
CGlRect< TModelUnit > TModelRect
CGlPoint< TModelUnit > TModelPoint
virtual void ColorC(const CRgbaColor &c)=0
Set current color (glColor{3,4}{f,d}{v,})
string Truncate(const char *text, TModelUnit w, ETruncate trunc=eTruncate_Ellipsis) const
Truncate text to the secified width.
CRgbaColor ContrastingColor(bool onlyBW=true) const
Return a color guaranteed to contrast nicely with this color.
static const string snpURL
virtual void AddRow(const string &sContents="", unsigned colspan=2)=0
add a row with a cell, spanning across all columns
static string SelectClinSigTerm(const string &clinsig)
returns the term with the highest pathogenicity if the CLNSIG string has multiple parts (terms)
static CIRef< ITooltipFormatter > CreateTooltipFormatter(ETooltipFormatters)
factory for requested tooltip formatter creation
virtual void AddLinksTitle(const string &sTitle)=0
add a row with the links title
virtual void SetTrustedData(bool trusted_data)
indicates whether the data is coming from a trusted source
virtual void AddLinkRow(const string &sTag, const string &sValue, unsigned valueColWidth=200)=0
add a row with two columns
static const string ClinVarIdURL
standard NCBI resourse URLs
virtual string CreateNcbiLink(const string &sText, const string &sUrl) const =0
construct the HTML code for a link from the displayed text label and supplied NCBI URL path
@ eTooltipFormatter_CSSTable
generated table is CSS based, generated NCBI URLs are paths (recommended for SViewer)
ENa_strand GetStrand(const CSeq_loc &loc, CScope *scope=0)
Returns eNa_strand_unknown if multiple Bioseqs in loc Returns eNa_strand_other if multiple strands in...
position_type GetLength(void) const
TThisType IntersectionWith(const TThisType &r) const
position_type GetToOpen(void) const
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static string SizetToString(size_t value, TNumToStringFlags flags=0, int base=10)
Convert size_t to string.
static list< string > & Split(const CTempString str, const CTempString delim, list< string > &arr, TSplitFlags flags=0, vector< SIZE_TYPE > *token_pos=NULL)
Split a string using specified delimiters.
static SIZE_TYPE FindNoCase(const CTempString str, const CTempString pattern, SIZE_TYPE start, SIZE_TYPE end, EOccurrence which=eFirst)
Find the pattern in the specified range of a string using a case insensitive search.
static string HtmlEncode(const CTempString str, THtmlEncode flags=fHtmlEnc_EncodeAll)
Encode a string for HTML.
static string Join(const TContainer &arr, const CTempString &delim)
Join strings using the specified delimiter.
static string & Replace(const string &src, const string &search, const string &replace, string &dst, SIZE_TYPE start_pos=0, SIZE_TYPE max_replace=0, SIZE_TYPE *num_replace=0)
Replace occurrences of a substring within a string.
static bool SplitInTwo(const CTempString str, const CTempString delim, string &str1, string &str2, TSplitFlags flags=0)
Split a string into two pieces using the specified delimiters.
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.
static string & ReplaceInPlace(string &src, const string &search, const string &replace, SIZE_TYPE start_pos=0, SIZE_TYPE max_replace=0, SIZE_TYPE *num_replace=0)
Replace occurrences of a substring within a string.
static string & ToUpper(string &str)
Convert string to upper case – string& version.
@ fSplit_Tokenize
All delimiters are merged and trimmed, to get non-empty tokens only.
@ fWithCommas
Use commas as thousands separator.
static const char label[]
TTo GetTo(void) const
Get the To member data.
TFrom GetFrom(void) const
Get the From member data.
ENa_strand
strand of nucleic acid
@ eType_snv
delta=[morph of length 1] NOTE: this is snV not snP; the latter requires frequency-based validation t...
@ eType_mnp
delta=[morph of length >1]
@ eType_delins
delta=[del, ins]
static void text(MDB_val *v)
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
double f(double x_, const double &y_)
static const float kMinScaleForRulerLabels
Shoudl match feature_ds.cpp::kMinScaleForMapping i.e.
static const TModelUnit kRSiteMarkerThreshold
Restriction sites marker visibility threshold (ie if the marker's width is smaller then the threshold...
static const int kVertSpace
vertical space between elements.
static const TModelUnit kRSiteMarkerWidth
Restriction sites marker width (absolute)
static const int kRulerHeight
feature ruler height.
static const TModelUnit kRSiteMarkerHeight
Restriction sites marker height (relative to the height of the bar)