40 #include <wx/checkbox.h>
41 #include "wx/valgen.h"
51 if (base == consensus)
58 return base == consensus;
60 return base ==
'C' || base ==
'A';
62 return base ==
'G' || base ==
'A';
64 return base ==
'G' || base ==
'C';
66 return base ==
'G' || base ==
'C' || base ==
'A';
68 return base ==
'T' || base ==
'A';
70 return base ==
'T' || base ==
'C';
72 return base ==
'T' || base ==
'C' || base ==
'A';
74 return base ==
'T' || base ==
'G';
76 return base ==
'T' || base ==
'G' || base ==
'A';
78 return base ==
'T' || base ==
'G' || base ==
'C';
80 return base ==
'T' || base ==
'G' || base ==
'C' || base ==
'A';
82 return base == consensus;
89 if (consensus == residue)
93 return residue ==
'N' || residue ==
'D';
95 return residue ==
'I' || residue ==
'L';
97 return residue ==
'Q' || residue ==
'E';
99 return consensus == residue;
108 switch (align_type) {
109 case IAlnExplorer::EAlignType::fDNA:
117 case IAlnExplorer::EAlignType::fMixed:
133 : m_Space(0), m_Gap(0)
148 : m_Space(0), m_Gap(0)
167 : m_Worst(
orig.m_Worst),
169 m_Space(
orig.m_Space),
210 return "Frequency-Based Difference";
213 #define SIMPLE_DESCR "This is a column-based method that assigns scores \
214 to residues in a column based on their representation in the column's frequency \
215 profile. Residues that occur infrequently are highlighted darkly; columns \
216 that contain any degree of mismatch will alsobe highlighted."
254 size_t total =
column.size() - space_n;
258 for(
size_t i = 0;
i <
column.size();
i++ ) {
304 int index = (
int) floor(score *
size);
338 DECLARE_EVENT_TABLE()
344 void OnApply ( wxCommandEvent& event );
358 m_Method(method), m_GradPanel()
374 wxBoxSizer* itemBoxSizer1 =
new wxBoxSizer(wxVERTICAL);
375 this->SetSizer(itemBoxSizer1);
385 itemBoxSizer1->Add(
m_GradPanel, 1, wxGROW|wxALL, 5);
387 wxCheckBox* itemCheckBox1 =
new wxCheckBox(
this,
wxID_ANY,
_(
"Ignore Empty Space"));
388 itemCheckBox1->SetValidator(wxGenericValidator(&
m_Space));
389 itemBoxSizer1->Add(itemCheckBox1, 0, wxALIGN_LEFT|wxALL, 5);
391 wxCheckBox* itemCheckBox2 =
new wxCheckBox(
this,
wxID_ANY,
_(
"Ignore Gaps"));
392 itemCheckBox2->SetValidator(wxGenericValidator(&
m_Gap));
393 itemBoxSizer1->Add(itemCheckBox2, 0, wxALIGN_LEFT|wxALL, 5);
424 m_UndefColor(0.8f, 0.8f, 1.0f),
432 m_UndefColor(
orig.m_UndefColor)
445 return "Show Differences";
449 #define SNP_DESCR "This method highlights differences observed from the master \
450 sequence in an alignment. In order to see any coloration with this scheme, \
451 you must select a master sequence. You can adjust the master sequence \
452 on the fly and display differences by selecting a new master from the context menu.";
461 const static float kSNP = 0.0f;
479 fill(scores.begin(), scores.end(),
kUndef);
481 for(
size_t i = 0;
i <
column.size();
i++ ) {
548 DECLARE_EVENT_TABLE()
554 void OnApply ( wxCommandEvent& event );
583 wxBoxSizer* itemBoxSizer1 =
new wxBoxSizer(wxVERTICAL);
584 this->SetSizer(itemBoxSizer1);
586 wxBoxSizer* itemBoxSizer2 =
new wxBoxSizer(wxHORIZONTAL);
588 wxColourPickerCtrl* itemColorPicker1 =
new wxColourPickerCtrl(
this,
wxID_ANY);
590 itemBoxSizer2->Add(itemColorPicker1, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
591 itemBoxSizer2->Add(
new wxStaticText(
this, wxID_STATIC,
_(
"Neutral (no master specified)")),
592 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
593 itemBoxSizer1->Add(itemBoxSizer2, 0, wxALIGN_LEFT|wxALL, 0);
595 itemBoxSizer2 =
new wxBoxSizer(wxHORIZONTAL);
596 wxColourPickerCtrl* itemColorPicker2 =
new wxColourPickerCtrl(
this,
wxID_ANY);
598 itemBoxSizer2->Add(itemColorPicker2, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
599 itemBoxSizer2->Add(
new wxStaticText(
this, wxID_STATIC,
_(
"SNP")),
600 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
601 itemBoxSizer1->Add(itemBoxSizer2, 0, wxALIGN_LEFT|wxALL, 0);
603 itemBoxSizer2 =
new wxBoxSizer(wxHORIZONTAL);
604 wxColourPickerCtrl* itemColorPicker3 =
new wxColourPickerCtrl(
this,
wxID_ANY);
606 itemBoxSizer2->Add(itemColorPicker3, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
607 itemBoxSizer2->Add(
new wxStaticText(
this, wxID_STATIC,
_(
"Normal")),
608 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
609 itemBoxSizer1->Add(itemBoxSizer2, 0, wxALIGN_LEFT|wxALL, 0);
611 wxCheckBox* itemCheckBox1 =
new wxCheckBox(
this,
wxID_ANY,
_(
"Ignore Empty Space"));
612 itemCheckBox1->SetValidator(wxGenericValidator(&
m_Space));
613 itemBoxSizer1->Add(itemCheckBox1, 0, wxALIGN_LEFT|wxALL, 5);
615 wxCheckBox* itemCheckBox2 =
new wxCheckBox(
this,
wxID_ANY,
_(
"Ignore Gaps"));
616 itemCheckBox2->SetValidator(wxGenericValidator(&
m_Gap));
617 itemBoxSizer1->Add(itemCheckBox2, 0, wxALIGN_LEFT|wxALL, 5);
664 return "Test Sequence-based";
696 size_t color_index = 0;
697 for(
int i = 0;
i <
range.GetLength();
i++ ) {
739 size_t index = (size_t) score;
793 : m_ColumnCount(0), m_SequenceLevel(
orig.m_SequenceLevel)
795 for (
auto i = 0;
i < EColors::eLast; ++
i)
809 return "Nonsynonymous substitutions";
813 Note: nonsynonymous substitution coloring is available only for CDS alignments.
814 Any sequence in alignment or pre-calculated consensus with only ACGT letters can be set as a master.)foo";
833 fill(scores.begin(), scores.end(), -1.);
835 for (
size_t i = 0;
i <
column.size();
i++) {
836 bool same = (
column[
i] == cons);
867 int index = (
int) floor(score *
size);
void GetParams(stParams ¶ms) const
CNonSynonymousScoringMethod - implementation of IScoringMethod.
CRgbaGradColorTable m_ColorTable
virtual string GetName() const override
returns unique name of the method that is used in UI to identify it
virtual int GetType() const override
returns combination of EAlignType flags defining types of alignments that can be colored with this me...
virtual int GetSupportedColorTypes() const override
returns a combination of EColorType flags
virtual string GetDescription() const override
returns a detailed description of the method that is used in UI
virtual void CalculateScores(char cons, const string &column, TScore &col_score, TScoreVector &scores) override
virtual const CRgbaColor & GetColorForNoScore(EColorType type) const override
Call for display colors when CanCalculateScores returns false.
virtual const CRgbaColor & GetColorForScore(TScore score, EColorType type) const override
returns a color corresponding to a given score value.
virtual ~CNonSynonymousScoringMethod()
CNonSynonymousScoringMethod()
CNonSynonymousScoringMethod.
virtual IUITool * Clone() const override
virtual void SetColorForNoScore(EColorType type, const CRgbaColor &color) override
CRgbaColor m_Colors[EColors::eLast]
class CRgbaColor provides a simple abstraction for managing colors.
virtual string GetDescription() const
returns a detailed description of the method that is used in UI
virtual IUITool * Clone() const
virtual int GetSupportedColorTypes() const
returns a combination of EColorType flags
friend class CSNPScoringPanel
virtual bool HasPropertiesPanel() const
returns true if the method supports properties dialog
virtual bool CanCalculateScores(const IScoringAlignment &aln)
Do we have what it takes to calculate scores? e.g. a master row selected?
virtual const CMenuItem * GetMenu()
Returns a pointer to the submenu.
virtual const CRgbaColor & GetColorForNoScore(EColorType type) const
Call for display colors when CanCalculateScores returns false.
virtual const CRgbaColor & GetColorForScore(TScore score, EColorType type) const
returns a color corresponding to a given score value.
virtual void CalculateScores(char cons, const string &column, TScore &col_score, TScoreVector &scores)
CSNPScoringMethod()
CSNPScoringMethod.
virtual wxWindow * CreatePropertiesPanel(wxWindow *parent)
This a factory method that shall produce a CPropertiesPanel representing properties of the method; th...
virtual string GetName() const
returns unique name of the method that is used in UI to identify it
virtual void SetColorForNoScore(EColorType type, const CRgbaColor &color)
void OnApply(wxCommandEvent &event)
CSNPScoringPanel(CSNPScoringMethod &method, wxWindow *parent, wxWindowID id=wxID_ANY)
CSNPScoringMethod & m_Method
CSimpleScoringMethod - trivial implementation of IScoringMethod.
virtual IUITool * Clone() const
virtual void CalculateScores(char cons, const string &column, TScore &col_score, TScoreVector &scores)
friend class CSimpleScoringPanel
CSimpleScoringMethod()
CSimpleScoringMethod.
virtual int GetType() const
returns combination of EAlignType flags defining types of alignments that can be colored with this me...
unique_ptr< CMenuItem > m_Menu
virtual wxWindow * CreatePropertiesPanel(wxWindow *parent)
This a factory method that shall produce a CPropertiesPanel representing properties of the method; th...
CRgbaGradColorTable m_ColorTable
virtual bool CanCalculateScores(const IScoringAlignment &aln)
Do we have what it takes to calculate scores? e.g. a master row selected?
virtual string GetDescription() const
returns a detailed description of the method that is used in UI
virtual bool IsAverageable() const
return "true" if scores could be averaged
virtual const CRgbaColor & GetColorForNoScore(EColorType type) const
Call for display colors when CanCalculateScores returns false.
CRgbaColor m_Worst
combination of EOptions flags
void SetOptions(int options)
virtual void SetColorForNoScore(EColorType type, const CRgbaColor &color)
vector< int > m_vCharCounts
char m_Space
histogramm of characters
virtual string GetName() const
returns unique name of the method that is used in UI to identify it
void CreateColorTable(int size)
virtual const CMenuItem * GetMenu()
Returns a pointer to the submenu.
virtual ~CSimpleScoringMethod()
virtual bool HasPropertiesPanel() const
returns true if the method supports properties dialog
virtual int GetSupportedColorTypes() const
returns a combination of EColorType flags
virtual const CRgbaColor & GetColorForScore(TScore score, EColorType type) const
returns a color corresponding to a given score value.
void OnApply(wxCommandEvent &event)
CSimpleScoringMethod & m_Method
CGradientColorPanel * m_GradPanel
CSimpleScoringPanel(CSimpleScoringMethod &method, wxWindow *parent, wxWindowID id=wxID_ANY)
int GetType() const
returns combination of EAlignType flags defining types of alignments that can be colored with this me...
virtual void CalculateScores(IAlnExplorer::TNumrow row, const IScoringAlignment &aln, TScoreColl &scores)
virtual int GetSupportedColorTypes() const
returns a combination of EColorType flags
CTestSeqBasedMethod()
CTestSeqBasedMethod.
virtual const CRgbaColor & GetColorForScore(TScore score, EColorType type) const
returns a color corresponding to a given score value.
virtual string GetName() const
returns unique name of the method that is used in UI to identify it
virtual string GetDescription() const
returns a detailed description of the method that is used in UI
virtual const CRgbaColor & GetColorForNoScore(IScoringMethod::EColorType type) const
Call for display colors when CanCalculateScores returns false.
CRgbaColor m_NoScoreColor
vector< CRgbaColor > m_vColors
virtual void SetColorForNoScore(IScoringMethod::EColorType type, const CRgbaColor &color)
virtual bool IsAverageable() const
return "true" if scores could be averaged
virtual IUITool * Clone() const
virtual void UpdateSettings(const IScoringAlignment &aln)
Set alignment specifi settings.
std::function< bool(char c, char b)> mf_CompareResidue
char m_AmbiguousResidue
Ambiguous Residue, typically 'N' for nucleotides, 'X' for proteins.
static const int kAmbiguousResidueScore
virtual TSeqPos GetAlnStart() const =0
virtual IAlnExplorer::EAlignType GetAlignType() const =0
virtual TSeqPos GetAlnStop() const =0
virtual string & GetAlnSeqString(IAlnExplorer::TNumrow row, string &buffer, const IAlnExplorer::TSignedRange &aln_range) const =0
vector< TScore > TScoreVector
static const int sm_DefGradientSize
default number of colors in gradient
static const Colors colors
Include a standard set of the NCBI C++ Toolkit most basic headers.
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
void SetSize(size_t size)
void FillGradient(const CRgbaColor &start_c, const CRgbaColor &end_c)
initialize the whole table with gradient colors in [start_c, end_c] range
void SetFrom(TSeqPos start)
void Set(float r, float g, float b)
set the color from an Fl_Color
void Lighten(float scale)
void push_back(const attr_type &attr)
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
unsigned int
A callback function used to compare two keys in a database.
where boath are integers</td > n< td ></td > n</tr > n< tr > n< td > tse</td > n< td > optional</td > n< td > String</td > n< td class=\"description\"> TSE option controls what blob is orig
range(_Ty, _Ty) -> range< _Ty >
const struct ncbi::grid::netcache::search::fields::SIZE size
static const float kUndef
const string CNONSYNONYMOUS_METHOD_DESCR
static bool s_CompareBases(char consensus, char base)
static bool s_CompareResidues(char consensus, char residue)
static const int kDefGradientSize
static const float kSameBase
static const char * column