📄 update_viewer.cpp
字号:
// find alignment, to replace it with BLAST result AlignmentList::iterator a, ae = GetCurrentAlignments().end(); for (a=GetCurrentAlignments().begin(); a!=ae; ++a) if (*a == update) break; if (a == GetCurrentAlignments().end()) return; // set up BLAST-2-sequences between update slave and each sequence from the multiple BLASTer::AlignmentList toRealign; for (int row=0; row<multiple->NRows(); ++row) { BlockMultipleAlignment::SequenceList *seqs = new BlockMultipleAlignment::SequenceList(2); (*seqs)[0] = multiple->GetSequenceOfRow(row); (*seqs)[1] = updateSeq; BlockMultipleAlignment *newAlignment = new BlockMultipleAlignment(seqs, updateSeq->parentSet->alignmentManager); if (newAlignment->AddUnalignedBlocks() && newAlignment->UpdateBlockMapAndColors(false)) { int excess = 0; if (!RegistryGetInteger(REG_ADVANCED_SECTION, REG_FOOTPRINT_RES, &excess)) WARNINGMSG("Can't get footprint excess residues from registry"); newAlignment->alignMasterFrom = uaBlocks.front()->GetRangeOfRow(row)->from - excess; if (newAlignment->alignMasterFrom < 0) newAlignment->alignMasterFrom = 0; newAlignment->alignMasterTo = uaBlocks.back()->GetRangeOfRow(row)->to + excess; if (newAlignment->alignMasterTo >= (*seqs)[0]->Length()) newAlignment->alignMasterTo = (*seqs)[0]->Length() - 1; newAlignment->alignSlaveFrom = update->alignSlaveFrom; newAlignment->alignSlaveTo = update->alignSlaveTo; toRealign.push_back(newAlignment); } else { ERRORMSG("error finalizing alignment"); delete newAlignment; } } // actually do BLAST alignments BLASTer::AlignmentList newAlignments; SetDiagPostLevel(eDiag_Error); // ignore all but Errors while reading data alignmentManager->blaster-> CreateNewPairwiseAlignmentsByBlast(NULL, toRealign, &newAlignments, false); SetDiagPostLevel(eDiag_Info); DELETE_ALL_AND_CLEAR(toRealign, BLASTer::AlignmentList); if (newAlignments.size() != multiple->NRows()) { ERRORMSG("UpdateViewer::BlastUpdate() - CreateNewPairwiseAlignmentsByBlast() failed"); return; } // replace alignment with result BlockMultipleAlignment *alignmentByNeighbor = GetAlignmentByBestNeighbor(multiple, newAlignments); DELETE_ALL_AND_CLEAR(newAlignments, BLASTer::AlignmentList); if (!alignmentByNeighbor) { WARNINGMSG("alignment unchanged"); return; } TRACEMSG("BLAST Neighbor succeeded - replacing alignment"); delete update; *a = alignmentByNeighbor; // recreate alignment display with new alignment AlignmentList copy = GetCurrentAlignments(); GetCurrentAlignments().clear(); GetCurrentDisplay()->Empty(); AddAlignments(copy);// (*viewerWindow)->ScrollToColumn(GetCurrentDisplay()->GetStartingColumn());}// comparison function: if CompareRows(a, b) == true, then row a moves uptypedef bool (*CompareUpdates)(BlockMultipleAlignment *a, BlockMultipleAlignment *b);static bool CompareUpdatesByIdentifier(BlockMultipleAlignment *a, BlockMultipleAlignment *b){ return MoleculeIdentifier::CompareIdentifiers( a->GetSequenceOfRow(1)->identifier, // sort by first slave row b->GetSequenceOfRow(1)->identifier);}static CompareUpdates updateComparisonFunction = NULL;void UpdateViewer::SortByIdentifier(void){ TRACEMSG("sorting updates by identifier"); updateComparisonFunction = CompareUpdatesByIdentifier; SortUpdates();}void UpdateViewer::SortUpdates(void){ if (!updateComparisonFunction) { ERRORMSG("UpdateViewer::SortUpdates() - must first set comparison function"); return; } // make vector of alignments AlignmentList& currentAlignments = GetCurrentAlignments(); if (currentAlignments.size() < 2) return; vector < BlockMultipleAlignment * > sortedVector(currentAlignments.size()); AlignmentList::const_iterator a, ae = currentAlignments.end(); int i = 0; for (a=currentAlignments.begin(); a!=ae; ++a) sortedVector[i++] = *a; // sort them stable_sort(sortedVector.begin(), sortedVector.end(), updateComparisonFunction); updateComparisonFunction = NULL; // replace window contents with sorted list currentAlignments.clear(); GetCurrentDisplay()->Empty(); AlignmentList sortedList; for (i=0; i<sortedVector.size(); ++i) sortedList.push_back(sortedVector[i]); AddAlignments(sortedList);}END_SCOPE(Cn3D)/** ---------------------------------------------------------------------------* $Log: update_viewer.cpp,v $* Revision 1000.3 2004/06/01 18:29:49 gouriano* PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.73** Revision 1.73 2004/05/21 21:41:40 gorelenk* Added PCH ncbi_pch.hpp** Revision 1.72 2004/05/21 17:29:51 thiessen* allow conversion of mime to cdd data** Revision 1.71 2004/03/15 18:38:52 thiessen* prefer prefix vs. postfix ++/-- operators** Revision 1.70 2004/02/19 17:05:20 thiessen* remove cn3d/ from include paths; add pragma to disable annoying msvc warning** Revision 1.69 2004/01/17 00:17:32 thiessen* add Biostruc and network structure load** Revision 1.68 2004/01/05 17:09:16 thiessen* abort import and warn if same accession different gi** Revision 1.67 2003/11/06 18:52:32 thiessen* make geometry violations shown on/off; allow multiple pmid entry in ref dialog** Revision 1.66 2003/09/25 14:11:43 thiessen* don't assume gi Seq-id's for imported structure's sequences** Revision 1.65 2003/08/21 18:27:40 thiessen* change header order for Mac compilation** Revision 1.64 2003/07/14 18:37:08 thiessen* change GetUngappedAlignedBlocks() param types; other syntax changes** Revision 1.63 2003/04/04 14:02:22 thiessen* more informative error messages on structure import** Revision 1.62 2003/04/02 18:03:16 thiessen* fix wxString/string confusion** Revision 1.61 2003/04/02 17:49:18 thiessen* allow pdb id's in structure import dialog** Revision 1.60 2003/03/14 19:57:07 thiessen* adjust wxStringTokenizer mode** Revision 1.59 2003/03/14 19:48:51 thiessen* allow multiple gi's in network sequence import dialog** Revision 1.58 2003/03/13 18:55:17 thiessen* tweak file load error reporting** Revision 1.57 2003/02/03 19:20:08 thiessen* format changes: move CVS Log to bottom of file, remove std:: from .cpp files, and use new diagnostic macros** Revision 1.56 2003/01/31 17:18:58 thiessen* many small additions and changes...** Revision 1.55 2003/01/23 20:03:05 thiessen* add BLAST Neighbor algorithm** Revision 1.54 2002/11/19 21:19:44 thiessen* more const changes for objects; fix user vs default style bug** Revision 1.53 2002/11/06 00:18:10 thiessen* fixes for new CRef/const rules in objects** Revision 1.52 2002/10/27 22:23:51 thiessen* save structure alignments from vastalign.cgi imports** Revision 1.51 2002/10/25 19:00:02 thiessen* retrieve VAST alignment from vastalign.cgi on structure import** Revision 1.50 2002/10/15 22:04:09 thiessen* fix geom vltns bug** Revision 1.49 2002/10/13 22:58:08 thiessen* add redo ability to editor** Revision 1.48 2002/09/30 17:13:02 thiessen* change structure import to do sequences as well; change cache to hold mimes; change block aligner vocabulary; fix block aligner dialog bugs** Revision 1.47 2002/09/26 18:31:24 thiessen* allow simultaneous import of multiple chains from single PDB** Revision 1.46 2002/09/16 21:24:58 thiessen* add block freezing to block aligner** Revision 1.45 2002/09/09 13:38:23 thiessen* separate save and save-as** Revision 1.44 2002/08/15 22:13:18 thiessen* update for wx2.3.2+ only; add structure pick dialog; fix MultitextDialog bug** Revision 1.43 2002/08/13 20:46:37 thiessen* add global block aligner** Revision 1.42 2002/07/27 12:29:52 thiessen* fix block aligner crash** Revision 1.41 2002/07/26 15:28:48 thiessen* add Alejandro's block alignment algorithm** Revision 1.40 2002/07/26 13:07:01 thiessen* fix const object problem** Revision 1.39 2002/07/01 23:17:04 thiessen* skip warning if master choice canceled** Revision 1.38 2002/06/06 01:30:02 thiessen* fixes for linux/gcc** Revision 1.37 2002/06/05 14:28:41 thiessen* reorganize handling of window titles** Revision 1.36 2002/06/04 12:48:56 thiessen* tweaks for release ; fill out help menu** Revision 1.35 2002/05/22 17:17:09 thiessen* progress on BLAST interface ; change custom spin ctrl implementation** Revision 1.34 2002/05/17 19:10:27 thiessen* preliminary range restriction for BLAST/PSSM** Revision 1.33 2002/04/26 19:01:00 thiessen* fix display delete bug** Revision 1.32 2002/03/28 14:06:02 thiessen* preliminary BLAST/PSSM ; new CD startup style** Revision 1.31 2002/03/07 19:16:04 thiessen* don't auto-show sequence windows** Revision 1.30 2002/03/04 15:52:15 thiessen* hide sequence windows instead of destroying ; add perspective/orthographic projection choice** Revision 1.29 2002/02/27 16:29:42 thiessen* add model type flag to general mime type** Revision 1.28 2002/02/22 14:24:01 thiessen* sort sequences in reject dialog ; general identifier comparison** Revision 1.27 2002/02/13 14:53:30 thiessen* add update sort** Revision 1.26 2002/02/12 17:19:22 thiessen* first working structure import** Revision 1.25 2002/02/01 00:41:21 thiessen* tweaks** Revision 1.24 2002/01/24 20:07:57 thiessen* read multiple FAST sequences** Revision 1.23 2002/01/02 02:08:29 thiessen* go back to viewer.cgi to test http/301 forwarding** Revision 1.22 2001/12/15 03:15:59 thiessen* adjustments for slightly changed object loader Set...() API** Revision 1.21 2001/12/12 14:58:10 thiessen* change URL to viewer.fcgi** Revision 1.20 2001/12/06 23:13:47 thiessen* finish import/align new sequences into single-structure data; many small tweaks** Revision 1.19 2001/11/30 14:02:05 thiessen* progress on sequence imports to single structures** Revision 1.18 2001/11/27 16:26:10 thiessen* major update to data management system** Revision 1.17 2001/10/01 16:04:25 thiessen* make CDD annotation window non-modal; add SetWindowTitle to viewers** Revision 1.16 2001/09/27 15:38:00 thiessen* decouple sequence import and BLAST** Revision 1.15 2001/09/20 19:31:30 thiessen* fixes for SGI and wxWin 2.3.2** Revision 1.14 2001/09/19 22:55:39 thiessen* add preliminary net import and BLAST** Revision 1.13 2001/09/18 03:10:46 thiessen* add preliminary sequence import pipeline** Revision 1.12 2001/06/02 17:22:46 thiessen* fixes for GCC** Revision 1.11 2001/05/17 18:34:26 thiessen* spelling fixes; change dialogs to inherit from wxDialog** Revision 1.10 2001/05/02 13:46:28 thiessen* major revision of stuff relating to saving of updates; allow stored null-alignments** Revision 1.9 2001/04/20 18:02:41 thiessen* don't open update viewer right away** Revision 1.8 2001/04/19 12:58:32 thiessen* allow merge and delete of individual updates** Revision 1.7 2001/04/05 22:55:36 thiessen* change bg color handling ; show geometry violations** Revision 1.6 2001/04/04 00:27:15 thiessen* major update - add merging, threader GUI controls** Revision 1.5 2001/03/30 03:07:34 thiessen* add threader score calculation & sorting** Revision 1.4 2001/03/22 00:33:17 thiessen* initial threading working (PSSM only); free color storage in undo stack** Revision 1.3 2001/03/17 14:06:49 thiessen* more workarounds for namespace/#define conflicts** Revision 1.2 2001/03/13 01:25:06 thiessen* working undo system for >1 alignment (e.g., update window)** Revision 1.1 2001/03/09 15:49:06 thiessen* major changes to add initial update viewer**/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -