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

Go to the SVN repository for this file.

1 /* $Id: Molinfo_field.cpp 66262 2015-02-17 21:53:17Z dicuccio $
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  * Author: J. Chen
27  *
28  * File Description:
29  * GetSequenceQualFromBioseq
30  *
31  * Remark:
32  * This code was originally generated by application DATATOOL
33  * using the following specifications:
34  * 'macro.asn'.
35  */
36 
37 // standard includes
38 #include <ncbi_pch.hpp>
39 
40 // generated includes
42 #include <objects/seq/MolInfo.hpp>
43 #include <objects/seq/Seq_inst.hpp>
44 
45 // generated classes
46 
48 
49 BEGIN_objects_SCOPE // namespace ncbi::objects::
50 
51 // destructor
53 {
54 }
55 
57 {
58  if (bioseq.Empty()) return kEmptyStr;
59  const CMolInfo* molinfo = 0;
60  if (bioseq->CanGetDescr()) {
61  ITERATE (list <CRef <CSeqdesc> >, it, bioseq->GetDescr().Get()) {
62  if ((*it)->IsMolinfo()) {
63  molinfo = &((*it)->GetMolinfo());
64  }
65  }
66  }
67 
68  string rval(kEmptyStr);
69  switch (Which()) {
70  case e_Molecule:
71  if (molinfo) {
72  rval = CMolInfo::ENUM_METHOD_NAME(EBiomol)()
73  ->FindName(molinfo->GetBiomol(), true);
74  }
75  break;
76  case e_Technique:
77  if (molinfo) {
78  rval = CMolInfo::ENUM_METHOD_NAME(ETech)()
79  ->FindName(molinfo->GetTech(), true);
80  }
81  break;
82  case e_Completedness:
83  if (molinfo) {
84  rval = CMolInfo::ENUM_METHOD_NAME(ECompleteness)()
85  ->FindName(molinfo->GetCompleteness(), true);
86  }
87  break;
88  case e_Mol_class:
89  rval = CSeq_inst::ENUM_METHOD_NAME(EMol)()
90  ->FindName(bioseq->GetInst().GetMol(), true);
91  if (rval == "dna" || rval == "rna") {
92  rval = NStr::ToUpper(rval);
93  }
94  else if (rval == "aa") {
95  rval = "protein";
96  }
97  else if (rval == "na") {
98  rval = "nucleotide";
99  }
100  break;
101  case e_Topology:
102  if (bioseq->GetInst().CanGetTopology()) {
103  rval = CSeq_inst::ENUM_METHOD_NAME(ETopology)()
104  ->FindName(bioseq->GetInst().GetTopology(), true);
105  }
106  break;
107  case e_Strand:
108  if (bioseq->GetInst().CanGetStrand()) {
110  ->FindName(bioseq->GetInst().GetStrand(), true);
111  if (rval == "ss") {
112  rval = "single";
113  }
114  else if (rval == "ds") {
115  rval = "double";
116  }
117  }
118  break;
119  default: break;
120  }
121  if (rval == "unknown" || rval == "not-set") rval = kEmptyStr;
122  return rval;
123 };
124 
125 END_objects_SCOPE // namespace ncbi::objects::
126 
128 
129 /* Original file checksum: lines: 57, chars: 1732, CRC32: db1a7fa6 */
User-defined methods of the data storage class.
string GetSequenceQualFromBioseq(CConstRef< CBioseq > bioseq) const
EStrand
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
Definition: ncbimisc.hpp:815
#define ENUM_METHOD_NAME(EnumName)
Definition: serialbase.hpp:994
bool Empty(void) const THROWS_NONE
Check if CConstRef is empty – not pointing to any object which means having a null value.
Definition: ncbiobj.hpp:1385
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
#define kEmptyStr
Definition: ncbistr.hpp:123
static string & ToUpper(string &str)
Convert string to upper case – string& version.
Definition: ncbistr.cpp:424
E_Choice Which(void) const
Which variant is currently selected.
TStrand GetStrand(void) const
Get the Strand member data.
Definition: Seq_inst_.hpp:777
bool CanGetStrand(void) const
Check if it is safe to call GetStrand method.
Definition: Seq_inst_.hpp:764
const TInst & GetInst(void) const
Get the Inst member data.
Definition: Bioseq_.hpp:336
TTopology GetTopology(void) const
Get the Topology member data.
Definition: Seq_inst_.hpp:733
bool CanGetTopology(void) const
Check if it is safe to call GetTopology method.
Definition: Seq_inst_.hpp:714
TTech GetTech(void) const
Get the Tech member data.
Definition: MolInfo_.hpp:497
const Tdata & Get(void) const
Get the member data.
Definition: Seq_descr_.hpp:166
bool CanGetDescr(void) const
Check if it is safe to call GetDescr method.
Definition: Bioseq_.hpp:309
TMol GetMol(void) const
Get the Mol member data.
Definition: Seq_inst_.hpp:612
TBiomol GetBiomol(void) const
Get the Biomol member data.
Definition: MolInfo_.hpp:447
TCompleteness GetCompleteness(void) const
Get the Completeness member data.
Definition: MolInfo_.hpp:594
const TDescr & GetDescr(void) const
Get the Descr member data.
Definition: Bioseq_.hpp:315
Modified on Thu Apr 25 08:22:03 2024 by modify_doxy.py rev. 669887