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

Go to the SVN repository for this file.

1 /* $Id: cmd_create_align.cpp 32605 2015-03-31 18:50:15Z filippov $
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: Igor Filippov based on work by Roman Katargin
27  */
28 
29 
30 #include <ncbi_pch.hpp>
31 
32 #include <objmgr/seq_entry_ci.hpp>
33 #include <objmgr/seq_annot_ci.hpp>
34 
36 
37 
40 
42 {
43  CSeq_annot_Handle annot;
44 
46  for (; annot_ci; ++annot_ci) {
47  if ((*annot_ci).IsAlign()) {
48  annot = *annot_ci;
49  break;
50  }
51  }
52 
53  CSeq_entry_EditHandle eh = m_seh.GetEditHandle();
54 
55  if (!annot) {
56  CRef<CSeq_annot> new_annot(new CSeq_annot());
57  annot = m_AnnotCreated = eh.AttachAnnot(*new_annot);
58  }
59 
60  CSeq_annot_EditHandle aeh(annot);
61  m_ah = aeh.AddAlign(*m_Align);
62 }
63 
65 {
66  m_ah.Remove();
67 
68  if (m_AnnotCreated) {
69  m_AnnotCreated.Remove();
70  }
71 }
72 
74 {
75  return "Create Alignment";
76 }
77 
objects::CSeq_align_Handle m_ah
CConstRef< objects::CSeq_align > m_Align
virtual void Unexecute()
Undo (opposite to Execute())
virtual void Execute()
Do the editing action.
virtual string GetLabel()
objects::CSeq_annot_EditHandle m_AnnotCreated
objects::CSeq_entry_Handle m_seh
CSeq_annot_CI –.
CSeq_annot_Handle –.
CSeq_entry_Handle –.
USING_SCOPE(objects)
CSeq_annot_EditHandle AttachAnnot(CSeq_annot &annot) const
Attach an annotation.
CSeq_align_Handle AddAlign(const CSeq_align &new_obj) const
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
Modified on Sun Mar 03 03:16:37 2024 by modify_doxy.py rev. 669887