NCBI C++ ToolKit
SpectrumSet.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: SpectrumSet.hpp 45512 2010-04-22 18:03:09Z lewisg $
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  * and reliability of the software and data, the NLM
15  * Although all reasonable efforts have been taken to ensure the accuracyand 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: Lewis Y. Geer
27  *
28  * File Description:
29  * Code for loading in spectrum datasets
30  *
31  * Remark:
32  * This code was originally generated by application DATATOOL
33  * using specifications from the data definition file
34  * 'omssa.asn'.
35  */
36 
37 #ifndef SPECTRUMSET_HPP
38 #define SPECTRUMSET_HPP
39 
40 
41 // generated includes
44 
45 #include <iostream>
46 #include <deque>
47 
48 #include <corelib/ncbistr.hpp>
49 
50 // generated classes
52 
53 BEGIN_objects_SCOPE // namespace ncbi::objects::
54 
55 // proton mass
56 const double kProton = 1.00728;
57 // neutron mass
58 const double kNeutron = 1.00866;
59 
60 //! struct for holding a single peak
61 typedef struct _InputPeak
62 {
63  //! scaled m/z value for peak
64  int mz;
65  //! unscaled intensity
66  float Intensity;
68 
69 //! for holding a spectrum
70 typedef deque < TInputPeak > TInputPeaks;
71 
72 
73 
75  // typedef CMSSpectrumset_Base Tparent;
77 
78 public:
79 
80  // constructor
81  CSpectrumSet(void);
82  // destructor
83  ~CSpectrumSet(void);
84 
85  ///
86  /// wrapper for various file loaders
87  ///
88  int LoadFile(const EMSSpectrumFileType FileType, CNcbiIstream& DTA, int Max = 0);
89 
90  ///
91  /// load in a single dta file
92  ///
93  int LoadDTA(
94  CNcbiIstream& DTA // stream containing dta
95  );
96 
97  ///
98  /// load in multiple dta files with <dta> tag separators
99  ///
100  /// returns -1 if more than Max spectra read
101  int LoadMultDTA(
102  CNcbiIstream& DTA, // stream containing tag delimited dtas
103  int Max = 0 // maximum number of dtas to read in, 0= no limit
104  );
105 
106  ///
107  /// load multiple dta's separated by a blank line
108  ///
109  /// returns -1 if more than Max spectra read
110  int LoadMultBlankLineDTA(
111  CNcbiIstream& DTA, // stream containing blank delimited dtas
112  int Max = 0, // maximum number of dtas to read in, 0= no limit
113  bool isPKL = false // pkl formatted?
114  );
115 
116  ///
117  /// load mgf file
118  ///
119  /// returns -1 if more than Max spectra read
120  int LoadMGF(
121  CNcbiIstream& DTA, // stream containing mgf file
122  int Max = 0 // maximum number of dtas to read in, 0= no limit
123  );
124 
125 protected:
126 
127  ///
128  /// Read in the header of a DTA file
129  ///
130  bool GetDTAHeader(
131  CNcbiIstream& DTA, // input stream
132  CRef <CMSSpectrum>& MySpectrum, // asn.1 container for spectra
133  bool isPKL = false // pkl formatted?
134  );
135 
136  //! Convert peak list to spectrum
137  /*!
138  \param InputPeaks list of the input m/z and intensity values
139  \param MySpectrum the spectrum to receive the scaled input
140  \return success
141  */
142  bool Peaks2Spectrum(const TInputPeaks& InputPeaks, CRef <CMSSpectrum>& MySpectrum) const;
143 
144  //!Read in the body of a dta like file
145  /*!
146  \param DTA input stream
147  \param InputPeaks list of the input m/z and intensity values
148  \return success
149  */
150  bool GetDTABody(
151  CNcbiIstream& DTA, // input stream
152  TInputPeaks& InputPeaks // asn.1 container for spectra
153  );
154 
155  ///
156  /// Read in an ms/ms block in an mgf file
157  ///
158  int GetMGFBlock(CNcbiIstream& DTA, CRef <CMSSpectrum>& MySpectrum);
159 
160 private:
161  // Prohibit copy constructor and assignment operator
164 
165 };
166 
167 
168 
169 /////////////////// CSpectrumSet inline methods
170 
171 // constructor
172 inline
174 {
175 }
176 
177 
178 // destructor
179 inline
181 {
182 }
183 
184 /////////////////// end of CSpectrumSet inline methods
185 
186 
187 END_objects_SCOPE // namespace ncbi::objects::
188 
190 
191 #endif // SPECTRUMSET_HPP
192 /* Original file checksum: lines: 85, chars: 2278, CRC32: c22a6458 */
User-defined methods of the data storage class.
User-defined methods of the data storage class.
const double kNeutron
Definition: SpectrumSet.hpp:58
struct _InputPeak TInputPeak
struct for holding a single peak
const double kProton
Definition: SpectrumSet.hpp:56
deque< TInputPeak > TInputPeaks
for holding a spectrum
Definition: SpectrumSet.hpp:70
CMSSpectrumset –.
CRef –.
Definition: ncbiobj.hpp:618
CSpectrumSet(const CSpectrumSet &value)
CSpectrumSet & operator=(const CSpectrumSet &value)
CMSSpectrumset Tparent
Definition: SpectrumSet.hpp:76
~CSpectrumSet(void)
CSpectrumSet(void)
char value[7]
Definition: config.c:431
The NCBI C++ standard methods for dealing with std::string.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
IO_PREFIX::istream CNcbiIstream
Portable alias for istream.
Definition: ncbistre.hpp:146
#define NCBI_XOMSSA_EXPORT
Definition: ncbi_export.h:1355
EMSSpectrumFileType
Access to EMSSpectrumFileType's attributes (values, names) as defined in spec.
static string LoadFile(CNcbiIstream &str)
struct for holding a single peak
Definition: SpectrumSet.hpp:62
int mz
scaled m/z value for peak
Definition: SpectrumSet.hpp:64
float Intensity
unscaled intensity
Definition: SpectrumSet.hpp:66
Modified on Sat Feb 24 07:50:12 2024 by modify_doxy.py rev. 669887