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

Go to the SVN repository for this file.

1 /* $Id: remove_xrefs.cpp 42313 2019-01-31 16:20:31Z 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>
33 #include <objmgr/feat_ci.hpp>
40 
43 
44 
46 {
47  feat->ResetDbxref();
48 }
49 
51 {
52  CRef<CCmdComposite> cmd(new CCmdComposite("Remove DBXrefs From Features"));
53  FindFeatures(seh,type,cmd);
54  cmd_processor->Execute(cmd);
55 }
56 
57 
58 
60 {
61  biosource.SetOrg().ResetDb();
62 }
63 
65 {
66  CRef<CCmdComposite> cmd(new CCmdComposite("Remove DBXrefs From BioSource"));
67  FindBioSource(seh,cmd);
68  cmd_processor->Execute(cmd);
69 }
70 
72 {
73  CRef<CCmdComposite> cmd(new CCmdComposite("Remove DBXrefs From BioSource And Features"));
76  cmd_processor->Execute(cmd);
77 }
78 
80 {
81  if (!feat->IsSetDbxref())
82  return;
83 
84  CSeq_feat::TDbxref::iterator dbtag = feat->SetDbxref().begin();
85  while ( dbtag != feat->SetDbxref().end() )
86  {
87  if ((*dbtag)->IsSetDb() && (*dbtag)->GetDb() == "taxon")
88  {
89  dbtag = feat->SetDbxref().erase(dbtag);
90  }
91  else
92  ++dbtag;
93  }
94  if (feat->SetDbxref().empty())
95  feat->ResetDbxref();
96 }
97 
99 {
100  CRef<CCmdComposite> cmd(new CCmdComposite("Remove Taxons From Features"));
102  cmd_processor->Execute(cmd);
103 }
104 
106 {
107  COrg_ref::TDb::iterator dbtag = biosource.SetOrg().SetDb().begin();
108  while ( dbtag != biosource.SetOrg().SetDb().end() )
109  {
110  if ((*dbtag)->IsSetDb() && (*dbtag)->GetDb() == "taxon")
111  {
112  dbtag = biosource.SetOrg().SetDb().erase(dbtag);
113  }
114  else
115  ++dbtag;
116  }
117  if (biosource.GetOrg().GetDb().empty())
118  biosource.SetOrg().ResetDb();
119 }
120 
122 {
123  CRef<CCmdComposite> cmd(new CCmdComposite("Remove Taxons From Features and BioSource"));
126  cmd_processor->Execute(cmd);
127 }
128 
static void rm_dbxref_from_biosource_and_feats(objects::CSeq_entry_Handle seh, ICommandProccessor *cmd_processor)
static void rm_dbxref_from_biosource(objects::CSeq_entry_Handle seh, ICommandProccessor *cmd_processor)
static void ModifyBioSource(objects::CBioSource &biosource)
static void ModifyFeature(CRef< objects::CSeq_feat > feat)
static void rm_dbxref_from_feat(objects::CSeq_entry_Handle seh, objects::CSeqFeatData::E_Choice type, ICommandProccessor *cmd_processor)
static void ModifyBioSource(objects::CBioSource &biosource)
static void rm_taxon_from_feats_and_biosource(objects::CSeq_entry_Handle seh, ICommandProccessor *cmd_processor)
static void rm_taxon_from_feats(objects::CSeq_entry_Handle seh, ICommandProccessor *cmd_processor)
static void ModifyFeature(CRef< objects::CSeq_feat > feat)
static void FindFeatures(objects::CSeq_entry_Handle seh, objects::CSeqFeatData::E_Choice type, CRef< CCmdComposite > cmd)
static void FindBioSource(objects::CSeq_entry_Handle tse, CRef< CCmdComposite > composite)
CSeq_entry_Handle –.
Undo/Redo interface for editing operations.
virtual void Execute(IEditCommand *command, wxWindow *window=0)=0
static CS_COMMAND * cmd
Definition: ct_dynamic.c:26
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
const TOrg & GetOrg(void) const
Get the Org member data.
Definition: BioSource_.hpp:509
void SetOrg(TOrg &value)
Assign a value to Org data member.
Definition: BioSource_.cpp:108
const TDb & GetDb(void) const
Get the Db member data.
Definition: Org_ref_.hpp:491
TDbxref & SetDbxref(void)
Assign a value to Dbxref data member.
Definition: Seq_feat_.hpp:1339
E_Choice
Choice variants.
void ResetDbxref(void)
Reset Dbxref data member.
Definition: Seq_feat_.cpp:188
bool IsSetDbxref(void) const
support for xref to other databases Check if a value has been assigned to Dbxref data member.
Definition: Seq_feat_.hpp:1321
@ e_not_set
No variant selected.
USING_SCOPE(ncbi::objects)
Utility macros and typedefs for exploring NCBI objects from seqfeat.asn.
Utility macros and typedefs for exploring NCBI objects from seqset.asn.
Definition: type.c:6
Modified on Thu Jun 13 17:28:25 2024 by modify_doxy.py rev. 669887