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

Go to the repository for this file.

1 /* $Id: MSHits.cpp 33815 2007-05-04 17:18:18Z kazimird $
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: .......
27  *
28  * File Description:
29  * .......
30  *
31  * Remark:
32  * This code was originally generated by application DATATOOL
33  * using the following specifications:
34  * 'omssa.asn'.
35  */
36 
37 // standard includes
38 #include <ncbi_pch.hpp>
39 
40 // generated includes
41 #include <objects/omssa/MSHits.hpp>
42 
43 #include <objects/omssa/MSMod.hpp>
45 
46 // generated classes
47 
49 
50 BEGIN_objects_SCOPE // namespace ncbi::objects::
51 
52 // destructor
54 {
55 }
56 
57 
58 ///
59 /// Makes a string of mods, positions for display purposes
60 ///
61 void CMSHits::MakeModString(string& StringOut, CRef <CMSModSpecSet> Modset) const
62 {
63  StringOut.erase();
64  if(CanGetMods()) {
65  ITERATE(TMods, i, GetMods()) {
66  if(!StringOut.empty()) StringOut += " ,";
67  if((*i)->GetModtype() < eMSMod_max) StringOut += Modset->GetModName((*i)->GetModtype());
68  else StringOut += NStr::IntToString((*i)->GetModtype());
69  StringOut += ":" + NStr::IntToString((*i)->GetSite()+1);
70  }
71  }
72 }
73 
74 
75 ///
76 /// Makes a peptide AA string, lower case for mods
77 ///
78 void CMSHits::MakePepString(string& StringOut) const
79 {
80  StringOut.erase();
81  if(CanGetPepstring()) {
82  StringOut = GetPepstring();
83  NStr::ToUpper(StringOut);
84  ITERATE(TMods, i, GetMods()) {
85  if((*i)->GetSite() < static_cast <int> (StringOut.size()))
86  StringOut[(*i)->GetSite()] = tolower((unsigned char) StringOut[(*i)->GetSite()]);
87  }
88  }
89 }
90 
91 
92 END_objects_SCOPE // namespace ncbi::objects::
93 
95 
96 /* Original file checksum: lines: 65, chars: 1878, CRC32: e17e37ca */
User-defined methods of the data storage class.
~CMSHits(void)
Definition: MSHits.cpp:53
void MakeModString(string &StringOut, CRef< CMSModSpecSet > Modset) const
Makes a string of mods, positions for display purposes.
Definition: MSHits.cpp:61
void MakePepString(string &StringOut) const
Makes a peptide AA string, lower case for mods.
Definition: MSHits.cpp:78
const char * GetModName(int Mod) const
get modification friendly name
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
Definition: ncbimisc.hpp:914
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:104
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:101
static string IntToString(int value, TNumToStringFlags flags=0, int base=10)
Convert int to string.
Definition: ncbistr.hpp:5057
static string & ToUpper(string &str)
Convert string to upper case – string& version.
Definition: ncbistr.cpp:402
bool CanGetMods(void) const
Check if it is safe to call GetMods method.
Definition: MSHits_.hpp:1013
list< CRef< CMSModHit > > TMods
Definition: MSHits_.hpp:101
bool CanGetPepstring(void) const
Check if it is safe to call GetPepstring method.
Definition: MSHits_.hpp:919
const TPepstring & GetPepstring(void) const
Get the Pepstring member data.
Definition: MSHits_.hpp:925
const TMods & GetMods(void) const
Get the Mods member data.
Definition: MSHits_.hpp:1019
@ eMSMod_max
maximum number of mods
Definition: MSMod_.hpp:296
int i
int tolower(Uchar c)
Definition: ncbictype.hpp:72
Modified on Sat Nov 07 14:10:09 2026 by modify_doxy.py rev. 717554