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

Go to the SVN repository for this file.

1 /* $Id: transg_src.cpp 28832 2013-09-04 16:47:31Z chenj $
2  * ===========================================================================
3  *
4  *
5  * PUBLIC DOMAIN NOTICE
6  * National Center for Biotechnology Information
7  *
8  * This software/database is a "United States Government Work" under the
9  * terms of the United States Copyright Act. It was written as part of
10  * the author's official duties as a United States Government employee and
11  * thus cannot be copyrighted. This software/database is freely available
12  * to the public for use. The National Library of Medicine and the U.S.
13  * Government have not placed any restriction on its use or reproduction.
14  *
15  * Although all reasonable efforts have been taken to ensure the accuracy
16  * and reliability of the software and data, the NLM and the U.S.
17  * Government do not and cannot warrant the performance or results that
18  * may be obtained by using this software or data. The NLM and the U.S.
19  * Government disclaim all warranties, express or implied, including
20  * warranties of performance, merchantability or fitness for any particular
21  * purpose.
22  *
23  * Please cite the author in any work or product based on this material.
24  *
25  * ===========================================================================
26  *
27  * Authors: Jie Chen
28  * File: Set transgenic BioSource
29  *
30  */
31 
32 #include <ncbi_pch.hpp>
33 #include <objmgr/bioseq_ci.hpp>
34 #include <objmgr/seqdesc_ci.hpp>
35 #include <objmgr/feat_ci.hpp>
36 #include <objects/seq/Seqdesc.hpp>
38 
40 
41 using namespace ncbi;
42 using namespace objects;
43 
45 {
46  if (!biosrc.CanGetSubtype()) return false;
47  ITERATE (list <CRef <CSubSource> >, it, biosrc.GetSubtype()) {
48  if ((*it)->GetSubtype() == CSubSource :: eSubtype_transgenic) return true;
49  }
50  return false;
51 };
52 
54 {
55  for (CBioseq_CI bit(tse); bit; ++bit) {
56  CSeqdesc_CI s_ci(*bit, CSeqdesc::e_Source);
57  if ( s_ci && CFeat_CI(*bit, CSeqFeatData::e_Biosrc) ) {
58  if (!x_HasTransgenicSubtype(s_ci->GetSource())) {
59  CRef <CBioSource> new_obj(new CBioSource);
60  new_obj->Assign(s_ci->GetSource());
61  CRef <CSubSource> new_subsrc(new CSubSource);
63  new_subsrc->SetName(" ");
64  new_obj->SetSubtype().push_back(new_subsrc);
65  add_to_cmd<objects::CBioSource> (
66  (CObject*)(&(s_ci->GetSource())), (CObject*)(new_obj.GetPointer()), composite);
67  }
68  }
69  }
70 };
CBioseq_CI –.
Definition: bioseq_ci.hpp:69
CFeat_CI –.
Definition: feat_ci.hpp:64
CSeq_entry_Handle –.
CSeqdesc_CI –.
Definition: seqdesc_ci.hpp:65
bool x_HasTransgenicSubtype(const CBioSource &biosrc)
Definition: transg_src.cpp:44
virtual void apply_to(const CSeq_entry_Handle &tse, CRef< CCmdComposite > composite)
Definition: transg_src.cpp:53
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
Definition: ncbimisc.hpp:815
virtual void Assign(const CSerialObject &source, ESerialRecursionMode how=eRecursive)
Set object to copy of another one.
TObjectType * GetPointer(void) THROWS_NONE
Get pointer,.
Definition: ncbiobj.hpp:998
const TSubtype & GetSubtype(void) const
Get the Subtype member data.
Definition: BioSource_.hpp:539
void SetSubtype(TSubtype value)
Assign a value to Subtype data member.
Definition: SubSource_.hpp:319
bool CanGetSubtype(void) const
Check if it is safe to call GetSubtype method.
Definition: BioSource_.hpp:533
void SetName(const TName &value)
Assign a value to Name data member.
Definition: SubSource_.hpp:359
TSubtype & SetSubtype(void)
Assign a value to Subtype data member.
Definition: BioSource_.hpp:545
const TSource & GetSource(void) const
Get the variant data.
Definition: Seqdesc_.cpp:566
@ e_Source
source of materials, includes Org-ref
Definition: Seqdesc_.hpp:133
Magic spell ;-) needed for some weird compilers... very empiric.
Modified on Sat Dec 02 09:23:17 2023 by modify_doxy.py rev. 669887