NCBI C++ ToolKit
cmd_cleanup.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: cmd_cleanup.cpp 41007 2018-05-09 18:36:32Z katargir $
2  * ===========================================================================
3  *
4  * PUBLIC DOMAIN NOTICE
5  * National Center for Biotechnology Information
6  *
7  * This software/database is a "United States Government Work" under the
8  * terms of the United States Copyright Act. It was written as part of
9  * the author's official duties as a United States Government employee and
10  * thus cannot be copyrighted. This software/database is freely available
11  * to the public for use. The National Library of Medicine and the U.S.
12  * Government have not placed any restriction on its use or reproduction.
13  *
14  * Although all reasonable efforts have been taken to ensure the accuracy
15  * and reliability of the software and data, the NLM and the U.S.
16  * Government do not and cannot warrant the performance or results that
17  * may be obtained by using this software or data. The NLM and the U.S.
18  * Government disclaim all warranties, express or implied, including
19  * warranties of performance, merchantability or fitness for any particular
20  * purpose.
21  *
22  * Please cite the author in any work or product based on this material.
23  *
24  * ===========================================================================
25  *
26  * Authors: Colleen Bollin
27  */
28 
29 
30 #include <ncbi_pch.hpp>
31 
34 
37 
38 #include "cmd_cleanup.hpp"
39 
42 
43 
45 {
46  CConstRef<CSeq_entry> entry = m_seh.GetCompleteSeq_entry();
48  copy->Assign(*entry);
49 
51  CScope scope2(*objmgr);
52  scope2.AddDefaults();
53  CSeq_entry_Handle new_seh = scope2.AddTopLevelSeqEntry(*copy);
54 
55  if (m_DoTax) {
57  if (tax) {
58  tax->Execute();
59  }
60  }
61 
63  cleanup.SetScope(&scope2);
64 
65  // perform BasicCleanup and ExtendedCleanup
66  try {
68  if (m_Extended) {
69  // basic cleanup is intrinsically part of ExtendedCleanup
70  changes = cleanup.ExtendedCleanup(new_seh, CCleanup::eClean_SyncGenCodes|CCleanup::eClean_KeepTopSet);
71  } else {
72  changes = cleanup.BasicCleanup(const_cast<CSeq_entry&>(*copy), CCleanup::eClean_SyncGenCodes);
73  }
74  } catch (CException& e) {
75  LOG_POST(Error << "error in cleanup: " << e.GetMsg());
76  }
77 
79  return CIRef<IEditCommand>(clean);
80 }
81 
83 {
84  return "Cleanup";
85 }
86 
@ eClean_KeepTopSet
Definition: cleanup.hpp:78
@ eClean_SyncGenCodes
Definition: cleanup.hpp:76
virtual CIRef< IEditCommand > x_CreateActionCmd()
Definition: cmd_cleanup.cpp:44
objects::CSeq_entry_Handle m_seh
Definition: cmd_cleanup.hpp:57
virtual string GetLabel()
Definition: cmd_cleanup.cpp:82
virtual void Execute()
Do the editing action.
CScope –.
Definition: scope.hpp:92
CSeq_entry_Handle –.
Definition: Seq_entry.hpp:56
USING_SCOPE(objects)
static void cleanup(void)
Definition: ct_dynamic.c:30
#define LOG_POST(message)
This macro is deprecated and it's strongly recomended to move in all projects (except tests) to macro...
Definition: ncbidiag.hpp:226
void Error(CExceptionArgs_Base &args)
Definition: ncbiexpt.hpp:1197
const string & GetMsg(void) const
Get message string.
Definition: ncbiexpt.cpp:461
static CRef< CObjectManager > GetInstance(void)
Return the existing object manager or create one.
CSeq_entry_Handle AddTopLevelSeqEntry(CSeq_entry &top_entry, TPriority pri=kPriority_Default, EExist action=eExist_Default)
Add seq_entry, default priority is higher than for defaults or loaders Add object to the score with p...
Definition: scope.cpp:522
void AddDefaults(TPriority pri=kPriority_Default)
Add default data loaders from object manager.
Definition: scope.cpp:504
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
void copy(Njn::Matrix< S > *matrix_, const Njn::Matrix< T > &matrix0_)
Definition: njn_matrix.hpp:613
The Object manager core.
CRef< CCmdComposite > TaxonomyLookupCommand(objects::CSeq_entry_Handle seh)
Modified on Sun Mar 03 03:14:53 2024 by modify_doxy.py rev. 669887