📄 sequence_viewer_window.cpp
字号:
int i; for (i=1; i<sequences.size(); ++i) // assuming master is first sequence titleStrs[i - 1] = sequences[i]->identifier->ToString().c_str(); vector < bool > selectedSlaves(sequences.size() - 1, false); wxString title = "Realign Slaves of "; title.Append(alignment->GetMaster()->identifier->ToString().c_str()); ShowHideDialog dialog( titleStrs, &selectedSlaves, NULL, // no "apply" button or callback true, this, -1, title, wxPoint(200, 100)); dialog.ShowModal(); // make list of slave rows to be realigned vector < int > rowOrder, realignSlaves; sequenceViewer->GetCurrentDisplay()->GetRowOrder(alignment, &rowOrder); for (i=0; i<selectedSlaves.size(); ++i) if (selectedSlaves[i]) realignSlaves.push_back(rowOrder[i + 1]); // do the realignment if (realignSlaves.size() >= 0) sequenceViewer->alignmentManager->RealignSlaveSequences(alignment, realignSlaves);}#define MASTER_HAS_STRUCTURE \ (sequenceViewer->alignmentManager != NULL && \ sequenceViewer->alignmentManager->GetCurrentMultipleAlignment() != NULL && \ sequenceViewer->alignmentManager->GetCurrentMultipleAlignment()->GetSequenceOfRow(0)->molecule != NULL)void SequenceViewerWindow::OnSort(wxCommandEvent& event){ switch (event.GetId()) { case MID_SORT_IDENT: if (DoProximitySort()) ProximitySortOff(); sequenceViewer->GetCurrentDisplay()->SortRowsByIdentifier(); break; case MID_SORT_THREADER: { if (DoProximitySort()) ProximitySortOff(); GetFloatingPointDialog fpDialog(NULL, "Weighting of PSSM/Contact score? ([0..1], 1 = PSSM only)", "Enter PSSM Weight", 0.0, 1.0, 0.05, (MASTER_HAS_STRUCTURE ? ((prevPSSMWeight >= 0.0) ? prevPSSMWeight : 0.5) : 1.0)); if (fpDialog.ShowModal() == wxOK) { double weightPSSM = prevPSSMWeight = fpDialog.GetValue(); SetCursor(*wxHOURGLASS_CURSOR); sequenceViewer->GetCurrentDisplay()->SortRowsByThreadingScore(weightPSSM); SetCursor(wxNullCursor); } break; } case MID_FLOAT_HIGHLIGHTS: if (DoProximitySort()) ProximitySortOff(); sequenceViewer->GetCurrentDisplay()->FloatHighlightsToTop(); break; case MID_FLOAT_PDBS: if (DoProximitySort()) ProximitySortOff(); sequenceViewer->GetCurrentDisplay()->FloatPDBRowsToTop(); break; case MID_FLOAT_G_V: if (DoProximitySort()) ProximitySortOff(); sequenceViewer->GetCurrentDisplay()->FloatGVToTop(); break; case MID_SORT_SELF_HIT: if (DoProximitySort()) ProximitySortOff(); sequenceViewer->GetCurrentDisplay()->SortRowsBySelfHit(); break; case MID_PROXIMITY_SORT: CancelAllSpecialModesExcept(MID_PROXIMITY_SORT); if (DoProximitySort()) SetCursor(*wxCROSS_CURSOR); else ProximitySortOff(); break; }}void SequenceViewerWindow::OnScoreThreader(wxCommandEvent& event){ GetFloatingPointDialog fpDialog(NULL, "Weighting of PSSM/Contact score? ([0..1], 1 = PSSM only)", "Enter PSSM Weight", 0.0, 1.0, 0.05, (MASTER_HAS_STRUCTURE ? ((prevPSSMWeight >= 0.0) ? prevPSSMWeight : 0.5) : 1.0)); if (fpDialog.ShowModal() == wxOK) { double weightPSSM = prevPSSMWeight = fpDialog.GetValue(); SetCursor(*wxHOURGLASS_CURSOR); if (sequenceViewer->GetCurrentDisplay()->IsEditable()) sequenceViewer->GetCurrentDisplay()->CalculateRowScoresWithThreader(weightPSSM); SetCursor(wxNullCursor); }}void SequenceViewerWindow::OnMarkBlock(wxCommandEvent& event){ switch (event.GetId()) { case MID_MARK_BLOCK: CancelAllSpecialModesExcept(MID_MARK_BLOCK); if (DoMarkBlock()) SetCursor(*wxCROSS_CURSOR); else MarkBlockOff(); break; case MID_CLEAR_MARKS: if (sequenceViewer->GetCurrentAlignments().size() > 0 && sequenceViewer->GetCurrentAlignments().front()->ClearMarks()) GlobalMessenger()->PostRedrawSequenceViewer(sequenceViewer); break; }}void SequenceViewerWindow::TurnOnEditor(void){ if (!menuBar->IsChecked(MID_ENABLE_EDIT)) Command(SequenceViewerWindow::MID_ENABLE_EDIT);}void SequenceViewerWindow::OnExport(wxCommandEvent& event){ SequenceViewer::eExportType type; if (event.GetId() == MID_EXPORT_FASTA) type = SequenceViewer::asFASTA; else if (event.GetId() == MID_EXPORT_A2M) type = SequenceViewer::asFASTAa2m; else if (event.GetId() == MID_EXPORT_TEXT) type = SequenceViewer::asText; else if (event.GetId() == MID_EXPORT_HTML) type = SequenceViewer::asHTML; sequenceViewer->ExportAlignment(type);}void SequenceViewerWindow::OnSelfHit(wxCommandEvent& event){ if (sequenceViewer->GetCurrentAlignments().size() > 0) { const BlockMultipleAlignment *multiple = sequenceViewer->GetCurrentAlignments().front(); sequenceViewer->alignmentManager->blaster->CalculateSelfHitScores(multiple); }}void SequenceViewerWindow::OnTaxonomy(wxCommandEvent& event){ if (!taxonomyTree) taxonomyTree = new TaxonomyTree(); if (sequenceViewer->GetCurrentAlignments().size() > 0) taxonomyTree->ShowTreeForAlignment(this, sequenceViewer->GetCurrentAlignments().front(), (event.GetId() == MID_TAXONOMY_ABBR));}void SequenceViewerWindow::OnHighlightBlocks(wxCommandEvent& event){ if (sequenceViewer->GetCurrentAlignments().size() == 0) return; GlobalMessenger()->RemoveAllHighlights(true); const BlockMultipleAlignment *multiple = sequenceViewer->GetCurrentAlignments().front(); BlockMultipleAlignment::UngappedAlignedBlockList blocks; multiple->GetUngappedAlignedBlocks(&blocks); if (blocks.size() == 0) return; BlockMultipleAlignment::UngappedAlignedBlockList::const_iterator b, be = blocks.end(); const Sequence *seq; const Block::Range *range; for (int row=0; row<multiple->NRows(); ++row) { seq = multiple->GetSequenceOfRow(row); for (b = blocks.begin(); b!=be; ++b) { range = (*b)->GetRangeOfRow(row); GlobalMessenger()->AddHighlights(seq, range->from, range->to); } }}END_SCOPE(Cn3D)/** ---------------------------------------------------------------------------* $Log: sequence_viewer_window.cpp,v $* Revision 1000.2 2004/06/01 18:29:17 gouriano* PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.54** Revision 1.54 2004/05/21 21:41:40 gorelenk* Added PCH ncbi_pch.hpp** Revision 1.53 2004/03/15 18:32:03 thiessen* prefer prefix vs. postfix ++/-- operators** Revision 1.52 2004/02/19 17:05:10 thiessen* remove cn3d/ from include paths; add pragma to disable annoying msvc warning** Revision 1.51 2003/10/20 13:17:15 thiessen* add float geometry violations sorting** Revision 1.50 2003/08/23 22:42:17 thiessen* add highlight blocks command** Revision 1.49 2003/03/06 19:23:56 thiessen* fix for compilation problem (seqfeat macros)** Revision 1.48 2003/02/03 19:20:06 thiessen* format changes: move CVS Log to bottom of file, remove std:: from .cpp files, and use new diagnostic macros** Revision 1.47 2003/01/14 14:15:07 thiessen* default PSSM score = 1.0 when no structure** Revision 1.46 2002/12/19 14:15:37 thiessen* mac fixes to menus, add icon** Revision 1.45 2002/12/06 17:07:15 thiessen* remove seqrow export format; add choice of repeat handling for FASTA export; export rows in display order** Revision 1.44 2002/12/02 13:37:09 thiessen* add seqrow format export** Revision 1.43 2002/10/13 22:58:08 thiessen* add redo ability to editor** Revision 1.42 2002/10/07 18:51:53 thiessen* add abbreviated taxonomy tree** Revision 1.41 2002/10/04 18:45:28 thiessen* updates to taxonomy viewer** Revision 1.40 2002/09/09 22:51:19 thiessen* add basic taxonomy tree viewer** Revision 1.39 2002/09/09 13:38:23 thiessen* separate save and save-as** Revision 1.38 2002/09/06 13:06:31 thiessen* fix menu accelerator conflicts** Revision 1.37 2002/09/05 18:38:57 thiessen* add sort by highlights** Revision 1.36 2002/09/03 13:15:58 thiessen* add A2M export** Revision 1.35 2002/08/15 22:13:17 thiessen* update for wx2.3.2+ only; add structure pick dialog; fix MultitextDialog bug** Revision 1.34 2002/06/13 14:54:07 thiessen* add sort by self-hit** Revision 1.33 2002/06/13 13:32:39 thiessen* add self-hit calculation** Revision 1.32 2002/06/05 17:25:47 thiessen* change 'update' to 'import' in GUI** Revision 1.31 2002/06/05 14:28:40 thiessen* reorganize handling of window titles** Revision 1.30 2002/05/17 19:10:27 thiessen* preliminary range restriction for BLAST/PSSM** Revision 1.29 2002/04/22 14:27:29 thiessen* add alignment export** Revision 1.28 2002/03/19 18:48:00 thiessen* small bug fixes; remember PSSM weight** Revision 1.27 2002/03/04 15:52:14 thiessen* hide sequence windows instead of destroying ; add perspective/orthographic projection choice** Revision 1.26 2002/02/13 14:53:30 thiessen* add update sort** Revision 1.25 2001/12/06 23:13:45 thiessen* finish import/align new sequences into single-structure data; many small tweaks** Revision 1.24 2001/10/20 20:16:32 thiessen* don't use wxDefaultPosition for dialogs (win2000 problem)** Revision 1.23 2001/10/08 14:18:33 thiessen* fix show/hide dialog under wxGTK** Revision 1.22 2001/10/01 16:04:24 thiessen* make CDD annotation window non-modal; add SetWindowTitle to viewers** Revision 1.21 2001/09/06 13:10:10 thiessen* tweak show hide dialog layout** Revision 1.20 2001/08/24 18:53:43 thiessen* add filename to sequence viewer window titles** Revision 1.19 2001/06/21 02:02:34 thiessen* major update to molecule identification and highlighting ; add toggle highlight (via alt)** Revision 1.18 2001/06/04 14:58:00 thiessen* add proximity sort; highlight sequence on browser launch** Revision 1.17 2001/06/01 14:05:13 thiessen* add float PDB sort** Revision 1.16 2001/05/17 18:34:26 thiessen* spelling fixes; change dialogs to inherit from wxDialog** Revision 1.15 2001/05/15 23:48:37 thiessen* minor adjustments to compile under Solaris/wxGTK** Revision 1.14 2001/05/11 02:10:42 thiessen* add better merge fail indicators; tweaks to windowing/taskbar** Revision 1.13 2001/05/09 17:15:07 thiessen* add automatic block removal upon demotion** Revision 1.12 2001/05/08 21:15:44 thiessen* add PSSM weight dialog for sorting** Revision 1.11 2001/04/04 00:27:15 thiessen* major update - add merging, threader GUI controls** Revision 1.10 2001/03/30 14:43:41 thiessen* show threader scores in status line; misc UI tweaks** Revision 1.9 2001/03/30 03:07:34 thiessen* add threader score calculation & sorting** Revision 1.8 2001/03/19 15:50:40 thiessen* add sort rows by identifier** Revision 1.7 2001/03/17 14:06:49 thiessen* more workarounds for namespace/#define conflicts** Revision 1.6 2001/03/13 01:25:06 thiessen* working undo system for >1 alignment (e.g., update window)** Revision 1.5 2001/03/09 15:49:05 thiessen* major changes to add initial update viewer** Revision 1.4 2001/03/06 20:20:51 thiessen* progress towards >1 alignment in a SequenceDisplay ; misc minor fixes** Revision 1.3 2001/03/02 15:32:52 thiessen* minor fixes to save & show/hide dialogs, wx string headers** Revision 1.2 2001/03/02 03:26:59 thiessen* fix dangling pointer upon app close** Revision 1.1 2001/03/01 20:15:51 thiessen* major rearrangement of sequence viewer code into base and derived classes**/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -