wbplg_aligner.cpp

来自「ncbi源码」· C++ 代码 · 共 559 行 · 第 1/2 页

CPP
559
字号
        CRef<CSeq_align> align(new CSeq_align());        CNWFormatter formatter (*aligner);        formatter.AsSeqAlign(align);        // we need to set the IDs correctly        TIds::iterator seq_id_iter = seq_ids.begin();        NON_CONST_ITERATE(CDense_seg::TIds, iter,                          align->SetSegs().SetDenseg().SetIds()) {            (*iter)->Assign(**seq_id_iter++);        }        // pack the alignment in a Seq-annot and label it appropriately        CRef<CSeq_annot> annot(new CSeq_annot());        annot->SetData().SetAlign().push_back(align);        // prepare a title        string str;        ITERATE (vector<string>, iter, seq_labels) {            if ( !str.empty() ) {                str += " + ";            }            str += *iter;        }        str = "Global alignment of " + str;        annot->AddTitle(str);        CTime time;        time.GetLocalTime();        str = "This alignment was produced on ";        str += time.AsString();        str += " using the Needleman-Wunsch alignment algorithm";        annot->AddComment(str);        CRef<CAnnotdesc> desc(new CAnnotdesc());        desc->SetCreate_date().SetStr(time.AsString());        annot->SetDesc().Set().push_back(desc);        //        // pass back to the system.  We may use the same scope and just attach,        // if that is appropriate        //        CConstRef<IDocument> doc_ref;        ITERATE (plugin_args::TLocList, iter, locs) {            if ( !doc_ref ) {                doc_ref.Reset(iter->first);            } else if (iter->first != doc_ref) {                doc_ref.Reset();                break;            }        }        if ( !doc_ref ) {            //            // query and targets come from different documents            // create a new one to handle the results            //            CRef<CScope> new_scope(new CScope(CDocManager::GetObjectManager()));            ITERATE (plugin_args::TLocList, iter, locs) {                new_scope->AddScope(iter->first->GetScope());            }            doc_ref.Reset(CDocManager::CreateDocument(*new_scope, *annot));        } else {            reply.AddAction(CPluginReplyAction::e_Add_to_document);        }        reply.AddObject(*doc_ref, *annot);        reply.SetStatus(eMessageStatus_success);    }    catch (CException& e) {        NcbiMessageBox("Global alignment failed:\n" + e.GetMsg());    }    catch(exception& e) {        NcbiMessageBox(string("Global alignment failed:\n") + e.what());    }}END_NCBI_SCOPE/* * =========================================================================== * $Log: wbplg_aligner.cpp,v $ * Revision 1000.4  2004/06/01 20:54:41  gouriano * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.54 * * Revision 1.54  2004/05/25 17:11:53  dicuccio * Deprecated old message box dialog in favor of standard progress dialog * * Revision 1.53  2004/05/21 22:27:46  gorelenk * Added PCH ncbi_pch.hpp * * Revision 1.52  2004/05/20 12:35:49  dicuccio * Removed dead code * * Revision 1.51  2004/05/17 15:11:44  kapustin * Initial revision * * Revision 1.50  2004/04/07 12:58:39  dicuccio * Removed dependence on gi for seq-id.  Changed default view to multiple * alignment view.  Cleaned up handling of view request / results processing * * Revision 1.49  2004/03/05 17:34:17  dicuccio * Use sequence::GetId() to retrieve GI-based ID * * Revision 1.48  2004/01/27 18:40:29  dicuccio * Code clean-up.  Renamed plugin classes to follow standard pattern * * Revision 1.47  2004/01/07 15:50:35  dicuccio * Adjusted for API change in CPluginUtils::GetLabel().  Standardized exception * reporting in algorithms. * * Revision 1.46  2003/12/22 19:26:29  dicuccio * Code reformatting.  Don't post a plugin message directly - use * CPluginUtils::CallPlugin() * * Revision 1.45  2003/12/09 15:46:16  dicuccio * Minor formatting change * * Revision 1.44  2003/11/24 15:45:24  dicuccio * Renamed CVersion to CPluginVersion * * Revision 1.43  2003/11/04 17:49:22  dicuccio * Changed calling parameters for plugins - pass CPluginMessage instead of paired * CPluginCommand/CPluginReply * * Revision 1.42  2003/10/27 17:47:04  dicuccio * Removed dead #includes * * Revision 1.41  2003/10/07 13:46:59  dicuccio * Renamed CPluginURL* to CPluginValue* * * Revision 1.40  2003/09/30 19:50:57  kapustin * Adjust for standard score matrix interface * * Revision 1.39  2003/09/04 14:05:23  dicuccio * Use IDocument instead of CDocument * * Revision 1.38  2003/09/03 14:46:52  rsmith * change namespace name from args to plugin_args to avoid clashes with variable names. * * Revision 1.37  2003/09/02 22:47:50  kapustin * Adjust for algo/align changes * * Revision 1.36  2003/09/02 17:08:06  rsmith * remove namespace name and variable name clash. * * Revision 1.35  2003/08/21 18:44:01  vasilche * Use CSeqVector::IsNucleotide() method instead of GetSequenceType(). * * Revision 1.34  2003/08/21 12:03:07  dicuccio * Make use of new typedef in plugin_utils.hpp for argument values. * * Revision 1.33  2003/08/05 17:07:16  dicuccio * Changed calling semantics for the message queue - pass by reference, not * CConstRef<> * * Revision 1.32  2003/07/31 17:02:26  dicuccio * Changed plugin message queue class name to be application agnostic * * Revision 1.31  2003/07/23 19:14:09  dicuccio * Moved logic for validating plugin arguments into CPluginUtils. * * Revision 1.30  2003/07/22 15:32:15  dicuccio * Changed to make use of new API in plugin_utils.hpp - GetArgValue() * * Revision 1.29  2003/07/14 11:10:18  shomrat * Plugin messageing system related changes * * Revision 1.28  2003/06/26 15:33:40  dicuccio * Moved GetURLValue() from PluginURL.hpp to plugin_utils.hpp.  Fixed * compilation errors relating to missing #includes * * Revision 1.27  2003/06/25 17:02:56  dicuccio * Split CPluginHandle into a handle (pointer-to-implementation) and * implementation file.  Lots of #include file clean-ups. * * Revision 1.26  2003/06/20 14:52:35  dicuccio * Revised plugin registration - moved GetInfo() into the plugin handler * * Revision 1.25  2003/06/17 16:41:43  dicuccio * Fix #includes after algo/ rearrangement * * Revision 1.24  2003/06/09 19:25:58  dicuccio * Added <stdio.h> for sprintf()** Revision 1.23  2003/06/02 16:06:20  dicuccio* Rearranged src/objects/ subtree.  This includes the following shifts:*     - src/objects/asn2asn --> arc/app/asn2asn*     - src/objects/testmedline --> src/objects/ncbimime/test*     - src/objects/objmgr --> src/objmgr*     - src/objects/util --> src/objmgr/util*     - src/objects/alnmgr --> src/objtools/alnmgr*     - src/objects/flat --> src/objtools/flat*     - src/objects/validator --> src/objtools/validator*     - src/objects/cddalignview --> src/objtools/cddalignview* In addition, libseq now includes six of the objects/seq... libs, and libmmdb* replaces the three libmmdb? libs.** Revision 1.22  2003/05/30 20:23:43  kapustin* Fix sequence index typo** Revision 1.21  2003/05/30 20:05:43  kapustin* Support arbitrarily sized sequences** Revision 1.20  2003/05/19 13:38:32  dicuccio* Moved gui/core/plugin/ --> gui/plugin/.  Merged core libraries* into libgui_core** Revision 1.19  2003/05/12 16:08:40  dicuccio* Updated to use new plugin action args** Revision 1.18  2003/05/08 18:27:56  kapustin* Allow specification of plugin's arguments** Revision 1.17  2003/04/30 14:09:42  dicuccio* Updated Needleman-Wunsch plugin - produce a Seq-annot as a document;* launch a default graphical view (cross alignment viewer)    *    * Revision 1.16  2003/04/24 16:37:30  dicuccio    * Updated to reflect changes in plugin API    *    * Revision 1.15  2003/04/22 16:29:00  kapustin    * Fix memory limit typo    *    * Revision 1.14  2003/04/22 16:18:36  kapustin    * Support aminoacid sequences. Set memory limit.    *    * Revision 1.13  2003/04/03 01:08:24  ucko    * Adjust for new FormatAsText interface.    *    * Revision 1.12  2003/03/12 21:12:47  kapustin    * Use text buffer provided by the aligner to store text messages    *    * Revision 1.11  2003/03/11 15:23:29  kuznets    * iterate -> ITERATE    *    * Revision 1.10  2003/03/05 21:23:11  kapustin    * Reflect new CNWAligner::FormatAsText() call    *    * Revision 1.9  2003/02/26 14:31:46  dicuccio    * General clean-up.  Fixed passing of arguments - alignment should work now.    *    * Revision 1.8  2003/02/25 14:44:34  dicuccio    * Changed accessors to match API changes in plugin arguments    *    * Revision 1.7  2003/02/24 13:03:14  dicuccio    * Renamed classes in plugin spec:    *     CArgSeg --> CPluginArgSet    *     CArgument --> CPluginArg    *     CPluginArgs --> CPluginCommand    *     CPluginCommands --> CPluginCommandSet    *    * Revision 1.6  2003/02/21 17:13:54  dicuccio    * Changed enums in CDlgMessageBox - added leading 'e' to avoid    * impossible-to-remove conflict with Windows code.    *    * Revision 1.5  2003/02/20 19:49:53  dicuccio    * Created new plugin architecture, based on ASN.1 spec. Moved GBENCH frameowrk    * over to use new plugin architecture.    *    * Revision 1.4  2003/02/05 17:23:21  ucko    * When going from CNcbiOstrstream to char* via CNcbiOstrstreamToString,    * explicitly use an intermediate string variable to avoid confusing some    * compilers (GCC 2.9x at least).    *    * Revision 1.3  2003/02/04 22:58:33  kapustin    * Split plugin activation into x_Verify() and x_Run(). Add progress callback    *    * Revision 1.2  2003/01/29 19:39:54  kapustin    * Increase output line width    *    * Revision 1.1  2003/01/29 19:10:37  kapustin    * Initial revision    *    * ===========================================================================    */

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?