59 m_EnableScoring(
true),
61 m_isDataReadSync(
false)
93 double min_scale = 1 / (max_sym_w * 0.75);
94 min_scale =
max(min_scale, 0.01);
171 bool b_invert_others)
178 vector<TNumrow>::iterator iter = std::find(rows.begin(), rows.end(),
TNumrow(consensus_idx));
180 if (!b_invert_others) {
182 if (iter != rows.end())
188 if (iter == rows.end())
189 rows.push_back(consensus_idx);
194 size_t n_rows = rows.size();
195 if(n_rows || b_invert_others) {
196 vector<TNumrow> v_items;
199 if(b_invert_others) {
201 vector<bool> new_visible(
GetNumRows(), ! b_visible);
203 ITERATE(vector<TNumrow>, it, rows) {
204 new_visible[*it] = b_visible;
207 vector<SRowRecord*> vis_recs;
208 vis_recs.reserve(b_visible ? rows.size()
209 : new_visible.size() - rows.size());
212 if(
row != master_row && new_visible[
row]) {
214 vis_recs.push_back(&rec);
221 v_items.reserve(vis_recs.size());
222 ITERATE(vector<SRowRecord*>, it, vis_recs) {
230 v_items.reserve(n_rows);
231 vector<TLine> v_indices;
232 v_indices.reserve(n_rows);
234 ITERATE(vector<TNumrow>, it, rows) {
239 if(b_old_vis != b_visible &&
row != master_row) {
244 v_indices.push_back(line);
246 v_items.push_back(
row);
340 return row->GetHeightPixels();
352 vector<TNumrow> nothing;
397 for (
size_t i = 0;
i <
n; ++
i) {
403 data.emplace_back(rec, s);
408 for(
size_t i = 0;
i <
n; ++
i) {
423 for (
size_t i = 0;
i <
n; ++
i) {
430 for (
size_t i = 0;
i <
n; ++
i) {
448 for (
size_t i = 0;
i <
n; ++
i) {
454 data.emplace_back(rec, pos);
459 for (
size_t i = 0;
i <
n; ++
i) {
524 if(pos >= 0 && pos < n_vis) {
529 int i = 0, line = pos;
530 for( ;
i < (
int) rows.size() && line < n_vis;
i++ ) {
535 new_vis[line] = p_rec;
553 while(ins_i < n_vis) {
625 int pane_rows_n = aln_rows_n;
643 vector<int> vVisibleRowPos;
651 vVisibleRows.resize(pane_rows_n);
652 vVisibleRowPos.resize(pane_rows_n);
655 RowToRec.resize(aln_rows_n);
668 if (
row == consensus_idx)
673 if(
row == MasterRow) {
678 vVisibleRows[i_line] = &RowToRec[
row];
687 }
catch (std::exception& e) {
737 int line = p_rec ? p_rec->
m_Line : -1;
759 row->SetDisplayStyle(style);
761 row->UpdateOnStyleChanged();
783 for(
int total_H = 0,
i = 0;
i <
N;
i++ ) {
822 if(new_master_row != -1) {
824 pNewMaster = rec.
m_Row;
831 vector<int> vDelItems;
832 vDelItems.push_back(rec.
m_Line);
853 row->UpdateOnAnchorChanged();
950 if(method->GetName() == name) {
1097 size_t entries_n = v_entries.size();
1099 for(
size_t i = 0;
i < entries_n;
i++ ) {
1146 for(
int i = 0;
i < count;
i++ ) {
static const int kColorGradNumber
virtual void x_CompleteInsertion()
performs update after all items have been inserted
virtual void EnableBackgroundProcessing(bool en)
virtual bool CanChangeMasterRow() const
changes Master (Anchor) and performs necessary updates
virtual void CreateConsensus(void)
Creates consenus row if it is not already created.
virtual void OnScoringFinished()
SRowRecord & x_GetRecordByRow(TNumrow row)
virtual int GetLineByRowNum(TNumrow row) const
virtual void SetDefaultMethod(const string &method_name)
virtual void x_UpdateMinScale()
CScoreCache::IListener * m_Listener
const CRowStyleCatalog * m_StyleCatalog
virtual void UpdateSortOrder(void)
enables auto sorting of rows, sorts rows using x_SortRows() and performs necessary updates
virtual bool AddScoringMethod(IScoringMethod *method)
adds scoring method; model assumes ownership of the method, it will be deleted automatically
CAlnMultiModel()
number of gradient colors in alignment
virtual CWidgetDisplayStyle * GetDisplayStyle()
virtual TNumrow GetLinesCount() const
NUmber of visible lines.
TRowRecVector m_vVisibleRows
line number SRowRecord* for visible rows
virtual string GetDefaultMethod(void)
bool m_EnableScoring
scoring support
virtual TSortState GetColumnSortState(TColumnType type)
returns sorting state for the specified column
virtual int GetLineByModelY(int Y) const
CIRef< IAlignRow > m_DataConsensusRow
IAligRow corresponding to consensus in the data.
virtual const IScoringMethod * GetCurrentMethod() const
virtual TIndex x_GetItemIndex(const TItem &item)
virtual void x_ClearItems(void)
virtual void x_CreateDisplayStyle()
virtual int GetLineHeight(TLine line) const
@ kMasterRowIndex
dummy master row index used in selection logic
virtual void x_UpdateOnCoordsChanged()
virtual void UpdateOnScoringChanged(const TSeqRange &range=TSeqRange::GetEmpty())
virtual IAlignRow * GetConsensusRow()
virtual void x_DoUpdateRowPositions(void)
recalculates vertical coordinates of row objects
CRef< CScoreCache > m_ScoreCache
virtual void x_InsertItem(TIndex index, const TItemEntry &entry)
inserts item, but does not updates all data structures
virtual void OnScoringProgress(float progress, const string &msg)
virtual void CreateRows(void)
Creates IAlignRow objects for each row in the data source.
virtual void x_EraseMarkedItems(void)
deletes all marked items in a single pass, performs neccessary updates
const size_t GetNumRows() const
Get number of rows registered in model.
virtual void EnableAutoSorting(bool b_en)
enables auto sorting but does not perform any updates
vector< SRowRecord > TRowToRecMap
virtual void SLM_InvertSingleItem(TIndex index)
virtual void SetRowOrder(const vector< TNumrow > &rows, int pos=0)
disables auto sorting, reorders rows in alignment so that rows from the given vector appear in the sp...
virtual int GetFocusedItemIndex() const
virtual TItem x_GetItem(TIndex index) const
virtual void SetStyleCatalog(const CRowStyleCatalog *catalog)
virtual void ClearRows(void)
Update handlers.
virtual bool IsRendererFocused()
virtual void UpdateOnRowHChanged(void)
updates model after row height changed
virtual void SetListener(CScoreCache::IListener *listener)
virtual IAlignRow * GetMasterRow()
list< CIRef< IScoringMethod > > TMethods
virtual bool SetMasterRow(TNumrow new_row)
virtual IAlignRow * GetRowByLine(TLine line)
all Y coordinates are OpenGL Viewport coordinates (not widget coords) "index" is a line index (not ro...
virtual bool IsItemSelected(int index) const
virtual bool x_SortRows(void)
This is a sorting callback automatically invoked by CAlnMultiModel when necessary.
virtual void SetShownElements(int shown_mask)
CRef< CConsensusRow > m_ConsensusRow
int GetRowState(TNumrow row) const
returns a combination of IAlignRow::EState flags
virtual void UpdateOnStyleChanged(void)
vector< int > m_vVisibleRowPos
bottom positions for visible rows[line]
virtual void x_UpdateOnVisibilityChanged(void)
CWidgetDisplayStyle * m_Style
virtual bool x_IsItemSelected(TIndex index) const
virtual void x_SetEntries(const TEntryVector &v_entries)
TMethods m_Methods
registered scoring methods
virtual IAlignRow * x_CreateRow(TNumrow row)
factory method for creating IAlignRow instances
TRowToRecMap m_RowToRec
map storing records for all rows
virtual void x_SelectItem(TIndex index, bool b_sel)
updates line numbers in SRowRecords
virtual int GetLinePosY(TLine line) const
IAlignRow * x_GetRowByLine(int Index)
virtual void UpdateOnDataChanged()
virtual ~CAlnMultiModel()
virtual void SLM_SelectAll(bool bSelect)
virtual void x_MarkItemForErase(TIndex index)
mark item for deletion
virtual bool x_UsingAutoSort() const
IAlignRow::TColumnType TColumnType
bool m_AutoSort
sorting support
void SetVisible(vector< TNumrow > rows, bool b_visible, bool b_invert_others=false)
makes specified rows visible/hidden, if b_invert_others == "true" then visibility of all rows not in ...
virtual const TMethods & GetMethods()
CIRef< IAlignRow > m_MasterRow
IAligRow corresponding to Anchor.
virtual void ResetCurrentMethod()
virtual void SetDataSource(IAlnMultiDataSource *p_ds)
virtual int GetShownElements()
returns mask of shown elements - header, ruler, master row, alignment, track matrix
virtual void x_DoUpdateRowsOrder(void)
performs sorting by invoking x_SortRows() and updates line numbers
virtual bool SortByColumn(TColumnType type, bool ascending)
sorts visible rows by specified column, return "false" if sorting is not supported (nothin happened)
vector< SRowRecord * > TRowRecVector
IAlnMultiDataSource * m_DataSource
virtual bool SetCurrentMethod(const string &name, const TSeqRange &range=TSeqRange::GetEmpty())
void x_DoUpdateRowLines(void)
virtual TIndex x_GetItemsCount() const
virtual void SLM_SelectSingleItem(TIndex index)
class CAlnVecRow - implementation of IAlignRow for CAlnVec-based alignments.
void SetConsensus(CConsensusRow *crow)
virtual void SetDisplayStyle(const CRowDisplayStyle *style)
virtual void SetScoreCache(CScoreCache *cache)
Class CConsensusRow - Simple interface to a row that represents the consensus for rendering purposes.
void SetHandle(const IAlignRowHandle *h)
vector< TPair > TPairVector
void Sort(TPairVector &data)
CRowDisplayStyle is a base class representing a display style for IAlignRow.
CRowStyleCatalog is a collection of CRowDisplayStyle-s assigned to rows in alignment.
const CRowDisplayStyle * GetStyleForRow(TNumrow row) const
virtual void OnScoringFinished()=0
virtual void OnScoringProgress(float progress, const string &msg)=0
const IScoringAlignment * GetAlignment() const
void SetScoringMethod(IScoringMethod *method)
void SetAlignment(const IScoringAlignment *aln)
void CalculateScores(const TSeqRange &range=TSeqRange::GetEmpty())
Recalculate scores using current method; resets scores if no method is selected.
IScoringMethod * GetScoringMethod()
void EnableBackgoundProcessing(bool en)
void SetListener(IListener *listener)
void SetGradNumber(int grad_n)
Sets the number of score gradations.
void InsertItems(const TItemVector &v_items, const TIndexVector &v_indices, bool b_update)
vector< TItem > TItemVector
void DeleteItems(const TIndexVector &vIndices, bool b_update)
bool InsertItem(TIndex index, const TItem &item, bool b_update)
vector< TItemEntry > TEntryVector
virtual void SLM_SelectAll(bool bSelect=true)
virtual bool SLM_IsItemSelected(TIndex index) const
virtual void SLM_FocusItem(TIndex index)
virtual void SLM_InvertSingleItem(TIndex index)
virtual TIndex SLM_GetFocusedItemIndex() const
virtual void SLM_SelectSingleItem(TIndex index)
void SetItems(const TItemVector &vItems, bool b_update, bool b_keep_selection=false)
pair< TItem, bool > TItemEntry
IAlignRowHandle provides an abstract way to access alignment row data.
Interface IAlignRow - abstracts row rendering in Multiple Alignment Widget.
virtual int GetRowNum() const =0
Returns index of row in IAlnMultiDataSource.
virtual void SetRowState(int mask, bool b_set)=0
Set/Clear Row State.
virtual int GetHeightPixels() const =0
Returns height of the row in pixels.
@ ePctIdentity
% identity to consensus or anchor
@ ePctCoverage
% coverage to anchor
@ eMismatches
% number of mismatches to anchor/consensus
Alignment explorer interface.
IAlnMultiDataSource - interface to a data source representing an abstract multiple alignment.
virtual IAlnExplorer::EAlignType GetAlignType() const =0
virtual const IAlignRowHandle * GetRowHandle(TNumrow row) const =0
virtual bool IsDataReadSync() const
virtual TSeqPos GetAlnStart(void) const =0
virtual int GetConsensusRow() const =0
returns index of the Consensus row or -1 if it doesn't exist
virtual bool CanChangeAnchor(void) const =0
virtual TNumrow GetNumRows(void) const =0
number of rows in alignment
virtual TSeqPos GetAlnStop(void) const =0
virtual bool SetAnchor(TNumrow anchor)=0
virtual bool IsSetAnchor(void) const =0
Anchoring methods.
virtual TNumrow GetAnchor(void) const =0
virtual void SetCreateConsensus(bool b)=0
virtual void CreateConsensus()=0
IAlnExplorer::TNumrow TNumrow
IScoringMethod represents an abstract algorithm for calculating alignment scores and assigning colors...
static const char * catalog
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 NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
const string & GetMsg(void) const
Get message string.
virtual const char * what(void) const noexcept
Standard report (includes full backlog).
void SetModelLimitsRect(const TModelRect &R)
TModelRect & GetModelLimitsRect(void)
void SetAdjustmentPolicy(int adjust_x, int adjust_y)
void EnableZoom(bool en_x, bool en_y)
virtual TModelUnit GetMetric(EMetric metric, const char *text=NULL, int len=-1) const
TModelRect & GetVisibleRect(void)
void SetMinScaleX(TModelUnit scale)
CGlRect< TModelUnit > TModelRect
void SetOriginType(EOriginType type_x, EOriginType type_y)
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
void Reset(void)
Reset reference object.
TObjectType * GetPointerOrNull(void) THROWS_NONE
Get pointer value.
#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.
range(_Ty, _Ty) -> range< _Ty >
constexpr auto sort(_Init &&init)
Multi-threading – classes, functions, and features.
#define row(bind, expected)
SRowRecord is a record representing a single alignment row.
CIRef< IAlignRow > m_Row
row object ptr
static bool PRecLineLess(const SRowRecord *rec1, const SRowRecord *rec2)
TLine m_Line
visual line index