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

Go to the SVN repository for this file.

1 /* $Id: modify_bsrc_interface.cpp 42254 2019-01-22 15:22:29Z asztalos $
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
27  */
28 
29 
30 #include <ncbi_pch.hpp>
32 #include <objmgr/feat_ci.hpp>
36 
39 
40 
42 {
43  x_ApplyToDescriptors(*(m_Seh.GetCompleteSeq_entry()), composite);
44 
45  for (CFeat_CI feat_it(m_Seh, SAnnotSelector(CSeqFeatData::e_Biosrc)); feat_it; ++feat_it) {
46  CRef<CSeq_feat> new_feat(new CSeq_feat());
47  new_feat->Assign(feat_it->GetOriginalFeature());
48  if (x_ApplyToBioSource(new_feat->SetData().SetBiosrc())) {
49  CRef<CCmdChangeSeq_feat> cmd(new CCmdChangeSeq_feat(*feat_it, *new_feat));
50  composite->AddCommand(*cmd);
51  }
52  }
53 }
54 
56 {
58  if ((*it)->IsSource()) {
59  const CSeqdesc& orig_desc = **it;
60  CRef<CSeqdesc> new_desc(new CSeqdesc);
61  new_desc->Assign(orig_desc);
62  if (x_ApplyToBioSource(new_desc->SetSource())) {
63  CRef<CCmdChangeSeqdesc> cmd(new CCmdChangeSeqdesc(m_Seh.GetScope().GetSeq_entryHandle(se), orig_desc, *new_desc));
64  composite->AddCommand(*cmd);
65  }
66  }
67  }
68 
69  if (se.IsSet()) {
71  x_ApplyToDescriptors(**it, composite);
72  }
73  }
74 }
75 
77 {
78  if (!tse)
79  return CRef<CCmdComposite>();
80 
81  m_Seh = tse;
82  CRef<CCmdComposite> composite(new CCmdComposite(title));
83  x_ApplyToSeqAndFeat(composite);
84  return composite;
85 }
86 
88 
void AddCommand(IEditCommand &command)
CFeat_CI –.
Definition: feat_ci.hpp:64
CSeq_entry_Handle –.
Definition: Seq_entry.hpp:56
namespace ncbi::objects::
Definition: Seq_feat.hpp:58
CRef< CCmdComposite > x_GetCommand(objects::CSeq_entry_Handle tse, const string &title)
void x_ApplyToDescriptors(const objects::CSeq_entry &se, CCmdComposite *composite)
objects::CSeq_entry_Handle m_Seh
virtual bool x_ApplyToBioSource(objects::CBioSource &biosource)=0
void x_ApplyToSeqAndFeat(CCmdComposite *composite)
static CS_COMMAND * cmd
Definition: ct_dynamic.c:26
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
#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 SetData(TData &value)
Assign a value to Data data member.
Definition: Seq_feat_.cpp:94
const TSet & GetSet(void) const
Get the variant data.
Definition: Seq_entry_.cpp:124
bool IsSet(void) const
Check if variant Set is selected.
Definition: Seq_entry_.hpp:263
TSource & SetSource(void)
Select the variant.
Definition: Seqdesc_.cpp:572
USING_SCOPE(objects)
#define FOR_EACH_SEQENTRY_ON_SEQSET(Itr, Var)
FOR_EACH_SEQENTRY_ON_SEQSET EDIT_EACH_SEQENTRY_ON_SEQSET.
#define FOR_EACH_SEQDESC_ON_SEQENTRY(Itr, Var)
FOR_EACH_SEQDESC_ON_SEQENTRY EDIT_EACH_SEQDESC_ON_SEQENTRY.
SAnnotSelector –.
Modified on Sun Jun 23 05:21:44 2024 by modify_doxy.py rev. 669887