74 static const string kBaseKey =
"GBPlugins.SeqGraphicSequenceBar";
79 "A horizontal bar representing the \
80 currently viewed top sequence in a zoomed-out view, and overlaid with sequence \
81 letters in a zoomed-in view at sequence level. For nucleotide sequences, both \
82 the original sequence and the complementary sequence may be shown with two \
90 , m_SegMapDS(seg_map_ds)
92 , m_ColorGapsKey(
true)
94 , m_SegMapJobCompleted(
false)
103 string title =
"Sequence ";
107 if ( !extra.empty() ) {
128 glyph->SetRenderingContext(r_cntx);
129 glyph->SetParent(
this);
184 if (pp.
Y() < t_h)
return true;
187 if (pp.
Y() < t_h + t_h - 2.0)
return true;
189 bool show_complement =
191 if (show_complement && pp.
Y() < t_h + b_h * 2.0 - 2.0) {
196 if ((*iter)->NeedTooltip(p, tt, t_title))
return true;
211 tt.
AddRow(sequence::CDeflineGenerator().GenerateDefline(bsh));
251 bool show_complement =
253 bool on_complement =
false;
254 if (show_complement && pp.
Y() > t_h + b_h) {
255 on_complement =
true;
258 int seq_p =
int(pp.
X());
262 tmp +=
" (Complementary Strand)";
264 tmp +=
" (Direct Strand)";
280 if (gap->IsSetLength())
282 if (gap->IsSetSeq_data() && gap->GetSeq_data().IsGap() && gap->GetSeq_data().GetGap().IsSetType() && gap->GetSeq_data().GetGap().GetType() ==
CSeq_gap::eType_contamination)
283 tmp =
"Contamination " +
tmp;
284 else if (gap->IsSetFuzz() && gap->GetFuzz().IsLim() && gap->GetFuzz().GetLim() ==
CInt_fuzz::eLim_unk)
290 if (gap && gap->IsSetSeq_data() && gap->GetSeq_data().IsGap() && gap->GetSeq_data().GetGap().IsSetLinkage_evidence())
292 for (
const auto &ev : gap->GetSeq_data().GetGap().GetLinkage_evidence())
314 if ( !
tmp.empty() ) {
315 tmp.insert(
tmp.begin() + (seq_p - left + 1),
']');
316 tmp.insert(
tmp.begin() + (seq_p - left),
'[');
328 if (p_areas ==
nullptr)
347 p_areas->push_back(area);
354 rsite_areas.reserve(
m_Rsites.size());
355 for (
const auto& rsite :
m_Rsites) {
356 rsite->GetHTMLActiveAreas(&rsite_areas);
359 for (
auto&
a : rsite_areas) {
361 p_areas->push_back(
a);
437 bool show_complement =
GetSeqVector().IsNucleotide() && seq_fit;
444 if (show_complement) {
482 if (it.
GetType() == objects::CSeqMap::eSeqGap)
488 if (gap->IsSetSeq_data() && gap->GetSeq_data().IsGap() && gap->GetSeq_data().GetGap().IsSetType() && gap->GetSeq_data().GetGap().GetType() ==
CSeq_gap::eType_contamination)
492 else if (gap->IsSetFuzz() && gap->GetFuzz().IsLim() && gap->GetFuzz().GetLim() ==
CInt_fuzz::eLim_unk)
529 bool show_strand)
const
553 0,
static_cast<TSeqPos>(seq_str.length()), seq_str);
563 for (
TSeqPos bp = 0; bp != seq_str.length(); bp++) {
564 bases[0] = seq_str[bp];
596 if (preset_style.empty()) {
620 LOG_POST(
Warning <<
"CSequenceTrack::x_LoadSettings() invalid settings - "
621 << iter->first <<
":" << iter->second);
632 int rs_w = view.
GetInt(
"RsiteWidth", 8);
633 int rs_h = view.
GetInt(
"RsiteHeight", 6);
636 (*s_iter)->SetSiteWidth(rs_w);
637 (*s_iter)->SetSiteHeight(rs_h);
652 (*s_iter)->SetSiteColor(rs_color);
659 for (
int i = 0;
i < 5; ++
i) {
676 if ( !preset_style.empty() ) {
677 settings[
"profile"] = preset_style;
718 "failed to load segment map.");
780 (*iter)->Update(
true);
793 (*iter)->Update(
true);
813 if ((*iter)->HasVisibleRsite())
return true;
844 if (!src_annots.
empty()) {
848 if (annots.
empty()) {
858 }
catch (exception& e) {
861 if (annots.
empty()) {
882 tracks[annots.
empty() ?
"Sequence" : annots.
begin()->first] =
922 config->SetLegend_text(
"anchor_8");
929 config->SetHelp() =
"The sequence bar is colored by the source \
930 sequence and to generate that base. <br>Blue=finished sequence<br>\
931 Orange=draft sequence<br>Green=WGS<br>Gray=Other<br>Black=Gap";
950 LOG_POST(
Warning <<
"CSequenceTrack::x_LoadSettings() invalid settings - "
951 << iter->first <<
":" << iter->second);
957 config->SetCheck_boxes().push_back(
959 kShowLabelKey,
"Show Label",
"Show/hide sequence track title",
"", show_label));
960 config->SetCheck_boxes().push_back(
962 kColorGapsKey,
"Color gaps by type",
"purple = gap of known length, red = gap of unknown length, yellow = contamination",
"", color_gaps));
User-defined methods of the data storage class.
User-defined methods of the data storage class.
CAppJobNotification Notification send by CAppJobEventTranslator.
CDataTrack - a abstract base class for layout tracks which need to deal with background data retrieva...
CRef< CSimpleLayout > m_Simple
void SetLayoutPolicy(ILayoutPolicy *policy)
Set policy on how to deploy the layout of its children.
static CGuiRegistry & GetInstance()
access the application-wide singleton
@ fNoTooltip
do not request and show tooltip
@ fNoPin
tooltip is not pinnable
@ fNoHighlight
no highlighting on mouse over
@ fSequence
sequence track flag
@ fNoSelection
the object can't be selected
int m_Flags
area flags, will need to replace m_Type
string m_ParentId
parent entity idendifier, such as track_id
void PushBack(CSeqGlyph *obj)
Append a layout object to the end.
TObjectList & SetChildren()
virtual void x_UpdateBoundingBox()
Update the bounding box assuming children's sizes are fixed if any.
void SetShowTitle(bool flag)
virtual void GetTooltip(const TModelPoint &p, ITooltipFormatter &tt, string &t_title) const
Get the tooltip if available.
bool m_Expanded
is this track in expanded state
void SetTitle(const string &label, const string &default_title=NcbiEmptyString)
virtual bool OnLeftDblClick(const TModelPoint &p)
bool GetShowTitle() const
ILayoutTrackHost * m_LTHost
Top level host owning the tracks.
const string & GetId() const
const string & GetProfile() const
TModelUnit x_GetTBHeight() const
Get title bar height including margin.
void SetMsg(const string &msg)
CConstRef< CSeqGraphicConfig > x_GetGlobalConfig() const
Method for getting global configuration from rendering context.
void SetProfile(const string &preset_style)
CLayoutTrack inline method implmentation.
CRef< CSeqGraphicConfig > m_gConfig
global configuration.
virtual CHTMLActiveArea * InitHTMLActiveArea(TAreaVector *p_areas) const
Initialize the HTML active area for a track.
static string GetSeqLocSignature(const objects::CSeq_loc &loc, objects::CScope *scope)
void GetLabel(string *label) const
class CRegistryReadView provides a nested hierarchical view at a particular key.
int GetInt(const string &key, int default_val=0) const
access a named key at this level, with no recursion
bool GetBool(const string &key, bool default_val=false) const
void Set(const string &key, int val)
access a named key at this level, with no recursion
CRenderingContext offers the basic context and utility methods for rendering layout objects in featur...
void TextOut(const CGlTextureFont *font, const char *text, TModelUnit x, TModelUnit y, bool center, bool adjust_flip=true) const
const TSeqRange & GetVisSeqRange() const
const TModelRange & GetVisibleRange() const
TSeqPos GetVisSeqTo() const
void DrawQuad(const TModelRect &rc, bool border=false) const
const TModelUnit & GetScale() const
bool WillSeqLetterFit() const
is it enougth space to sequence letters.
TSeqPos GetVisSeqFrom() const
void Draw3DQuad(TModelUnit x1, TModelUnit y1, TModelUnit x2, TModelUnit y2, const CRgbaColor &color, bool border=false) const
void Draw5Prime(TModelUnit x, TModelUnit y, bool direct, TModelUnit size_h, TModelUnit size_v) const
class CRgbaColor provides a simple abstraction for managing colors.
A glyph representing a list of restriction sites stored in one seq-feat.
static CRegistryReadView GetSizeReadView(const CGuiRegistry ®, const string &base_key, const string §, const string &key, const string &def_sect="")
static void GetFont(const CRegistryReadView &view, const string &face_key, const string &size_key, CGlTextureFont &f)
static string ComposeProfileString(const TKeyValuePairs &settings)
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 CRegistryReadView GetReadView(const CGuiRegistry ®, const string &base_key, const string &curr_key, const string &def_key1="", const string &def_key2="", const string &def_key3="")
read/readwrite view creation helper methods.
static CRegistryWriteView GetWriteView(CGuiRegistry ®, const string &base_key, const string &curr_key, const string &def_key1="", const string &def_key2="", const string &def_key3="")
static CRegistryWriteView GetColorRWView(CGuiRegistry ®, const string &base_key, const string §, const string &key, const string &def_sect="")
static CRegistryWriteView GetSizeRWView(CGuiRegistry ®, const string &base_key, const string §, const string &key, const string &def_sect="")
static void SetColor(CRegistryWriteView &view, const string &key, const CRgbaColor &color)
static void GetColor(const CRegistryReadView &view, const string &key, CRgbaColor &color)
static void SetFont(CRegistryWriteView &view, const string &face_key, const string &size_key, const CGlTextureFont &f)
void SetJobListener(CEventHandler *listener)
Set JobDispatcher listener.
virtual void ClearJobID(TJobID job_id)
virtual void DeleteAllJobs()
Remove waiting jobs from queue or cancel the unfinished jobs.
CSGJobResult – the data structure holding the seqgraphic job results.
void SetAnnot(const string &annot)
CSGFeatureDS inline methods.
const string & GetAnnot() const
static bool GetEnabled()
Indicates if the segment map is enabled.
void LoadSegmentSmear(const TSeqRange &range, TModelUnit scale, const objects::CSeqVector *seq_vec=nullptr)
Used in sequence track for showing segment color.
bool HasSegmentMap(int level, const TSeqRange &range) const
Query if there is segment maps for given level.
void GetAnnotNames(objects::SAnnotSelector &sel, const TSeqRange &range, TAnnotNameTitleMap &names) const
objects::CScope & GetScope(void) const
Get the scope from the handle.
TSeqPos GetSequenceLength() const
const objects::CSeqVector & GetSeqVector(void) const
objects::CBioseq_Handle GetBioseqHandle(void) const
Get the underlying bioseq handle.
void GetSequence(TSeqPos from, TSeqPos to, string &buffer) const
retrieve a string representing the IUPAC characters for the sequence [from to].
string GetAcc_Best() const
this is more suitable for display purposes since the returned string will not always be good to recon...
objects::CSeq_id_Handle GetBestIdHandle() const
static bool IsChromosome(const objects::CBioseq_Handle &handle, objects::CScope &scope)
void SetColorCode(const TColorCode &colors)
CSegmentSmearGlyph inline methods.
void x_InitHTMLActiveArea(CHTMLActiveArea &area) const
initialize the basic information for a given active area.
CRenderingContext * m_Context
the rendering context
virtual void SetHeight(TModelUnit h)
void SetParent(CSeqGlyph *p)
bool IsIn(const TModelPoint &p) const
Hit test for points in PARENT COORD.
virtual void SetWidth(TModelUnit w)
virtual void SetLeft(TModelUnit l)
virtual TModelUnit GetHeight() const
virtual void SetTop(TModelUnit b)
void Draw() const
render the layout.
vector< CHTMLActiveArea > TAreaVector
void x_World2Local(TModelPoint &p) const
Transform the coordiante from world coord. to local coord.
list< CRef< CSeqGlyph > > TObjects
void SetRenderingContext(CRenderingContext *context)
Set the rendering context.
const string & GetSizeLevel() const
int GetObjectSpace() const
bool GetShowComments() const
const string & GetColorTheme() const
static SIZE_TYPE Complement(const string &src, TCoding src_coding, TSeqPos pos, TSeqPos length, string &dst)
namespace ncbi::objects::
virtual string GetExtensionLabel() const
returns a displayable label for this extension ( please capitalize the key words - "My Extension" )
virtual void GetMatchedAnnots(const TAnnotMetaDataList &src_annots, const ILayoutTrackFactory::SExtraParams ¶ms, TAnnotNameTitleMap &out_annots) const
virtual const CTrackTypeInfo & GetThisTypeInfo() const
virtual CRef< objects::CTrackConfigSet > GetSettings(const string &profile, const TKeyValuePairs &settings, const CTempTrackProxy *track_proxy) const
virtual TTrackMap CreateTracks(SConstScopedObject &object, ISGDataSourceContext *ds_context, CRenderingContext *r_cntx, const SExtraParams ¶ms=SExtraParams(), const TAnnotMetaDataList &src_annots=TAnnotMetaDataList()) const
create a layout track based on input object and extra parameters.
virtual string GetExtensionIdentifier() const
returns the unique human-readable identifier for the extension the id should use lowercase letters se...
CSequenceTrack – the layout track for holding and visualizing a molecule sequence superimposed by com...
vector< CRef< CRsitesGlyph > > TRsites
list of restriction sites
CRgbaColor m_SeqBarColor
sequence bar color.
virtual void x_LoadSettings(const string &preset_style, const TKeyValuePairs &settings)
load the track settings.
CRef< CGlTextureFont > m_SeqFont
font
virtual CConstRef< CObject > GetObject(TSeqPos pos) const
access our core component - we wrap an object(s) of some sort.
virtual CRef< CSeqGlyph > HitTest(const TModelPoint &p)
Hit testing.
virtual bool x_Empty() const
bool m_SegMapJobCompleted
virtual const IObjectBasedGlyph::TIntervals & GetIntervals(void) const
access sub-intervals (if any).
const objects::CSeqVector & GetSeqVector() const
virtual CHTMLActiveArea * InitHTMLActiveArea(TAreaVector *p_areas) const
Initialize the HTML active area for a track.
virtual bool HasObject(CConstRef< CObject > obj) const
check if the wrapped object(s) is the one.
bool x_HasVisibleRsite() const
virtual void x_SaveSettings(const string &preset_style)
save part of settings to a profile string.
virtual void x_OnJobCompleted(CAppJobNotification ¬ify)
TModelUnit x_GetBarHeight() const
Get the sequence bar height.
virtual bool NeedTooltip(const TModelPoint &p, ITooltipFormatter &tt, string &t_title) const
Check if need to show tooltip.
virtual string GetSignature() const
return signature for this glyph.
CRgbaColor m_StrandColor
sequence strand color.
virtual const CTrackTypeInfo & GetTypeInfo() const
void x_RenderGaps(const TModelRect &rcm, TSeqPos from, TSeqPos to, bool show3d) const
bool m_ShowSegMap
superimpose segment map.
CSegmentSmearGlyph::TColorCode m_SegMapColors
color codes for segment map.
TModelUnit x_GetGapsBarHeight() const
Get the height of the gaps bar, drown on top of the segment map.
CRef< CSGSequenceDS > m_SeqDS
CRgbaColor m_SeqColor
sequence text color.
CRef< objects::CSeq_loc > m_Location
bool x_ShowSegMap() const
virtual void x_RenderContent() const
The content rendering must be implemented in the derived layout tracks.
virtual void x_UpdateData()
update track content.
CRef< CSGSegmentMapDS > m_SegMapDS
void x_SaveConfiguration(const string &preset_style) const
save all track settings to the configuration file.
virtual bool OnLeftDblClick(const TModelPoint &p)
CSequenceTrack(CSGSequenceDS *seq_ds, CRenderingContext *r_cntx, CSGSegmentMapDS *seg_map_ds=NULL)
virtual CRef< CSGGenBankDS > GetDataSource()
Method for accessing the data source.
virtual void x_UpdateBoundingBox()
Update the bounding box assuming children's sizes are fixed if any.
void x_RenderSequence(const TModelRect &rcm, bool seq_fit, bool direct, bool show_strand) const
Render a sequence bar and the sequence if fits.
static CTrackTypeInfo m_TypeInfo
virtual void GetTooltip(const TModelPoint &p, ITooltipFormatter &tt, string &t_title) const
Get the tooltip if available.
virtual void GetObjects(vector< CConstRef< CObject > > &objs) const
retrieve CObjects corresponding to this CSeqGlyph.
virtual const objects::CSeq_loc & GetLocation(void) const
access the position of this object.
bool m_ShowLabel
show sequence label.
const CLayoutTrack * GetTrack() const
static CRef< objects::CCheckBox > CreateCheckBox(const string &name, const string &disp_n, const string &help_text, const string &legend_txt, bool value, bool optional=false)
CTrackTypeInfo - holds description of a layout track type.
const string & GetDescr() const
const string & GetId() const
CConstRef< CUser_field > GetFieldRef(const string &str, const string &delim=".", NStr::ECase use_case=NStr::eCase) const
static void GetMatchedAnnots(const TAnnotMetaDataList &src_annots, const vector< string > &target_annots, const string &annot_type, const string &track_type, TAnnotNameTitleMap &out_annots)
Help function to find matched annotations.
virtual void LTH_ZoomOnRange(const TSeqRange &range)=0
notifies the host we need to zoom on to a range.
vector< TSeqRange > TIntervals
ISGDSManager is seqgraphic data source manage that serves as an data source context.
virtual CIRef< ISGDataSource > GetDS(const string &type, SConstScopedObject &object)=0
Get a seqgraphic data source instance of the specified type.
const_iterator begin() const
iterator_bool insert(const value_type &val)
container_type::value_type value_type
unsigned int TSeqPos
Type for sequence locations and lengths.
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
#define NON_CONST_ITERATE(Type, Var, Cont)
Non constant version of ITERATE macro.
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
void Error(CExceptionArgs_Base &args)
const string & GetMsg(void) const
Get message string.
void Warning(CExceptionArgs_Base &args)
virtual const char * what(void) const noexcept
Standard report (includes full backlog).
static objects::SAnnotSelector GetAnnotSelector(TAnnotFlags flags=0)
request an annotation selector for a given type
void Offset(T d_x, T d_y)
IRender & GetGl()
convenience function for getting current render manager
virtual TModelUnit TextHeight(const CGlTextureFont *font) const =0
virtual void ColorC(const CRgbaColor &c)=0
Set current color (glColor{3,4}{f,d}{v,})
virtual void AddRow(const string &sContents="", unsigned colspan=2)=0
add a row with a cell, spanning across all columns
CRef< CObject > GetResult() const
returns non-null pointer only if Completed or Running and has temporary results available
CRgbaColor GetGreyscale() const
Returns the greyscale equivalent of the current color.
virtual bool IsEmpty() const =0
Indicates if the tooltip is empty.
#define ENUM_METHOD_NAME(EnumName)
const COrg_ref & GetOrg_ref(const CBioseq_Handle &handle)
Return the org-ref associated with a given sequence.
TSeqPos GetEndPosition(void) const
return end position of current segment in sequence (exclusive)
CConstRef< CSeq_literal > GetGapSeq_literal(void) const
returns gap Seq-data object ref returns null if it's not a gap or an unspecified gap
SAnnotSelector & SetResolveDepth(int depth)
SetResolveDepth sets the limit of subsegment resolution in searching annotations.
CSeqMap::ESegmentType GetType(void) const
SAnnotSelector & SetAnnotType(TAnnotType type)
Set annotation type (feat, align, graph)
TSeqPos GetPosition(void) const
return position of current segment in sequence
CConstRef< CSeq_literal > GetRefGapLiteral(void) const
return CSeq_literal with gap data, or null if either the segment is not a gap, or an unspecified gap
const CSeqMap_CI & GetCurrentSeqMap_CI() const
bool IsInGap(void) const
true if current position of CSeqVector_CI is inside of sequence gap
void GetSeqData(TSeqPos start, TSeqPos stop, string &buffer) const
Fill the buffer string with the sequence data for the interval [start, stop).
TObjectType * GetPointer(void) const THROWS_NONE
Get pointer,.
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
void Reset(void)
Reset reference object.
CRange< TSeqPos > TSeqRange
typedefs for sequence ranges
static TThisType GetWhole(void)
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static bool StringToBool(const CTempString str)
Convert string to bool.
static const string BoolToString(bool value)
Convert bool to string.
static string UIntToString(unsigned int value, TNumToStringFlags flags=0, int base=10)
Convert UInt to string.
static bool EqualNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive equality of a substring with another string.
@ fWithCommas
Use commas as thousands separator.
TTo GetTo(void) const
Get the To member data.
TFrom GetFrom(void) const
Get the From member data.
const TStr & GetStr(void) const
Get the variant data.
bool IsStr(void) const
Check if variant Str is selected.
const TData & GetData(void) const
Get the Data member data.
bool IsStr(void) const
Check if variant Str is selected.
const TStr & GetStr(void) const
Get the variant data.
const TType & GetType(void) const
Get the Type member data.
Tdata & Set(void)
Assign a value to data member.
bool IsRsite(void) const
Check if variant Rsite is selected.
const TLocation & GetLocation(void) const
Get the Location member data.
const TData & GetData(void) const
Get the Data member data.
bool IsPacked_pnt(void) const
Check if variant Packed_pnt is selected.
bool IsMap(void) const
Check if variant Map is selected.
const TUser & GetUser(void) const
Get the variant data.
const Tdata & Get(void) const
Get the member data.
const TMap & GetMap(void) const
Get the variant data.
list< CRef< CSeq_feat > > Tdata
const TExt & GetExt(void) const
Get the Ext member data.
bool CanGetExt(void) const
Check if it is safe to call GetExt method.
@ e_User
user defined object
unsigned int
A callback function used to compare two keys in a database.
range(_Ty, _Ty) -> range< _Ty >
static const TModelUnit kGapBarHeight
static const string kColorGapsKey
static const int kBarHeight
static const string kDefProfile
static const string kShowLabelKey
static const int kSeqTooltipLength
CSequenceTrack.
static const string kBaseKey