A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/paint__alignment_8cpp_source.html below:

NCBI C++ ToolKit: src/gui/widgets/edit/paint_alignment.cpp Source File

32 #include <wx/graphics.h> 33 #include <wx/settings.h> 34 #include <wx/msgdlg.h> 44 #include <wx/textfile.h> 65

: 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),

66

m_EnableFeatures(

false

), m_EnableSubstitute(

true

)

69

SetBackgroundStyle(wxBG_STYLE_PAINT);

70

SetBackgroundColour(*wxWHITE);

71

m_Font = wxFont(10, wxFONTFAMILY_TELETYPE, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL);

79  if

(m_TotalLength > 0)

81

wxGraphicsContext *gc = wxGraphicsContext::Create();

82

gc->SetFont(m_Font, *wxBLACK);

83

CalculateFontWidthAndHeight(gc);

84

m_NumCols = CalculateNumCols();

85

m_NumRows =

static_cast<int>

(m_NumAlignRows * (m_TotalLength / m_NumCols));

86

m_LastRowLength = m_TotalLength % m_NumCols;

87  if

(m_LastRowLength > 0)

88

m_NumRows += m_NumAlignRows;

97

SetRowCount(m_NumRows);

99

wxWindow *win = GetParent();

105

win = 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())

119

accession =

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())

182

seq += seq_plus.substr(start,

len

);

188  if

(real_start >= 0 && real_start < seq_minus.size())

190

seq += seq_minus.substr(real_start,

len

);

215

vector<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 )

249

res = start + (pos - (total_len -

len

));

252

res = start + total_len - 1 - pos;

270  while

( seg < num_segs )

281

res = start +

len

- 1;

299

res = start +

len

- 1;

325  while

( seg < num_segs )

335

start = length - start -

len

;

336

pos2 = length - pos - 1;

338  if

(start >= 0 && pos2 >= start && pos2 < start +

len

)

340

res = total_len + pos2 - start;

344  if

(start >= 0 && start > pos2 && left)

350  if

(start >= 0 && start +

len

- 1 < pos2 && !left)

352

found_len = total_len +

len

- 1;

368  const

vector< vector<pair<string,objects::CSeqFeatData::ESubtype> > > &feat_types,

369  const

vector< vector<objects::CBioseq_Handle::EVectorStrand> > &feat_strand)

406

wxSize sz = GetClientSize();

407  int

num_rows =

static_cast<int>

(GetVisibleRowsEnd() - GetVisibleRowsBegin());

409  int

uc =

event

.GetKeyCode();

439

wxMessageBox (

_

(

"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  int

num_groups = col / 12;

520  int

pos_in_group = col % 12;

521  if

(pos_in_group != 10 && pos_in_group != 11)

562  if

(evt.GetModifiers() == wxMOD_SHIFT)

582

wxMessageBox (

_

(

"Selection should be confined to the same bioseq"

),

_

(

"Warning"

), wxOK);

659

wxAutoBufferedPaintDC dc(

this

);

660

wxGraphicsContext *gc = wxGraphicsContext::Create( dc );

664

gc->SetFont(

m_Font

, *wxBLACK);

675  int

hidden_rows =

static_cast<int>

(GetVisibleRowsBegin());

677  unsigned int row

= hidden_rows;

679  int

client_y = GetClientSize().y;

683  for

(

size_t

align_row = start_align_row; align_row <

m_NumAlignRows

; ++align_row)

685  unsigned int

seq_pos = start;

686  DrawTextLine

(start, y,

row

,

static_cast<int>

(align_row), gc, seq_pos);

744

wxColour backgroundColour = GetBackgroundColour();

745  if

(!backgroundColour.Ok())

746

backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);

747

wxSize sz = GetClientSize();

748

wxRect windowRect(wxPoint(0,0), sz);

749

gc->SetBrush(wxBrush(backgroundColour));

750

gc->SetPen(wxPen(backgroundColour, 1));

751

gc->DrawRectangle(windowRect.GetX(),windowRect.GetY(),windowRect.GetWidth(),windowRect.GetHeight());

759

wxDouble externalLeading;

762

gc->GetTextExtent(wxString(

m_Seqs

.front().substr(0,1000)), &width, &height, &descent, &externalLeading);

767

gc->GetTextExtent(wxString(

m_Seqs

.front()), &width, &height, &descent, &externalLeading);

770

width = ceil(1+width);

771

height = ceil(2+height);

778  int

width =

int

(GetClientSize().x);

781  int

num_groups = line_length / 12;

786

line_length = 10*num_groups;

794  unsigned int

orig_pos = seq_pos;

795  int

orig_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 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 834  label

<< seq_pos + 1 + (10 - ((col + 1) % 10));

835  if

((col +

label

.Length()) % 10 == 0 )

837

gc->SetFont(

m_Font

, wxColour(255,0,255));

838

gc->DrawText(

label

,x,y);

839

gc->SetFont(

m_Font

,*wxBLACK);

845

gc->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 int

start,

int

col,

int row

,

int

align_row,

unsigned int

seq_pos,

int

x,

int

&y,

const

vector<unsigned int> &feats_in_row,

855  const map

<

unsigned int

, vector<unsigned int> > &feats_with_exons, wxGraphicsContext *gc)

const 860

gc->SetFont(

m_Font

,*wxBLACK);

863

substr =

m_Seqs

[align_row][seq_pos];

872  if

(pos1 >= 0 && pos2 >= 0 && seq_pos >= pos1 && seq_pos <= pos2 && align_row ==

m_SelAlignRow

)

873

gc->DrawText(wxString(substr),x,y, gc->CreateBrush(*wxLIGHT_GREY_BRUSH));

875

gc->DrawText(wxString(substr),x,y);

880  DrawFeatures

(

row

,align_row,seq_pos,x,y,feats_in_row,feats_with_exons,gc);

888

gc->SetPen( *wxRED_PEN);

897  const

wxPen* pen = wxBLACK_PEN;

901

default : pen = wxBLACK_PEN;

break

;

914

wxString id_label(

m_Labels

[align_row]);

915  if

(allowed > pos_label.Length() && allowed < pos_label.Length() + id_label.Length())

916

id_label = id_label.Left(allowed - pos_label.Length());

917  int len

=

static_cast<int>

(allowed - pos_label.Length() - id_label.Length());

919

id_label = wxString(

m_Labels

[align_row]).Left(allowed);

924

gc->SetFont(

m_Font

,*wxRED);

926

gc->SetFont(

m_Font

,*wxBLACK);

927

gc->DrawText(id_label, x, y);

934

wxDouble externalLeading;

935

gc->GetTextExtent(id_label + wxString(

'N'

,

len

), &width, &height, &descent, &externalLeading);

937

gc->SetFont(

m_Font

,wxColour(255,0,255));

938

gc->DrawText(pos_label, x, y);

940

gc->SetFont(

m_Font

,*wxBLACK);

946 void CPaintAlignment::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 948  for

(

unsigned int

k = 0; k < feats_in_row.size(); k++)

950  unsigned int i

= feats_in_row[k];

955

gc->DrawText(wxString(

label

),x,y);

963

vector<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) )

975

feats_in_row.push_back(

static_cast<int>

(

i

));

983 void CPaintAlignment::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 985  for

(

unsigned int

k = 0; k < feats_in_row.size(); k++)

987  unsigned int i

= feats_in_row[k];

993  bool

startpoint =

false

;

994  bool

endpoint =

false

;

996  if

(

f

!= feats_with_exons.end())

998  for

(

unsigned int

m = 0; m <

f

->second.size(); m++)

1000  unsigned int

j =

f

->second[m];

1003  if

(seq_pos >= start && seq_pos <= stop)

1006  if

(seq_pos == start)

1008  if

(seq_pos == stop)

1019

gc->SetBrush(*wxBLACK_BRUSH);

1029  if

(

m_FeatStrand

[align_row][

i

] == objects::CBioseq_Handle::eStrand_Plus)

1036

gc->DrawLines(3,lines);

1044

gc->DrawLines(3,lines);

1059  bool

found =

false

;

1076  return

pair<int,int>(pos1, pos2);

1078  return

pair<int,int>(-1, -1);

1089  return

pair<int,int>(pos1, pos2);

1115

vector<pair<TSeqPos,TSeqPos> > feat_whole_range;

1116

vector< vector<TSeqPos> > feat_length_before;

1117

vector<TSeqPos> feat_total_length;

1123

vector<TSeqPos> length_before;

1130

length_before.push_back(length);

1133

feat_whole_range.push_back(pair<TSeqPos,TSeqPos>(start,stop));

1134

feat_total_length.push_back(length);

1135

feat_length_before.push_back(length_before);

1145

vector<unsigned int> ranges;

1146  for

(

unsigned int

j=0; j<

m_FeatRanges

[align_row][

i

].size(); j++)

1151  int

row_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) )

1156

ranges.push_back(j);

1166  for

(

unsigned int

k = 0; k < feats_in_row.size(); k++)

1168  unsigned int i

= feats_in_row[k];

1170  if

(!ranges.empty())

1171

feats_with_exons[

i

] = ranges;

1173  return

feats_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