82 static const string kBaseKey =
"GBPlugins.SeqGraphicSNP";
86 "Variation features from dbSNP");
101 if (iter->second == layout) {
110 , m_eLayout(eLayout_Adaptive)
112 , m_IconLayout(eIcon_Layout,
"Layout",
true,
"track_layout")
113 , m_PreferredTitle(sTitle)
119 if(!sLayout.empty()) {
154 bool bShowLabels =
false;
207 bool bIsLayoutOnlyChange =
true;
222 wxMenuItemList& item_list = menu.GetMenuItems();
223 ITERATE (wxMenuItemList, iter, item_list) {
225 if ((*iter)->IsChecked() &&
id !=
m_eLayout) {
229 bIsLayoutOnlyChange =
false;
236 bIsLayoutOnlyChange =
false;
241 bIsLayoutOnlyChange =
false;
254 if (bIsLayoutOnlyChange) {
267 if ( !preset_style.empty() ) {
268 settings[
"profile"] = preset_style;
279 if (preset_style.empty()) {
298 << iter->first <<
":" << iter->second);
299 }
catch (std::exception&) {
301 << iter->first <<
":" << iter->second);
329 string msg =
"Zoom to see data!";
378 for ( ; feature_iter; ++feature_iter) {
390 for ( ; graph_iter; ++graph_iter) {
394 graph.push_back(pGraph);
398 seq_entry.SetAnnot().push_back(pAnnot);
408 static size_t s_MaxFeatures(30 * 1000 * 1000);
411 if(nFeats > s_MaxFeatures) {
414 " records. Please reduce the range and try again. If you need the whole SNP dataset, you can go to <a href=\"https://ftp.ncbi.nih.gov/snp/\" target=\"_blank\">dbSNP FTP site</a>.";
437 ERR_POST(
"CSnpTrack::x_OnJobCompleted() notification for job \
438 does not contain results.");
455 m_Msg +=
", density (seq-feats)";
458 m_Msg +=
", density (seq-graphs)";
561 if ( !src_annots.
empty() ) {
579 string sAnnot(iter->second);
588 track_settings.count(
"Layout") ? track_settings[
"Layout"] :
""));
590 feat_track->SetAnnot(sAnnot);
609 for(
auto&
i : src_annots) {
612 i.first,
i.second->m_Title));
636 config_set->
Set().push_back(
x_GetSettings(settings, track_proxy, is_clinvar_track));
649 config->SetLegend_text(
"anchor_4");
650 if (is_clinvar_track) {
651 config->SetLegend_text(
"anchor_4.2");
652 config->SetSubkey(
"clinvar");
655 bool show_only_pathogenic{
false};
665 }
catch (std::exception&) {
672 "Controls how variants are displayed");
673 choice->SetValues().push_back(
676 "Show variants for 50 or less",
677 "Show labels if less than 15 variants; Show density bar if greater than 50 variants",
678 "Lines represent the variant features from dbSNP"));
679 choice->SetValues().push_back(
682 "Collapse on single line",
683 "Always show the density bar of variants",
684 "Lines represent the variant features from dbSNP"));
685 choice->SetValues().push_back(
689 "Show all variants rendered individually",
690 "Lines represent the variant features from dbSNP"));
691 choice->SetValues().push_back(
694 "Show variants with labels",
695 "Always show the labels of variants",
696 "Lines represent the variant features from dbSNP"));
697 config->SetChoice_list().push_back(choice);
699 config->SetCheck_boxes().push_back(
701 "ShowOnlyPathogenic",
702 "Show only pathogenic/likely pathogenic",
703 "Show only pathogenic/likely pathogenic",
704 "", show_only_pathogenic,
true));
731 bool isInsertion(
false);
738 vector<string> Ngbrs;
741 if(Ngbrs.size() == 4 &&
742 NStr::StringToNumeric<int>(Ngbrs[3]) - NStr::StringToNumeric<int>(Ngbrs[2]) == 1) {
746 catch (std::exception&) {
767 NCBI_ASSERT(
true,
"Unexpected SNP bitfield version!");
781 string sColorKey(
"Default");
783 switch(VariationClass)
786 sColorKey =
"SingleBase";
792 sColorKey =
"Insertion";
795 sColorKey =
"Deletion";
798 sColorKey =
"Identity";
801 sColorKey =
"Inversion";
804 sColorKey =
"MultiBase";
807 sColorKey =
"Heterozygous";
810 sColorKey =
"Microsatellite";
813 sColorKey =
"NamedSNP";
816 sColorKey =
"NoVariation";
877 return iParamsCache->second;
User-defined methods of the data storage class.
User-defined methods of the data storage class.
static const map< string, CAlignmentTrack::ELayout > sm_LayoutMap
CAppJobNotification Notification send by CAppJobEventTranslator.
CDataTrack - a abstract base class for layout tracks which need to deal with background data retrieva...
virtual void Update(bool layout_only)
Update content and layout including the bounding box.
void SetConfig(CConstRef< CFeatureParams > conf)
const objects::CSeq_feat & GetFeature(void) const
Access the original feature.
CFeatureParams: the data structure holding feature rendering parameters.
CGlTextureFont m_LabelFont
ELabelPosition m_LabelPos
EBoxStyle
how the box of the feature is drawn
@ eBox_Insertion
additional decoration for the box
@ eBox_Deletion
add an inverted triangle to mark a deletion
@ ePos_Side
always on 5' side
void Add(CSeqGlyph *obj)
Append a layout object to the end.
CRef< CInlineLayout > m_Inline
CRef< CLayeredLayout > m_Layered
void SetLayoutPolicy(ILayoutPolicy *policy)
Set policy on how to deploy the layout of its children.
static CGuiRegistry & GetInstance()
access the application-wide singleton
void SetConfig(const CSeqGraphicConfig &config)
void x_DeregisterIcon(TIconID id)
deregister an icon if already registered.
void SetTitle(const string &label, const string &default_title=NcbiEmptyString)
@ eIcon_Layout
icon id for setting layout style
ILayoutTrackHost * m_LTHost
Top level host owning the tracks.
string m_Msg
special message need to show on title bar
string GetTitle() const
get the track title.
void x_OnLayoutChanged()
update the layout.
TTrackAttrFlags m_Attrs
various track attributes
virtual void x_OnIconClicked(TIconID id)
Mouse left-click event handler on an icon.
@ fNavigable
Track has navigation controls.
const string & GetProfile() const
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.
int TIconID
use int as TIconID instead of EIconID.
void x_RegisterIcon(const SIconInfo &icon)
register track icons.
class CRegistryReadView provides a nested hierarchical view at a particular key.
CRenderingContext offers the basic context and utility methods for rendering layout objects in featur...
const TSeqRange & GetVisSeqRange() const
const TModelUnit & GetScale() const
bool IsOverviewMode() const
bool WillSeqLetterFit() const
is it enougth space to sequence letters.
class CRgbaColor provides a simple abstraction for managing colors.
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 void ParseProfileString(const string &profile_str, TKeyValuePairs &settings)
static void GetColor(const CRegistryReadView &view, const string &key, CRgbaColor &color)
virtual bool AllJobsFinished() const
void SetJobListener(CEventHandler *listener)
Set JobDispatcher listener.
objects::CBioseq_Handle & GetBioseqHandle(void)
Get the underlying bioseq handle.
virtual void ClearJobID(TJobID job_id)
void SetDepth(int depth)
Set the annotation selector resolving depth.
virtual void DeleteAllJobs()
Remove waiting jobs from queue or cancel the unfinished jobs.
void SetAdaptive(bool flag)
void LoadData(const TSeqRange &range, CSnpJob::SParams &p, SSnpFilter *filter)
static void GetAnnotNames(SConstScopedObject &object, map< string, string > &annots, const TSeqRange &range, const ILayoutTrackFactory::SExtraParams ¶ms)
static CRgbaColor GetSNPColor(const objects::CSeq_feat &feat, const CRegistryReadView &ColorView)
CRef< CFeatureParams > SetParamsTemplate()
CRef< CFeatureParams > m_ParamsTemplate
CConstRef< CFeatureParams > GetFeatureParams(const objects::CSeq_feat &feat, const CRegistryReadView &ColorView) const
static CRef< CSNPFeatureParams > CreateSNPFeatureParams()
TParamsCache m_ParamsCache
void Reset(CConstRef< CFeatureParams > OrigParams)
class CSeqGlyph defines an interface that wraps a rectilinear abstract object.
CRenderingContext * m_Context
the rendering context
const CRenderingContext * GetRenderingContext() const
Get the rendering context.
list< CRef< CSeqGlyph > > TObjects
int GetObjectSpace() const
namespace ncbi::objects::
CSnpBitfield is a facade for representing any version of the SNP bitfield.
EVariationClass GetVariationClass() const
static string s_AdjustAnnotName(const string &sAnnotName)
! this is a temporary function for an interim period when SNP filters are taken from !...
virtual string GetExtensionIdentifier() const
returns the unique human-readable identifier for the extension the id should use lowercase letters se...
virtual TTrackMap CreateTracks(SConstScopedObject &object, ISGDataSourceContext *ds_context, CRenderingContext *r_cntx, const SExtraParams ¶ms=SExtraParams(), const TAnnotMetaDataList &src_annots=TAnnotMetaDataList()) const
CSnpTrackFactory.
virtual const CTrackTypeInfo & GetThisTypeInfo() const
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
CRef< objects::CTrackConfigSet > GetSettings(const string &profile, const TKeyValuePairs &settings, const CTempTrackProxy *track_proxy) const
CRef< objects::CTrackConfig > x_GetSettings(const TKeyValuePairs &settings, const CTempTrackProxy *track_proxy, bool is_clinvar_track) const
static CTrackTypeInfo m_TypeInfo
virtual void x_UpdateData()
update track content.
void SetAnnot(const string &name)
virtual const CTrackTypeInfo & GetTypeInfo() const
virtual string GetFullTitle() const
get a more meaningful title.
virtual bool CheckRange(TSeqRange range, string &sMsg, size_t &nFeats)
objects::CFeat_CI x_GetFeat_CI(const TSeqRange &range)
virtual void x_SaveSettings(const string &preset_style)
save the track settings to a profile string.
CRef< CSNPFeatureParams > m_Params
virtual void x_LoadSettings(const string &preset_style, const TKeyValuePairs &settings)
load the track settings.
CSnpTrack(CSGSnpDS *ds, CRenderingContext *r_cntx, const string &sFilter, const string &sTitle, const string &sLayout="")
bool x_IsOverviewMode() const
void GenerateAsn1(objects::CSeq_entry &seq_entry, TSeqRange range)
objects::CGraph_CI x_GetGraph_CI(const TSeqRange &range)
virtual void x_OnJobCompleted(CAppJobNotification ¬ify)
void x_ProcessJobResult()
virtual void x_OnIconClicked(TIconID id)
Mouse left-click event handler on an icon.
@ eLayout_Features
Show features whenever possible.
@ eLayout_Labels
Show labels and cascade features (CLayeredLayoutPolicy)
@ eLayout_Density
Always show density.
@ eLayout_Adaptive
All SNPs drawn in one line.
CRef< SSnpFilter > m_Filter
void x_AddSnpsLayout(const SSnpJobResult &result)
CRef< SSnpJobResult > m_JobResult
class CStaticArrayMap<> provides access to a static array in much the same way as CStaticArraySet<>,...
TBase::const_iterator const_iterator
const string & GetSource() 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::CCheckBox > CreateCheckBox(const string &name, const string &disp_n, const string &help_text, const string &legend_txt, bool value, 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)
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_PopupMenu(wxMenu *menu)=0
show track-specific context menu.
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.
container_type::iterator iterator
const_iterator end() const
iterator_bool insert(const value_type &val)
container_type::value_type value_type
const_iterator find(const key_type &key) const
#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 NCBI_ASSERT(expr, mess)
#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...
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
void Warning(CExceptionArgs_Base &args)
static bool IsExtendedNAA(const string &annot, bool isStrict=false)
check if a given annotation is an extended NAA (named accession[.version][number],...
void SetFontFace(EFontFace face, bool use_bitmap_overrides=true)
void SetFontSize(unsigned int size)
Set/get font size in points.
CGlPoint< TModelUnit > TModelPoint
void Set(float r, float g, float b)
set the color from an Fl_Color
CRef< CObject > GetResult() const
returns non-null pointer only if Completed or Running and has temporary results available
static size_t EstimateSNPCount(const TSeqRange &range, const string &sAnnotName, CBioseq_Handle &Handle)
static CGraph_CI GetGraph_CI(const TSeqRange &range, const string &sAnnotName, CBioseq_Handle &Handle)
static CFeat_CI GetFeat_CI(const TSeqRange &range, const string &sAnnotName, CBioseq_Handle &Handle)
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
const CSeq_graph & GetMappedGraph(void) const
Graph mapped to the master sequence.
const CSeq_feat & GetMappedFeature(void) const
Feature mapped to the master sequence.
bool NotNull(void) const THROWS_NONE
Check if pointer is not null – same effect as NotEmpty().
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
void Reset(void)
Reset reference object.
#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 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 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.
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.
const TStr & GetStr(void) const
Get the variant data.
const TData & GetData(void) const
Get the Data member data.
Tdata & Set(void)
Assign a value to data member.
bool IsSetExt(void) const
user defined structure extension Check if a value has been assigned to Ext data member.
const TExt & GetExt(void) const
Get the Ext member data.
void SetData(TData &value)
Assign a value to Data data member.
list< CRef< CSeq_graph > > TGraph
list< CRef< CSeq_feat > > TFtable
unsigned int
A callback function used to compare two keys in a database.
range(_Ty, _Ty) -> range< _Ty >
const struct ncbi::grid::netcache::search::fields::SIZE size
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
static const TLayoutStr s_LayoutStrs[]
CStaticArrayMap< string, CSnpTrack::ELayout > TLayoutMap
const string & s_LayoutValueToStr(CSnpTrack::ELayout layout)
static CFeatureParams::EBoxStyle s_GetBoxStyle(const CSeq_feat &feat)
static const string kDefProfile
static CSnpBitfield::EVariationClass s_GetVariationClass(const CSeq_feat &feat)
DEFINE_STATIC_ARRAY_MAP(TLayoutMap, sm_LayoutMap, s_LayoutStrs)
static CSnpTrack::ELayout s_LayoutStrToValue(const string &layout)
SStaticPair< const char *, CSnpTrack::ELayout > TLayoutStr
CSnpTrack.
static const string kBaseKey
TIconID m_Id
must be unique within the context
bool bPreferFeat
Return feat glyphs instead of histogram glyphs.
bool bAdaptive
Only return feat glyphs when not overview.
CRenderingContext * r_cntx
CSeqGlyph::TObjects listObjs
Template structure SStaticPair is simlified replacement of STL pair<> Main reason of introducing this...
void UseDefaultMarginWidth(wxMenu &menu)
Using default menu item margin width.