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

Go to the SVN repository for this file.

1 /* $Id: clear_nomenclature.cpp 37224 2016-12-16 14:54:23Z 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
27  */
28 
29 
30 #include <ncbi_pch.hpp>
32 #include <objmgr/util/feature.hpp>
33 #include <objmgr/util/sequence.hpp>
37 
40 
42 {
43  if (!tse)
44  return CRef<CCmdComposite>(NULL);
45  bool modified = false;
46  CRef<CCmdComposite> composite( new CCmdComposite("Clear Nomenclature") );
47  for (CFeat_CI feat_ci(tse, CSeqFeatData::eSubtype_gene); feat_ci; ++feat_ci)
48  {
49  CRef<CSeq_feat> new_feat(new CSeq_feat());
50  new_feat->Assign(feat_ci->GetOriginalFeature());
51 
52  if (new_feat->IsSetData() && new_feat->GetData().IsGene() && new_feat->GetData().GetGene().IsSetFormal_name())
53  {
54  new_feat->SetData().SetGene().ResetFormal_name();
55  composite->AddCommand(*CRef<CCmdChangeSeq_feat>(new CCmdChangeSeq_feat(feat_ci->GetSeq_feat_Handle(), *new_feat)));
56  modified = true;
57  }
58  }
59 
60  if (!modified)
61  composite.Reset();
62  return composite;
63 }
64 
65 
static CRef< CCmdComposite > apply(CSeq_entry_Handle tse)
void AddCommand(IEditCommand &command)
CFeat_CI –.
Definition: feat_ci.hpp:64
CSeq_entry_Handle –.
namespace ncbi::objects::
Definition: Seq_feat.hpp:58
USING_SCOPE(ncbi::objects)
#define NULL
Definition: ncbistd.hpp:225
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
void Reset(void)
Reset reference object.
Definition: ncbiobj.hpp:773
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
bool IsSetFormal_name(void) const
Check if a value has been assigned to Formal_name data member.
Definition: Gene_ref_.hpp:828
bool IsSetData(void) const
the specific data Check if a value has been assigned to Data data member.
Definition: Seq_feat_.hpp:913
bool IsGene(void) const
Check if variant Gene is selected.
const TData & GetData(void) const
Get the Data member data.
Definition: Seq_feat_.hpp:925
void SetData(TData &value)
Assign a value to Data data member.
Definition: Seq_feat_.cpp:94
const TGene & GetGene(void) const
Get the variant data.
Modified on Sat Dec 09 04:45:37 2023 by modify_doxy.py rev. 669887