: wxVScrolledWindow(parent,
id, pos,
size, wxFULL_REPAINT_ON_RESIZE|wxWANTS_CHARS), m_Alignment(ah), m_FeatRanges(feat_ranges), m_FeatTypes(feat_types), m_FeatStrand(feat_strand),
66m_EnableFeatures(
false), m_EnableSubstitute(
true)
69SetBackgroundStyle(wxBG_STYLE_PAINT);
70SetBackgroundColour(*wxWHITE);
71m_Font = wxFont(10, wxFONTFAMILY_TELETYPE, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);
79 if(m_TotalLength > 0)
81wxGraphicsContext *gc = wxGraphicsContext::Create();
82gc->SetFont(m_Font, *wxBLACK);
83CalculateFontWidthAndHeight(gc);
84m_NumCols = CalculateNumCols();
85m_NumRows =
static_cast<int>(m_NumAlignRows * (m_TotalLength / m_NumCols));
86m_LastRowLength = m_TotalLength % m_NumCols;
87 if(m_LastRowLength > 0)
88m_NumRows += m_NumAlignRows;
97SetRowCount(m_NumRows);
99wxWindow *win = GetParent();
105win = win->GetParent();
115 for(CBioseq_Handle::TId::const_iterator it = bsh.
GetId().begin(); it != bsh.
GetId().end(); ++it)
117 const CSeq_id&
id= *(it->GetSeqId());
118 if(
id.IsGenbank() &&
id.GetGenbank().IsSetAccession())
119accession =
id.GetGenbank().GetAccession();
120 if(
id.IsLocal() &&
id.GetLocal().IsStr())
121 local=
id.GetLocal().GetStr();
123 if(!accession.empty())
125 if(!
local.empty())
180 if(start < seq_plus.size())
182seq += seq_plus.substr(start,
len);
188 if(real_start >= 0 && real_start < seq_minus.size())
190seq += seq_minus.substr(real_start,
len);
215vector<unsigned int> feats_in_row =
GetFeaturesInRow(
static_cast<int>(
row), align_row);
217 DrawLabelCell(0, 0,
r,
static_cast<int>(
row), align_row, feats_in_row, feats_with_exons,
NULL);
235 while( seg < num_segs )
249res = start + (pos - (total_len -
len));
252res = start + total_len - 1 - pos;
270 while( seg < num_segs )
281res = start +
len- 1;
299res = start +
len- 1;
325 while( seg < num_segs )
335start = length - start -
len;
336pos2 = length - pos - 1;
338 if(start >= 0 && pos2 >= start && pos2 < start +
len)
340res = total_len + pos2 - start;
344 if(start >= 0 && start > pos2 && left)
350 if(start >= 0 && start +
len- 1 < pos2 && !left)
352found_len = total_len +
len- 1;
368 constvector< vector<pair<string,objects::CSeqFeatData::ESubtype> > > &feat_types,
369 constvector< vector<objects::CBioseq_Handle::EVectorStrand> > &feat_strand)
406wxSize sz = GetClientSize();
407 intnum_rows =
static_cast<int>(GetVisibleRowsEnd() - GetVisibleRowsBegin());
409 intuc =
event.GetKeyCode();
439wxMessageBox (
_(
"Selection should be confined to the same bioseq"),
_(
"Warning"), wxOK);
501 int row=
static_cast<int>(GetVisibleRowsBegin());
503 while( y_row < y &&
row<= GetVisibleRowsEnd()+1 )
519 intnum_groups = col / 12;
520 intpos_in_group = col % 12;
521 if(pos_in_group != 10 && pos_in_group != 11)
562 if(evt.GetModifiers() == wxMOD_SHIFT)
582wxMessageBox (
_(
"Selection should be confined to the same bioseq"),
_(
"Warning"), wxOK);
659wxAutoBufferedPaintDC dc(
this);
660wxGraphicsContext *gc = wxGraphicsContext::Create( dc );
664gc->SetFont(
m_Font, *wxBLACK);
675 inthidden_rows =
static_cast<int>(GetVisibleRowsBegin());
677 unsigned int row= hidden_rows;
679 intclient_y = GetClientSize().y;
683 for(
size_talign_row = start_align_row; align_row <
m_NumAlignRows; ++align_row)
685 unsigned intseq_pos = start;
686 DrawTextLine(start, y,
row,
static_cast<int>(align_row), gc, seq_pos);
744wxColour backgroundColour = GetBackgroundColour();
745 if(!backgroundColour.Ok())
746backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
747wxSize sz = GetClientSize();
748wxRect windowRect(wxPoint(0,0), sz);
749gc->SetBrush(wxBrush(backgroundColour));
750gc->SetPen(wxPen(backgroundColour, 1));
751gc->DrawRectangle(windowRect.GetX(),windowRect.GetY(),windowRect.GetWidth(),windowRect.GetHeight());
759wxDouble externalLeading;
762gc->GetTextExtent(wxString(
m_Seqs.front().substr(0,1000)), &width, &height, &descent, &externalLeading);
767gc->GetTextExtent(wxString(
m_Seqs.front()), &width, &height, &descent, &externalLeading);
770width = ceil(1+width);
771height = ceil(2+height);
778 intwidth =
int(GetClientSize().x);
781 intnum_groups = line_length / 12;
786line_length = 10*num_groups;
794 unsigned intorig_pos = seq_pos;
795 intorig_y = y_label;
798 DrawLabelCell(orig_pos,x,y_label,
row, align_row, feats_in_row, feats_with_exons, gc);
803 DrawTextCell(start,
i,
row, align_row, seq_pos, x, y, feats_in_row, feats_with_exons, gc);
819 void CPaintAlignment::DrawLabelCell(
unsigned intpos,
intx,
int&y,
int row,
intalign_row,
constvector<unsigned int> &feats_in_row,
const map<
unsigned int, vector<unsigned int> > &feats_with_exons, wxGraphicsContext *gc)
const 834 label<< seq_pos + 1 + (10 - ((col + 1) % 10));
835 if((col +
label.Length()) % 10 == 0 )
837gc->SetFont(
m_Font, wxColour(255,0,255));
838gc->DrawText(
label,x,y);
839gc->SetFont(
m_Font,*wxBLACK);
845gc->SetPen(wxPen(wxColour(255,0,255)));
846 if( (col +1) % 10 == 0)
848 else if( (col +1) % 10 == 5)
854 void CPaintAlignment::DrawTextCell(
const unsigned intstart,
intcol,
int row,
intalign_row,
unsigned intseq_pos,
intx,
int&y,
constvector<unsigned int> &feats_in_row,
855 const map<
unsigned int, vector<unsigned int> > &feats_with_exons, wxGraphicsContext *gc)
const 860gc->SetFont(
m_Font,*wxBLACK);
863substr =
m_Seqs[align_row][seq_pos];
872 if(pos1 >= 0 && pos2 >= 0 && seq_pos >= pos1 && seq_pos <= pos2 && align_row ==
m_SelAlignRow)
873gc->DrawText(wxString(substr),x,y, gc->CreateBrush(*wxLIGHT_GREY_BRUSH));
875gc->DrawText(wxString(substr),x,y);
880 DrawFeatures(
row,align_row,seq_pos,x,y,feats_in_row,feats_with_exons,gc);
888gc->SetPen( *wxRED_PEN);
897 constwxPen* pen = wxBLACK_PEN;
901default : pen = wxBLACK_PEN;
break;
914wxString id_label(
m_Labels[align_row]);
915 if(allowed > pos_label.Length() && allowed < pos_label.Length() + id_label.Length())
916id_label = id_label.Left(allowed - pos_label.Length());
917 int len=
static_cast<int>(allowed - pos_label.Length() - id_label.Length());
919id_label = wxString(
m_Labels[align_row]).Left(allowed);
924gc->SetFont(
m_Font,*wxRED);
926gc->SetFont(
m_Font,*wxBLACK);
927gc->DrawText(id_label, x, y);
934wxDouble externalLeading;
935gc->GetTextExtent(id_label + wxString(
'N',
len), &width, &height, &descent, &externalLeading);
937gc->SetFont(
m_Font,wxColour(255,0,255));
938gc->DrawText(pos_label, x, y);
940gc->SetFont(
m_Font,*wxBLACK);
946 void CPaintAlignment::DrawFeatureLabels(
int row,
intalign_row,
intx,
int&y,
constvector<unsigned int> &feats_in_row,
const map<
unsigned int, vector<unsigned int> > &feats_with_exons, wxGraphicsContext *gc)
const 948 for(
unsigned intk = 0; k < feats_in_row.size(); k++)
950 unsigned int i= feats_in_row[k];
955gc->DrawText(wxString(
label),x,y);
963vector<unsigned int> feats_in_row;
971 if( (row_start >= start && row_end <= stop) ||
972(start >= row_start && start <= row_end) ||
973(stop >= row_start && stop <= row_end) )
975feats_in_row.push_back(
static_cast<int>(
i));
983 void CPaintAlignment::DrawFeatures(
int row,
intalign_row,
unsigned intseq_pos,
intx,
int&y,
constvector<unsigned int> &feats_in_row,
const map<
unsigned int, vector<unsigned int> > &feats_with_exons, wxGraphicsContext *gc)
const 985 for(
unsigned intk = 0; k < feats_in_row.size(); k++)
987 unsigned int i= feats_in_row[k];
993 boolstartpoint =
false;
994 boolendpoint =
false;
996 if(
f!= feats_with_exons.end())
998 for(
unsigned intm = 0; m <
f->second.size(); m++)
1000 unsigned intj =
f->second[m];
1003 if(seq_pos >= start && seq_pos <= stop)
1006 if(seq_pos == start)
1008 if(seq_pos == stop)
1019gc->SetBrush(*wxBLACK_BRUSH);
1029 if(
m_FeatStrand[align_row][
i] == objects::CBioseq_Handle::eStrand_Plus)
1036gc->DrawLines(3,lines);
1044gc->DrawLines(3,lines);
1059 boolfound =
false;
1076 returnpair<int,int>(pos1, pos2);
1078 returnpair<int,int>(-1, -1);
1089 returnpair<int,int>(pos1, pos2);
1115vector<pair<TSeqPos,TSeqPos> > feat_whole_range;
1116vector< vector<TSeqPos> > feat_length_before;
1117vector<TSeqPos> feat_total_length;
1123vector<TSeqPos> length_before;
1130length_before.push_back(length);
1133feat_whole_range.push_back(pair<TSeqPos,TSeqPos>(start,stop));
1134feat_total_length.push_back(length);
1135feat_length_before.push_back(length_before);
1145vector<unsigned int> ranges;
1146 for(
unsigned intj=0; j<
m_FeatRanges[align_row][
i].size(); j++)
1151 introw_end = row_start +
m_NumCols- 1;
1152 if( (row_start >= start && row_end <= stop) ||
1153(start >= row_start && start <= row_end) ||
1154(stop >= row_start && stop <= row_end) )
1156ranges.push_back(j);
1166 for(
unsigned intk = 0; k < feats_in_row.size(); k++)
1168 unsigned int i= feats_in_row[k];
1170 if(!ranges.empty())
1171feats_with_exons[
i] = ranges;
1173 returnfeats_with_exons;
void ReportPos(int pos, const string &label)
void ReportRange(int pos1, int pos2, const string &label)
void GetLabel(string *label, ELabelType type, bool worst=false) const
const CSeq_id & GetSeq_id(TDim row) const
vector< vector< TSeqPos > > m_FeatTotalLength
void CalculateFontWidthAndHeight(wxGraphicsContext *gc)
vector< vector< vector< TSeqPos > > > m_FeatLengthBefore
virtual void OnUpdate()
Notification for the derived class that moment is good for doing its update and drawing stuff.
CAlignmentAssistant * m_Parent
int AlignPosToSeqPos(int pos, int row, bool left) const
int FindRowByCoord(int y, int &y_row)
void DrawLabelCell(unsigned int pos, int x, int &y, int row, int align_row, const vector< unsigned int > &feats_in_row, const map< unsigned int, vector< unsigned int > > &feats_with_exons, wxGraphicsContext *gc) const
vector< CDense_seg::TDim > m_visible_to_row
static string GetSeqTitle(CBioseq_Handle bsh)
virtual void OnEraseBackground(wxEraseEvent &event)
vector< unsigned int > IsExonPresent(int i, int row, int align_row) const
void OnMouseDown(wxMouseEvent &evt)
CSeq_align_Handle m_Alignment
vector< vector< vector< pair< TSeqPos, TSeqPos > > > > m_FeatRanges
void DrawTextLine(const unsigned int start, int &y_label, int row, int align_row, wxGraphicsContext *gc, unsigned int &seq_pos)
vector< vector< pair< string, CSeqFeatData::ESubtype > > > m_FeatTypes
pair< int, int > GetSelection(int row)
void OnMouseDrag(wxMouseEvent &evt)
void SetAlign(CSeq_align_Handle ah)
void DrawFeatureLabels(int row, int align_row, int x, int &y, const vector< unsigned int > &feats_in_row, const map< unsigned int, vector< unsigned int > > &feats_with_exons, wxGraphicsContext *gc) const
vector< string > m_Labels
void EnableSubstitute(bool enable)
virtual ~CPaintAlignment()
const wxPen * GetColorForFeature(objects::CSeqFeatData::ESubtype subtype) const
void ClearScreen(wxGraphicsContext *gc)
void DrawTopLineNumbers(int align_row, unsigned int seq_pos, int col, int x, int &y, wxGraphicsContext *gc) const
bool MouseToSeqPos(wxPoint p, int &row, int &y_row)
int SeqPosToAlignPos(int pos, int row, bool left)
void DrawCursor(int col, int row, int x, int &y, wxGraphicsContext *gc) const
void DrawFeatures(int row, int align_row, unsigned int seq_pos, int x, int &y, const vector< unsigned int > &feats_in_row, const map< unsigned int, vector< unsigned int > > &feats_with_exons, wxGraphicsContext *gc) const
int LeftMarginWidth() const
map< unsigned int, vector< unsigned int > > GetFeatsWithExons(int row, int align_row, const vector< unsigned int > &feats_in_row) const
void EnableFeatures(bool enable)
pair< int, int > GetAlignSelection(void)
void OnResize(wxSizeEvent &)
void NormalizeCursorColRows()
virtual void OnPaint(wxPaintEvent &event)
Painting.
vector< unsigned int > GetFeaturesInRow(int row, int align_row) const
void UpdateFeatures(const vector< vector< vector< pair< TSeqPos, TSeqPos > > > > &feat_ranges, const vector< vector< pair< string, objects::CSeqFeatData::ESubtype > > > &feat_types, const vector< vector< objects::CBioseq_Handle::EVectorStrand > > &feat_strand)
vector< vector< CBioseq_Handle::EVectorStrand > > m_FeatStrand
vector< vector< pair< TSeqPos, TSeqPos > > > m_FeatWholeRange
void OnKeyDown(wxKeyEvent &event)
void DrawLineNumber(int align_row, unsigned int seq_pos, int x, int &y, wxGraphicsContext *gc) const
virtual wxCoord OnGetRowHeight(size_t row) const
void DrawTextCell(const unsigned int start, int col, int row, int align_row, unsigned int seq_pos, int x, int &y, const vector< unsigned int > &feats_in_row, const map< unsigned int, vector< unsigned int > > &feats_with_exons, wxGraphicsContext *gc) const
static SIZE_TYPE ReverseComplement(const string &src, TCoding src_coding, TSeqPos pos, TSeqPos length, string &dst)
static DLIST_TYPE *DLIST_NAME() first(DLIST_LIST_TYPE *list)
static const char * str(char *buf, int n)
unsigned int TSeqPos
Type for sequence locations and lengths.
int TSignedSeqPos
Type for signed sequence position.
void swap(NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair1, NCBI_NS_NCBI::pair_base_member< T1, T2 > &pair2)
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
CBioseq_Handle GetBioseqHandle(const CSeq_id &id)
Get bioseq handle by seq-id.
bool IsNucleotide(void) const
TBioseqCore GetBioseqCore(void) const
Get bioseq core structure.
CScope & GetScope(void) const
Get scope this handle belongs to.
TSeqPos GetBioseqLength(void) const
const CSeq_align::TSegs & GetSegs(void) const
const TId & GetId(void) const
CSeqVector GetSeqVector(EVectorCoding coding, ENa_strand strand=eNa_strand_plus) const
Get sequence: Iupacna or Iupacaa if use_iupac_coding is true.
@ eCoding_Iupac
Set coding to printable coding (Iupacna or Iupacaa)
void GetSeqData(TSeqPos start, TSeqPos stop, string &buffer) const
Fill the buffer string with the sequence data for the interval [start, stop).
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static const char label[]
bool CanGetDim(void) const
Check if it is safe to call GetDim method.
const TDenseg & GetDenseg(void) const
Get the variant data.
E_Choice Which(void) const
Which variant is currently selected.
bool IsSetStrands(void) const
Check if a value has been assigned to Strands data member.
const TStarts & GetStarts(void) const
Get the Starts member data.
const TLens & GetLens(void) const
Get the Lens member data.
bool CanGetNumseg(void) const
Check if it is safe to call GetNumseg method.
bool CanGetIds(void) const
Check if it is safe to call GetIds method.
TDim GetDim(void) const
Get the Dim member data.
bool CanGetStarts(void) const
Check if it is safe to call GetStarts method.
TNumseg GetNumseg(void) const
Get the Numseg member data.
const TStrands & GetStrands(void) const
Get the Strands member data.
bool CanGetLens(void) const
Check if it is safe to call GetLens method.
ENa_strand
strand of nucleic acid
unsigned int
A callback function used to compare two keys in a database.
const struct ncbi::grid::netcache::search::fields::SIZE size
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
static SLJIT_INLINE sljit_ins lb(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
#define row(bind, expected)
string ToStdString(const wxString &s)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4