📄 sequence_display.cpp
字号:
if (j > 0) ++i; if (N > 0 && N < arrangedByProximity.size()) arrangedByProximity[N] = sortedByScore[R++]; } // recreate the row list with new order RowVector newRows(rows.size()); int nNewRows = 0; for (row=0; row<rows.size(); ++row) { DisplayRowFromAlignment *alnRow = dynamic_cast<DisplayRowFromAlignment*>(rows[row]); if (alnRow) newRows[row] = arrangedByProximity[nNewRows++]; // put arranged rows in place else newRows[row] = rows[row]; // leave other rows in original order } if (nNewRows == arrangedByProximity.size()) // sanity check rows = newRows; else ERRORMSG("SequenceDisplay::ProximitySort() - internal inconsistency"); // finally, highlight the key row and scroll approximately there GlobalMessenger()->RemoveAllHighlights(true); GlobalMessenger()->AddHighlights(seq1, 0, seq1->Length() - 1); (*viewerWindow)->ScrollToRow((M - 3) > 0 ? (M - 3) : 0); (*viewerWindow)->viewer->Save(); // make this an undoable operation (*viewerWindow)->UpdateDisplay(this); return true;}bool SequenceDisplay::CalculateRowScoresWithThreader(double weightPSSM){ if (isEditable) { SequenceViewer *seqViewer = dynamic_cast<SequenceViewer*>((*viewerWindow)->viewer); if (seqViewer) { seqViewer->alignmentManager->CalculateRowScoresWithThreader(weightPSSM); TRACEMSG("calculated row scores"); return true; } } return false;}void SequenceDisplay::RowsAdded(int nRowsAddedToMultiple, BlockMultipleAlignment *multiple, int alnWhere){ if (nRowsAddedToMultiple <= 0) return; // find the last row that's from this multiple int r, nRows = 0, lastAlnRowIndex, displayWhere = -1; DisplayRowFromAlignment *lastAlnRow = NULL; for (r=0; r<rows.size(); ++r) { DisplayRowFromAlignment *alnRow = dynamic_cast<DisplayRowFromAlignment*>(rows[r]); if (alnRow && alnRow->alignment == multiple) { lastAlnRow = alnRow; lastAlnRowIndex = r; ++nRows; if (alnWhere >= 0 && alnRow->row == alnWhere) displayWhere = r; // convert 'where' from alignment row to display row } } if (!lastAlnRow || multiple->NRows() != nRows + nRowsAddedToMultiple) { ERRORMSG("SequenceDisplay::RowsAdded() - inconsistent parameters"); return; } int rowToMergeAfter = (displayWhere >= 0) ? displayWhere : lastAlnRowIndex; INFOMSG("adding new row after display row #" << (rowToMergeAfter+1)); // move higher rows up to leave space for new rows int nRowsToMove = rows.size() - 1 - rowToMergeAfter; rows.resize(rows.size() + nRowsAddedToMultiple); for (r=0; r<nRowsToMove; ++r) rows[rows.size() - 1 - r] = rows[rows.size() - 1 - r - nRowsAddedToMultiple]; // add new rows, assuming new rows to add to the display are from the last rows of the multiple for (r=0; r<nRowsAddedToMultiple; ++r) rows[rowToMergeAfter + 1 + r] = new DisplayRowFromAlignment( multiple->NRows() + r - nRowsAddedToMultiple, multiple); UpdateAfterEdit(multiple);}void SequenceDisplay::RowsRemoved(const vector < int >& rowsRemoved, const BlockMultipleAlignment *multiple){ if (rowsRemoved.size() == 0) return; // first, construct a map of old alignment row numbers -> new row numbers; also do sanity checks int i; vector < int > alnRowNumbers(multiple->NRows() + rowsRemoved.size()); vector < bool > removedAlnRows(alnRowNumbers.size(), false); for (i=0; i<alnRowNumbers.size(); ++i) alnRowNumbers[i] = i; for (i=0; i<rowsRemoved.size(); ++i) { if (rowsRemoved[i] < 1 || rowsRemoved[i] >= alnRowNumbers.size()) { ERRORMSG("SequenceDisplay::RowsRemoved() - can't remove row " << removedAlnRows[i]); return; } else removedAlnRows[rowsRemoved[i]] = true; } VectorRemoveElements(alnRowNumbers, removedAlnRows, rowsRemoved.size()); map < int, int > oldRowToNewRow; for (i=0; i<alnRowNumbers.size(); ++i) oldRowToNewRow[alnRowNumbers[i]] = i; // then tag rows to remove from display, and update row numbers for rows not removed vector < bool > removeDisplayRows(rows.size(), false); for (i=0; i<rows.size(); ++i) { DisplayRowFromAlignment *alnRow = dynamic_cast<DisplayRowFromAlignment*>(rows[i]); if (alnRow && alnRow->alignment == multiple) { if (removedAlnRows[alnRow->row]) { delete rows[i]; removeDisplayRows[i] = true; } else alnRow->row = oldRowToNewRow[alnRow->row]; } } VectorRemoveElements(rows, removeDisplayRows, rowsRemoved.size()); UpdateAfterEdit(multiple);}bool SequenceDisplay::GetDisplayCoordinates(const Molecule *molecule, int seqIndex, BlockMultipleAlignment::eUnalignedJustification justification, int *column, int *row){ if (!molecule || seqIndex < 0) return false; int displayRow; const Sequence *seq; // search by Molecule* for (displayRow=0; displayRow<NRows(); ++displayRow) { seq = rows[displayRow]->GetSequence(); if (seq && seq->molecule == molecule) { *row = displayRow; const DisplayRowFromAlignment *alnRow = dynamic_cast<DisplayRowFromAlignment*>(rows[displayRow]); if (alnRow) { *column = alnRow->alignment->GetAlignmentIndex(alnRow->row, seqIndex, justification); return (*column >= 0); } const DisplayRowFromSequence *seqRow = dynamic_cast<DisplayRowFromSequence*>(rows[displayRow]); if (seqRow && seqIndex >= seqRow->fromIndex && seqIndex <= seqRow->toIndex) { *column = seqIndex - seqRow->fromIndex; return true; } } } return false;}END_SCOPE(Cn3D)/** ---------------------------------------------------------------------------* $Log: sequence_display.cpp,v $* Revision 1000.3 2004/06/01 18:29:04 gouriano* PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.73** Revision 1.73 2004/05/21 21:41:39 gorelenk* Added PCH ncbi_pch.hpp** Revision 1.72 2004/03/15 17:55:06 thiessen* prefer prefix vs. postfix ++/-- operators** Revision 1.71 2004/02/19 17:05:05 thiessen* remove cn3d/ from include paths; add pragma to disable annoying msvc warning** Revision 1.70 2003/11/06 19:07:19 thiessen* leave show gv's on if on already** Revision 1.69 2003/10/20 13:17:15 thiessen* add float geometry violations sorting** Revision 1.68 2003/07/14 18:37:07 thiessen* change GetUngappedAlignedBlocks() param types; other syntax changes** Revision 1.67 2003/02/03 19:20:05 thiessen* format changes: move CVS Log to bottom of file, remove std:: from .cpp files, and use new diagnostic macros** Revision 1.66 2003/01/31 17:18:58 thiessen* many small additions and changes...** Revision 1.65 2003/01/29 01:41:05 thiessen* add merge neighbor instead of merge near highlight** Revision 1.64 2003/01/28 21:07:56 thiessen* add block fit coloring algorithm; tweak row dragging; fix style bug** Revision 1.63 2003/01/27 16:42:24 thiessen* remove debugging messages** Revision 1.62 2003/01/27 15:52:22 thiessen* merge after highlighted row; show rejects; trim rejects from new reject list** Revision 1.61 2003/01/23 20:03:05 thiessen* add BLAST Neighbor algorithm** Revision 1.60 2002/10/13 22:58:08 thiessen* add redo ability to editor** Revision 1.59 2002/09/16 21:24:58 thiessen* add block freezing to block aligner** Revision 1.58 2002/09/05 18:38:57 thiessen* add sort by highlights** Revision 1.57 2002/08/28 20:30:33 thiessen* fix proximity sort bug** Revision 1.56 2002/08/15 22:13:16 thiessen* update for wx2.3.2+ only; add structure pick dialog; fix MultitextDialog bug** Revision 1.55 2002/08/15 12:57:07 thiessen* fix highlight redraw bug** Revision 1.54 2002/08/13 20:46:37 thiessen* add global block aligner** Revision 1.53 2002/07/26 15:28:48 thiessen* add Alejandro's block alignment algorithm** Revision 1.52 2002/07/23 15:46:50 thiessen* print out more BLAST info; tweak save file name** Revision 1.51 2002/06/13 14:54:07 thiessen* add sort by self-hit** Revision 1.50 2002/05/17 19:10:27 thiessen* preliminary range restriction for BLAST/PSSM** Revision 1.49 2002/05/07 20:22:47 thiessen* fix for BLAST/PSSM** Revision 1.48 2002/05/02 18:40:25 thiessen* do BLAST/PSSM for debug builds only, for testing** Revision 1.47 2002/04/26 19:01:00 thiessen* fix display delete bug** Revision 1.46 2002/04/26 13:46:36 thiessen* comment out all blast/pssm methods** Revision 1.45 2002/03/28 14:06:02 thiessen* preliminary BLAST/PSSM ; new CD startup style** Revision 1.44 2002/02/28 19:11:52 thiessen* wrap sequences in single-structure mode** Revision 1.43 2002/02/22 14:24:01 thiessen* sort sequences in reject dialog ; general identifier comparison** Revision 1.42 2002/02/21 12:26:30 thiessen* fix row delete bug ; remember threader options** Revision 1.41 2002/02/19 14:59:39 thiessen* add CDD reject and purge sequence** Revision 1.40 2002/02/15 15:27:12 thiessen* on Mac, use meta for MouseDown events** Revision 1.39 2002/02/15 01:02:17 thiessen* ctrl+click keeps edit modes** Revision 1.38 2002/02/05 18:53:25 thiessen* scroll to residue in sequence windows when selected in structure window** Revision 1.37 2001/12/05 17:16:56 thiessen* fix row insert bug** Revision 1.36 2001/11/30 14:02:05 thiessen* progress on sequence imports to single structures** Revision 1.35 2001/11/27 16:26:08 thiessen* major update to data management system** Revision 1.34 2001/10/08 00:00:09 thiessen* estimate threader N random starts; edit CDD name** Revision 1.33 2001/09/27 15:37:59 thiessen* decouple sequence import and BLAST** Revision 1.32 2001/09/19 22:55:39 thiessen* add preliminary net import and BLAST** Revision 1.31 2001/08/24 14:54:50 thiessen* make status row # order-independent :)** Revision 1.30 2001/08/24 14:32:51 thiessen* add row # to status line** Revision 1.29 2001/08/08 02:25:27 thiessen* add <memory>** Revision 1.28 2001/07/10 16:39:55 thiessen* change selection control keys; add CDD name/notes dialogs** Revision 1.27 2001/06/21 02:02:34 thiessen* major update to molecule identification and highlighting ; add toggle highlight (via alt)** Revision 1.26 2001/06/07 19:05:38 thiessen* functional (although incomplete) render settings panel ; highlight title - not sequence - upon mouse click** Revision 1.25 2001/06/05 13:21:08 thiessen* fix structure alignment list problems** Revision 1.24 2001/06/04 14:58:00 thiessen* add proximity sort; highlight sequence on browser launch** Revision 1.23 2001/06/01 18:07:27 thiessen* fix display clone bug** Revision 1.22 2001/06/01 14:05:12 thiessen* add float PDB sort** Revision 1.21 2001/06/01 13:35:58 thiessen* add aligned block number to status line** Revision 1.20 2001/05/31 18:47:08 thiessen* add preliminary style dialog; remove LIST_TYPE; add thread single and delete all; misc tweaks** Revision 1.19 2001/05/22 19:09:31 thiessen* many minor fixes to compile/run on Solaris/GTK** Revision 1.18 2001/05/14 16:04:31 thiessen* fix minor row reordering bug** Revision 1.17 2001/05/11 02:10:42 thiessen* add better merge fail indicators; tweaks to windowing/taskbar** Revision 1.16 2001/05/09 17:15:06 thiessen* add automatic block removal upon demotion** Revision 1.15 2001/05/02 16:35:15 thiessen* launch entrez web page on sequence identifier** Revision 1.14 2001/04/19 12:58:32 thiessen* allow merge and delete of individual updates** Revision 1.13 2001/04/18 15:46:53 thiessen* show description, length, and PDB numbering in status line** Revision 1.12 2001/04/05 22:55:35 thiessen* change bg color handling ; show geometry violations** Revision 1.11 2001/04/04 00:27:14 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/22 00:33:17 thiessen* initial threading working (PSSM only); free color storage in undo stack** Revision 1.7 2001/03/19 15:50:39 thiessen* add sort rows by identifier** Revision 1.6 2001/03/13 01:25:05 thiessen* working undo system for >1 alignment (e.g., update window)** Revision 1.5 2001/03/09 15:49:04 thiessen* major changes to add initial update viewer** Revision 1.4 2001/03/06 20:49:14 thiessen* fix row->alignment bug** Revision 1.3 2001/03/06 20:20:50 thiessen* progress towards >1 alignment in a SequenceDisplay ; misc minor fixes** Revision 1.2 2001/03/02 15:32:52 thiessen* minor fixes to save & show/hide dialogs, wx string headers** 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 + -