NCBI C++ ToolKit
cmd_convert_to_delayed_gen-prod-set_quals.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: cmd_convert_to_delayed_gen-prod-set_quals.cpp 41022 2018-05-10 15:14:39Z 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: Igor Filippov
27  */
28 
29 
30 #include <ncbi_pch.hpp>
31 
32 #include <objmgr/feat_ci.hpp>
34 
37 
39 
42 
43 
45 {
46  CRef<CCmdComposite> composite( new CCmdComposite("Convert to Delayed Gen-Prod-Set Qualifiers") );
47  for (CFeat_CI feat_ci(m_seh); feat_ci; ++feat_ci)
48  {
49  const CSeq_feat& orig = feat_ci->GetOriginalFeature();
50  if (orig.IsSetData()
51  && (orig.GetData().GetSubtype() == CSeqFeatData::eSubtype_cdregion || orig.GetData().GetSubtype() == CSeqFeatData::eSubtype_mRNA))
52  {
53  CRef<CSeq_feat> new_feat(new CSeq_feat());
54  new_feat->Assign(orig);
55  bool changed = false;
56  EDIT_EACH_GBQUAL_ON_SEQFEAT(qual, *new_feat)
57  {
58  if ((*qual)->IsSetQual())
59  {
60  if ((*qual)->GetQual() == "protein_id")
61  {
62  (*qual)->SetQual() = "orig_protein_id";
63  changed = true;
64  }
65  if ((*qual)->GetQual() == "transcript_id")
66  {
67  (*qual)->SetQual() = "orig_transcript_id";
68  changed = true;
69  }
70  }
71  }
72  if (changed)
73  {
74  composite->AddCommand(*CRef<CCmdChangeSeq_feat>(new CCmdChangeSeq_feat(feat_ci->GetSeq_feat_Handle(), *new_feat)));
75  }
76  }
77  }
78 
79  return CIRef<IEditCommand>(composite);
80 }
81 
83 {
84  return "Convert to Delayed Gen-Prod-Set Qualifiers";
85 }
86 
void AddCommand(IEditCommand &command)
CFeat_CI –.
Definition: feat_ci.hpp:64
namespace ncbi::objects::
Definition: Seq_feat.hpp:58
USING_SCOPE(objects)
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
where boath are integers</td > n< td ></td > n</tr > n< tr > n< td > tse</td > n< td > optional</td > n< td > String</td > n< td class=\"description\"> TSE option controls what blob is orig
Utility macros and typedefs for exploring NCBI objects from seqfeat.asn.
#define EDIT_EACH_GBQUAL_ON_SEQFEAT(Itr, Var)
Modified on Sat Dec 02 09:19:54 2023 by modify_doxy.py rev. 669887